Package org.apache.jackrabbit.core.jndi
Class BindableRepository
- java.lang.Object
-
- org.apache.jackrabbit.commons.AbstractRepository
-
- org.apache.jackrabbit.core.jndi.BindableRepository
-
- All Implemented Interfaces:
Serializable
,Repository
,Referenceable
,JackrabbitRepository
public class BindableRepository extends AbstractRepository implements Repository, JackrabbitRepository, Referenceable, Serializable
A referenceable and serializable content repository proxy. This class implements the Proxy design pattern (GoF) for the Jackrabbit Repository implementation. The proxy implementation delays the instantiation of the actual Repository instance and implements serialization and JNDI referenceability by keeping track of the repository configuration parameters.A BindableRepository instance contains the configuration file and home directory paths of a Jackrabbit repository. The separate
init()
method is used to create a transientRepositoryImpl
instance to which all the JCR API calls are delegated.An instance of this class is normally always also initialized. The uninitialized state is only used briefly during the static construction, deserialization, and JNDI "referenciation".
A JVM shutdown hook is used to make sure that the initialized repository is properly closed when the JVM shuts down. The
RegistryHelper.unregisterRepository(javax.naming.Context, String)
method should be used to explicitly close the repository if needed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGFILEPATH_ADDRTYPE
type ofconfigFilePath
reference addressstatic String
REPHOMEDIR_ADDRTYPE
type ofrepHomeDir
reference address-
Fields inherited from interface org.apache.jackrabbit.api.JackrabbitRepository
OPTION_PRINCIPAL_MANAGEMENT_SUPPORTED, OPTION_PRIVILEGE_MANAGEMENT_SUPPORTED, OPTION_USER_MANAGEMENT_SUPPORTED
-
Fields inherited from interface javax.jcr.Repository
IDENTIFIER_STABILITY, IDENTIFIER_STABILITY_INDEFINITE_DURATION, IDENTIFIER_STABILITY_METHOD_DURATION, IDENTIFIER_STABILITY_SAVE_DURATION, IDENTIFIER_STABILITY_SESSION_DURATION, LEVEL_1_SUPPORTED, LEVEL_2_SUPPORTED, NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED, NODE_TYPE_MANAGEMENT_INHERITANCE, NODE_TYPE_MANAGEMENT_INHERITANCE_MINIMAL, NODE_TYPE_MANAGEMENT_INHERITANCE_MULTIPLE, NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE, NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED, NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED, NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED, NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED, NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED, NODE_TYPE_MANAGEMENT_PROPERTY_TYPES, NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED, NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED, NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED, NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED, OPTION_ACCESS_CONTROL_SUPPORTED, OPTION_ACTIVITIES_SUPPORTED, OPTION_BASELINES_SUPPORTED, OPTION_JOURNALED_OBSERVATION_SUPPORTED, OPTION_LIFECYCLE_SUPPORTED, OPTION_LOCKING_SUPPORTED, OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED, OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED, OPTION_OBSERVATION_SUPPORTED, OPTION_QUERY_SQL_SUPPORTED, OPTION_RETENTION_SUPPORTED, OPTION_SHAREABLE_NODES_SUPPORTED, OPTION_SIMPLE_VERSIONING_SUPPORTED, OPTION_TRANSACTIONS_SUPPORTED, OPTION_UNFILED_CONTENT_SUPPORTED, OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED, OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED, OPTION_VERSIONING_SUPPORTED, OPTION_WORKSPACE_MANAGEMENT_SUPPORTED, OPTION_XML_EXPORT_SUPPORTED, OPTION_XML_IMPORT_SUPPORTED, QUERY_FULL_TEXT_SEARCH_SUPPORTED, QUERY_JOINS, QUERY_JOINS_INNER, QUERY_JOINS_INNER_OUTER, QUERY_JOINS_NONE, QUERY_LANGUAGES, QUERY_STORED_QUERIES_SUPPORTED, QUERY_XPATH_DOC_ORDER, QUERY_XPATH_POS_INDEX, REP_NAME_DESC, REP_VENDOR_DESC, REP_VENDOR_URL_DESC, REP_VERSION_DESC, SPEC_NAME_DESC, SPEC_VERSION_DESC, WRITE_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description BindableRepository(Reference reference)
Creates a BindableRepository instance with the configuration information in the given JNDI reference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JackrabbitRepository
createRepository()
Creates a repository instance based on the contained JNDI reference.String
getDescriptor(String key)
Delegated to the underlying repository instance.String[]
getDescriptorKeys()
Delegated to the underlying repository instance.Value
getDescriptorValue(String key)
Delegated to the underlying repository instance.Value[]
getDescriptorValues(String key)
Delegated to the underlying repository instance.Reference
getReference()
Returns the JNDI reference for this content repository.protected JackrabbitRepository
getRepository()
Returns the underlying repository instance.boolean
isSingleValueDescriptor(String key)
Delegated to the underlying repository instance.boolean
isStandardDescriptor(String key)
Delegated to the underlying repository instance.Session
login(Credentials credentials, String workspaceName)
Delegated to the underlying repository instance.void
shutdown()
Delegated to the underlying repository instance.-
Methods inherited from class org.apache.jackrabbit.commons.AbstractRepository
login, login, login, login
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.api.JackrabbitRepository
login
-
Methods inherited from interface javax.jcr.Repository
login, login, login
-
-
-
-
Field Detail
-
CONFIGFILEPATH_ADDRTYPE
public static final String CONFIGFILEPATH_ADDRTYPE
type ofconfigFilePath
reference address- See Also:
Reference.get(String)
, Constant Field Values
-
REPHOMEDIR_ADDRTYPE
public static final String REPHOMEDIR_ADDRTYPE
type ofrepHomeDir
reference address- See Also:
Reference.get(String)
, Constant Field Values
-
-
Constructor Detail
-
BindableRepository
public BindableRepository(Reference reference) throws RepositoryException
Creates a BindableRepository instance with the configuration information in the given JNDI reference.- Parameters:
reference
- JNDI reference- Throws:
RepositoryException
- if the repository can not be started
-
-
Method Detail
-
createRepository
protected JackrabbitRepository createRepository() throws RepositoryException
Creates a repository instance based on the contained JNDI reference. Can be overridden by subclasses to return different repositories. A subclass can access the JNDI reference through thegetReference()
method. The default implementation returns aRepositoryImpl
instance.- Returns:
- repository instance
- Throws:
RepositoryException
- if the repository could not be created
-
getRepository
protected JackrabbitRepository getRepository()
Returns the underlying repository instance. Can be used by subclasses to access the repository instance.- Returns:
- repository instance
-
login
public Session login(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException
Delegated to the underlying repository instance.- Specified by:
login
in interfaceRepository
- Throws:
LoginException
NoSuchWorkspaceException
RepositoryException
-
getDescriptor
public String getDescriptor(String key)
Delegated to the underlying repository instance.- Specified by:
getDescriptor
in interfaceRepository
-
getDescriptorKeys
public String[] getDescriptorKeys()
Delegated to the underlying repository instance.- Specified by:
getDescriptorKeys
in interfaceRepository
-
getDescriptorValue
public Value getDescriptorValue(String key)
Delegated to the underlying repository instance.- Specified by:
getDescriptorValue
in interfaceRepository
-
getDescriptorValues
public Value[] getDescriptorValues(String key)
Delegated to the underlying repository instance.- Specified by:
getDescriptorValues
in interfaceRepository
-
isSingleValueDescriptor
public boolean isSingleValueDescriptor(String key)
Delegated to the underlying repository instance.- Specified by:
isSingleValueDescriptor
in interfaceRepository
-
isStandardDescriptor
public boolean isStandardDescriptor(String key)
Delegated to the underlying repository instance. Returns true if the given key identifies a standard descriptor.- Specified by:
isStandardDescriptor
in interfaceRepository
- Overrides:
isStandardDescriptor
in classAbstractRepository
- Parameters:
key
- descriptor key- Returns:
true
if the key identifies a standard descriptor,false
otherwise
-
getReference
public Reference getReference()
Returns the JNDI reference for this content repository. The returned reference holds the configuration information required to create a copy of this instance.- Specified by:
getReference
in interfaceReferenceable
- Returns:
- the JNDI reference
-
shutdown
public void shutdown()
Delegated to the underlying repository instance.- Specified by:
shutdown
in interfaceJackrabbitRepository
-
-