Package org.apache.servicemix.jbi.deployment

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


            if(log.isDebugEnabled()){
                log.debug("Loading new installer from "+installJarURL);
            }
            File tmpDir=AutoDeploymentService.unpackLocation(environmentContext.getTmpDir(),installJarURL);
            if(tmpDir!=null){
                Descriptor root=DescriptorFactory.buildDescriptor(tmpDir);
                if(root!=null&&root.getComponent()!=null){
                    String componentName=root.getComponent().getIdentification().getName();
                    if(!installers.containsKey(componentName)){
                        InstallerMBeanImpl installer=doInstallArchive(tmpDir,root);
                        if(installer!=null){
                            result=installer.getObjectName();
                            installers.put(componentName,installer);
View Full Code Here


        return null;
    }
   
    private InstallerMBeanImpl createInstaller(String componentName) throws IOException, DeploymentException {
        File installationDir = environmentContext.getComponentInstallationDir(componentName);
        Descriptor root = DescriptorFactory.buildDescriptor(installationDir);
        Component descriptor = root.getComponent();

        InstallationContextImpl installationContext = new InstallationContextImpl(descriptor);
        installationContext.setInstall(false);
        installationContext.setInstallRoot(installationDir);
        // now build the ComponentContext
View Full Code Here

    public String installSharedLibrary(String aSharedLibURI){
        String result="";
        try{
            File tmpDir=AutoDeploymentService.unpackLocation(environmentContext.getTmpDir(),aSharedLibURI);
            if(tmpDir!=null){
                Descriptor root=DescriptorFactory.buildDescriptor(tmpDir);
                SharedLibrary sl=root.getSharedLibrary();
                if(sl!=null){
                    result=doInstallSharedLibrary(tmpDir,sl);
                }
            }else{
                log.warn("location: "+aSharedLibURI+" isn't valid");
View Full Code Here

     * @throws DeploymentException
     */
    public void install(String location, Properties props, boolean autoStart) throws DeploymentException {
        File tmpDir = AutoDeploymentService.unpackLocation(environmentContext.getTmpDir(),location);
        if (tmpDir != null) {
            Descriptor root = DescriptorFactory.buildDescriptor(tmpDir);
            if (root != null) {
                install(tmpDir, props, root, autoStart);
            }else{
                log.error("Could not find Descriptor from: " + location);
            }
View Full Code Here

            if (files != null) {
                for (int i = 0; i < files.length; i++) {
                    if (files[i].isDirectory()) {
                        File dir = FileVersionUtil.getLatestVersionDirectory(files[i]);
                        if (dir != null) {
                            Descriptor root = DescriptorFactory.buildDescriptor(dir);
                            if (root != null) {
                                SharedLibrary sl = root.getSharedLibrary();
                                if (sl != null) {
                                    try {
                                        container.getRegistry().registerSharedLibrary(sl, dir);
                                    } catch (Exception e) {
                                        log.error("Failed to initialize sharted library", 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) {
                    Component comp = root.getComponent();
                  String componentName = comp.getIdentification().getName();
                  entry.type = "component";
                  entry.name = componentName;
                    try {
                        if (container.getRegistry().getComponent(componentName) != null) {
                            installationService.unloadInstaller(componentName, true);
                        }
                        // See if shared libraries are installed
                        entry.dependencies = getSharedLibraryNames(comp);
                        if (log.isDebugEnabled()) {
                            log.debug("Component dependencies: " + entry.dependencies);
                        }
                        String missings = null;
                        boolean canInstall = true;
                        for (Iterator it = entry.dependencies.iterator(); it.hasNext();) {
                            String libraryName = (String) it.next();
                            if (container.getRegistry().getSharedLibrary(libraryName) == null) {
                                canInstall = false;
                                if (missings != null) {
                                    missings += ", " + libraryName;
                                } else {
                                    missings = libraryName;
                                }
                            }
                        }
                        if (canInstall) {
                            installationService.install(tmpDir, null, root, autoStart);
                            checkPendingSAs();
                        } else {
                            entry.pending = true;
                            log.warn("Shared libraries " + missings + " are not installed yet: the component" + componentName +
                                     " installation is suspended and will be resumed once the listed shared libraries are installed");
                            pendingComponents.put(tmpDir, entry);
                        }
                    } catch (Exception e) {
                        String errStr = "Failed to update Component: " + componentName;
                        log.error(errStr, e);
                        throw new DeploymentException(errStr, e);
                    }
                } else if (root.getSharedLibrary() != null) {
                  String libraryName = root.getSharedLibrary().getIdentification().getName();
                  entry.type = "library";
                  entry.name = libraryName;
                    installationService.doInstallSharedLibrary(tmpDir, root.getSharedLibrary());
                    checkPendingComponents();
                } else if (root.getServiceAssembly() != null) {
                    ServiceAssembly sa = root.getServiceAssembly();
                    String name = sa.getIdentification().getName();
                  entry.type = "assembly";
                  entry.name = name;
                    try {
                        if (deploymentService.isSaDeployed(name)) {
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

        }

        // 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);
            return descriptor;
View Full Code Here

     * @throws org.apache.geronimo.common.DeploymentException
     *             if there was a problem with the configuration
     */
    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException,
                    DeploymentException {
        Descriptor descriptor = (Descriptor) plan;
        if (descriptor.getComponent() != null) {
            return new Artifact("servicemix-components", descriptor.getComponent().getIdentification().getName(),
                            (Version) null, "car");
        } else if (descriptor.getServiceAssembly() != null) {
            return new Artifact("servicemix-assemblies", descriptor.getServiceAssembly().getIdentification().getName(),
                            (Version) null, "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

        environment.setConfigId(configId);
        EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);

        DeploymentContext context = null;
        try {
            Descriptor descriptor = (Descriptor) plan;
            context = new DeploymentContext(configurationDir,
                            inPlaceDeployment ? DeploymentUtil.toFile(jarFile) : null, environment,
                            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

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.