Package org.apache.servicemix.jbi.deployment

Examples of org.apache.servicemix.jbi.deployment.Descriptor


        }

        // Check that the jbi descriptor is present
        try {
            URL url = DeploymentUtil.createJarURL(module, "META-INF/jbi.xml");
            Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
            if (descriptor == null) {
                return null;
            }
            DescriptorFactory.checkDescriptor(descriptor);
           
View Full Code Here


     *             if there was a problem with the configuration
     */
    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException,
                    DeploymentException {
        DeploymentPlanWrapper wrapper = (DeploymentPlanWrapper) plan;
        Descriptor descriptor = wrapper.getServicemixDescriptor();
        if (descriptor.getComponent() != null) {
            return new Artifact("servicemix-components", descriptor.getComponent().getIdentification().getName(),
                            "0.0", "car");
        } else if (descriptor.getServiceAssembly() != null) {
            return new Artifact("servicemix-assemblies", descriptor.getServiceAssembly().getIdentification().getName(),
                            "0.0", "car");
        } else if (descriptor.getSharedLibrary() != null) {
            return new Artifact("servicemix-libraries", descriptor.getSharedLibrary().getIdentification().getName(),
                            descriptor.getSharedLibrary().getVersion(), "car");
        } else {
            throw new DeploymentException("Unable to construct configuration ID " + module.getName()
                            + ": unrecognized jbi package. Should be a component, assembly or library.");
        }
    }
View Full Code Here

          }
        }

        DeploymentContext context = null;
        try {
            Descriptor descriptor = wrapper.getServicemixDescriptor();
            Map name = new HashMap();
            name.put("Config", configId.toString());
            context = new DeploymentContext(configurationDir,
                            inPlaceDeployment ? DeploymentUtil.toFile(jarFile) : null, environment,
                            new AbstractName(configId, name),
                            ConfigurationModuleType.SERVICE, kernel.getNaming(), ConfigurationUtil
                                            .getConfigurationManager(kernel), repositories);
            if (descriptor.getComponent() != null) {
                buildComponent(descriptor, context, jarFile);
            } else if (descriptor.getServiceAssembly() != null) {
                buildServiceAssembly(descriptor, context, jarFile);
            } else if (descriptor.getSharedLibrary() != null) {
                buildSharedLibrary(descriptor, context, jarFile);
            } else {
                throw new IllegalStateException("Invalid jbi descriptor");
            }
        } catch (Exception e) {
View Full Code Here

        }
        // unpackLocation returns null if no jbi descriptor is found
        if (tmpDir == null) {
            throw failure("deploy", "Unable to find jbi descriptor: " + location);
        }
        Descriptor root = null;
        try {
            root = DescriptorFactory.buildDescriptor(tmpDir);
        } catch (Exception e) {
            throw failure("deploy", "Unable to build jbi descriptor: " + location, e);
        }
        if (root == null) {
            throw failure("deploy", "Unable to find jbi descriptor: " + location);
        }
        if (root != null) {
            try {
                container.getBroker().suspend();
                if (root.getComponent() != null) {
                    updateComponent(entry, autoStart, tmpDir, root);
                } else if (root.getSharedLibrary() != null) {
                    updateSharedLibrary(entry, tmpDir, root);
                } else if (root.getServiceAssembly() != null) {
                    updateServiceAssembly(entry, autoStart, tmpDir, root);
                }
            } finally {
                container.getBroker().resume();
            }
View Full Code Here

            }
            if (canDeploy) {
                File tmp = (File) me.getKey();
                deployedSas.add(tmp);
                try {
                    Descriptor root = DescriptorFactory.buildDescriptor(tmp);
                    deploymentService.deployServiceAssembly(tmp, root.getServiceAssembly());
                    deploymentService.start(root.getServiceAssembly().getIdentification().getName());
                } catch (Exception e) {
                    String errStr = "Failed to update Service Assembly: " + tmp.getName();
                    LOG.error(errStr, e);
                }
            }
View Full Code Here

            }
            if (canInstall) {
                File tmp = me.getKey();
                installedComponents.add(tmp);
                try {
                    Descriptor root = DescriptorFactory.buildDescriptor(tmp);
                    installationService.install(tmp, null, root, true);
                } catch (Exception e) {
                    String errStr = "Failed to update Component: " + tmp.getName();
                    LOG.error(errStr, e);
                }
View Full Code Here

            }
            if (canInstall) {
                File tmp = (File) me.getKey();
                installedComponents.add(tmp);
                try {
                    Descriptor root = DescriptorFactory.buildDescriptor(tmp);
                    installationService.install(tmp, null, root, true);
                } catch (Exception e) {
                    String errStr = "Failed to update Component: " + tmp.getName();
                    log.error(errStr, e);
                }
View Full Code Here

    protected SourceTransformer transformer = new SourceTransformer();

    public void testParse() throws Exception {

        // lets force the JBI container to be constructed first
        Descriptor root = (Descriptor) context.getBeansOfType(Descriptor.class).values().iterator().next();
        assertNotNull("JBI Container not found in spring!", root);

        SharedLibrary sl = root.getSharedLibrary();
        Identification identification = sl.getIdentification();
        assertEquals("getName", "TestSharedLibrary", identification.getName());
        assertEquals("getDescription", "This is a test shared library.", identification.getDescription());
       
    }
View Full Code Here

    protected SourceTransformer transformer = new SourceTransformer();

    public void testParse() throws Exception {

        // lets force the JBI container to be constructed first
        Descriptor root = (Descriptor) context.getBean("jbi");
        assertNotNull("JBI Container not found in spring!", root);

        // component stuff
        Component component = root.getComponent();
        assertNotNull("component is null", component);
        assertEquals("getBootstrapClassName", "com.foo.Engine1Bootstrap", component.getBootstrapClassName());
        assertEquals("getComponentClassName", "com.foo.Engine1", component.getComponentClassName());
        assertEquals("getComponentClassPath", new ClassPath(new String[] {"Engine1.jar"}), component.getComponentClassPath());
        assertEquals("getBootstrapClassPath", new ClassPath(new String[] {"Engine2.jar"}), component.getBootstrapClassPath());
View Full Code Here

public class ServiceAssemblyTest extends DeploymentTest {

    public void testParse() throws Exception {

        // lets force the JBI container to be constructed first
        Descriptor root = (Descriptor) context.getBean("jbi");
        assertNotNull("JBI Container not found in spring!", root);

        ServiceAssembly serviceAssembly = root.getServiceAssembly();
        assertNotNull("serviceAssembly is null", serviceAssembly);

        Identification identification = serviceAssembly.getIdentification();
        assertNotNull("identification is null", identification);
        assertEquals("getName", "ServiceAssembly_041207153211-0800_saId", identification.getName());
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.deployment.Descriptor

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.