org.apache.slide.common
Class Namespace

java.lang.Object
  extended byorg.apache.slide.common.Namespace

public final class Namespace
extends java.lang.Object

A Namespace contains a hierarchically organized tree of information.

Objects in the namespace are generally referred to as Nodes. Nodes may have a parent, children, content and meta-data. They can also be versioned (so that multiple revisions of the object's content and metadata are stored) and locked (so that only specific principals are allowed to read or modify the object). In addition, access control information can be assigned to every node.

Nodes in the hierarchy are identified by their URI (Unique Resource Identifier). A URI is analogous to a file path in traditional file systems. For example:

     /users/john/documents/my_document.txt
   
As you can see, the slash ("/") is used to separate nodes in the path.

Client applications can not access a Namespace object directly. Instead, access must be requested from the Domain, which will hand out a proxy object (NamespaceAccessToken) that enables the client application to access the namespace using the helpers.

Namespaces are necessarily self-contained. What this means is that a namespace cannot reference or contain links to another namespace. A namespace is typically assigned per-application, which effectively isolates it's data and security context from those of other applications.

Version:
$Revision: 1.65.2.1 $

Field Summary
static java.lang.String CONTENT_INDEX_STORE
           
static java.lang.String CONTENT_STORE
           
protected static java.lang.Class createStoreListenerClass
           
protected static java.lang.String I_CREATESTORELISTENERCLASS
           
protected static java.lang.String I_CREATESTORELISTENERCLASS_DEFAULT
           
static java.lang.String LOCK_STORE
           
static java.lang.String NODE_STORE
           
static java.lang.String PROPERTIES_INDEX_STORE
           
static java.lang.String REFERENCE
           
static java.lang.String REVISION_DESCRIPTOR_STORE
           
static java.lang.String REVISION_DESCRIPTORS_STORE
           
static java.lang.String SECURITY_STORE
           
static java.lang.String SEQUENCE_STORE
           
 
Constructor Summary
(package private) Namespace()
          Constructor.
 
Method Summary
 void clearNamespace()
          Reinitialize namespace.
(package private)  void clearUriCache()
          Clear uri cache.
 void connectService(Service service, CredentialsToken token)
          Connects a data source on demand.
(package private)  java.lang.Object dereferenceStore(java.lang.String storeType, java.util.Hashtable childStores)
           
 void disconnectServices()
          Disconnects all services.
 java.util.Enumeration enumerateScopes()
          Enumerate all scopes managed by this namespace.
 Logger getApplicationLogger()
          Return the current application logger.
 NamespaceConfig getConfig()
          Returns the namespace configuration.
 ContentInterceptor[] getContentInterceptors()
          Get content interceptors associated with this namespace.
 Logger getLogger()
          Return the current logger.
 java.lang.String getName()
          Gets the qulified name of the namespace.
 java.lang.String getSearchClassName()
          Method getSearchClassName
 Store getStore(Scope scope)
          Get the Data Source associated with the given scope, if any.
 javax.transaction.TransactionManager getTransactionManager()
          Transaction manager accessor.
 Uri getUri(SlideToken token, java.lang.String uri)
          Builds a new uri object to access this namespace.
 Uri getUri(SlideToken token, java.lang.String uri, boolean forcedEnlistment)
          Builds a new uri object to access this namespace.
 Uri getUri(java.lang.String uri)
          Builds a new uri object to access this namespace.
 void initializeServices()
          At the end of the service registration, this service is called to perform any required initialization task.
(package private)  void loadBaseData(Configuration namespaceBaseDataDefinition)
          Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.
(package private)  void loadConfiguration(Configuration namespaceConfigurationDefinition)
          Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.
(package private)  void loadDefinition(Configuration definition)
          Parses the contents of the specified definition object, and uses that info to initialize the namespace.
(package private)  void loadExtractors(Configuration namespaceExtractorsDefinition)
           
(package private)  void loadParameters(Configuration namespaceConfigurationDefinition)
          Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.
 void registerStore(java.lang.String storeName, java.lang.Class storeClass, java.util.Hashtable parameters, Scope scope, java.util.Hashtable childStores)
          Used to register a Store in the namespace for the specified scope.
 Store retrieveStore(Scope scope, CredentialsToken token)
          Get the Data Source associated with the given scope, if any and connect to the store.
 void setApplicationLogger(Logger logger)
          Set the logger used by this namespace.
 void setLogger(Logger logger)
          Set the logger used by this namespace.
 void setName(java.lang.String name)
          Sets the qualified name of the namespace.
 void setSearchClassName(java.lang.String searchClassName)
          Method setSearchClassName
 java.lang.String toString()
          Get a String representation of this namespace.
 void unregisterStore(Scope scope)
          Remove a Store from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REFERENCE

public static final java.lang.String REFERENCE
See Also:
Constant Field Values

NODE_STORE

public static final java.lang.String NODE_STORE
See Also:
Constant Field Values

SECURITY_STORE

public static final java.lang.String SECURITY_STORE
See Also:
Constant Field Values

LOCK_STORE

public static final java.lang.String LOCK_STORE
See Also:
Constant Field Values

REVISION_DESCRIPTORS_STORE

public static final java.lang.String REVISION_DESCRIPTORS_STORE
See Also:
Constant Field Values

REVISION_DESCRIPTOR_STORE

public static final java.lang.String REVISION_DESCRIPTOR_STORE
See Also:
Constant Field Values

CONTENT_STORE

public static final java.lang.String CONTENT_STORE
See Also:
Constant Field Values

PROPERTIES_INDEX_STORE

public static final java.lang.String PROPERTIES_INDEX_STORE
See Also:
Constant Field Values

CONTENT_INDEX_STORE

public static final java.lang.String CONTENT_INDEX_STORE
See Also:
Constant Field Values

SEQUENCE_STORE

public static final java.lang.String SEQUENCE_STORE
See Also:
Constant Field Values

I_CREATESTORELISTENERCLASS

protected static final java.lang.String I_CREATESTORELISTENERCLASS
See Also:
Constant Field Values

I_CREATESTORELISTENERCLASS_DEFAULT

protected static final java.lang.String I_CREATESTORELISTENERCLASS_DEFAULT
See Also:
Constant Field Values

createStoreListenerClass

protected static java.lang.Class createStoreListenerClass
Constructor Detail

Namespace

Namespace()
Constructor.

Method Detail

setName

public void setName(java.lang.String name)
Sets the qualified name of the namespace.

Parameters:
name - Name of the namespace

getName

public java.lang.String getName()
Gets the qulified name of the namespace.

Returns:
String Namespace name

setSearchClassName

public void setSearchClassName(java.lang.String searchClassName)
Method setSearchClassName

Parameters:
searchClassName - classname of the search implementation

getSearchClassName

public java.lang.String getSearchClassName()
Method getSearchClassName

Returns:
classname of the search implementation

getConfig

public NamespaceConfig getConfig()
Returns the namespace configuration.

Returns:
NamespaceConfig Namespace configuration

enumerateScopes

public java.util.Enumeration enumerateScopes()
Enumerate all scopes managed by this namespace.

Returns:
return an enumeration of all scopes

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Transaction manager accessor.


getLogger

public Logger getLogger()
Return the current logger.


setLogger

public void setLogger(Logger logger)
Set the logger used by this namespace.


getApplicationLogger

public Logger getApplicationLogger()
Return the current application logger.


setApplicationLogger

public void setApplicationLogger(Logger logger)
Set the logger used by this namespace.


registerStore

public void registerStore(java.lang.String storeName,
                          java.lang.Class storeClass,
                          java.util.Hashtable parameters,
                          Scope scope,
                          java.util.Hashtable childStores)
                   throws ServiceRegistrationFailedException,
                          ServiceParameterErrorException,
                          ServiceParameterMissingException
Used to register a Store in the namespace for the specified scope. First, the function instantiate the Store, then gives it its init parameters. It is then stored in the stores Hashtable, associated with the given scope.

Parameters:
storeClass - Class of the Data Source
parameters - Init parameters for the Data Source
scope - Scope for which the Data Source is registered
childStores - Instances of the typed stores
Throws:
ServiceRegistrationFailed - An error occured during instantiation of the service
ServiceParameterErrorException - Incorrect service parameter
ServiceParameterMissingException - Service parameter missing
ServiceRegistrationFailedException

dereferenceStore

java.lang.Object dereferenceStore(java.lang.String storeType,
                                  java.util.Hashtable childStores)

initializeServices

public void initializeServices()
                        throws ServicesInitializationFailedException
At the end of the service registration, this service is called to perform any required initialization task.

Throws:
ServicesInitializationFailedException - One or more exception occured while initializing services

clearNamespace

public void clearNamespace()
Reinitialize namespace.


connectService

public void connectService(Service service,
                           CredentialsToken token)
                    throws ServiceConnectionFailedException,
                           ServiceAccessException
Connects a data source on demand.

Parameters:
service - Service on which a connection attempt will be made
token - the credentials token containing e.g. the credential
Throws:
ServiceConnectionFailedException - Error connecting service
ServiceAccessException - Unspecified low level service access exception

disconnectServices

public void disconnectServices()
                        throws ServicesShutDownFailedException
Disconnects all services.

Throws:
ServicesShutDownFailedException - Error disconnecting one or more services

unregisterStore

public void unregisterStore(Scope scope)
                     throws ServiceDisconnectionFailedException,
                            ServiceAccessException
Remove a Store from the registry.

Parameters:
scope - Scope to disconnect
Throws:
ServiceDisconnctionFailedException - Error disconnecting DescriptorsStore
ServiceAccessException - Unspecified error during service access
ServiceDisconnectionFailedException

getStore

public Store getStore(Scope scope)
Get the Data Source associated with the given scope, if any. In contrary to the retrieveStore method, this methos does not perform a connection.

Parameters:
scope - Scope to match

retrieveStore

public Store retrieveStore(Scope scope,
                           CredentialsToken token)
                    throws ServiceConnectionFailedException,
                           ServiceAccessException
Get the Data Source associated with the given scope, if any and connect to the store.

Parameters:
scope - Scope to match
token - the Credeantials token containing e.g. the credential
Throws:
ServiceConnectionFailedException - Connection to Store failed
ServiceAccessException - Unspecified service access exception

getUri

public Uri getUri(java.lang.String uri)
Builds a new uri object to access this namespace. This call will return a Uri which doesn't have its token field set. The store should accept such Uri as valid, and bypass any check that is made based on the state.

Parameters:
uri - Requested Uri
Returns:
Uri

getUri

public Uri getUri(SlideToken token,
                  java.lang.String uri)
Builds a new uri object to access this namespace.

Parameters:
token - SlideToken
uri - Requested Uri
Returns:
Uri

getUri

public Uri getUri(SlideToken token,
                  java.lang.String uri,
                  boolean forcedEnlistment)
Builds a new uri object to access this namespace.

Parameters:
token - SlideToken
uri - Requested Uri
forcedEnlistment - may differ from the value set in token
Returns:
Uri

clearUriCache

void clearUriCache()
Clear uri cache.


getContentInterceptors

public ContentInterceptor[] getContentInterceptors()
Get content interceptors associated with this namespace.


loadDefinition

void loadDefinition(Configuration definition)
              throws SlideException,
                     ConfigurationException
Parses the contents of the specified definition object, and uses that info to initialize the namespace.

Parameters:
definition - Definiton of the scopes and stores of the namespace
Throws:
SlideException - Something went wrong during registry or services initialization
ConfigurationException - Error parsing configuration file

loadBaseData

void loadBaseData(Configuration namespaceBaseDataDefinition)
            throws SlideException,
                   ConfigurationException
Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.

Parameters:
namespaceBaseDataDefinition - Namespace base data
Throws:
SlideException - Something went wrong during registry or services initialization
ConfigurationException

loadConfiguration

void loadConfiguration(Configuration namespaceConfigurationDefinition)
                 throws SlideException
Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.

Parameters:
namespaceConfigurationDefinition - The configuration to load.
Throws:
SlideException - Something went wrong during registry or services initialization

loadParameters

void loadParameters(Configuration namespaceConfigurationDefinition)
              throws SlideException
Parses the contents of the specified reader, and uses that info to initialize the specified Slide namespace.

Parameters:
namespaceConfigurationDefinition - Namespace configuration
Throws:
SlideException - Something went wrong during registry or services initialization

loadExtractors

void loadExtractors(Configuration namespaceExtractorsDefinition)
              throws SlideException
Throws:
SlideException

toString

public java.lang.String toString()
Get a String representation of this namespace.