org.modeshape.repository
Class RepositoryService

java.lang.Object
  extended by org.modeshape.repository.RepositoryService
All Implemented Interfaces:
Observer, org.modeshape.repository.service.AdministeredService

@ThreadSafe
public class RepositoryService
extends Object
implements org.modeshape.repository.service.AdministeredService, Observer

A service that manages the RepositorySourcees defined within a configuration repository.


Nested Class Summary
protected  class RepositoryService.Administrator
          The administrative component for this service.
protected  class RepositoryService.ConfigurationChangeObserver
           
 
Constructor Summary
RepositoryService(RepositorySource configurationSource, String configurationWorkspaceName, Path pathToConfigurationRoot, ExecutionContext context, Problems problems)
          Create a service instance, reading the configuration describing new RepositorySource instances from the supplied configuration repository.
 
Method Summary
protected  Object createInstanceFromProperties(Subgraph subgraph, Location location, Problems problems, boolean mustHaveClassName)
          Instantiate the Object described by the supplied properties.
protected  RepositorySource createRepositorySource(Subgraph subgraph, Location location, Problems problems)
          Instantiate the RepositorySource described by the supplied properties.
 boolean equals(Object obj)
          
 org.modeshape.repository.service.ServiceAdministrator getAdministrator()
          
 String getConfigurationSourceName()
           
 String getConfigurationWorkspaceName()
           
 ExecutionContext getExecutionEnvironment()
           
 String getJndiName()
           
protected  Path getPathToConfigurationRoot()
           
 RepositoryLibrary getRepositoryLibrary()
          Get the library of RepositorySource instances used by this service.
 void notify(Changes changes)
          Method that is called for each set of changes from the Observable instance(s) with which this observer is registered.
protected  boolean setBeanPropertyIfExistsAndNotSet(Object target, String propertyName, Object value)
           
protected  void shutdownService()
           
protected  void startService()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryService

public RepositoryService(RepositorySource configurationSource,
                         String configurationWorkspaceName,
                         Path pathToConfigurationRoot,
                         ExecutionContext context,
                         Problems problems)
Create a service instance, reading the configuration describing new RepositorySource instances from the supplied configuration repository.

Parameters:
configurationSource - the RepositorySource that is the configuration repository
configurationWorkspaceName - the name of the workspace in the RepositorySource that is the configuration repository, or null if the default workspace of the source should be used (if there is one)
pathToConfigurationRoot - the path of the node in the configuration source repository that should be treated by this service as the root of the service's configuration; if null, then "/dna:system" is used
context - the execution context in which this service should run
problems - the Problems instance that this service should use to report problems starting repositories
Throws:
IllegalArgumentException - if the bootstrap source is null or the execution context is null
Method Detail

getAdministrator

public final org.modeshape.repository.service.ServiceAdministrator getAdministrator()

Specified by:
getAdministrator in interface org.modeshape.repository.service.AdministeredService

getConfigurationSourceName

public final String getConfigurationSourceName()
Returns:
configurationSourceName

getConfigurationWorkspaceName

public final String getConfigurationWorkspaceName()
Returns:
configurationWorkspaceName

getRepositoryLibrary

public final RepositoryLibrary getRepositoryLibrary()
Get the library of RepositorySource instances used by this service.

Returns:
the RepositorySource library; never null

getPathToConfigurationRoot

protected final Path getPathToConfigurationRoot()
Returns:
pathToConfigurationRoot

getExecutionEnvironment

public final ExecutionContext getExecutionEnvironment()
Returns:
env

getJndiName

public String getJndiName()

startService

protected void startService()

shutdownService

protected void shutdownService()

createRepositorySource

protected RepositorySource createRepositorySource(Subgraph subgraph,
                                                  Location location,
                                                  Problems problems)
Instantiate the RepositorySource described by the supplied properties.

Parameters:
subgraph - the subgraph containing the configuration information for this RepositorySource
location - the location of the properties to apply to the new RepositorySource
problems - the problems container in which any problems should be reported; never null
Returns:
the repository source instance, or null if it could not be created

createInstanceFromProperties

protected Object createInstanceFromProperties(Subgraph subgraph,
                                              Location location,
                                              Problems problems,
                                              boolean mustHaveClassName)
Instantiate the Object described by the supplied properties.

Parameters:
subgraph - the subgraph containing the configuration information for this instance
location - the location of the properties to apply to the new instance
problems - the problems container in which any problems should be reported; never null
mustHaveClassName - indicates that the properties must include a class name; if true a problem will be added for instances that do not have a class name specified
Returns:
the instance, or null if it could not be created

setBeanPropertyIfExistsAndNotSet

protected boolean setBeanPropertyIfExistsAndNotSet(Object target,
                                                   String propertyName,
                                                   Object value)

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

notify

public void notify(Changes changes)
Method that is called for each set of changes from the Observable instance(s) with which this observer is registered.

Specified by:
notify in interface Observer
Parameters:
changes - the changes that are being published
See Also:
Observer.notify(org.modeshape.graph.observe.Changes)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.