001: /*
002: * Copyright 2006 Day Management AG, Switzerland. All rights reserved.
003: */
004: package javax.jcr;
005:
006: import javax.naming.Referenceable;
007:
008: /**
009: * The entry point into the content repository. The <code>Repository</code> object
010: * is usually acquired through JNDI.
011: */
012: public interface Repository extends Referenceable {
013:
014: /**
015: * The descriptor key for the version of the specification
016: * that this repository implements. For JCR 2.0
017: * the value of this descriptor is "2.0".
018: */
019: public static final String SPEC_VERSION_DESC = "jcr.specification.version";
020:
021: /**
022: * The descriptor key for the name of the specification
023: * that this repository implements. For JCR 2.0
024: * the value of this descriptor is "Content Repository for
025: * Java Technology API".
026: */
027: public static final String SPEC_NAME_DESC = "jcr.specification.name";
028:
029: /**
030: * The descriptor key for the name of the repository vendor.
031: */
032: public static final String REP_VENDOR_DESC = "jcr.repository.vendor";
033:
034: /**
035: * The descriptor key for the URL of the repository vendor.
036: */
037: public static final String REP_VENDOR_URL_DESC = "jcr.repository.vendor.url";
038:
039: /**
040: * The descriptor key for the name of this repository implementation.
041: */
042: public static final String REP_NAME_DESC = "jcr.repository.name";
043:
044: /**
045: * The descriptor key for the version of this repository implementation.
046: */
047: public static final String REP_VERSION_DESC = "jcr.repository.version";
048:
049: /**
050: * Indicates whether this implementation supports all level 1 features.
051: * This descriptor should always be "true".
052: */
053: public static final String LEVEL_1_SUPPORTED = "level.1.supported";
054:
055: /**
056: * Indicates whether this implementation supports all level 2 features.
057: * This descriptor will be either "true" or "false".
058: */
059: public static final String LEVEL_2_SUPPORTED = "level.2.supported";
060:
061: /**
062: * Indicates whether this implementation supports node type registration.
063: * This descriptor will be either "true" or "false".
064: *
065: * @since JCR 2.0
066: */
067: public static final String OPTION_NODE_TYPE_REG_SUPPORTED = "option.node.type.reg.supported";
068:
069: /**
070: * Indicates whether this implementation supports transactions.
071: * This descriptor will be either "true" or "false".
072: */
073: public static final String OPTION_TRANSACTIONS_SUPPORTED = "option.transactions.supported";
074:
075: /**
076: * Indicates whether this implementation supports versioning.
077: * This descriptor will be either "true" or "false".
078: */
079: public static final String OPTION_VERSIONING_SUPPORTED = "option.versioning.supported";
080:
081: /**
082: * Indicates whether this implementation supports simple versioning.
083: * This descriptor will be either "true" or "false".
084: *
085: * @since JCR 2.0
086: */
087: public static final String OPTION_SIMPLE_VERSIONING_SUPPORTED = "option.simple.versioning.supported";
088:
089: /**
090: * Indicates whether this implementation supports activities.
091: * This descriptor will be either "true" or "false".
092: *
093: * @since JCR 2.0
094: */
095: public static final String OPTION_ACTIVITIES_SUPPORTED = "option.activities.supported";
096:
097: /**
098: * Indicates whether this implementation supports configurations and
099: * baselines. This descriptor will be either "true" or "false".
100: *
101: * @since JCR 2.0
102: */
103: public static final String OPTION_BASELINES_SUPPORTED = "option.baselines.supported";
104:
105: /**
106: * Indicates whether this implementation supports asynchronous observation.
107: * This descriptor will be either "true" or "false".
108: */
109: public static final String OPTION_OBSERVATION_SUPPORTED = "option.observation.supported";
110:
111: /**
112: * Indicates whether this implementation supports journaled observation.
113: * This descriptor will be either "true" or "false".
114: *
115: * @since JCR 2.0
116: */
117: public static final String OPTION_JOURNALED_OBSERVATION_SUPPORTED = "option.journaled.observation.supported";
118:
119: /**
120: * Indicates whether this implementation supports locking.
121: * This descriptor will be either "true" or "false".
122: */
123: public static final String OPTION_LOCKING_SUPPORTED = "option.locking.supported";
124:
125: /**
126: * Indicates whether this implementation supports the SQL query language.
127: * This descriptor will be either "true" or "false".
128: */
129: public static final String OPTION_QUERY_SQL_SUPPORTED = "option.query.sql.supported";
130:
131: /**
132: * Indicates whether this implementation supports access control discovery.
133: * This descriptor will be either "true" or "false".
134: *
135: * @since JCR 2.0
136: */
137: public static final String OPTION_ACCESS_CONTROL_DISCOVERY_SUPPORTED = "option.access.control.discovery.supported";
138:
139: /**
140: * Indicates whether this implementation supports access control policies.
141: * This descriptor will be either "true" or "false".
142: *
143: * @since JCR 2.0
144: */
145: public static final String OPTION_ACCESS_CONTROL_POLICIES_SUPPORTED = "option.access.control.policies.supported";
146:
147: /**
148: * Indicates whether this implementation supports access control entries.
149: * This descriptor will be either "true" or "false".
150: *
151: * @since JCR 2.0
152: */
153: public static final String OPTION_ACCESS_CONTROL_ENTRIES_SUPPORTED = "option.access.control.entries.supported";
154:
155: /**
156: * Indicates whether this implementation supports lifecycle management.
157: * This descriptor will be either "true" or "false".
158: *
159: * @since JCR 2.0
160: */
161: public static final String OPTION_LIFECYCLE_SUPPORTED = "option.lifecycle.supported";
162:
163: /**
164: * Indicates whether the index position notation for
165: * same-name siblings is supported within XPath queries.
166: * This descriptor will be either "true" or "false".
167: */
168: public static final String QUERY_XPATH_POS_INDEX = "query.xpath.pos.index";
169:
170: /**
171: * Indicates whether XPath queries return results in document order.
172: * This descriptor will be either "true" or "false".
173: */
174: public static final String QUERY_XPATH_DOC_ORDER = "query.xpath.doc.order";
175:
176: /**
177: * Returns a string array holding all descriptor keys available for this implementation.
178: * This set must contain at least the built-in keys defined by the string constants in
179: * this interface. Used in conjunction with {@link #getDescriptor(String name)}
180: * to query information about this repository implementation.
181: *
182: * @return a string array holding all descriptor keys.
183: */
184: public String[] getDescriptorKeys();
185:
186: /**
187: * Returns the descriptor for the specified key. Used to query information about this
188: * repository implementation. The set of available keys can be found by calling
189: * {@link #getDescriptorKeys}. If the specifed key is not found, <code>null</code> is returned.
190: *
191: * @param key a string corresponding to a descriptor for this repository implementation.
192: * @return a descriptor string
193: */
194: public String getDescriptor(String key);
195:
196: /**
197: * Authenticates the user using the supplied <code>credentials</code>. If <code>workspaceName</code> is
198: * recognized as the name of an existing workspace in the repository and
199: * authorization to access that workspace is granted, then a new <code>Session</code> object is returned.
200: * The format of the string <code>workspaceName</code> depends upon the implementation.
201: * <p>
202: * If <code>credentials</code> is <code>null</code>, it is assumed that authentication is handled by a
203: * mechanism external to the repository itself (for example, through the JAAS framework) and that the
204: * repository implementation exists within a context (for example, an application server) that allows
205: * it to handle authorization of the request for access to the specified workspace.
206: * <p>
207: * If <code>workspaceName</code> is <code>null</code>, a default workspace is automatically selected by
208: * the repository implementation. This may, for example, be the "home workspace" of the user whose
209: * credentials were passed, though this is entirely up to the configuration and implementation of the
210: * repository. Alternatively, it may be a "null workspace" that serves only to provide the method
211: * {@link Workspace#getAccessibleWorkspaceNames}, allowing the client to select from among available "real"
212: * workspaces.
213: * <p>
214: * If authentication or authorization for the specified workspace fails, a <code>LoginException</code> is
215: * thrown.
216: * <p>
217: * If <code>workspaceName</code> is not recognized, a <code>NoSuchWorkspaceException</code> is thrown.
218: *
219: * @param credentials The credentials of the user
220: * @param workspaceName the name of a workspace.
221: * @return a valid session for the user to access the repository.
222: * @throws LoginException If the login fails.
223: * @throws NoSuchWorkspaceException If the specified <code>workspaceName</code> is not recognized.
224: * @throws RepositoryException if another error occurs.
225: */
226: public Session login(Credentials credentials, String workspaceName)
227: throws LoginException, NoSuchWorkspaceException,
228: RepositoryException;
229:
230: /**
231: * Equivalent to <code>login(credentials, null)</code>.
232: *
233: * @param credentials The credentials of the user
234: * @return a valid session for the user to access the repository.
235: * @throws LoginException If the login authentication fails.
236: * @throws RepositoryException if another error occurs.
237: */
238: public Session login(Credentials credentials)
239: throws LoginException, RepositoryException;
240:
241: /**
242: * Equivalent to <code>login(null, workspaceName)</code>.
243: *
244: * @param workspaceName the name of a workspace.
245: * @return a valid session for the user to access the repository.
246: * @throws LoginException If the login authentication fails.
247: * @throws NoSuchWorkspaceException If the specified <code>workspaceName</code> is not recognized.
248: * @throws RepositoryException if another error occurs.
249: */
250: public Session login(String workspaceName) throws LoginException,
251: NoSuchWorkspaceException, RepositoryException;
252:
253: /**
254: * Equivalent to <code>login(null, null)</code>.
255: *
256: * @return a valid session for the user to access the repository.
257: * @throws LoginException If the login authentication fails.
258: * @throws RepositoryException if another error occurs.
259: */
260: public Session login() throws LoginException, RepositoryException;
261: }
|