Package org.glassfish.internal.embedded

Examples of org.glassfish.internal.embedded.Server$Builder


        Properties properties = new Properties();
        properties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
                                        "DomainCreation");
        properties.setProperty("-domain", domainConfig.getDomainName());
        Server server = builder.build(properties);

        server.start();
        Habitat habitat = server.getHabitat();
        // Will always need DAS's name & config. No harm using the name 'server'
        // to fetch <server-config>
        com.sun.enterprise.config.serverbeans.Server serverConfig =
            habitat.getComponent(
                com.sun.enterprise.config.serverbeans.Server.class, "server");
        Config config = habitat.getComponent(
            Config.class, serverConfig.getConfigRef());

        // Create a context object for this domain creation to enable the new
        // modules to make decisions
        DomainContext ctx = new DomainContext();
        ctx.setDomainType("dev"); //TODO : Whenever clustering/HA is supported
        // this setting needs to be fixed. Domain type can be dev/ha/cluster and
        // this type needs to be extracted possibly using an api from installer
        ctx.setLogger(LogDomains.getLogger(
            DomainInitializer.class, LogDomains.SERVER_LOGGER));

        // now for every such Inhabitant, fetch the actual initial config and
        // insert it into the module that initial config was targeted for.
        Collection<DomainInitializer> inits =
                habitat.getAllByContract(DomainInitializer.class);
        if (inits.isEmpty()) {
            logger.info(strings.get("NoCustomization"));
        }
        for (DomainInitializer inhabitant : habitat.getAllByContract(
            DomainInitializer.class)) {
            logger.info(strings.get("InvokeInitializer",
                                                inhabitant.getClass()));
            Container newContainerConfig = inhabitant.getInitialConfig(ctx);
            config.getContainers().add(newContainerConfig);
        }
        server.stop();
    }
View Full Code Here


        Properties properties = new Properties();
        properties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
                "DomainCreation");
        properties.setProperty("-domain", domainConfig.getDomainName());
        Server server = builder.build(properties);

        server.start();
        Habitat habitat = server.getHabitat();
        // Will always need DAS's name & config. No harm using the name 'server'
        // to fetch <server-config>
        com.sun.enterprise.config.serverbeans.Server serverConfig =
                habitat.getComponent(
                com.sun.enterprise.config.serverbeans.Server.class, "server");
        Config config = habitat.getComponent(
                Config.class, serverConfig.getConfigRef());

        // Create a context object for this domain creation to enable the new
        // modules to make decisions
        DomainContext ctx = new DomainContext();
        ctx.setDomainType("dev"); //TODO : Whenever clustering/HA is supported
        // this setting needs to be fixed. Domain type can be dev/ha/cluster and
        // this type needs to be extracted possibly using an api from installer
        ctx.setLogger(LogDomains.getLogger(
                DomainInitializer.class, LogDomains.SERVER_LOGGER));

        // now for every such Inhabitant, fetch the actual initial config and
        // insert it into the module that initial config was targeted for.
        Collection<DomainInitializer> inits =
                habitat.getAllByContract(DomainInitializer.class);
        if (inits.isEmpty()) {
            logger.info(strings.get("NoCustomization"));
        }
        for (DomainInitializer inhabitant : habitat.getAllByContract(
                DomainInitializer.class)) {
            logger.info(strings.get("InvokeInitializer",
                    inhabitant.getClass()));
            Container newContainerConfig = inhabitant.getInitialConfig(ctx);
            config.getContainers().add(newContainerConfig);
        }
        server.stop();
    }
View Full Code Here

TOP

Related Classes of org.glassfish.internal.embedded.Server$Builder

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.