in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ComponentInstaller.java [393:426]
private ObjectName initComponent() throws Exception {
ComponentDesc componentDesc = installationContext.getDescriptor();
List<SharedLibrary> libs = new ArrayList<SharedLibrary>();
if (componentDesc.getSharedLibraries() != null) {
for (SharedLibraryList sll : componentDesc.getSharedLibraries()) {
SharedLibrary lib = deployer.getSharedLibrary(sll.getName());
if (lib == null) {
// TODO: throw exception here ?
} else {
libs.add(lib);
}
}
}
SharedLibrary[] aLibs = libs.toArray(new SharedLibrary[libs.size()]);
if (innerComponent == null) {
ClassLoader classLoader = createClassLoader(
getBundle(),
componentDesc.getIdentification().getName(),
(String[]) installationContext.getClassPathElements().toArray(new String[installationContext.getClassPathElements().size()]),
componentDesc.isComponentClassLoaderDelegationParentFirst(),
aLibs);
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
Class clazz = classLoader.loadClass(componentDesc.getComponentClassName());
innerComponent = (javax.jbi.component.Component) clazz.newInstance();
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
}
Component component = deployer.registerComponent(getBundle(), componentDesc, innerComponent, aLibs);
return deployer.getEnvironment().getManagedObjectName(component);
}