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

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


            installers.remove(bundle);
        }
    }

    public ServiceUnitImpl createServiceUnit(ServiceUnitDesc sud, File suRootDir, ComponentImpl component) {
        return new ServiceUnitImpl(sud, suRootDir, component);
    }
View Full Code Here


                sus = new ArrayList<ServiceUnitImpl>();
                for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
                    String componentName = sud.getTarget().getComponentName();
                    ComponentImpl component = deployer.getComponent(componentName);
                    // Create service unit object
                    ServiceUnitImpl su = deployer.createServiceUnit(sud, null, component);
                    sus.add(su);
                }
            }
            postInstall();
            ServiceAssembly sa = deployer.registerServiceAssembly(bundle, descriptor.getServiceAssembly(), sus);
View Full Code Here

        if (isModified && !isFirstInstall) {
            for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
                File suRootDir = new File(saDir, sud.getIdentification().getName());
                String componentName = sud.getTarget().getComponentName();
                ComponentImpl component = deployer.getComponent(componentName);
                ServiceUnitImpl su = deployer.createServiceUnit(sud, suRootDir, component);
                try {
                    su.undeploy();
                } catch (Exception e) {
                    LOGGER.warn("Problem undeploying SU " + su.getName());
                }
            }
        }

        // Wipe out the SA dir
        if (isModified) {
            FileUtil.deleteFile(saDir);
            FileUtil.buildDirectory(saDir);
        }
        // Iterate each SU and deploy it
        List<ServiceUnitImpl> sus = new ArrayList<ServiceUnitImpl>();
        Exception failure = null;
        for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
            // Create directory for this SU
            File suRootDir = new File(saDir, sud.getIdentification().getName());
            // Unpack it
            if (isModified) {
                String zip = sud.getTarget().getArtifactsZip();
                URL zipUrl = bundle.getResource(zip);
                FileUtil.unpackArchive(zipUrl, suRootDir);
            }
            // Find component
            String componentName = sud.getTarget().getComponentName();
            ComponentImpl component = deployer.getComponent(componentName);
            // Create service unit object
            ServiceUnitImpl su = deployer.createServiceUnit(sud, suRootDir, component);
            try {
                LOGGER.debug("Deploying SU " + su.getName());
                if (isModified) {
                    su.deploy();
                }
                // Add it to the list
                sus.add(su);
            } catch (Throwable e) {
                LOGGER.error("Error deploying SU " + su.getName(), e);
                failure = new Exception("Error deploying SU " + su.getName(), e);
                break;
            }
        }
        // If failure, undeploy SU and exit
        if (failure != null) {
            for (ServiceUnitImpl su : sus) {
                try {
                    LOGGER.debug("Undeploying SU " + su.getName());
                    su.undeploy();
                } catch (Exception e) {
                    LOGGER.warn("Error undeploying SU " + su.getName(), e);
                }
            }
            throw failure;
        }
        return sus;
View Full Code Here

                sus = new ArrayList<ServiceUnitImpl>();
                for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
                    String componentName = sud.getTarget().getComponentName();
                    ComponentImpl component = deployer.getComponent(componentName);
                    // Create service unit object
                    ServiceUnitImpl su = deployer.createServiceUnit(sud, null, component);
                    sus.add(su);
                }
            }
            postInstall();
            ServiceAssembly sa = deployer.registerServiceAssembly(bundle, descriptor.getServiceAssembly(), sus);
View Full Code Here

        if (isModified && !isFirstInstall) {
            for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
                File suRootDir = new File(saDir, sud.getIdentification().getName());
                String componentName = sud.getTarget().getComponentName();
                ComponentImpl component = deployer.getComponent(componentName);
                ServiceUnitImpl su = deployer.createServiceUnit(sud, suRootDir, component);
                try {
                    su.undeploy();
                } catch (Exception e) {
                    LOGGER.warn("Problem undeploying SU " + su.getName());
                }
            }
        }

        // Wipe out the SA dir
        if (isModified) {
            FileUtil.deleteFile(saDir);
            FileUtil.buildDirectory(saDir);
        }
        // Iterate each SU and deploy it
        List<ServiceUnitImpl> sus = new ArrayList<ServiceUnitImpl>();
        Exception failure = null;
        for (ServiceUnitDesc sud : descriptor.getServiceAssembly().getServiceUnits()) {
            // Create directory for this SU
            File suRootDir = new File(saDir, sud.getIdentification().getName());
            // Unpack it
            if (isModified) {
                String zip = sud.getTarget().getArtifactsZip();
                URL zipUrl = bundle.getResource(zip);
                FileUtil.unpackArchive(zipUrl, suRootDir);
            }
            // Find component
            String componentName = sud.getTarget().getComponentName();
            ComponentImpl component = deployer.getComponent(componentName);
            // Create service unit object
            ServiceUnitImpl su = deployer.createServiceUnit(sud, suRootDir, component);
            try {
                LOGGER.debug("Deploying SU " + su.getName());
                if (isModified) {
                    su.deploy();
                }
                // Add it to the list
                sus.add(su);
            } catch (Throwable e) {
                LOGGER.error("Error deploying SU " + su.getName(), e);
                failure = new Exception("Error deploying SU " + su.getName(), e);
                break;
            }
        }
        // If failure, undeploy SU and exit
        if (failure != null) {
            for (ServiceUnitImpl su : sus) {
                try {
                    LOGGER.debug("Undeploying SU " + su.getName());
                    su.undeploy();
                } catch (Exception e) {
                    LOGGER.warn("Error undeploying SU " + su.getName(), e);
                }
            }
            throw failure;
        }
        return sus;
View Full Code Here

            installers.remove(bundle);
        }
    }

    public ServiceUnitImpl createServiceUnit(ServiceUnitDesc sud, File suRootDir, ComponentImpl component) {
        return new ServiceUnitImpl(sud, suRootDir, component);
    }
View Full Code Here

TOP

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

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.