try {
AxisModule axismodule = new AxisModule();
ClassLoader loader = new org.apache.axis2.osgi.deployment.BundleClassLoader(bundle, Registry.class.getClassLoader());
axismodule.setModuleClassLoader(loader);
AxisConfiguration axisConfig = configurationContext.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) {
/*
Bundle version is defined as
version ::=
major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
major ::= number
minor ::= number
micro ::= number
qualifier ::= ( alphanum | ’_’ | '-' )+
*/
String[] versionSplit = bundleVersion.split("\\.");
int[] components = new int[Math.min(versionSplit.length, 3)];
for (int i = 0; i < components.length; i++) {
components[i] = Integer.parseInt(versionSplit[i]);
}
axismodule.setVersion(new Version(components, versionSplit.length > 3 ? versionSplit[3] : null));
}
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.