org.apache.axis2.deployment
Class DeploymentEngine

java.lang.Object
  extended by org.apache.axis2.deployment.DeploymentEngine
All Implemented Interfaces:
DeploymentConstants
Direct Known Subclasses:
FileSystemConfigurator, ScriptDeploymentEngine, URLBasedAxisConfigurator, WarBasedAxisConfigurator

public abstract class DeploymentEngine
extends java.lang.Object
implements DeploymentConstants


Field Summary
protected  AxisConfiguration axisConfig
          to keep a ref to engine register this ref will pass to engine when it call start() method
protected  ConfigurationContext configContext
           
protected  boolean hotDeployment
          Support for hot deployment is controlled by this flag
protected  boolean hotUpdate
          Support for hot update is controlled by this flag
protected  ModuleDeployer moduleDeployer
           
protected  java.io.File modulesDir
           
protected  java.lang.String modulesPath
           
protected  RepositoryListener repoListener
           
protected  Scheduler scheduler
           
protected  ServiceDeployer serviceDeployer
           
protected  java.io.File servicesDir
           
protected  java.lang.String servicesPath
           
protected static java.lang.String webLocationString
           
protected  java.util.List wsToDeploy
          Stores all the web Services to deploy.
protected  java.util.List wsToUnDeploy
          Stores all the web Services to undeploy.
 
Fields inherited from interface org.apache.axis2.deployment.DeploymentConstants
ATTACHMENTS_LIFECYCLE_MANAGER, ATTRIBUTE_ACTIVATE, ATTRIBUTE_CLASS, ATTRIBUTE_DEFAULT_VERSION, ATTRIBUTE_LOCKED, ATTRIBUTE_NAME, ATTRIBUTE_NAMESPACE, ATTRIBUTE_PACKAGE, ATTRIBUTE_SCOPE, ATTRIBUTE_WSADDRESSING, AXIS2_CONFIGURATION_RESOURCE, AXIS2_CONFIGURATION_XML, AXIS2_REPO, BOOLEAN_FALSE, BOOLEAN_TRUE, DEPLOYER, DIRECTORY, DIRECTORY_AXIS2_HOME, DIRECTORY_CONF, EXTENSION, MAPPING, META_INF, MODULE_DRI_PATH, MODULE_PATH, MODULE_XML, POLICY_NS_URI, PROPERTY_TEMP_DIR, RESOURCE_MODULES, SCHEMA, SCHEMA_ELEMENT_QUALIFIED, SCHEMA_NAME_SPACE, SEPARATOR_COLON, SEPARATOR_DOT, SERVICE_DIR_PATH, SERVICE_PATH, SERVICES_XML, SUFFIX_JAR, SUFFIX_MAR, SUFFIX_WSDL, TAG_AFTER, TAG_ANTI_JAR_LOCKING, TAG_APPLIES_TO, TAG_AXISCONFIG, TAG_BEFORE, TAG_CLASS_NAME, TAG_CLUSTER, TAG_CONFIGURATION_MANAGER, TAG_CONTENT_TYPE, TAG_CONTEXT, TAG_CONTEXT_MANAGER, TAG_DEFAULT_MODULE_VERSION, TAG_DEFAULTS, TAG_DESCRIPTION, TAG_DISPATCH_ORDER, TAG_DISPATCHER, TAG_EXCLUDE, TAG_EXCLUDE_OPERATIONS, TAG_EXCLUDE_PROPERTIES, TAG_EXPOSE, TAG_EXTRACT_SERVICE_ARCHIVE, TAG_FLOW_IN, TAG_FLOW_IN_FAULT, TAG_FLOW_OUT, TAG_FLOW_OUT_FAULT, TAG_HANDLER, TAG_HOT_DEPLOYMENT, TAG_HOT_UPDATE, TAG_INCLUDE_PROPERTIES, TAG_LABEL, TAG_LIST_ID, TAG_LISTENER, TAG_MAPPING, TAG_MEP, TAG_MESSAGE, TAG_MESSAGE_BUILDER, TAG_MESSAGE_BUILDERS, TAG_MESSAGE_FORMATTER, TAG_MESSAGE_FORMATTERS, TAG_MESSAGE_RECEIVER, TAG_MESSAGE_RECEIVERS, TAG_MODULE, TAG_MODULE_CONFIG, TAG_NAMESPACES, TAG_OBJECT_SUPPLIER, TAG_OPERATION, TAG_ORDER, TAG_PACKAGE_NAME, TAG_PACKAGE2QNAME, TAG_PARAMETER, TAG_PHASE, TAG_PHASE_FIRST, TAG_PHASE_LAST, TAG_PHASE_ORDER, TAG_POLICY, TAG_POLICY_ATTACHMENT, TAG_POLICY_REF, TAG_QNAME, TAG_REFERENCE, TAG_REPLICATION, TAG_SERVICE, TAG_SERVICE_GROUP, TAG_SUPPORTED_POLICY_NAMESPACES, TAG_TARGET_RESOLVER, TAG_TARGET_RESOLVERS, TAG_THREAD_CONTEXT_MIGRATOR, TAG_THREAD_CONTEXT_MIGRATORS, TAG_TRANSPORT, TAG_TRANSPORT_RECEIVER, TAG_TRANSPORT_SENDER, TAG_TRANSPORTS, TAG_TYPE, TARGET_NAME_SPACE
 
Constructor Summary
DeploymentEngine()
           
 
Method Summary
static void addNewModule(AxisModule modulemetadata, AxisConfiguration axisConfiguration)
           
static void addServiceGroup(AxisServiceGroup serviceGroup, java.util.ArrayList serviceList, java.net.URL serviceLocation, DeploymentFileData currentDeploymentFile, AxisConfiguration axisConfiguration)
           
 void addWSToDeploy(DeploymentFileData file)
           
 void addWSToUndeploy(WSInfo file)
           
static AxisModule buildModule(java.io.File modulearchive, AxisConfiguration config)
          Builds an AxisModule for a given module archive file.
static AxisService buildService(java.io.InputStream serviceInputStream, ConfigurationContext configCtx)
          Fills an axisservice object using services.xml.
static AxisServiceGroup buildServiceGroup(java.io.InputStream servicesxml, java.lang.ClassLoader classLoader, java.lang.String serviceGroupName, ConfigurationContext configCtx, ArchiveReader archiveReader, java.util.HashMap wsdlServices)
          To build a AxisServiceGroup for a given services.xml You have to add the created group into AxisConfig
 void cleanup()
          Clean up the mess
 void doDeploy()
           
 void engageModules()
          Checks if the modules, referred by server.xml, exist or that they are deployed.
protected static void fillServiceGroup(AxisServiceGroup serviceGroup, java.util.ArrayList serviceList, java.net.URL serviceLocation, AxisConfiguration axisConfig)
           
 AxisConfiguration getAxisConfig()
          Gets AxisConfiguration.
static java.lang.String getAxisServiceName(java.lang.String fileName)
          Retrieves service name from the archive file name.
 Deployer getDeployerForExtension(java.lang.String extension)
           
 java.util.HashMap getDirectoryToExtensionMappingMap()
           
protected  java.util.ArrayList getFileList(java.net.URL fileListUrl)
           
 AxisModule getModule(java.lang.String moduleName)
           
 ModuleDeployer getModuleDeployer()
           
 java.io.File getModulesDir()
           
 RepositoryListener getRepoListener()
           
 java.io.File getRepositoryDir()
           
protected  java.lang.String getRepositoryPath(java.io.File repository)
           
 ServiceDeployer getServiceDeployer()
           
 java.io.File getServicesDir()
           
static java.lang.String getWebLocationString()
           
 boolean isHotUpdate()
           
protected  MessageReceiver loadDefaultMessageReceiver(java.lang.String mepURL, AxisService service)
           
 void loadFromClassPath()
           
 void loadRepository(java.lang.String repoDir)
           
 void loadRepositoryFromURL(java.net.URL repoURL)
           
static AxisServiceGroup loadServiceGroup(java.io.File serviceFile, ConfigurationContext configCtx)
           
 void loadServices()
           
 void loadServicesFromUrl(java.net.URL repoURL)
           
 AxisConfiguration populateAxisConfiguration(java.io.InputStream in)
          To get AxisConfiguration for a given inputStream this method can be used.
protected  java.util.ArrayList populateService(AxisServiceGroup serviceGroup, java.net.URL servicesURL, java.lang.String serviceName)
           
protected  void prepareRepository(java.lang.String repositoryName)
          Creates directories for modules/services, copies configuration xml from class loader if necessary
protected  void setClassLoaders(java.lang.String axis2repoURI)
          To set the all the classLoader hierarchy this method can be used , the top most parent is CCL then SCL(system Class Loader) CCL : SCL : : MCCL SCCL : : MCL SCL

MCCL : module common class loader SCCL : Service common class loader MCL : module class loader SCL : Service class loader

 void setConfigContext(ConfigurationContext configContext)
           
protected  void setDeploymentFeatures()
          Sets hotDeployment and hot update.
 void setDirectoryToExtensionMappingMap(java.util.HashMap directoryToExtensionMappingMap)
           
 void setExtensionToDeployerMappingMap(java.util.HashMap extensionToDeployerMappingMap)
           
static void setWebLocationString(java.lang.String webLocationString)
           
protected  void startSearch(RepositoryListener listener)
          Starts the Deployment engine to perform Hot deployment and so on.
 void unDeploy()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webLocationString

protected static java.lang.String webLocationString

scheduler

protected Scheduler scheduler

hotUpdate

protected boolean hotUpdate
Support for hot update is controlled by this flag


hotDeployment

protected boolean hotDeployment
Support for hot deployment is controlled by this flag


wsToDeploy

protected java.util.List wsToDeploy
Stores all the web Services to deploy.


wsToUnDeploy

protected java.util.List wsToUnDeploy
Stores all the web Services to undeploy.


axisConfig

protected AxisConfiguration axisConfig
to keep a ref to engine register this ref will pass to engine when it call start() method


configContext

protected ConfigurationContext configContext

repoListener

protected RepositoryListener repoListener

servicesPath

protected java.lang.String servicesPath

servicesDir

protected java.io.File servicesDir

modulesPath

protected java.lang.String modulesPath

modulesDir

protected java.io.File modulesDir

serviceDeployer

protected ServiceDeployer serviceDeployer

moduleDeployer

protected ModuleDeployer moduleDeployer
Constructor Detail

DeploymentEngine

public DeploymentEngine()
Method Detail

setWebLocationString

public static void setWebLocationString(java.lang.String webLocationString)

loadServices

public void loadServices()

loadRepository

public void loadRepository(java.lang.String repoDir)
                    throws DeploymentException
Throws:
DeploymentException

loadFromClassPath

public void loadFromClassPath()
                       throws DeploymentException
Throws:
DeploymentException

loadServicesFromUrl

public void loadServicesFromUrl(java.net.URL repoURL)

loadRepositoryFromURL

public void loadRepositoryFromURL(java.net.URL repoURL)
                           throws DeploymentException
Throws:
DeploymentException

populateService

protected java.util.ArrayList populateService(AxisServiceGroup serviceGroup,
                                              java.net.URL servicesURL,
                                              java.lang.String serviceName)
                                       throws DeploymentException
Throws:
DeploymentException

loadDefaultMessageReceiver

protected MessageReceiver loadDefaultMessageReceiver(java.lang.String mepURL,
                                                     AxisService service)

addNewModule

public static void addNewModule(AxisModule modulemetadata,
                                AxisConfiguration axisConfiguration)
                         throws AxisFault
Throws:
AxisFault

addServiceGroup

public static void addServiceGroup(AxisServiceGroup serviceGroup,
                                   java.util.ArrayList serviceList,
                                   java.net.URL serviceLocation,
                                   DeploymentFileData currentDeploymentFile,
                                   AxisConfiguration axisConfiguration)
                            throws AxisFault
Throws:
AxisFault

fillServiceGroup

protected static void fillServiceGroup(AxisServiceGroup serviceGroup,
                                       java.util.ArrayList serviceList,
                                       java.net.URL serviceLocation,
                                       AxisConfiguration axisConfig)
                                throws AxisFault
Throws:
AxisFault

addWSToDeploy

public void addWSToDeploy(DeploymentFileData file)
Parameters:
file - ArchiveFileData

addWSToUndeploy

public void addWSToUndeploy(WSInfo file)
Parameters:
file - WSInfo

doDeploy

public void doDeploy()

engageModules

public void engageModules()
                   throws AxisFault
Checks if the modules, referred by server.xml, exist or that they are deployed.

Throws:
AxisFault - : If smt goes wrong

populateAxisConfiguration

public AxisConfiguration populateAxisConfiguration(java.io.InputStream in)
                                            throws DeploymentException
To get AxisConfiguration for a given inputStream this method can be used. The inputstream should be a valid axis2.xml , else you will be getting DeploymentExceptions.

First creat a AxisConfiguration using given inputSream , and then it will try to find the repository location parameter from AxisConfiguration, so if user has add a parameter with the name "repository" , then the value specified by that parameter will be the repository and system will try to load modules and services from that repository location if it a valid location. hot deployment and hot update will work as usual in this case.

You will be getting AxisConfiguration corresponding to given inputstream if it is valid , if something goes wrong you will be getting DeploymentException

Parameters:
in - : InputStream to axis2.xml
Returns:
a populated AxisConfiguration
Throws:
DeploymentException - : If something goes wrong

startSearch

protected void startSearch(RepositoryListener listener)
Starts the Deployment engine to perform Hot deployment and so on.

Parameters:
listener - : RepositoryListener

unDeploy

public void unDeploy()

getAxisConfig

public AxisConfiguration getAxisConfig()
Gets AxisConfiguration.

Returns:
AxisConfiguration AxisConfiguration

getAxisServiceName

public static java.lang.String getAxisServiceName(java.lang.String fileName)
Retrieves service name from the archive file name. If the archive file name is service1.aar , then axis2 service name would be service1

Parameters:
fileName - the archive file name
Returns:
Returns String.

getModule

public AxisModule getModule(java.lang.String moduleName)
                     throws AxisFault
Throws:
AxisFault

isHotUpdate

public boolean isHotUpdate()

getWebLocationString

public static java.lang.String getWebLocationString()

setClassLoaders

protected void setClassLoaders(java.lang.String axis2repoURI)
                        throws DeploymentException
To set the all the classLoader hierarchy this method can be used , the top most parent is CCL then SCL(system Class Loader) CCL : SCL : : MCCL SCCL : : MCL SCL

MCCL : module common class loader SCCL : Service common class loader MCL : module class loader SCL : Service class loader

Parameters:
axis2repoURI - : The repository folder of Axis2
Throws:
DeploymentException - if there's a problem

setDeploymentFeatures

protected void setDeploymentFeatures()
Sets hotDeployment and hot update.


prepareRepository

protected void prepareRepository(java.lang.String repositoryName)
Creates directories for modules/services, copies configuration xml from class loader if necessary

Parameters:
repositoryName - the pathname of the repository

getRepositoryPath

protected java.lang.String getRepositoryPath(java.io.File repository)

getFileList

protected java.util.ArrayList getFileList(java.net.URL fileListUrl)

setConfigContext

public void setConfigContext(ConfigurationContext configContext)

buildModule

public static AxisModule buildModule(java.io.File modulearchive,
                                     AxisConfiguration config)
                              throws DeploymentException
Builds an AxisModule for a given module archive file. This does not called the init method since there is no reference to configuration context so who ever create module using this has to called module.init if it is required

Parameters:
modulearchive - : Actual module archive file
config - : AxisConfiguration : for get classloaders etc..
Returns:
a complete AxisModule read from the file.
Throws:
DeploymentException - if there's a problem

buildService

public static AxisService buildService(java.io.InputStream serviceInputStream,
                                       ConfigurationContext configCtx)
                                throws DeploymentException
Fills an axisservice object using services.xml. First creates an axisservice object using WSDL and then fills it using the given services.xml. Loads all the required class and builds the chains, finally adds the servicecontext to EngineContext and axisservice into EngineConfiguration.

Parameters:
serviceInputStream - InputStream containing configuration data
configCtx - the ConfigurationContext in which we're deploying
Returns:
Returns AxisService.
Throws:
DeploymentException - if there's a problem

buildServiceGroup

public static AxisServiceGroup buildServiceGroup(java.io.InputStream servicesxml,
                                                 java.lang.ClassLoader classLoader,
                                                 java.lang.String serviceGroupName,
                                                 ConfigurationContext configCtx,
                                                 ArchiveReader archiveReader,
                                                 java.util.HashMap wsdlServices)
                                          throws AxisFault
To build a AxisServiceGroup for a given services.xml You have to add the created group into AxisConfig

Parameters:
servicesxml - InputStream created from services.xml or equivalent
classLoader - ClassLoader to use
serviceGroupName - name of the service group
configCtx - the ConfigurationContext in which we're deploying
archiveReader - the ArchiveReader we're working with
wsdlServices - Map of existing WSDL services
Returns:
a fleshed-out AxisServiceGroup
Throws:
AxisFault - if there's a problem

loadServiceGroup

public static AxisServiceGroup loadServiceGroup(java.io.File serviceFile,
                                                ConfigurationContext configCtx)
                                         throws AxisFault
Throws:
AxisFault

getServicesDir

public java.io.File getServicesDir()

getModulesDir

public java.io.File getModulesDir()

getRepositoryDir

public java.io.File getRepositoryDir()

setExtensionToDeployerMappingMap

public void setExtensionToDeployerMappingMap(java.util.HashMap extensionToDeployerMappingMap)

setDirectoryToExtensionMappingMap

public void setDirectoryToExtensionMappingMap(java.util.HashMap directoryToExtensionMappingMap)

getDirectoryToExtensionMappingMap

public java.util.HashMap getDirectoryToExtensionMappingMap()

getRepoListener

public RepositoryListener getRepoListener()

getServiceDeployer

public ServiceDeployer getServiceDeployer()

getModuleDeployer

public ModuleDeployer getModuleDeployer()

getDeployerForExtension

public Deployer getDeployerForExtension(java.lang.String extension)

cleanup

public void cleanup()
Clean up the mess



Copyright © 2007 Apache Web Services Project. All Rights Reserved.