Package javax.jbi.component

Examples of javax.jbi.component.ServiceUnitManager


                 jbiServiceUnit = getAssociatedJbiServiceUnit(comp, sl);
             } catch (GBeanNotFoundException e) {
                 throw new DeploymentException("Can not find the associated service unit for this service assembly. "
                         + "Check if it's deployed and started.", e);
             }
             ServiceUnitManager serviceUnitManager = jbiServiceUnit.getServiceUnitManager();
             File installDir = new File(context.getBaseDir(), installUri.toString());
             String deploy = serviceUnitManager.deploy(name, installDir.getAbsolutePath())
             serviceUnitReferences.add(new ServiceUnitReference(sl, name, installDir.getAbsolutePath()));
             log.debug(deploy);
        }
        // Create the JBI deployment managed object
        Properties props = new Properties();
View Full Code Here


        ServiceReference[] refs = context.getAllServiceReferences(
                "javax.jbi.component.Component", "(&(NAME=OdeBpelEngine))");
        if (refs == null || refs.length != 1) {
            throw new RuntimeException("no appropriate service :(");
        }
        ServiceUnitManager suM = ((Component) context.getService(refs[0]))
                .getServiceUnitManager();
        ClassLoader l = Thread.currentThread().getContextClassLoader();
        try {
            ClassLoader suL = suM.getClass().getClassLoader();
            Thread.currentThread().setContextClassLoader(new BundleClassLoader(suL, context.getBundle()));
            suM.deploy(generatedName, rootDir.getAbsolutePath());
            suM.init(generatedName, rootDir.getAbsolutePath());
            suM.start(generatedName);
        } finally {
            Thread.currentThread().setContextClassLoader(l);
        }

    }
View Full Code Here

        ServiceReference[] refs = context.getAllServiceReferences(
                "javax.jbi.component.Component", "(&(NAME=OdeBpelEngine))");
        if (refs == null || refs.length != 1) {
            throw new RuntimeException("no appropriate service :(");
        }
        ServiceUnitManager suM = ((Component) context.getService(refs[0]))
                .getServiceUnitManager();
        suM.shutDown(generatedName);
        suM.undeploy(generatedName, rootDir.getAbsolutePath());

    }
View Full Code Here

     * @throws DeploymentException
     */
    public void init() throws DeploymentException {
        LOG.info("Initializing service unit: " + getName());
        checkComponentStarted("init");
        ServiceUnitManager sum = getServiceUnitManager();
        File path = getServiceUnitRootPath();
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getComponentClassLoader());
            sum.init(getName(), path.getAbsolutePath());
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
        currentState = STOPPED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void start() throws DeploymentException {
        LOG.info("Starting service unit: " + getName());
        checkComponentStarted("start");
        ServiceUnitManager sum = getServiceUnitManager();
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getComponentClassLoader());
            sum.start(getName());
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
        currentState = STARTED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void stop() throws DeploymentException {
        LOG.info("Stopping service unit: " + getName());
        checkComponentStarted("stop");
        ServiceUnitManager sum = getServiceUnitManager();
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getComponentClassLoader());
            sum.stop(getName());
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
        currentState = STOPPED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void shutDown() throws DeploymentException {
        LOG.info("Shutting down service unit: " + getName());
        checkComponentStartedOrStopped("shutDown");
        ServiceUnitManager sum = getServiceUnitManager();
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getComponentClassLoader());
            sum.shutDown(getName());
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
        currentState = SHUTDOWN;
    }
View Full Code Here

                }
                // Deploy it
                boolean success = false;
                try {
                    ComponentMBeanImpl lcc = container.getComponent(componentName);
                    ServiceUnitManager sum = lcc.getServiceUnitManager();
                    ClassLoader cl = Thread.currentThread().getContextClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(lcc.getComponent().getClass().getClassLoader());
                        String resultMsg = sum.deploy(suName, targetDir.getAbsolutePath());
                        success = getComponentTaskResult(resultMsg, componentName, componentResults, true);
                    } finally {
                        Thread.currentThread().setContextClassLoader(cl);
                    }
                    // TODO: need to register the SU somewhere to keep track of its state
View Full Code Here

        registry.unregisterServiceUnit(su.getKey());
        // unpack the artifact
        // now get the component and give it a SA
        ComponentMBeanImpl component = container.getComponent(componentName);
        if (component != null) {
            ServiceUnitManager sum = component.getServiceUnitManager();
            if (sum != null) {
                ClassLoader cl = Thread.currentThread().getContextClassLoader();
                try {
                    Thread.currentThread().setContextClassLoader(component.getComponent().getClass().getClassLoader());
                    sum.undeploy(name, targetDir.getAbsolutePath());
                } finally {
                    Thread.currentThread().setContextClassLoader(cl);
                }
                FileUtil.deleteFile(targetDir);
            }
View Full Code Here

        registry.unregisterServiceUnit(su.getKey());
        // unpack the artifact
        // now get the component and give it a SA
        ComponentMBeanImpl component = container.getComponent(componentName);
        if (component != null) {
            ServiceUnitManager sum = component.getServiceUnitManager();
            if (sum != null) {
                ClassLoader cl = Thread.currentThread().getContextClassLoader();
                try {
                    Thread.currentThread().setContextClassLoader(component.getComponent().getClass().getClassLoader());
                    sum.undeploy(name, targetDir.getAbsolutePath());
                } finally {
                    Thread.currentThread().setContextClassLoader(cl);
                }
                FileUtil.deleteFile(targetDir);
            }
View Full Code Here

TOP

Related Classes of javax.jbi.component.ServiceUnitManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.