Package org.apache.servicemix.jbi.deployer.artifacts

Examples of org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl


    }

    public void unregisterDeployedServiceAssembly(ServiceReference reference, DeployedAssembly assembly) {
        // TODO: what to do here ? we should not uninstall the bundle as it's managed externally
        // TODO: but we should maybe stop / shut it down
        ServiceAssemblyImpl sa = getServiceAssembly(assembly.getName());
        if (sa != null) {
            try {
                if (sa.getState() == AbstractLifecycleJbiArtifact.State.Started) {
                    sa.stop(false);
                }
                if (sa.getState() == AbstractLifecycleJbiArtifact.State.Stopped) {
                    sa.shutDown(false, true);
                }
                for (ServiceUnitImpl su : sa.getServiceUnitsList()) {
                    su.undeploy();
                }
            } catch (Exception e) {
                LOGGER.error("Error unregistering deployed service assembly", e);
            } finally {
View Full Code Here


            throw new JBIException(e);
        }
    }

    public void stop(boolean force) throws Exception {
        ServiceAssemblyImpl assembly = deployer.getServiceAssembly(getName());
        if (assembly == null && !force) {
            throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not deployed.");
        }
        // Check assembly state is shutdown
        if (assembly != null && !LifeCycleMBean.SHUTDOWN.equals(assembly.getCurrentState())) {
            if (!force) {
                throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not shut down.");
            }
            if (LifeCycleMBean.STARTED.equals(assembly.getCurrentState())) {
                assembly.stop(false);
            }
            if (LifeCycleMBean.STOPPED.equals(assembly.getCurrentState())) {
                assembly.shutDown(false, force);
            }
        }
        if (deployedAssembly == null) {
            for (ServiceUnitImpl su : assembly.getServiceUnitsList()) {
                su.getComponentImpl().removeServiceUnit(su);
            }
        } else {
            deployedAssembly.undeploy(bundle.getState() == Bundle.ACTIVE);
        }
View Full Code Here

    public void uninstall(boolean force) throws Exception {
        // Shutdown SA
        stop(force);
        // Retrieve SA
        ServiceAssemblyImpl assembly = deployer.getServiceAssembly(getName());
        if (assembly == null && !force) {
            throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not deployed.");
        }
        if (assembly != null) {
            // Undeploy SUs
            if (assembly.getServiceUnitsList() != null) {
                for (ServiceUnitImpl su : assembly.getServiceUnitsList()) {
                    su.undeploy();
                }
            }
            // Unregister assembly
            deployer.unregisterServiceAssembly(assembly);
View Full Code Here

    }

    public ServiceAssembly registerServiceAssembly(Bundle bundle, ServiceAssemblyDesc serviceAssemblyDesc, List<ServiceUnitImpl> sus) throws Exception {
        // Now create the SA and initialize it
        Preferences prefs = preferencesService.getUserPreferences(serviceAssemblyDesc.getIdentification().getName());
        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(bundle, serviceAssemblyDesc, sus, prefs, endpointListener, autoStart);
        sa.setShutdownTimeout(shutdownTimeout);
        sa.setListenerRegistry(listenerRegistry);
        sa.init();
        serviceAssemblies.put(sa.getName(), sa);
        // populate props from the component meta-data
        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put(NAME, serviceAssemblyDesc.getIdentification().getName());
        // register the service assembly in the OSGi registry
        LOGGER.debug("Registering JBI service assembly");
View Full Code Here

        return component;
    }

    public ServiceAssemblyImpl registerServiceAssembly(Bundle bundle, ServiceAssemblyDesc serviceAssemblyDesc, List<ServiceUnitImpl> sus) throws Exception {
        // Now create the SA and initialize it
        ServiceAssemblyImpl sa = new ServiceAssemblyImpl(bundle, serviceAssemblyDesc, sus,
                                                         storage.getStorage(serviceAssemblyDesc.getIdentification().getName()),
                                                         endpointListener, autoStart);
        sa.setShutdownTimeout(shutdownTimeout);
        sa.setListenerRegistry(listenerRegistry);
        sa.init();
        serviceAssemblies.put(sa.getName(), sa);
        // populate props from the component meta-data
        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put(NAME, serviceAssemblyDesc.getIdentification().getName());
        // register the service assembly in the OSGi registry
        LOGGER.debug("Registering JBI service assembly");
View Full Code Here

    }

    public void unregisterDeployedServiceAssembly(ServiceReference reference, DeployedAssembly assembly) {
        // TODO: what to do here ? we should not uninstall the bundle as it's managed externally
        // TODO: but we should maybe stop / shut it down
        ServiceAssemblyImpl sa = getServiceAssembly(assembly.getName());
        if (sa != null) {
            try {
                if (sa.getState() == AbstractLifecycleJbiArtifact.State.Started) {
                    sa.stop(false);
                }
                if (sa.getState() == AbstractLifecycleJbiArtifact.State.Stopped) {
                    sa.shutDown(false, true);
                }
                for (ServiceUnitImpl su : sa.getServiceUnitsList()) {
                    su.undeploy();
                }
            } catch (Exception e) {
                LOGGER.error("Error unregistering deployed service assembly", e);
            } finally {
View Full Code Here

            throw new JBIException(e);
        }
    }

    public void stop(boolean force) throws Exception {
        ServiceAssemblyImpl assembly = deployer.getServiceAssembly(getName());
        if (assembly == null && !force) {
            throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not deployed.");
        }
        // Check assembly state is shutdown
        if (assembly != null && !LifeCycleMBean.SHUTDOWN.equals(assembly.getCurrentState())) {
            if (!force) {
                throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not shut down.");
            }
            if (LifeCycleMBean.STARTED.equals(assembly.getCurrentState())) {
                assembly.stop(false);
            }
            if (LifeCycleMBean.STOPPED.equals(assembly.getCurrentState())) {
                assembly.shutDown(false, force);
            }
        }
       
        if (deployedAssembly == null) {
          if (assembly != null) {
            for (ServiceUnitImpl su : assembly.getServiceUnitsList()) {
              su.getComponentImpl().removeServiceUnit(su);
            }
          }
        } else {
            deployedAssembly.undeploy(bundle.getState() == Bundle.ACTIVE);
View Full Code Here

    public void uninstall(boolean force) throws Exception {
        // Shutdown SA
        stop(force);
        // Retrieve SA
        ServiceAssemblyImpl assembly = deployer.getServiceAssembly(getName());
        if (assembly == null && !force) {
            throw ManagementSupport.failure("undeployServiceAssembly", "ServiceAssembly '" + getName() + "' is not deployed.");
        }
        if (assembly != null) {
            // Undeploy SUs
            if (assembly.getServiceUnitsList() != null) {
                for (ServiceUnitImpl su : assembly.getServiceUnitsList()) {
                    su.undeploy();
                }
            }
            // Unregister assembly
            deployer.unregisterServiceAssembly(assembly);
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.deployer.artifacts.ServiceAssemblyImpl

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.