org.modeshape.jboss.managed
Class ManagedEngine

java.lang.Object
  extended by org.modeshape.jboss.managed.ManagedEngine
All Implemented Interfaces:
ModeShapeManagedObject

@Immutable
public final class ManagedEngine
extends Object
implements ModeShapeManagedObject

A ManagedEngine instance is a JBoss managed object for a JcrEngine.


Nested Class Summary
static class ManagedEngine.Component
           
static class ManagedEngine.ManagedProperty
           
 
Constructor Summary
ManagedEngine()
           
ManagedEngine(JcrEngine engine)
          Creates a JBoss managed object from the specified engine.
 
Method Summary
 RepositorySource getConnector(String connectorName)
          Obtains a connector by name.
 Collection<ManagedConnector> getConnectors()
          Obtains the managed connectors of this engine.
protected  JcrEngine getEngine()
          A utility method that must be used by all non-synchronized methods to access the engine.
 long getInUseConnections(String connectorName)
          Tests to see if a connector isRunning.
 List<ManagedEngine.ManagedProperty> getProperties(String objectName, ManagedEngine.Component objectType)
          Obtains the properties for the passed in object.
 int getQueryActivity()
           
 Collection<ManagedRepository> getRepositories()
          Obtains the managed repositories of this engine.
 JcrRepository getRepository(String repositoryName)
          Obtains the specified managed repository of this engine.
 List<ManagedEngine.ManagedProperty> getRepositoryProperties(String repositoryName)
          Obtains the managed sequencing service.
 String getRepositoryVersion(String repositoryName)
          Obtains the JCR version supported by this repository.
 int getSaveActivity()
           
 org.modeshape.repository.sequencer.SequencingService getSequencingService()
          Obtains the managed sequencing service.
 Object getSessionActivity()
           
 String getVersion()
          Obtains the version (build number) of this ModeShape instance.
 boolean isRunning()
          Indicates if the managed engine is running.
 List<ManagedLock> listLocks()
          Obtains all the repository locks sorted by owner.
 List<ManagedLock> listLocks(Comparator<ManagedLock> lockSorter)
          Obtains all the repository locks sorted by the specified sorter.
 List<ManagedSession> listSessions()
          Obtains all the repository sessions sorted by user name.
 List<ManagedSession> listSessions(Comparator<ManagedSession> sessionSorter)
          Obtains all the repository sessions sorted by the specified sorter.
protected  void loadConfigurationAndCreateEngine()
           
 boolean pingConnector(String connectorName)
          Pings a connector by name.
 boolean removeLock(String lockId)
          Removes the lock with the specified identifier.
 void restart()
          First shutdowns the engine and then starts it back up again.
 void setConfigURL(URL configurationUrl)
           
 void shutdown()
          Performs an engine shutdown.
 void start()
          Starts the engine.
 boolean terminateSession(String sessionId)
          Terminates the session with the specified identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedEngine

public ManagedEngine()

ManagedEngine

public ManagedEngine(JcrEngine engine)
Creates a JBoss managed object from the specified engine.

Parameters:
engine - the engine being managed (never null)
Method Detail

setConfigURL

public void setConfigURL(URL configurationUrl)
                  throws Exception
Throws:
Exception

loadConfigurationAndCreateEngine

protected void loadConfigurationAndCreateEngine()
                                         throws Exception
Throws:
Exception

getEngine

protected JcrEngine getEngine()
A utility method that must be used by all non-synchronized methods to access the engine. Subsequent calls to this method may return different JcrEngine instances, so all non-synchronized methods should call this method once and use the returned reference for all operations against the engine.

Returns:
the engine at the moment this method is called; may be null if an engine could not be created

start

public void start()
Starts the engine. This is a JBoss managed operation.

See Also:
JcrEngine.start()

isRunning

public boolean isRunning()
Indicates if the managed engine is running. This is a JBoss managed operation.

Returns:
true if the engine is running

restart

public void restart()
             throws Exception
First shutdowns the engine and then starts it back up again. This is a JBoss managed operation.

Throws:
Exception - if there is a problem restarting the engine (usually reading the configuration file)
See Also:
shutdown(), start()

shutdown

public void shutdown()
Performs an engine shutdown. This is a JBoss managed operation.

See Also:
ModeShapeEngine.shutdown()

getConnectors

public Collection<ManagedConnector> getConnectors()
Obtains the managed connectors of this engine. This is a JBoss managed operation.

Returns:
an unmodifiable collection of managed connectors (never null)

getInUseConnections

public long getInUseConnections(String connectorName)
Tests to see if a connector isRunning.

Parameters:
connectorName -
Returns:
boolean

getProperties

public List<ManagedEngine.ManagedProperty> getProperties(String objectName,
                                                         ManagedEngine.Component objectType)
Obtains the properties for the passed in object. This is a JBoss managed operation.

Parameters:
objectName -
objectType -
Returns:
an collection of managed properties (may be null)

getRepositories

public Collection<ManagedRepository> getRepositories()
Obtains the managed repositories of this engine. This is a JBoss managed operation.

Returns:
an unmodifiable collection of repositories (never null)

getRepository

public JcrRepository getRepository(String repositoryName)
Obtains the specified managed repository of this engine. This is called by the JNDIManagedRepositories when a JNDI lookup is performed to find a repository.

Parameters:
repositoryName - for the repository to be returned
Returns:
a repository or null if repository doesn't exist

getRepositoryVersion

public String getRepositoryVersion(String repositoryName)
Obtains the JCR version supported by this repository. This is a JBoss managed readonly property.

Parameters:
repositoryName - (never null)
Returns:
String version (never null)

getQueryActivity

public int getQueryActivity()

getSaveActivity

public int getSaveActivity()

getSessionActivity

public Object getSessionActivity()

listLocks

public List<ManagedLock> listLocks()
Obtains all the repository locks sorted by owner. This is a JBoss managed operation.

Returns:
a list of sessions sorted by owner (never null)

listLocks

public List<ManagedLock> listLocks(Comparator<ManagedLock> lockSorter)
Obtains all the repository locks sorted by the specified sorter.

Parameters:
lockSorter - the lock sorter (never null)
Returns:
a list of locks sorted by the specified lock sorter (never null)

listSessions

public List<ManagedSession> listSessions()
Obtains all the repository sessions sorted by user name. This is a JBoss managed operation.

Returns:
a list of sessions sorted by user name (never null)

listSessions

public List<ManagedSession> listSessions(Comparator<ManagedSession> sessionSorter)
Obtains all the repository sessions sorted by the specified sorter.

Parameters:
sessionSorter - the session sorter (never null)
Returns:
a list of locks sorted by the specified session sorter (never null)

removeLock

public boolean removeLock(String lockId)
Removes the lock with the specified identifier. This is a JBoss managed operation.

Parameters:
lockId - the lock's identifier
Returns:
true if the lock was removed

terminateSession

public boolean terminateSession(String sessionId)
Terminates the session with the specified identifier. This is a JBoss managed operation.

Parameters:
sessionId - the session's identifier
Returns:
true if the session was terminated

getConnector

public RepositorySource getConnector(String connectorName)
Obtains a connector by name.

Parameters:
connectorName -
Returns:
RepositorySource - may be null)

pingConnector

public boolean pingConnector(String connectorName)
Pings a connector by name.

Parameters:
connectorName -
Returns:
RepositorySource - may be null)

getSequencingService

public org.modeshape.repository.sequencer.SequencingService getSequencingService()
Obtains the managed sequencing service. This is a JBoss managed operation.

Returns:
the sequencing service or null if never started

getRepositoryProperties

public List<ManagedEngine.ManagedProperty> getRepositoryProperties(String repositoryName)
Obtains the managed sequencing service. This is a JBoss managed operation.

Parameters:
repositoryName -
Returns:
the sequencing service or null if never started

getVersion

public String getVersion()
Obtains the version (build number) of this ModeShape instance. This is a JBoss managed operation.

Returns:
the ModeShape version


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