Package org.apache.servicemix.jbi.container

Examples of org.apache.servicemix.jbi.container.ServiceAssemblyEnvironment


      container.deactivateComponent(component.getName());
    }
   
    public void register(ServiceAssembly assembly) throws Exception {
      File rootDir = new File(assembly.getRootDir());
      ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
      env.setRootDir(rootDir);
      env.setInstallDir(new File(rootDir, "install"));
      env.setSusDir(new File(rootDir, "sus"));
      env.setStateFile(new File(rootDir, "state.xml"));
      ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
      if (env.getStateFile().isFile()) {
        salc.restore();
      } else {
        salc.start();
      }
    }
View Full Code Here


      container.deactivateComponent(component.getName());
    }
   
    public void register(ServiceAssembly assembly) throws Exception {
      File rootDir = new File(assembly.getRootDir());
      ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
      env.setRootDir(rootDir);
      env.setInstallDir(new File(rootDir, "install"));
      env.setSusDir(new File(rootDir, "sus"));
      env.setStateFile(new File(rootDir, "state.xml"));
      ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
      if (env.getStateFile().isFile()) {
        salc.restore();
      } else {
        salc.start();
      }
    }
View Full Code Here

        container.deactivateComponent(component.getName());
    }
   
    public void register(ServiceAssembly assembly) throws Exception {
        File rootDir = new File(assembly.getRootDir());
        ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
        env.setRootDir(rootDir);
        env.setInstallDir(new File(rootDir, "install"));
        env.setSusDir(new File(rootDir, "sus"));
        env.setStateFile(new File(rootDir, "state.xml"));
        ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
        if (env.getStateFile().isFile()) {
            salc.restore();
        } else {
            salc.start();
        }
    }
View Full Code Here

     * @return result/status of the deployment in xml format
     * @throws Exception  in xml format
     */
    protected String deployServiceAssembly(File tmpDir, ServiceAssembly sa) throws Exception {
        String assemblyName = sa.getIdentification().getName();
        ServiceAssemblyEnvironment env = environmentContext.getNewServiceAssemblyEnvironment(assemblyName);
        File saDirectory = env.getInstallDir();

        // move the assembly to a well-named holding area
        LOGGER.debug("Moving {} to {}", tmpDir.getAbsolutePath(), saDirectory.getAbsolutePath());
        saDirectory.getParentFile().mkdirs();
        if (!tmpDir.renameTo(saDirectory)) {
            throw ManagementSupport.failure("deploy", "Failed to rename " + tmpDir + " to " + saDirectory);
        }
        // Check all SUs requirements
        ServiceUnit[] sus = sa.getServiceUnits();
        if (sus != null) {
            checkSus(saDirectory, sus);
        }
        // Everything seems ok, so deploy all SUs
        int nbFailures = 0;
        List<Element> componentResults = new ArrayList<Element>();
        List<String> suKeys = new ArrayList<String>();
        if (sus != null) {
            for (int i = 0; i < sus.length; i++) {
                File targetDir = null;
                String suName = sus[i].getIdentification().getName();
                String artifact = sus[i].getTarget().getArtifactsZip();
                String componentName = sus[i].getTarget().getComponentName();
                // TODO: skip duplicates
                // Unpack SU
                try {
                    File artifactFile = new File(saDirectory, artifact);
                    targetDir = env.getServiceUnitDirectory(componentName, suName);
                    LOGGER.debug("Unpack service unit archive {} to {}", artifactFile, targetDir);
                    FileUtil.unpackArchive(artifactFile, targetDir);
                } catch (IOException e) {
                    nbFailures++;
                    componentResults.add(ManagementSupport.createComponentFailure(
View Full Code Here

        // Initialize all assemblies
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                String assemblyName = files[i].getName();
                try {
                    ServiceAssemblyEnvironment env = environmentContext.getServiceAssemblyEnvironment(assemblyName);
                    Descriptor root = DescriptorFactory.buildDescriptor(env.getInstallDir());
                    if (root != null) {
                        ServiceAssembly sa = root.getServiceAssembly();
                        if (sa != null && sa.getIdentification() != null) {
                            registry.registerServiceAssembly(sa, env);
                        }
View Full Code Here

        container.deactivateComponent(component.getName());
    }
   
    public void register(ServiceAssembly assembly) throws Exception {
        File rootDir = new File(assembly.getRootDir());
        ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
        env.setRootDir(rootDir);
        env.setInstallDir(new File(rootDir, "install"));
        env.setSusDir(new File(rootDir, "sus"));
        env.setStateFile(new File(rootDir, "state.xml"));
        ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
        if (env.getStateFile().isFile()) {
            salc.restore();
        } else {
            salc.start();
        }
    }
View Full Code Here

        container.deactivateComponent(component.getName());
    }
   
    public void register(ServiceAssembly assembly) throws Exception {
        File rootDir = new File(assembly.getRootDir());
        ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
        env.setRootDir(rootDir);
        env.setInstallDir(new File(rootDir, "install"));
        env.setSusDir(new File(rootDir, "sus"));
        env.setStateFile(new File(rootDir, "state.xml"));
        ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
        if (env.getStateFile().isFile()) {
            salc.restore();
        } else {
            salc.start();
        }
    }
View Full Code Here

     * @return result/status of the deployment in xml format
     * @throws Exception  in xml format
     */
    protected String deployServiceAssembly(File tmpDir, ServiceAssembly sa) throws Exception {
        String assemblyName = sa.getIdentification().getName();
        ServiceAssemblyEnvironment env = environmentContext.getNewServiceAssemblyEnvironment(assemblyName);
        File saDirectory = env.getInstallDir();

        // move the assembly to a well-named holding area
        if (LOG.isDebugEnabled()) {
            LOG.debug("Moving " + tmpDir.getAbsolutePath() + " to " + saDirectory.getAbsolutePath());
        }
        saDirectory.getParentFile().mkdirs();
        if (!tmpDir.renameTo(saDirectory)) {
            throw ManagementSupport.failure("deploy", "Failed to rename " + tmpDir + " to " + saDirectory);
        }
        // Check all SUs requirements
        ServiceUnit[] sus = sa.getServiceUnits();
        if (sus != null) {
            checkSus(saDirectory, sus);
        }
        // Everything seems ok, so deploy all SUs
        int nbFailures = 0;
        List<Element> componentResults = new ArrayList<Element>();
        List<String> suKeys = new ArrayList<String>();
        if (sus != null) {
            for (int i = 0; i < sus.length; i++) {
                File targetDir = null;
                String suName = sus[i].getIdentification().getName();
                String artifact = sus[i].getTarget().getArtifactsZip();
                String componentName = sus[i].getTarget().getComponentName();
                // TODO: skip duplicates
                // Unpack SU
                try {
                    File artifactFile = new File(saDirectory, artifact);
                    targetDir = env.getServiceUnitDirectory(componentName, suName);
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Unpack service unit archive " + artifactFile + " to " + targetDir);
                    }
                    FileUtil.unpackArchive(artifactFile, targetDir);
                } catch (IOException e) {
View Full Code Here

        // Initialize all assemblies
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                String assemblyName = files[i].getName();
                try {
                    ServiceAssemblyEnvironment env = environmentContext.getServiceAssemblyEnvironment(assemblyName);
                    Descriptor root = DescriptorFactory.buildDescriptor(env.getInstallDir());
                    if (root != null) {
                        ServiceAssembly sa = root.getServiceAssembly();
                        if (sa != null && sa.getIdentification() != null) {
                            registry.registerServiceAssembly(sa, env);
                        }
View Full Code Here

     * @return result/status of the deployment in xml format
     * @throws Exception  in xml format
     */
    protected String deployServiceAssembly(File tmpDir, ServiceAssembly sa) throws Exception {
        String assemblyName = sa.getIdentification().getName();
        ServiceAssemblyEnvironment env = environmentContext.getNewServiceAssemblyEnvironment(assemblyName);
        File saDirectory = env.getInstallDir();

        // move the assembly to a well-named holding area
        if (LOG.isDebugEnabled()) {
            LOG.debug("Moving " + tmpDir.getAbsolutePath() + " to " + saDirectory.getAbsolutePath());
        }
        saDirectory.getParentFile().mkdirs();
        if (!tmpDir.renameTo(saDirectory)) {
            throw ManagementSupport.failure("deploy", "Failed to rename " + tmpDir + " to " + saDirectory);
        }
        // Check all SUs requirements
        ServiceUnit[] sus = sa.getServiceUnits();
        if (sus != null) {
            checkSus(saDirectory, sus);
        }
        // Everything seems ok, so deploy all SUs
        int nbFailures = 0;
        List<Element> componentResults = new ArrayList<Element>();
        List<String> suKeys = new ArrayList<String>();
        if (sus != null) {
            for (int i = 0; i < sus.length; i++) {
                File targetDir = null;
                String suName = sus[i].getIdentification().getName();
                String artifact = sus[i].getTarget().getArtifactsZip();
                String componentName = sus[i].getTarget().getComponentName();
                // TODO: skip duplicates
                // Unpack SU
                try {
                    File artifactFile = new File(saDirectory, artifact);
                    targetDir = env.getServiceUnitDirectory(componentName, suName);
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Unpack service unit archive " + artifactFile + " to " + targetDir);
                    }
                    FileUtil.unpackArchive(artifactFile, targetDir);
                } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.container.ServiceAssemblyEnvironment

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.