org.modeshape.repository
Class RepositoryLibrary.Administrator

java.lang.Object
  extended by org.modeshape.repository.service.AbstractServiceAdministrator
      extended by org.modeshape.repository.RepositoryLibrary.Administrator
All Implemented Interfaces:
org.modeshape.repository.service.ServiceAdministrator
Enclosing class:
RepositoryLibrary

protected class RepositoryLibrary.Administrator
extends org.modeshape.repository.service.AbstractServiceAdministrator

The administrative component for this service.

Author:
Randall Hauch

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.modeshape.repository.service.ServiceAdministrator
org.modeshape.repository.service.ServiceAdministrator.State
 
Constructor Summary
protected RepositoryLibrary.Administrator()
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
          Blocks until the shutdown has completed, or the timeout occurs, or the current thread is interrupted, whichever happens first.
protected  boolean doCheckIsTerminated()
          Subclasses should implement this method to determine whether the service has completed shutdown.
protected  void doShutdown(org.modeshape.repository.service.ServiceAdministrator.State fromState)
          Implementation of the functionality to switch to the shutdown state.
protected  void doStart(org.modeshape.repository.service.ServiceAdministrator.State fromState)
          Implementation of the functionality to switch to the started state.
 
Methods inherited from class org.modeshape.repository.service.AbstractServiceAdministrator
doPause, getServiceName, getServiceName, getState, isPaused, isShutdown, isStarted, isTerminated, pause, setState, setState, shutdown, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryLibrary.Administrator

protected RepositoryLibrary.Administrator()
Method Detail

doStart

protected void doStart(org.modeshape.repository.service.ServiceAdministrator.State fromState)
Implementation of the functionality to switch to the started state. This method is only called if the state from which the service is transitioning is appropriate (ServiceAdministrator.State.PAUSED). This method does nothing by default, and should be overridden if needed.

Overrides:
doStart in class org.modeshape.repository.service.AbstractServiceAdministrator
Parameters:
fromState - the state from which this service is transitioning; never null

doShutdown

protected void doShutdown(org.modeshape.repository.service.ServiceAdministrator.State fromState)
Implementation of the functionality to switch to the shutdown state. This method is only called if the state from which the service is transitioning is appropriate (ServiceAdministrator.State.STARTED or ServiceAdministrator.State.PAUSED). This method does nothing by default, and should be overridden if needed.

Overrides:
doShutdown in class org.modeshape.repository.service.AbstractServiceAdministrator
Parameters:
fromState - the state from which this service is transitioning; never null

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Blocks until the shutdown has completed, or the timeout occurs, or the current thread is interrupted, whichever happens first.

Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
true if this service complete shut down and false if the timeout elapsed before it was shut down completely
Throws:
InterruptedException - if interrupted while waiting

doCheckIsTerminated

protected boolean doCheckIsTerminated()
Subclasses should implement this method to determine whether the service has completed shutdown.

Specified by:
doCheckIsTerminated in class org.modeshape.repository.service.AbstractServiceAdministrator
Returns:
true if terminated, or false otherwise


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