Package org.apache.geronimo.deployment.xbeans

Examples of org.apache.geronimo.deployment.xbeans.ConfigurationType


        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(Bootstrap.class.getClassLoader());

            // parse the deployment-system and j2ee-deployer plans
            ConfigurationType deployerSystemConfig = ConfigurationDocument.Factory.parse(new File(deployerSystemPlan)).getConfiguration();
            ConfigurationType j2eeDeployerConfig = ConfigurationDocument.Factory.parse(new File(j2eeDeployerPlan)).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));

            //TODO should the defaultParentId be null??
            ServiceConfigBuilder builder = new ServiceConfigBuilder(null, repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.deployment.cli.DeployTool");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());
            mainAttributes.putValue(CommandLineManifest.ENDORSED_DIRS.toString(), deployerEndorsedDirs);

            // attribute that indicates to a JSR-88 tool that we have a Deployment factory
            mainAttributes.putValue("J2EE-DeploymentFactory-Implementation-Class", deploymentFactory);
View Full Code Here


public class ConfigPlanTest extends TestCase {
    private URL plan1;

    public void testParser() throws Exception {
        ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1);
        ConfigurationType configuration = doc.getConfiguration();
        assertEquals("test/plan1", configuration.getConfigId());

        DependencyType[] dependencies = configuration.getDependencyArray();
        assertEquals(1, dependencies.length);
        assertEquals("geronimo", dependencies[0].getGroupId());
        assertEquals("geronimo-kernel", dependencies[0].getArtifactId());
        assertEquals("DEV", dependencies[0].getVersion());

        GbeanType[] gbeans = configuration.getGbeanArray();
        assertEquals(1, gbeans.length);
        assertEquals("geronimo.test:name=MyMockGMBean", gbeans[0].getGbeanName());
        AttributeType[] attrs = gbeans[0].getAttributeArray();
        assertEquals(2, attrs.length);
        assertEquals("value", attrs[0].getName());
View Full Code Here

        referenceCollection.add(javaBeanXmlAttributeBuilder);
        ServiceConfigBuilder builder = new ServiceConfigBuilder(URI.create("test/foo"), null, referenceCollection, null, null);
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL plan1 = cl.getResource("services/plan1.xml");
        ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1);
        ConfigurationType plan = doc.getConfiguration();
        File outFile = File.createTempFile("foo", "bar");
        outFile.delete();
        if (!outFile.mkdirs()) {
            fail("could not create temp dir");
        }
        try {
            DeploymentContext context = new DeploymentContext(outFile, URI.create("foo/bar"), ConfigurationModuleType.SERVICE, URI.create("foo"), "domain", "server", null);
            J2eeContext j2eeContext = new J2eeContextImpl("domain", "server", "null", "test", "configtest", "foo", NameFactory.J2EE_MODULE);
            GbeanType[] gbeans = plan.getGbeanArray();
            ServiceConfigBuilder.addGBeans(gbeans, cl, j2eeContext, context);
            GBeanData[] beanDatas = context.getGBeans();
            assertEquals(1, beanDatas.length);
            GBeanData data = beanDatas[0];
            FooBarBean fooBarBean = (FooBarBean) data.getAttribute("fooBarBean");
View Full Code Here

            throw new DeploymentException("no plan at " + planFile, e);
        }
    }

    public ConfigurationData buildConfiguration(Object plan, JarFile unused, File outfile) throws IOException, DeploymentException {
        ConfigurationType configType = (ConfigurationType) plan;
        String domain = null;
        String server = null;

        return buildConfiguration(configType, domain, server, outfile);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.deployment.xbeans.ConfigurationType

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.