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

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

public class ServiceManagerImpl
extends java.lang.Object
implements 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(J2EEServerService j2eeServer)
           
 void disableServiceStatesCheck()
          
 java.util.List<java.lang.String> getAllServices()
          
 java.util.List<java.lang.String> getOptionalServices()
          
 java.lang.String getServiceDescription(java.lang.String service)
          Return the description of a given service.
 java.lang.String getServiceState(java.lang.String service)
          Return the state of a given service.
protected  boolean isServiceStarted(java.lang.String service)
          Returns true if the service is started, false otherwise.
protected  boolean isServiceStopped(java.lang.String service)
          Returns true if the service is stopped, false otherwise.
 void setConfigurationManager(ConfigurationManager configurationManager)
           
 void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
           
 void setDeploymentPlanDeployer(DeploymentPlanDeployer deploymentPlanDeployer)
           
 void setServerProperties(ServerProperties serverProperties)
           
 J2EEServiceState setServiceState(java.lang.String service, 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(java.lang.String service, boolean deployOSGiResources)
          Start a JOnAS service.
 void startServices()
          
 void stop()
          Finalization method.
 void stopService(java.lang.String service)
          Stop a JOnAS service.
 void stopServices()
          
 void unbindJ2EEServer(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 java.util.List<java.lang.String> getAllServices()

Specified by:
getAllServices in interface ServiceManager

getOptionalServices

public java.util.List<java.lang.String> getOptionalServices()

Specified by:
getOptionalServices in interface ServiceManager

setServiceState

public J2EEServiceState setServiceState(java.lang.String service,
                                        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 java.lang.String getServiceState(java.lang.String service)
Return the state of a given service.

Specified by:
getServiceState in interface ServiceManager
Parameters:
service - The service name
Returns:
the service state

getServiceDescription

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

Specified by:
getServiceDescription in interface ServiceManager
Parameters:
service - The service name
Returns:
the service description

startService

public void startService(java.lang.String service,
                         boolean deployOSGiResources)
                  throws java.lang.Exception
Start a JOnAS service.

Specified by:
startService in interface ServiceManager
Parameters:
service - Name of the service to start
deployOSGiResources - True if OSGi resources of the service need to be deployed
Throws:
java.lang.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 ServiceManager
Parameters:
deployable - The deployable to analyse

stopService

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

Specified by:
stopService in interface ServiceManager
Parameters:
service - Name of the service to stop
Throws:
java.lang.Exception - If the stop of the service fails

startServices

public void startServices()

Specified by:
startServices in interface ServiceManager

stopServices

public void stopServices()

Specified by:
stopServices in interface ServiceManager

bindJ2EEServer

public void bindJ2EEServer(J2EEServerService j2eeServer)
Parameters:
j2eeServer - The j2eeServer to set

unbindJ2EEServer

public void unbindJ2EEServer(J2EEServerService j2eeServer)
Parameters:
j2eeServer - the j2eeServer to unset

setConfigurationManager

public void setConfigurationManager(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(DeploymentPlanDeployer deploymentPlanDeployer)
Parameters:
deploymentPlanDeployer - the deploymentPlanDeployer to set

setServerProperties

public void setServerProperties(ServerProperties serverProperties)
Parameters:
serverProperties - the serverProperties to set

disableServiceStatesCheck

public void disableServiceStatesCheck()

Specified by:
disableServiceStatesCheck in interface ServiceManager

isServiceStarted

protected boolean isServiceStarted(java.lang.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(java.lang.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 © 2012 OW2 Consortium. All Rights Reserved.