|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.dna.repository.RepositoryLibrary
@ThreadSafe public class RepositoryLibrary
A library of RepositorySource
instances and the RepositoryConnectionPool
used to manage the connections for
each.
Constructor Summary | |
---|---|
RepositoryLibrary(RepositorySource configurationSource,
String configurationWorkspaceName,
Path pathToSourcesConfigurationRoot,
ExecutionContext context)
Create a new manager instance. |
Method Summary | |
---|---|
boolean |
addSource(RepositorySource source)
Add the supplied source. |
boolean |
addSource(RepositorySource source,
boolean replaceIfExisting)
Add the supplied source. |
RepositoryConnection |
createConnection(String sourceName)
Create a RepositoryConnection using the given RepositorySource name. |
ServiceAdministrator |
getAdministrator()
|
RepositoryConnectionPool |
getConnectionPool(String sourceName)
Get the connection pool managing the RepositorySource with the specified name managed by this instance. |
ExecutionContext |
getExecutionContext()
|
RepositorySource |
getSource(String sourceName)
Get the RepositorySource with the specified name managed by this instance. |
Collection<String> |
getSourceNames()
Get an unmodifiable collection of RepositorySource names. |
Collection<RepositorySource> |
getSources()
Get an unmodifiable collection of RepositorySource instances managed by this instance. |
boolean |
isTerminated()
Return true if this library has completed its termination and no longer has any open connections. |
boolean |
isTerminating()
Returns true if this library is in the process of terminating after ServiceAdministrator.shutdown() has been called
on the administrator , but the library has connections that have not yet normally been
closed . |
boolean |
register(Observer observer)
Register the supplied observer. |
boolean |
removeSource(RepositorySource source,
long timeToAwait,
TimeUnit unit)
Remove from this library the supplied source (or a source with the same name as that supplied). |
RepositorySource |
removeSource(String name)
Remove from this library the source with the supplied name. |
RepositorySource |
removeSource(String name,
long timeToAwait,
TimeUnit unit)
Remove from this library the source with the supplied name. |
boolean |
unregister(Observer observer)
Unregister the supplied observer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepositoryLibrary(RepositorySource configurationSource, String configurationWorkspaceName, Path pathToSourcesConfigurationRoot, ExecutionContext context)
configurationSource
- the RepositorySource
that is the configuration repositoryconfigurationWorkspaceName
- 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)pathToSourcesConfigurationRoot
- 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 usedcontext
- the execution context in which this service should run
IllegalArgumentException
- if the executionContextFactory
reference is nullMethod Detail |
---|
public boolean register(Observer observer)
This can be used to register observers for all of the repository sources managed by this library. The supplied observer will receive all of the changes originating from these sources.
register
in interface Observable
observer
- the observer to be added; may be null
Observable.register(org.jboss.dna.graph.observe.Observer)
public boolean unregister(Observer observer)
This can be used to unregister observers for all of the repository sources managed by this library.
unregister
in interface Observable
observer
- the observer to be removed; may not be null
Observable.unregister(org.jboss.dna.graph.observe.Observer)
public ExecutionContext getExecutionContext()
public ServiceAdministrator getAdministrator()
public boolean isTerminating()
ServiceAdministrator.shutdown()
has been called
on the administrator
, but the library has connections that have not yet normally been
closed
. This method may be useful for debugging. A return of true reported a
sufficient period after shutdown may indicate that connection users have ignored or suppressed interruption, causing this
repository not to properly terminate.
isTerminated()
public boolean isTerminated()
isTerminating()
public Collection<String> getSourceNames()
RepositorySource
names.
public Collection<RepositorySource> getSources()
RepositorySource
instances managed by this instance.
public RepositorySource getSource(String sourceName)
sourceName
- the name of the source
public RepositoryConnectionPool getConnectionPool(String sourceName)
RepositorySource
with the specified name managed by this instance.
sourceName
- the name of the source
public boolean addSource(RepositorySource source)
source
- the source to add
public boolean addSource(RepositorySource source, boolean replaceIfExisting)
If a source with the same name already exists, it will be replaced only if replaceIfExisting
is true. If this
is the case, then the existing source will be removed from the connection pool, and that pool will be
shutdown
(allowing any in-use connections to be used and finished normally).
source
- the source to addreplaceIfExisting
- true if an existing source should be replaced, or false if this method should return false if
there is already an existing source with the supplied name.
public boolean removeSource(RepositorySource source, long timeToAwait, TimeUnit unit) throws InterruptedException
This method can safely be called while the federation repository is in use.
source
- the source to be removedtimeToAwait
- the amount of time to wait while all of the source's connections are closed, or non-positive if the call
should not wait at allunit
- the time unit to be used for timeToAwait
InterruptedException
- if the thread is interrupted while awaiting closing of the connectionspublic RepositorySource removeSource(String name)
removeSource(name,0,TimeUnit.SECONDS)
.
name
- the name of the source to be removed
removeSource(String, long, TimeUnit)
public RepositorySource removeSource(String name, long timeToAwait, TimeUnit unit) throws InterruptedException
name
- the name of the source to be removedtimeToAwait
- the amount of time to wait while all of the source's connections are closed, or non-positive if the call
should not wait at allunit
- the time unit to be used for timeToAwait
InterruptedException
- if the thread is interrupted while awaiting closing of the connectionsremoveSource(String)
public RepositoryConnection createConnection(String sourceName)
RepositoryConnection
using the given RepositorySource
name.
createConnection
in interface RepositoryConnectionFactory
sourceName
- the name of the source from which a connection should be obtained
RepositoryConnectionFactory.createConnection(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |