org.ow2.jonas.lib.service.manager
Class ServiceManagerImpl

java.lang.Object
  extended by org.ow2.jonas.lib.service.manager.ServiceManagerImpl
All Implemented Interfaces:
org.ow2.jonas.management.ServiceManager

public class ServiceManagerImpl
extends Object
implements org.ow2.jonas.management.ServiceManager

Class to manage the JOnAS services.

Author:
Francois Fornaciari

Constructor Summary
ServiceManagerImpl(org.osgi.framework.BundleContext bc)
          Construct a service manager for JOnAS server.
 
Method Summary
 void bindJ2EEServer(org.ow2.jonas.management.J2EEServerService j2eeServer)
           
 void disableServiceStatesCheck()
          
 List<String> getAllServices()
          
 List<String> getOptionalServices()
          
 String getServiceDescription(String service)
          Return the description of a given service.
 String getServiceState(String service)
          Return the state of a given service.
protected  boolean isServiceStarted(String service)
          Returns true if the service is started, false otherwise.
protected  boolean isServiceStopped(String service)
          Returns true if the service is stopped, false otherwise.
 void setConfigurationManager(org.ow2.jonas.configuration.ConfigurationManager configurationManager)
           
 void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
           
 void setDeploymentPlanDeployer(org.ow2.jonas.configuration.DeploymentPlanDeployer deploymentPlanDeployer)
           
 void setServerProperties(org.ow2.jonas.properties.ServerProperties serverProperties)
           
 org.ow2.jonas.lib.management.javaee.J2EEServiceState setServiceState(String service, org.ow2.jonas.lib.management.javaee.J2EEServiceState state)
          Modify a service state.
 void start()
          Initialization method.
 void startRequiredServices(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Start all required services for a given deployable.
 void startService(String service)
          Start a JOnAS service.
 void startServices()
          
 void stop()
          Finalization method.
 void stopService(String service)
          Stop a JOnAS service.
 void stopServices()
          
 void unbindJ2EEServer(org.ow2.jonas.management.J2EEServerService j2eeServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceManagerImpl

public ServiceManagerImpl(org.osgi.framework.BundleContext bc)
Construct a service manager for JOnAS server.

Parameters:
bc - The bundleContext reference
Method Detail

start

public void start()
Initialization method.


stop

public void stop()
Finalization method.


getAllServices

public List<String> getAllServices()

Specified by:
getAllServices in interface org.ow2.jonas.management.ServiceManager

getOptionalServices

public List<String> getOptionalServices()

Specified by:
getOptionalServices in interface org.ow2.jonas.management.ServiceManager

setServiceState

public org.ow2.jonas.lib.management.javaee.J2EEServiceState setServiceState(String service,
                                                                            org.ow2.jonas.lib.management.javaee.J2EEServiceState state)
Modify a service state. This may arrive at startup when a service registers itself before the J2EEServer server initialization phase, or due to a service state notification (ServiceEvent in OSGI).

Parameters:
service - The service name
state - new state
Returns:
the service state

getServiceState

public String getServiceState(String service)
Return the state of a given service.

Specified by:
getServiceState in interface org.ow2.jonas.management.ServiceManager
Parameters:
service - The service name
Returns:
the service state

getServiceDescription

public String getServiceDescription(String service)
Return the description of a given service.

Specified by:
getServiceDescription in interface org.ow2.jonas.management.ServiceManager
Parameters:
service - The service name
Returns:
the service description

startService

public void startService(String service)
                  throws Exception
Start a JOnAS service.

Specified by:
startService in interface org.ow2.jonas.management.ServiceManager
Parameters:
service - Name of the service to start
Throws:
Exception - If the startup of the service fails

startRequiredServices

public void startRequiredServices(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Start all required services for a given deployable.

Specified by:
startRequiredServices in interface org.ow2.jonas.management.ServiceManager
Parameters:
deployable - The deployable to analyse

stopService

public void stopService(String service)
                 throws Exception
Stop a JOnAS service.

Specified by:
stopService in interface org.ow2.jonas.management.ServiceManager
Parameters:
service - Name of the service to stop
Throws:
Exception - If the stop of the service fails

startServices

public void startServices()

Specified by:
startServices in interface org.ow2.jonas.management.ServiceManager

stopServices

public void stopServices()

Specified by:
stopServices in interface org.ow2.jonas.management.ServiceManager

bindJ2EEServer

public void bindJ2EEServer(org.ow2.jonas.management.J2EEServerService j2eeServer)
Parameters:
j2eeServer - The j2eeServer to set

unbindJ2EEServer

public void unbindJ2EEServer(org.ow2.jonas.management.J2EEServerService j2eeServer)
Parameters:
j2eeServer - the j2eeServer to unset

setConfigurationManager

public void setConfigurationManager(org.ow2.jonas.configuration.ConfigurationManager configurationManager)
Parameters:
configurationManager - the configurationManager to set

setDeployerManager

public void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
Parameters:
deployerManager - the deployerManager to set

setDeploymentPlanDeployer

public void setDeploymentPlanDeployer(org.ow2.jonas.configuration.DeploymentPlanDeployer deploymentPlanDeployer)
Parameters:
deploymentPlanDeployer - the deploymentPlanDeployer to set

setServerProperties

public void setServerProperties(org.ow2.jonas.properties.ServerProperties serverProperties)
Parameters:
serverProperties - the serverProperties to set

disableServiceStatesCheck

public void disableServiceStatesCheck()

Specified by:
disableServiceStatesCheck in interface org.ow2.jonas.management.ServiceManager

isServiceStarted

protected boolean isServiceStarted(String service)
Returns true if the service is started, false otherwise.

Parameters:
service - The given service name
Returns:
True if the service is started, false otherwise.

isServiceStopped

protected boolean isServiceStopped(String service)
Returns true if the service is stopped, false otherwise.

Parameters:
service - The given service name
Returns:
True if the service is stopped, false otherwise.


Copyright © 2011 OW2 Consortium. All Rights Reserved.