org.glassfish.paas.orchestrator
Class ServiceOrchestratorImpl

java.lang.Object
  extended by org.glassfish.paas.orchestrator.ServiceOrchestratorImpl
All Implemented Interfaces:
ServiceOrchestrator

@Service
@Scoped(value=org.glassfish.hk2.scopes.Singleton.class)
public class ServiceOrchestratorImpl
extends Object
implements ServiceOrchestrator


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.paas.orchestrator.ServiceOrchestrator
ServiceOrchestrator.ReconfigAction
 
Field Summary
static String ATOMIC_DEPLOYMENT_FLAG
           
static boolean atomicDeploymentEnabled
           
protected  org.jvnet.hk2.component.Habitat habitat
           
static String ORCHESTRATOR_UNDEPLOY_CALL
           
static String PARALLEL_PROVISIONING_FLAG
           
static boolean parallelProvisioningEnabled
           
 
Constructor Summary
ServiceOrchestratorImpl()
           
 
Method Summary
 void addExternalService(String serviceName, ConfiguredService configuredService)
           
 void addSharedService(String serviceName, ProvisionedService provisionedService)
           
 void deploy(String appName, PaaSDeploymentContext dc)
           
 void deployApplication(String appName, ReadableArchive cloudArchive)
          Deploys an application archive into the PaaS runtime.
 void disable(String appName, ExtendedDeploymentContext dc)
           
 void enable(String appName, DeploymentContext dc)
           
static Collection<Class> getAllStates()
           
 ConfiguredService getConfiguredService(String serviceName)
           
 ServicePlugin getDefaultPlugin(Collection<ServicePlugin> pluginsList, String type)
           
 ServicePlugin getDefaultPluginForServiceRef(String serviceRefType)
           
 ServiceDescription getExternalServiceDescription(String serviceName)
           
 ServicePlugin getPlugin(ServiceDescription sd)
           
 Set<ServicePlugin> getPlugins()
           
 Set<ServicePlugin> getPlugins(ServiceMetadata appServiceMetadata)
          get plugins list for association or dissociation or re-association
 ProvisionedService getProvisionedService(ServiceDescription sd, String appName)
           
 ServiceDescription getServiceDescription(String appName, String service)
          given the application-name and service-name, retrieve the service-description info.
 ServiceDescription getServiceDescriptionForSharedOrExternalService(String serviceName)
           
 Collection<ServiceDescription> getServiceDescriptionsToProvision(String appName)
           
 Collection<ServiceDescription> getServiceDescriptionsToUnprovision(String appName)
           
 ServiceMetadata getServices(ReadableArchive archive)
          Provides the ServiceMetadata associated with an application archive.
 Set<Service> getServices(String appName)
          returns the effective set of services that the application uses.
 Set<Service> getServicesForAssociation(String appName)
           
 Set<Service> getServicesForDissociation(String appName)
           
 Collection<Service> getServicesManagedByPlugin(ServicePlugin plugin, Set<Service> allServices)
           
 Collection<ProvisionedService> getServicesProvisionedByPlugin(ServicePlugin plugin, Set<ProvisionedService> provisionedServices)
           
 Collection<ProvisionedService> getServicesToUnprovision(String appName)
           
 ProvisionedService getSharedService(String serviceName)
           
 ServiceDescription getSharedServiceDescription(String serviceName)
           
 String getVirtualClusterForApplication(String appName, ServiceMetadata appServiceMetadata)
          Name of the JavaEE service will be the name of the virtual cluster.
 boolean isAtomicDeploymentEnabled()
           
 boolean isParallelProvisioningEnabled()
           
 void postDeploy(String appName, DeploymentContext dc)
           
 void postDeploy(String appName, PaaSDeploymentContext dc)
           
 void postUndeploy(String appName, DeploymentContext dc)
           
 void postUndeploy(String appName, PaaSDeploymentContext dc)
           
 void preDeploy(String appName, DeploymentContext dc)
           
 void preDeploy(String appName, PaaSDeploymentContext dc)
           
 void preUndeploy(String appName, DeploymentContext dc)
           
 void preUndeploy(String appName, PaaSDeploymentContext pc)
           
 ConfiguredService removeExternalService(String serviceName)
           
 ProvisionedService removeSharedService(String serviceName)
           
 void removeVirtualCluster(String virtualClusterName)
           
 boolean scaleService(String appName, String svcName, int scaleCount, AllocationStrategy allocStrategy)
          Scales the size of a Service up or down as per the provided scalingFactor.
 void startup(String appName, DeploymentContext dc)
           
 void undeploy(OpsParams params, ExtendedDeploymentContext context)
           
 void undeploy(String appName, PaaSDeploymentContext dc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

habitat

protected org.jvnet.hk2.component.Habitat habitat

ORCHESTRATOR_UNDEPLOY_CALL

public static final String ORCHESTRATOR_UNDEPLOY_CALL
See Also:
Constant Field Values

PARALLEL_PROVISIONING_FLAG

public static final String PARALLEL_PROVISIONING_FLAG
See Also:
Constant Field Values

ATOMIC_DEPLOYMENT_FLAG

public static final String ATOMIC_DEPLOYMENT_FLAG
See Also:
Constant Field Values

parallelProvisioningEnabled

public static boolean parallelProvisioningEnabled

atomicDeploymentEnabled

public static boolean atomicDeploymentEnabled
Constructor Detail

ServiceOrchestratorImpl

public ServiceOrchestratorImpl()
Method Detail

getAllStates

public static Collection<Class> getAllStates()

getPlugins

public Set<ServicePlugin> getPlugins(ServiceMetadata appServiceMetadata)
get plugins list for association or dissociation or re-association

Parameters:
appServiceMetadata - ServiceMetadata
Returns:
Set Set of plugins.

getPlugins

public Set<ServicePlugin> getPlugins()

deployApplication

public void deployApplication(String appName,
                              ReadableArchive cloudArchive)
Description copied from interface: ServiceOrchestrator
Deploys an application archive into the PaaS runtime. XXX: This is currently used by the cloud-deploy command. The deploy command integration is through ApplicationLifecycleInterceptor and hence this can be removed later once we move to the deploy command fully.

Specified by:
deployApplication in interface ServiceOrchestrator
Parameters:
appName - the name of the application as it should be referenced in the PaaS console
cloudArchive - the application archive

getServicesForAssociation

public Set<Service> getServicesForAssociation(String appName)

getServicesForDissociation

public Set<Service> getServicesForDissociation(String appName)

postDeploy

public void postDeploy(String appName,
                       DeploymentContext dc)

deploy

public void deploy(String appName,
                   PaaSDeploymentContext dc)

postDeploy

public void postDeploy(String appName,
                       PaaSDeploymentContext dc)

startup

public void startup(String appName,
                    DeploymentContext dc)

enable

public void enable(String appName,
                   DeploymentContext dc)

disable

public void disable(String appName,
                    ExtendedDeploymentContext dc)

preUndeploy

public void preUndeploy(String appName,
                        PaaSDeploymentContext pc)

preUndeploy

public void preUndeploy(String appName,
                        DeploymentContext dc)

undeploy

public void undeploy(String appName,
                     PaaSDeploymentContext dc)

postUndeploy

public void postUndeploy(String appName,
                         PaaSDeploymentContext dc)

postUndeploy

public void postUndeploy(String appName,
                         DeploymentContext dc)

getServices

public ServiceMetadata getServices(ReadableArchive archive)
                            throws Exception
Description copied from interface: ServiceOrchestrator
Provides the ServiceMetadata associated with an application archive. This is used by GUI and the IDE plugin to get the service dependencies and default ServiceDescriptions associated that the OE and SPEs have discovered for the provided application archive.

Specified by:
getServices in interface ServiceOrchestrator
Parameters:
archive - Application archive
Returns:
The ServiceMetadata of the application discovered by OE and SPEs.
Throws:
Exception

getServicesManagedByPlugin

public Collection<Service> getServicesManagedByPlugin(ServicePlugin plugin,
                                                      Set<Service> allServices)

getServicesProvisionedByPlugin

public Collection<ProvisionedService> getServicesProvisionedByPlugin(ServicePlugin plugin,
                                                                     Set<ProvisionedService> provisionedServices)

getVirtualClusterForApplication

public String getVirtualClusterForApplication(String appName,
                                              ServiceMetadata appServiceMetadata)
Name of the JavaEE service will be the name of the virtual cluster. This method is used to create a virtual-cluster per deployment unit, meant for all application-scoped-services.
If there is no application scoped service, application-name will be chosen as virtual-cluster-name

Parameters:
appName - application-name
appServiceMetadata - meta-data
Returns:
String virtual-cluster-name

getServicesToUnprovision

public Collection<ProvisionedService> getServicesToUnprovision(String appName)

getProvisionedService

public ProvisionedService getProvisionedService(ServiceDescription sd,
                                                String appName)

getServiceDescriptionsToProvision

public Collection<ServiceDescription> getServiceDescriptionsToProvision(String appName)

getServiceDescriptionsToUnprovision

public Collection<ServiceDescription> getServiceDescriptionsToUnprovision(String appName)

removeVirtualCluster

public void removeVirtualCluster(String virtualClusterName)

getDefaultPluginForServiceRef

public ServicePlugin getDefaultPluginForServiceRef(String serviceRefType)

getDefaultPlugin

public ServicePlugin getDefaultPlugin(Collection<ServicePlugin> pluginsList,
                                      String type)

scaleService

public boolean scaleService(String appName,
                            String svcName,
                            int scaleCount,
                            AllocationStrategy allocStrategy)
Description copied from interface: ServiceOrchestrator
Scales the size of a Service up or down as per the provided scalingFactor. The Cloud Elasticity Manager(CEM) component uses this method to perform auto-scaling of Services (GlassFish Cluster etc) based on user-defined alerts and alarms.

Specified by:
scaleService in interface ServiceOrchestrator
Parameters:
appName - Name of the application
svcName - Names of the service to be scaled
scaleCount - Number of units of the Service that needs to be scaled. A positive number for scaling up and a negative number for scaling down.
allocStrategy - The allocationStrategy that needs to be utilized to scale the Service. The allocationStrategy implementation that is provided could be used to spawn a new instance in a less-loaded/underutilized machine in the ServerPool. This could be null, if the default allocation strategy needs to be employed.
Returns:
true if the scaling operation was successful, and false otherwise

getServiceDescription

public ServiceDescription getServiceDescription(String appName,
                                                String service)
Description copied from interface: ServiceOrchestrator
given the application-name and service-name, retrieve the service-description info.
Useful for GUI/Tooling modules to retrieve the service-description.

Specified by:
getServiceDescription in interface ServiceOrchestrator
Parameters:
appName - application-name
service - service-name
Returns:
ServiceDescription

undeploy

public void undeploy(OpsParams params,
                     ExtendedDeploymentContext context)

preDeploy

public void preDeploy(String appName,
                      PaaSDeploymentContext dc)

preDeploy

public void preDeploy(String appName,
                      DeploymentContext dc)

addSharedService

public void addSharedService(String serviceName,
                             ProvisionedService provisionedService)

addExternalService

public void addExternalService(String serviceName,
                               ConfiguredService configuredService)

removeExternalService

public ConfiguredService removeExternalService(String serviceName)

removeSharedService

public ProvisionedService removeSharedService(String serviceName)

getConfiguredService

public ConfiguredService getConfiguredService(String serviceName)

getSharedService

public ProvisionedService getSharedService(String serviceName)

getExternalServiceDescription

public ServiceDescription getExternalServiceDescription(String serviceName)

getServiceDescriptionForSharedOrExternalService

public ServiceDescription getServiceDescriptionForSharedOrExternalService(String serviceName)
                                                                   throws PaaSDeploymentException
Throws:
PaaSDeploymentException

getSharedServiceDescription

public ServiceDescription getSharedServiceDescription(String serviceName)

getPlugin

public ServicePlugin getPlugin(ServiceDescription sd)

isParallelProvisioningEnabled

public boolean isParallelProvisioningEnabled()

isAtomicDeploymentEnabled

public boolean isAtomicDeploymentEnabled()

getServices

public Set<Service> getServices(String appName)
returns the effective set of services that the application uses. ie., application-scoped (ProvisionedService), shared (ProvisionedService), external (ConfiguredService) services used/referred by the application

Parameters:
appName - application-name
Returns:
Set of Services


Copyright © 2012. All Rights Reserved.