Package javax.jbi.component

Examples of javax.jbi.component.ServiceUnitManager


    private void undeploy(ServiceUnitReference reference) {
       try {
            Component componentGBean = getComponentGBean(
                    reference.getAssocialtedServiceUnitName().getArtifactId(),
                    reference.getAssocialtedServiceUnitName());
            ServiceUnitManager serviceUnitManager =
                componentGBean.getComponent().getServiceUnitManager();
            serviceUnitManager.undeploy(reference.getServiceUnitName(),
                    reference.getServiceUnitPath());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
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

     * @throws DeploymentException
     */
    public void init() throws DeploymentException {
        LOGGER.info("Initializing service unit: {}", getName());
        checkComponentStarted("init");
        final ServiceUnitManager sum = getServiceUnitManager();
        final File path = getServiceUnitRootPath();
        new TimedOutExecutor(getComponentClassLoader(), "init " + getName(),
                new Callable<Object>() {
                    public Object call() throws Exception {
                        sum.init(getName(), path.getAbsolutePath());
                        return null;
                    }
                }).execute(getDeploymentTimeout());
        currentState = STOPPED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void start() throws DeploymentException {
        LOGGER.info("Starting service unit: {}", getName());
        checkComponentStarted("start");
        final ServiceUnitManager sum = getServiceUnitManager();
        new TimedOutExecutor(getComponentClassLoader(), "start " + getName(),
                new Callable<Object>() {
                    public Object call() throws Exception {
                        sum.start(getName());
                        return null;
                    }
                }).execute(getDeploymentTimeout());
        currentState = STARTED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void stop() throws DeploymentException {
        LOGGER.info("Stopping service unit: {}", getName());
        checkComponentStarted("stop");
        final ServiceUnitManager sum = getServiceUnitManager();
        new TimedOutExecutor(getComponentClassLoader(), "stop " + getName(),
                new Callable<Object>() {
                    public Object call() throws Exception {
                        sum.stop(getName());
                        return null;
                    }
                }).execute(getDeploymentTimeout());
        currentState = STOPPED;
    }
View Full Code Here

     * @throws DeploymentException
     */
    public void shutDown() throws DeploymentException {
        LOGGER.info("Shutting down service unit: {}", getName());
        checkComponentStartedOrStopped("shutDown");
        final ServiceUnitManager sum = getServiceUnitManager();
        new TimedOutExecutor(getComponentClassLoader(), "shutdown " + getName(),
                new Callable<Object>() {
                    public Object call() throws Exception {
                        sum.shutDown(getName());
                        return null;
                    }
                }).execute(getDeploymentTimeout());
        currentState = SHUTDOWN;
    }
View Full Code Here

  public boolean canDeployToComponent(String componentName) {
    RegistryComponent comp = this.registry.getComponent(componentName);
    if (comp != null) {
      // TODO: check component state
      ServiceUnitManager mgr = ((Component)comp.getComponent()).getServiceUnitManager();
      return mgr != null;
    }
    return false;
  }
View Full Code Here

    private void undeploy(ServiceUnitReference reference) {
       try {
            Component componentGBean = getComponentGBean(
                    reference.getAssocialtedServiceUnitName().getArtifactId(),
                    reference.getAssocialtedServiceUnitName());
            ServiceUnitManager serviceUnitManager =
                componentGBean.getComponent().getServiceUnitManager();
            serviceUnitManager.undeploy(reference.getServiceUnitName(),
                    reference.getServiceUnitPath());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
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

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.