AxisModule axismodule = new AxisModule();
ClassLoader loader =
new BundleClassLoader(bundle, Registry.class.getClassLoader());
axismodule.setModuleClassLoader(loader);
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
ModuleBuilder builder =
new ModuleBuilder(url.openStream(), axismodule, axisConfig);
Dictionary headers = bundle.getHeaders();
String bundleSymbolicName = (String) headers.get("Bundle-SymbolicName");
if (bundleSymbolicName != null && bundleSymbolicName.length() != 0) {
axismodule.setName(bundleSymbolicName);
}
String bundleVersion = (String) headers.get("Bundle-Version");
if (bundleVersion != null && bundleVersion.length() != 0) {
String moduleVersion = "SNAPSHOT";
/*
Bundle version is defined as
version ::=
major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
major ::= number
minor ::= number
micro ::= number
qualifier ::= ( alphanum | ’_’ | '-' )+
Hence, in order to sync up with Axis2 module versioning, which is a floating
point number, following logic is used to create the version
version := major(.minormircor)
*/
String[] versionSplit = bundleVersion.split("\\.");
if (versionSplit.length == 3) {
moduleVersion =
versionSplit[0] + "." + versionSplit[1] + versionSplit[2];
} else if (versionSplit.length == 2) {
moduleVersion = versionSplit[0] + "." + versionSplit[1];
} else if (versionSplit.length == 1) {
moduleVersion = versionSplit[0];
}
axismodule.setVersion(moduleVersion);
}
builder.populateModule();
axismodule.setParent(axisConfig);
AxisModule module = axisConfig.getModule(axismodule.getName());
if (module == null) {
DeploymentEngine.addNewModule(axismodule, axisConfig);
//initialze the module if the module contains Module interface.