GigaSpaces XAP 7.0 API

org.openspaces.pu.container.jee.glassfish
Class GlassfishJeeProcessingUnitContainerProvider

java.lang.Object
  extended by org.openspaces.pu.container.jee.glassfish.GlassfishJeeProcessingUnitContainerProvider
All Implemented Interfaces:
ClusterInfoAware, BeanLevelPropertiesAware, ClassLoaderAwareProcessingUnitContainerProvider, DeployableProcessingUnitContainerProvider, JeeProcessingUnitContainerProvider, ProcessingUnitContainerProvider, ApplicationContextProcessingUnitContainerProvider

public class GlassfishJeeProcessingUnitContainerProvider
extends Object
implements JeeProcessingUnitContainerProvider, ClassLoaderAwareProcessingUnitContainerProvider

A container allowing to support Glassfish V3 prelude embedded as a web container.

The glassfish server is a shared one between all applications. The first application deployed will start the glassfish server. The last one undeployed will stop it (though currently it is not closed properly).

Since there is no way to cleanly stop glassfish (currently), a port is assigned to glassfish on creation and is used throughout the lifecycle of the JVM. The port starts from 9008 (can be set using com.gs.glassfish.port system property) and tries for 20 times until it manages to find a usuable port. Finding usuable ports is done through locks on files, so it only works for used ports between different JVMs that use this container. Files are used since it is not possible to start stop glassfish cleanly now.

The glassfish work directory is created under GSHOME/work/glassfish/[portNumber].

A glassfish domain.xml file is used in order to configure the glassfish instance. By default, it is located under GSHOME/lib/glassfish/domain.xml and can be changed using com.gs.glassfish.domainXml system property. The domain xml uses a single main GigaSpaces property called com.gs.glassfish.port and is changed dynamically and created under the glassfish work directory (generated-domain.xml).

Note, this overrides the built in Glassfish Server code so it won't generate dynamically the http listener and virtual server. This allows for greater control over how the Glassfish is conifugred by exposing the full domain xml to the user.

Any other ${...} notation will be replaced (if possible) in the domain.xml file using context propertes as well.

Author:
kimchy

Field Summary
static String DEFAULT_GLASSFISH_PU
           
static String GLASSFISH_LOCATION_PREFIX_SYSPROP
           
static String INSTANCE_SHARD
           
static String INTERNAL_GLASSFISH_PU_PREFIX
           
 
Fields inherited from interface org.openspaces.pu.container.jee.JeeProcessingUnitContainerProvider
APPLICATION_CONTEXT_CONTEXT, BEAN_LEVEL_PROPERTIES_CONTEXT, CLUSTER_INFO_CONTEXT
 
Fields inherited from interface org.openspaces.pu.container.spi.ApplicationContextProcessingUnitContainerProvider
DEFAULT_FS_PU_CONTEXT_LOCATION, DEFAULT_PU_CONTEXT_LOCATION
 
Fields inherited from interface org.openspaces.pu.container.DeployableProcessingUnitContainerProvider
CONTEXT_PROPERTY_DEPLOY_PATH
 
Constructor Summary
GlassfishJeeProcessingUnitContainerProvider()
           
 
Method Summary
 void addConfigLocation(Resource resource)
          Adds a config location using Springs Resource abstraction.
 void addConfigLocation(String path)
          Adds a config location based on a String description using Springs PathMatchingResourcePatternResolver.
 ProcessingUnitContainer createContainer()
          Creates a processing unit container.
static com.sun.enterprise.deploy.shared.ArchiveFactory getArchiveFactory(org.glassfish.embed.Server server)
           
static com.sun.enterprise.v3.services.impl.GrizzlyService getGrizzlyService(org.glassfish.embed.Server server)
           
static com.sun.appserv.management.monitor.statistics.HTTPListenerStats getHTTPListenerStats(org.glassfish.embed.Server server)
           
 void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
          Sets the BeanLevelProperties that will be used to configure this processing unit.
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader this processing unit container will load the application context with.
 void setClusterInfo(ClusterInfo clusterInfo)
          Sets the ClusterInfo that will be used to configure this processing unit.
 void setDeployPath(File warPath)
          Sets the deploy path where the exploded war jetty will work with is located.
 void setParentContext(ApplicationContext parentContext)
          Sets Spring parent ApplicationContext that will be used when constructing this processing unit application context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GLASSFISH_PU

public static final String DEFAULT_GLASSFISH_PU
See Also:
Constant Field Values

INTERNAL_GLASSFISH_PU_PREFIX

public static final String INTERNAL_GLASSFISH_PU_PREFIX
See Also:
Constant Field Values

INSTANCE_SHARD

public static final String INSTANCE_SHARD
See Also:
Constant Field Values

GLASSFISH_LOCATION_PREFIX_SYSPROP

public static final String GLASSFISH_LOCATION_PREFIX_SYSPROP
See Also:
Constant Field Values
Constructor Detail

GlassfishJeeProcessingUnitContainerProvider

public GlassfishJeeProcessingUnitContainerProvider()
Method Detail

setParentContext

public void setParentContext(ApplicationContext parentContext)
Sets Spring parent ApplicationContext that will be used when constructing this processing unit application context.


setBeanLevelProperties

public void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
Sets the BeanLevelProperties that will be used to configure this processing unit. When constructing the container this provider will automatically add to the application context both BeanLevelPropertyBeanPostProcessor and BeanLevelPropertyPlaceholderConfigurer based on this bean level properties.

Specified by:
setBeanLevelProperties in interface BeanLevelPropertiesAware

setClusterInfo

public void setClusterInfo(ClusterInfo clusterInfo)
Sets the ClusterInfo that will be used to configure this processing unit. When constructing the container this provider will automatically add to the application context the ClusterInfoBeanPostProcessor in order to allow injection of cluster info into beans that implement ClusterInfoAware.

Specified by:
setClusterInfo in interface ClusterInfoAware
Parameters:
clusterInfo - The cluster information to be injected

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the class loader this processing unit container will load the application context with.

Specified by:
setClassLoader in interface ClassLoaderAwareProcessingUnitContainerProvider

addConfigLocation

public void addConfigLocation(Resource resource)
Adds a config location using Springs Resource abstraction. This config location represents a Spring xml context.

Note, once a config location is added that default location used when no config location is defined won't be used (the default location is classpath*:/META-INF/spring/pu.xml).

Specified by:
addConfigLocation in interface ApplicationContextProcessingUnitContainerProvider

addConfigLocation

public void addConfigLocation(String path)
                       throws IOException
Adds a config location based on a String description using Springs PathMatchingResourcePatternResolver.

Specified by:
addConfigLocation in interface ApplicationContextProcessingUnitContainerProvider
Throws:
IOException
See Also:
PathMatchingResourcePatternResolver

setDeployPath

public void setDeployPath(File warPath)
Sets the deploy path where the exploded war jetty will work with is located.

Specified by:
setDeployPath in interface DeployableProcessingUnitContainerProvider

createContainer

public ProcessingUnitContainer createContainer()
                                        throws CannotCreateContainerException
Description copied from interface: ProcessingUnitContainerProvider
Creates a processing unit container.

Specified by:
createContainer in interface ProcessingUnitContainerProvider
Returns:
A newly created processing unit container.
Throws:
CannotCreateContainerException

getArchiveFactory

public static com.sun.enterprise.deploy.shared.ArchiveFactory getArchiveFactory(org.glassfish.embed.Server server)
                                                                         throws Exception
Throws:
Exception

getHTTPListenerStats

public static com.sun.appserv.management.monitor.statistics.HTTPListenerStats getHTTPListenerStats(org.glassfish.embed.Server server)
                                                                                            throws Exception
Throws:
Exception

getGrizzlyService

public static com.sun.enterprise.v3.services.impl.GrizzlyService getGrizzlyService(org.glassfish.embed.Server server)
                                                                            throws Exception
Throws:
Exception

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.