| Method from org.apache.axis2.context.ConfigurationContextFactory Detail: |
public static ConfigurationContext createBasicConfigurationContext(String resourceName) throws Exception {
InputStream in = Loader.getResourceAsStream(resourceName);
AxisConfiguration axisConfig = new AxisConfiguration();
AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig, null);
builder.populateConfig();
axisConfig.validateSystemPredefinedPhases();
ConfigurationContext configContext = new ConfigurationContext(axisConfig);
if (axisConfig.getClusterManager() != null) {
configContext.initCluster();
}
setContextPaths(axisConfig, configContext);
return configContext;
}
Creates configuration context using resource file found in the classpath. |
public static ConfigurationContext createConfigurationContext(AxisConfigurator axisConfigurator) throws AxisFault {
AxisConfiguration axisConfig = axisConfigurator.getAxisConfiguration();
// call to the deployment listners
Parameter param = axisConfig.getParameter(Constants.Configuration.DEPLOYMENT_LIFE_CYCLE_LISTENER);
DeploymentLifeCycleListener deploymentLifeCycleListener = null;
if (param != null){
String className = (String) param.getValue();
try {
deploymentLifeCycleListener = (DeploymentLifeCycleListener) Class.forName(className).newInstance();
} catch (InstantiationException e) {
log.error("Can not instantiate deployment Listener " + className, e);
throw new AxisFault("Can not instantiate deployment Listener " + className);
} catch (IllegalAccessException e) {
log.error("Illegal Access deployment Listener " + className, e);
throw new AxisFault("Illegal Access deployment Listener " + className);
} catch (ClassNotFoundException e) {
log.error("Class not found deployment Listener " + className, e);
throw new AxisFault("Class not found deployment Listener " + className);
}
}
if (deploymentLifeCycleListener != null){
deploymentLifeCycleListener.preDeploy(axisConfig);
}
ConfigurationContext configContext = new ConfigurationContext(axisConfig);
if (axisConfigurator instanceof DeploymentEngine) {
((DeploymentEngine) axisConfigurator).setConfigContext(configContext);
}
//To override context path
setContextPaths(axisConfig, configContext);
init(configContext);
axisConfigurator.engageGlobalModules();
axisConfigurator.loadServices();
addModuleService(configContext);
// TODO: THIS NEEDS A TEST CASE!
initApplicationScopeServices(configContext);
axisConfig.setStart(true);
if (deploymentLifeCycleListener != null){
deploymentLifeCycleListener.postDeploy(configContext);
}
// Finally initialize the cluster
if (axisConfig.getClusterManager() != null) {
configContext.initCluster();
}
return configContext;
}
Creates a AxisConfiguration depending on the user requirement.
First creates an AxisConfigurator object with appropriate parameters.
Depending on the implementation getAxisConfiguration(), gets
the AxisConfiguration and uses it to create the ConfigurationContext. |
public static ConfigurationContext createConfigurationContextFromFileSystem(String path) throws AxisFault {
return createConfigurationContextFromFileSystem(path, null);
}
|
public static ConfigurationContext createConfigurationContextFromFileSystem(String path,
String axis2xml) throws AxisFault {
return createConfigurationContext(new FileSystemConfigurator(path, axis2xml));
}
To get a ConfigurationContext for given data , and underline implementation
is Axis2 default impl which is file system based deployment model to create
an AxisConfiguration.
Here either or both parameter can be null. So that boil down to following
scenarios and it should note that parameter value should be full path ,
you are not allowed to give one relative to other. And these two can be located
in completely different locations.
- If none of them are null , then AxisConfiguration will be based on the
value of axis2xml , and the repository will be the value specified by the
path parameter and there will not be any assumptions.
- If axis2xml is null , then the repository will be the value specfied by
path parameter and AxisConfiguration will be created using default_axis2.xml
- If path parameter is null , then AxisConfiguration will be created using
that axis2.xml. And after creating AxisConfiguration system will try to
find user has specified repository parameter in axis2.xml
(<parameter name="repository">location of the repo</parameter>) , if it
find that then repository will be the value specified by that parameter.
- If both are null , then it is simple , AixsConfiguration will be created
using default_axis2.xml and thats it.
Note : rather than passing any parameters you can give them as System
properties. Simple you can add following system properties before
you call this.
- axis2.repo : same as path parameter
- axis2.xml : same as axis2xml
|
public static ConfigurationContext createConfigurationContextFromURIs(URL axis2xml,
URL repositoy) throws AxisFault {
return createConfigurationContext(new URLBasedAxisConfigurator(axis2xml, repositoy));
}
|
public static ConfigurationContext createDefaultConfigurationContext() throws Exception {
return createBasicConfigurationContext(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
}
Gets the default configuration context by using Axis2.xml in the classpath |
public static ConfigurationContext createEmptyConfigurationContext() throws AxisFault {
AxisConfiguration axisConfiguration = new AxisConfiguration();
ConfigurationContext configContext = new ConfigurationContext(axisConfiguration);
if (axisConfiguration.getClusterManager() != null) {
configContext.initCluster();
}
setContextPaths(axisConfiguration, configContext);
return configContext;
}
creates an empty configuration context. |