Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.slide.common
Class Domain

    java.lang.Object
      org.apache.slide.common.Domain

public final class Domain
extends java.lang.Object

The Domain controls access to its registered namespaces and performs initialization and connection management on behalf of the namespaces.

From the client application's perspective, the domain represents the only directly accessible object. It is through this object that the client gains access to namespaces, using the static method `Domain.accessNamespace()`.

Since the domain acts as the root of a directory service, it is a static entity and there can be only one domain per JVM.

### Initialization

When Slide is first initialized, the Domain configuration is loaded. The location of the domain configuration file is given through the `org.apache.slide.domain` property in the Slide properties, or can be specified as argument to the static `Domain.init()` method.

The domain configuration is written by an administrator and describes how each namespace is to be initialized. It includes information like:

- The low-level services the namespace uses (structure store, content store, etc.)
- The namespace base topology, which includes the location of the base actions and paths in the namespace.

### Access and Security

After initialization is complete, the client application can request access to the domain. It uses one of the two methods:

- `Domain.accessNamespace(SecurityToken securityObject, String namespace)`
  Used to access a specific namespace. This method returns a `NamespaceAccessToken`, which thereafter must be used by the client application to perform operations on the namespace.
- `Domain.accessDomain(SecurityToken securityObject)`
  Enumerates the registered namespaces with this domain. This allows application to browse the list of available namespaces.

The Domain uses an object (argument `securityObject`) to decide whether or not the client should be granted access. A good candidate is a reference to the client servlet or servlet context.
Note: Currently, access control on namespaces is not implemented.

Version:
  $Revision: 1.48.2.1 $

Constructor Summary
`Domain()`

Method Summary
`static DomainAccessToken` | `accessDomain(SecurityToken token)` Access a Domain.
`static NamespaceAccessToken` | `accessNamespace(SecurityToken token, java.lang.String namespaceName)` Access a Namespace.
`(package private) static void` | `addNamespace(Namespace namespace)` Add a namespace to the domain.
`static void` | `closeNamespace(NamespaceAccessToken token)` Close a namespace.
`static void` | `closeNamespace(SecurityToken token, java.lang.String namespaceName)` Clsose a namespace.
`static void` | `debug(java.lang.Object data)` Debug.
`static java.util.Enumeration` | `enumerateNamespaces()` Enumerate namespace names.
`static void` | `error(java.lang.Object data)` Error.
`static void` | `error(java.lang.Object data, java.lang.Throwable t)` Error.
`static java.lang.String` | `getDefaultNamespace()` Return the default namespace of this domain.
`static java.lang.String` | `getDomainFileName()` Access the file name of domain.xml.
`(package private) static Logger` | `getLogger()` Get the Domain logger.
`(package private) static Namespace` | `getNamespace(java.lang.String namespaceName)` Get a namespace.
`static java.lang.String` | `getParameter(java.lang.String name)` Get a domain parameter.
`static java.lang.String` | `getParameter(java.lang.String name, java.lang.String defaultValue)` Get a domain parameter.
`static java.lang.String` | `getParameter(java.lang.String name, java.lang.String defaultValue, Store store)` Get a domain parameter - possibly overlaid by a store specific value.
`static void` | `info(java.lang.Object data)` Info.
`static void` | `init(Configuration configuration)` Domain initialization routine using Avalon configuration parser.
`static void` | `init(java.io.InputStream configurationInputStream)` Domain initialization routine using Avalon configuration parser.
`static void` | `init(java.lang.String configurationFileName)` Domain initialization routine using Avalon configuration parser.
`static void` | `init(java.net.URL configurationURL)` Domain initialization routine using Avalon configuration parser.
`static boolean` | `isDebugEnabled()` Check if the default channel with the DEBUG level is enabled for logging.
`static boolean` | `isEnabled(int level)` Check if the default channel with the specified level is enabled for logging.
`static boolean` | `isEnabled(java.lang.String channel, int level)` Check if the channel with the specified level is enabled for logging.
`static boolean` | `isErrorEnabled()` Check if the default channel with the ERROR level is enabled for logging.
`static boolean` | `isInfoEnabled()` Check if the default channel with the INFO level is enabled for logging.
`static boolean` | `isInitialized()` Tests if the domain has been initialized before.
`static boolean` | `isWarningEnabled()` Check if the default channel with the WARNING level is enabled for logging.
`static void` | `log(java.lang.Object data)` Log.
`static void` | `log(java.lang.Object data, int level)` Log.
`static void` | `log(java.lang.Object data, java.lang.String channel, int level)` Log.
`static boolean` | `namespacesAreInitialized()` Return true, if all namespaces have been initialized.
`(package private) static void` | `selfInit()` Default initialization of the domain.
`(package private) static void` | `setDomain(EmbeddedDomain domain)` Set the embedded domain field.
`static void` | `setInitialized(boolean initialized)` Set the domain as having been initialized before.
`(package private) static void` | `setLogger(Logger logger)` Set the logger to be used by Slide.
`(package private) static void` | `setParameters(java.util.Hashtable parameters)` Set the specified parameters
`(package private) static void` | `start()` Start domain (doesn't do anything yet).
`(package private) static void` | `stop()` Stop domain.
`static void` | `warn(java.lang.Object data)` Warning.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Domain

    public Domain()

Method Detail

### isInitialized

    public static boolean isInitialized()

  Tests if the domain has been initialized before.

  Returns:
    boolean True if the domain has already been initialized

### namespacesAreInitialized

    public static boolean namespacesAreInitialized()

  Return true, if all namespaces have been initialized.

### setInitialized

    public static void setInitialized(boolean initialized)

  Set the domain as having been initialized before.

### getDefaultNamespace

    public static java.lang.String getDefaultNamespace()

  Return the default namespace of this domain.

  Returns:
    the name of the default namespace

### accessNamespace

    public static NamespaceAccessToken accessNamespace(SecurityToken token,
                                                       java.lang.String namespaceName)

  Access a Namespace.

  Parameters:
    `token` - Entity which wants access
    `namespaceName` - Name of the namespace on which access is requested
  Returns:
    NamespaceAccessToken Access token to the namespace

### enumerateNamespaces

    public static java.util.Enumeration enumerateNamespaces()

  Enumerate namespace names.

### closeNamespace

    public static void closeNamespace(NamespaceAccessToken token)

  Close a namespace.

  Parameters:
    `token` - Namespace access token

### closeNamespace

    public static void closeNamespace(SecurityToken token,
                                      java.lang.String namespaceName)

  Clsose a namespace.

  Parameters:
    `token` - Entity which wants to close the namespace
    `namespaceName` - Name of the namespace

### accessDomain

    public static DomainAccessToken accessDomain(SecurityToken token)

  Access a Domain.

  Parameters:
    `token` - Service who wants access
  Returns:
    DomainAccessToken Access token to the domain

### getDomainFileName

    public static java.lang.String getDomainFileName()

  Access the file name of domain.xml.

  Returns:
    String the expanded file name as a string.

### init

    public static void init(java.net.URL configurationURL)
                     throws java.lang.Exception

  Domain initialization routine using Avalon configuration parser.

  Parameters:
    `configurationURL` - The file name to read the configuration
  Throws:
    `java.lang.Exception`

### init

    public static void init(java.lang.String configurationFileName)
                     throws java.lang.Exception

  Domain initialization routine using Avalon configuration parser.

  Parameters:
    `configurationFileName` - The file name to read the configuration
  Throws:
    `java.lang.Exception`

### init

    public static void init(java.io.InputStream configurationInputStream)
                     throws java.lang.Exception

  Domain initialization routine using Avalon configuration parser.

  Parameters:
    `configurationInputStream` - The file name to read the configuration
  Throws:
    `java.lang.Exception`

### init

    public static void init(Configuration configuration)

  Domain initialization routine using Avalon configuration parser.

  Parameters:
    `configuration` - Avalon configuration object

### log

    public static void log(java.lang.Object data,
                           java.lang.String channel,
                           int level)

  Log.

  Parameters:
    `data` - The object to log.
    `channel` - The channel name used for logging.
    `level` - The level used for logging.

### log

    public static void log(java.lang.Object data,
                           int level)

  Log.

  Parameters:
    `data` - The object to log.
    `level` - The level used for logging.

### log

    public static void log(java.lang.Object data)

  Log.

  Parameters:
    `data` - The object to log.

### debug

    public static void debug(java.lang.Object data)

  Debug.

  Parameters:
    `data` - The object to log

### error

    public static void error(java.lang.Object data)

  Error.

  Parameters:
    `data` - The object to log

### error

    public static void error(java.lang.Object data,
                             java.lang.Throwable t)

  Error.

  Parameters:
    `data` - The object to log
    `t` - Throwable object

### info

    public static void info(java.lang.Object data)

  Info.

  Parameters:
    `data` - The object to log

### warn

    public static void warn(java.lang.Object data)

  Warning.

  Parameters:
    `data` - The object to log

### isEnabled

    public static boolean isEnabled(java.lang.String channel,
                                    int level)

  Check if the channel with the specified level is enabled for logging. This implementation ignores the channel specification

  Parameters:
    `channel` - The channel specification
    `level` - The level specification

### isEnabled

    public static boolean isEnabled(int level)

  Check if the default channel with the specified level is enabled for logging.

  Parameters:
    `level` - The level specification

### isDebugEnabled

    public static boolean isDebugEnabled()

  Check if the default channel with the DEBUG level is enabled for logging.

### isWarningEnabled

    public static boolean isWarningEnabled()

  Check if the default channel with the WARNING level is enabled for logging.

### isInfoEnabled

    public static boolean isInfoEnabled()

  Check if the default channel with the INFO level is enabled for logging.

### isErrorEnabled

    public static boolean isErrorEnabled()

  Check if the default channel with the ERROR level is enabled for logging.

### setDomain

    static void setDomain(EmbeddedDomain domain)

  Set the embedded domain field.

### start

    static void start()
               throws java.lang.Exception

  Start domain (doesn't do anything yet).

  Throws:
    `java.lang.Exception`

### stop

    static void stop()
              throws java.lang.Exception

  Stop domain.

  Throws:
    `java.lang.Exception`

### addNamespace

    static void addNamespace(Namespace namespace)

  Add a namespace to the domain.

  Parameters:
    `namespace` - Namespace to be added

### getNamespace

    static Namespace getNamespace(java.lang.String namespaceName)

  Get a namespace.

  Parameters:
    `namespaceName` - Name of the namespace
  Returns:
    Namespace

### getParameter

    public static java.lang.String getParameter(java.lang.String name)

  Get a domain parameter.

  Parameters:
    `name` - the parameter name
  Returns:
    the parameter value

### getParameter

    public static java.lang.String getParameter(java.lang.String name,
                                                java.lang.String defaultValue)

  Get a domain parameter.

  Parameters:
    `name` - the parameter name
    `defaultValue` - the default value to be returned
  Returns:
    the parameter value

### getParameter

    public static java.lang.String getParameter(java.lang.String name,
                                                java.lang.String defaultValue,
                                                Store store)

  Get a domain parameter - possibly overlaid by a store specific value.

  Parameters:
    `name` - the parameter name
    `defaultValue` - the default value
    `store` - the store to check for store-specific values
  Returns:
    the parameter value

### setParameters

    static void setParameters(java.util.Hashtable parameters)

  Set the specified parameters

  Parameters:
    `parameters` - the parameters

### setLogger

    static void setLogger(Logger logger)

  Set the logger to be used by Slide.

  Parameters:
    `logger` - Logger the domain will use

### getLogger

    static Logger getLogger()

  Get the Domain logger.

  Returns:
    The domain logger

### selfInit

    static void selfInit()

  Default initialization of the domain.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD