public ObjectName activateComponent()

in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallerMBeanImpl.java [175:218]


    public ObjectName activateComponent() throws JBIException {
        ObjectName result = null;
        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
        org.apache.servicemix.jbi.deployment.Component descriptor = context.getDescriptor();
        try {
            ClassLoader cl = buildClassLoader(
                                    context.getInstallRootAsDir(),
                                    (String[]) context.getClassPathElements().toArray(new String[0]),
                                    descriptor.isComponentClassLoaderDelegationParentFirst(),
                                    context.getSharedLibraries());
            Thread.currentThread().setContextClassLoader(cl);
            Class componentClass = cl.loadClass(descriptor.getComponentClassName());
            Component component = (Component) componentClass.newInstance();
            result = container.activateComponent(
                                    context.getInstallRootAsDir(), 
                                    component, 
                                    context.getComponentDescription(),
                                    (ComponentContextImpl) context.getContext(), 
                                    context.isBinding(), 
                                    context.isEngine(), 
                                    context.getSharedLibraries());
        } catch (MalformedURLException e) {
            LOGGER.error("Could not create class loader", e);
            throw new DeploymentException(e);
        } catch (NoClassDefFoundError e) {
            LOGGER.error("Class not found: {}", descriptor.getBootstrapClassName(), e);
            throw new DeploymentException(e);
        } catch (ClassNotFoundException e) {
            LOGGER.error("Class not found: {}", descriptor.getBootstrapClassName(), e);
            throw new DeploymentException(e);
        } catch (InstantiationException e) {
            LOGGER.error("Could not instantiate: {}", descriptor.getBootstrapClassName(), e);
            throw new DeploymentException(e);
        } catch (IllegalAccessException e) {
            LOGGER.error("Illegal access on: {}", descriptor.getBootstrapClassName(), e);
            throw new DeploymentException(e);
        } catch (JBIException e) {
            LOGGER.error("Could not initialize: {}", descriptor.getBootstrapClassName(), e);
            throw new DeploymentException(e);
        }  finally {
            Thread.currentThread().setContextClassLoader(oldCl);
        }
        return result;
    }