org.ow2.jonas.lib.service
Class AbsServiceImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, Service
Direct Known Subclasses:
AbsDBServiceImpl, BaseDiscovery, BaseJMXService, BaseWebContainerService, CarolRegistryService, CmiServiceImpl, DefaultWSDLPublisherManager, DeployableMonitorService, EasyBeansService, HaServiceImpl, JAXRPCService, JAXWSService, JOnASDataBaseManagerService, JOnASEARService, JOnASEJBService, JOnASMailService, JOnASResourceMonitorService, JOnASResourceService, JonasSecurityServiceImpl, JOnASWorkCleanerService, JOnASWorkManagerService, JOTMTransactionService, SmartclientServiceImpl, VersioningServiceImpl

public abstract class AbsServiceImpl
extends ReconfigEmitter
implements Service

Abstract implementation of a Service.


Field Summary
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
AbsServiceImpl()
           
 
Method Summary
protected static List<String> convertToList(String value)
          Utility method to convert a given String of comma-separated elements to a List.
protected  void doInit(Context ctx)
          Deprecated.  
protected abstract  void doStart()
          Abstract start-up method to be implemented by sub-classes.
protected abstract  void doStop()
          Abstract method for service stopping to be implemented by sub-classes.
 String getDomainName()
          Return the domain's name of this service.
 String getJonasServerName()
          Return the JOnAS server's name of this service.
 String getName()
          Returns the service's name.
 ServerProperties getServerProperties()
          Get the Server Properties.
 void init(Context ctx)
          Initialize the service.
 boolean isStarted()
          Returns true if the service is started, false otherwise.
 void setName(String name)
          Set the service's name.
 void setServerProperties(ServerProperties props)
          Set the Server Properties.
 void start()
          Start the service.
 void stop()
          Stop the service.
protected  void throwRequirementException(String message)
          Utility Exception throwing method to identify the error source.
 String toString()
           
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbsServiceImpl

public AbsServiceImpl()
Method Detail

init

public void init(Context ctx)
          throws ServiceException
Initialize the service.

Specified by:
init in interface Service
Parameters:
ctx - configuration of the service
Throws:
ServiceException - service initialization failed

getServerProperties

public ServerProperties getServerProperties()
Get the Server Properties.


setServerProperties

public void setServerProperties(ServerProperties props)
Set the Server Properties.

Parameters:
props - ServerProperties instance

start

public void start()
           throws ServiceException
Start the service.

Specified by:
start in interface Service
Throws:
ServiceException - service start-up failed

stop

public void stop()
          throws ServiceException
Stop the service.

Specified by:
stop in interface Service
Throws:
ServiceException - service stopping failed

isStarted

public boolean isStarted()
Returns true if the service is started, false otherwise.

Specified by:
isStarted in interface Service
Returns:
true if the service is started

getName

public String getName()
Returns the service's name.

Specified by:
getName in interface Service
Returns:
the service name

setName

public void setName(String name)
Set the service's name.

Specified by:
setName in interface Service
Parameters:
name - the name to set

getDomainName

public String getDomainName()
Return the domain's name of this service.

Returns:
the domain name

getJonasServerName

public String getJonasServerName()
Return the JOnAS server's name of this service.

Returns:
the server name

doInit

@Deprecated
protected void doInit(Context ctx)
               throws ServiceException
Deprecated. 

Default initialization method to be overridden by sub-classes.

Parameters:
ctx - configuration of the service
Throws:
ServiceException - service initialization failed

doStart

protected abstract void doStart()
                         throws ServiceException
Abstract start-up method to be implemented by sub-classes.

Throws:
ServiceException - service start-up failed

doStop

protected abstract void doStop()
                        throws ServiceException
Abstract method for service stopping to be implemented by sub-classes.

Throws:
ServiceException - service stopping failed

toString

public String toString()
Overrides:
toString in class Object
Returns:
a String representation of a given Service.
See Also:
Object.toString()

throwRequirementException

protected void throwRequirementException(String message)
                                  throws ServiceException
Utility Exception throwing method to identify the error source.

Parameters:
message - Descriptive requirement message.
Throws:
ServiceException - always.

convertToList

protected static List<String> convertToList(String value)
Utility method to convert a given String of comma-separated elements to a List.

Parameters:
value - String value
Returns:
List constructed from the given String


Copyright © 2010 OW2 Consortium. All Rights Reserved.