Package org.apache.geronimo.deployment

Examples of org.apache.geronimo.deployment.DeploymentContext


            outfile = targetConfigurationStore.createNewConfigurationDir(configId);
        } catch (ConfigurationAlreadyExistsException e) {
            throw new DeploymentException(e);
        }

        DeploymentContext context = null;
        try {
            ConfigurationManager configurationManager = this.configurationManager;
            if (configurationManager == null) {
                configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories);
            }

            AbstractName moduleName = naming.createRootName(configId, configId.toString(), SERVICE_MODULE);
            context = new DeploymentContext(outfile,
                    inPlaceDeployment && null != jar ? DeploymentUtil.toFile(jar) : null,
                    environment,
                    moduleName,
                    ConfigurationModuleType.SERVICE,
                    naming,
                    configurationManager,
                    repositories);
            if(jar != null) {
                File file = new File(jar.getName());
                context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
            }

            serviceBuilders.build(moduleType, context, context);
            return context;
        } catch (DeploymentException de) {
View Full Code Here


        ArtifactManager artifactManager = new DefaultArtifactManager();
        ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, repository);

        Object config = builder.getDeploymentPlan(plan, null, new ModuleIDBuilder());

        DeploymentContext context = builder.buildConfiguration(
                false,
                builder.getConfigurationID(config, null, new ModuleIDBuilder()),
                config,
                null,
                Collections.singleton(targetConfigurationStore),
                artifactResolver,
                targetConfigurationStore);

        ConfigurationData configurationData = context.getConfigurationData();

        try {
            writeConfiguration(configurationData);
        }
        finally {
            context.close();
        }
    }
View Full Code Here

            targetConfigurationStore.createNewConfigurationDir(configId);
        } catch (ConfigurationAlreadyExistsException e) {
            throw new DeploymentException(e);
        }

        DeploymentContext context = null;
        try {
            ConfigurationManager configurationManager = this.configurationManager;
            if (configurationManager == null) {
                configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories, bundleContext);
            }

            AbstractName moduleName = naming.createRootName(configId, configId.toString(), SERVICE_MODULE);
            File tempDirectory = FileUtils.createTempDir();
            context = new DeploymentContext(tempDirectory,
                    inPlaceDeployment && null != jar ? JarUtils.toFile(jar) : null,
                    environment,
                    moduleName,
                    ConfigurationModuleType.SERVICE,
                    naming,
                    configurationManager,
                    repositories, bundleContext);
            if(jar != null) {
                File file = new File(jar.getName());
                context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
            }
            context.initializeConfiguration();
            serviceBuilders.build(moduleType, context, context);
            return context;
        } catch (DeploymentException de) {
            cleanupContext(context);
            throw de;
View Full Code Here

            ArtifactManager artifactManager = new DefaultArtifactManager();
            ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, mockRepository);
            ConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.EMPTY_SET, artifactResolver, Collections.EMPTY_SET, bundleContext);
            bundleContext.setConfigurationManager(configurationManager);
            AbstractName moduleName = naming.createRootName(environment.getConfigId(), "foo", "bar");
            DeploymentContext context = new DeploymentContext(outFile, null, environment, moduleName, ConfigurationModuleType.CAR, naming, configurationManager, Collections.<Repository>singleton(mockRepository), bundleContext);
            context.initializeConfiguration();
            gbeanBuilder.build(plan, context, context);
            Set gbeanNames = context.getGBeanNames();
            assertEquals(1, gbeanNames.size());
            AbstractName beanName = (AbstractName) gbeanNames.iterator().next();
            GBeanData data = context.getGBeanInstance(beanName);
            FooBarBean fooBarBean = (FooBarBean) data.getAttribute("fooBarBean");
            assertNotNull(fooBarBean);
            assertEquals("foo", fooBarBean.getFoo());
            assertEquals(10, fooBarBean.getBar());
            FooBarBean inner = fooBarBean.getBean();
View Full Code Here

        cursor.toFirstContentToken();
        xmlObject = cursor.getObject();
        HashMap<String, Artifact> locations = new HashMap<String, Artifact>();
        locations.put(null, Artifact.create("test/foo/1.0/car"));
        BundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", new HashMap<Artifact, ConfigurationData>(), locations);
        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1.0/car")), null, ConfigurationModuleType.SERVICE, new Jsr77Naming(), new MockConfigurationManager(), Collections.<Repository>emptySet(), bundleContext);
        context.initializeConfiguration();
        AbstractName parentName = new AbstractName(URI.create("test/foo/1.0/car?name=parent,j2eeType=foo"));
        builder.getReferences(xmlObject, context, parentName, bundleContext.getBundle());
        secBuilder.doStop();
    }
View Full Code Here

            } catch (Exception e) {
                throw new DeploymentException("Error resolving Aries Application", e);
            }
        }

        DeploymentContext context = installer.startInstall(app, targetConfigurationStore);

        return context;
    }
View Full Code Here

        Naming naming = kernel.getNaming();
        AbstractName moduleName = naming.createRootName(configId, configId.toString(), "AriesApplication");
        //Use a temporary folder to hold the extracted files for analysis use
        File tempDirectory = FileUtils.createTempDir();
        try {
            DeploymentContext context = new DeploymentContext(tempDirectory,
                            null,
                            environment,
                            moduleName,
                            ConfigurationModuleType.EBA,
                            naming,
                            configurationManager,
                            null,
                            bundleContext);

            context.flush();
            context.initializeConfiguration();

            app.store(tempDirectory);

            AbstractName name = naming.createChildName(moduleName, "AriesApplication", "GBean");
            GBeanData data = new GBeanData(name, ApplicationGBean.class);
            data.setAttribute("configId", configId);
            data.setReferencePattern("Installer", abstractName);

            context.addGBean(data);

            return context;
        } catch (DeploymentException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

    public void install(AriesApplication app) throws ConfigurationAlreadyExistsException, IOException, DeploymentException {
        ConfigurationStore store = configurationStores.iterator().next();
        if (store == null) {
            throw new DeploymentException("No ConfigurationStore");
        }
        DeploymentContext context = startInstall(app, store);
        ConfigurationData configurationData = finishInstall(context, store);

        try {
            configurationManager.loadConfiguration(configurationData.getId());
            configurationManager.startConfiguration(configurationData.getId());
View Full Code Here

        super.tearDown();
    }

    public void testBuildConfiguration() throws Exception {
        ConfigurationData configurationData = null;
        DeploymentContext context = null;
        try {
            EARConfigBuilder configBuilder = new EARConfigBuilder(defaultParentId,
                    transactionManagerAbstractNameQuery,
                    connectionTrackerAbstractNameQuery,
                    corbaGBeanAbstractNameQuery,
                    null,
                    globalContextAbstractNameQuery,
                    Collections.singleton(repository),
                    ejbConfigBuilder,
                    webConfigBuilder,
                    connectorConfigBuilder,
                    activationSpecInfoLocator,
                    appClientConfigBuilder,
                    serviceBuilder,
                    BValModuleBuilder,
                    persistenceUnitBuilder,
                    namingBuilder,
                    naming,
                    artifactResolvers,
                    bundleContext);

            Object plan = configBuilder.getDeploymentPlan(null, earFile, idBuilder);
            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
            configurationData = getConfigurationData(context);
        } finally {
            if (context != null) {
                context.close();
            }
            if (configurationData != null) {
                FileUtils.recursiveDelete(configurationData.getConfigurationDir());
            }
        }
View Full Code Here

                naming,
                artifactResolvers,
                bundleContext);

        ConfigurationData configurationData = null;
        DeploymentContext context = null;
        try {
            Object plan = configBuilder.getDeploymentPlan(resolveFile("src/test/resources/plans/test-bad-ejb-jar.xml"), earFile, idBuilder);
            context = configBuilder.buildConfiguration(false, configBuilder.getConfigurationID(plan, earFile, idBuilder), plan, earFile, Collections.singleton(configStore), artifactResolver, configStore);
            configurationData = getConfigurationData(context);
            fail("Should have thrown a DeploymentException");
        } catch (DeploymentException e) {
            //we now may get a FileNotFoundException for missing wars.
        } finally {
            if (context != null) {
                context.close();
            }
            if (configurationData != null) {
                FileUtils.recursiveDelete(configurationData.getConfigurationDir());
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.deployment.DeploymentContext

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.