Package org.glassfish.embeddable

Examples of org.glassfish.embeddable.GlassFishProperties


            // Don't set temporarily created instanceroot in the user supplied
            // GlassFishProperties, hence clone it.
            Properties cloned = new Properties();
            cloned.putAll(glassFishProperties.getProperties());

            final GlassFishProperties gfProps = new GlassFishProperties(cloned);
            setEnv(gfProps);

            final StartupContext startupContext = new StartupContext(gfProps.getProperties());
           
            ModulesRegistry modulesRegistry = SingleHK2Factory.getInstance().createModulesRegistry();

            ServiceLocator serviceLocator = main.createServiceLocator(modulesRegistry, startupContext, Arrays.asList((PopulatorPostProcessor)new EmbeddedInhabitantsParser(), new ContextDuplicatePostProcessor()), null);

            final ModuleStartup gfKernel = main.findStartupService(modulesRegistry, serviceLocator, null, startupContext);
            // create a new GlassFish instance
            GlassFishImpl gfImpl = new GlassFishImpl(gfKernel, serviceLocator, gfProps.getProperties()) {
                @Override
                public void dispose() throws GlassFishException {
                    try {
                        super.dispose();
                    } finally {
                        gfMap.remove(gfProps.getInstanceRoot());
                        if ("true".equalsIgnoreCase(gfProps.getProperties().
                                getProperty(autoDelete)) && gfProps.getInstanceRoot() != null) {
                            File instanceRoot = new File(gfProps.getInstanceRoot());
                            if (instanceRoot.exists()) { // might have been deleted already.
                                Util.deleteRecursive(instanceRoot);
                            }
                        }
                    }
                }
            };
            // Add this newly created instance to a Map
            gfMap.put(gfProps.getInstanceRoot(), gfImpl);
            return gfImpl;
        } catch (GlassFishException e) {
            throw e;
        } catch(Exception e) {
            throw new GlassFishException(e);
View Full Code Here


    }

    public void run() throws Exception {
        addShutdownHook(); // handle Ctrt-C.

        GlassFishProperties gfProps =new GlassFishProperties();
        gfProps.setProperty("org.glassfish.embeddable.autoDelete",
                System.getProperty("org.glassfish.embeddable.autoDelete", "true"));

        gf = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
       
        gf.start();
View Full Code Here

            // Don't set temporarily created instanceroot in the user supplied
            // GlassFishProperties, hence clone it.
            Properties cloned = new Properties();
            cloned.putAll(glassFishProperties.getProperties());

            final GlassFishProperties gfProps = new GlassFishProperties(cloned);
            setEnv(gfProps);

            final StartupContext startupContext = new StartupContext(gfProps.getProperties());
            ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry();
            final Habitat habitat = main.createHabitat(modulesRegistry, startupContext);
            final ModuleStartup gfKernel = main.findStartupService(modulesRegistry, habitat, null, startupContext);
            // create a new GlassFish instance
            GlassFishImpl gfImpl = new GlassFishImpl(gfKernel, habitat, gfProps.getProperties()) {
                @Override
                public void dispose() throws GlassFishException {
                    try {
                        super.dispose();
                    } finally {
                        if ("true".equalsIgnoreCase(gfProps.getProperties().
                                getProperty(autoDelete)) && gfProps.getInstanceRoot() != null) {
                            File instanceRoot = new File(gfProps.getInstanceRoot());
                            if (instanceRoot.exists()) { // might have been deleted already.
                                Util.deleteRecursive(instanceRoot);
                            }
                        }
                    }
                }
            };
            // Add this newly created instance to a Map
            gfMap.put(gfProps.getInstanceRoot(), gfImpl);
            return gfImpl;
        } catch (GlassFishException e) {
            throw e;
        } catch(Exception e) {
            throw new GlassFishException(e);
View Full Code Here

            final BootstrapProperties bsProperties = new BootstrapProperties(properties);
            if (gfr == null) {
                // Should we do the following in a separate thread?
                gfr = GlassFishRuntime.bootstrap(bsProperties, getClass().getClassLoader());
            }
            gf = gfr.newGlassFish(new GlassFishProperties(properties));
            gf.start();
        }
    }
View Full Code Here

        GlassFishRuntime runtime = GlassFishRuntime.bootstrap(bootstrapProperties);

        File domDir = new File(domainConfig.getDomainRoot(),
                domainConfig.getDomainName());
        File configDir = new File(domDir, "config");
        GlassFishProperties glassFishProperties = new GlassFishProperties();
        glassFishProperties.setConfigFileURI(new File(configDir,
                "domain.xml").toURI().toString());
        glassFishProperties.setConfigFileReadOnly(false);
        glassFishProperties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
                "DomainCreation");
        glassFishProperties.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY,
                domDir.getAbsolutePath());
        glassFishProperties.setProperty("-domain", domainConfig.getDomainName());

        GlassFish glassfish = runtime.newGlassFish(glassFishProperties);
        glassfish.start();

        // Will always need DAS's name & config. No harm using the name 'server'
View Full Code Here

        VerifierFrameworkContext verifierFrameworkContext =
                new Initializer(args).getVerificationContext();

        addShutdownHook(); // Since in gui mode, we don't get a chance to clean up, we need to install a shutdown hook
        gfr = GlassFishRuntime.bootstrap();
        GlassFishProperties gfp = new GlassFishProperties();
        gfp.setProperty(StartupContext.TIME_ZERO_NAME, (new Long(System.currentTimeMillis())).toString());
        final String VERIFIER_MODULE = "org.glassfish.verifier";
        gfp.setProperty(StartupContext.STARTUP_MODULE_NAME, VERIFIER_MODULE);
//        gfp.setConfigFileURI("file:/tmp/domain.xml");
        GlassFish gf = gfr.newGlassFish(gfp);
        gf.start();
        int failedCount = -1;
        Verifier verifier = gf.getService(Verifier.class);
View Full Code Here

        GlassFishRuntime runtime = GlassFishRuntime.bootstrap(bootstrapProperties);

        File domDir = new File(domainConfig.getDomainRoot(),
                domainConfig.getDomainName());
        File configDir = new File(domDir, "config");
        GlassFishProperties glassFishProperties = new GlassFishProperties();
        glassFishProperties.setConfigFileURI(new File(configDir,
                "domain.xml").toURI().toString());
        glassFishProperties.setConfigFileReadOnly(false);
        glassFishProperties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
                "DomainCreation");
        glassFishProperties.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY,
                domDir.getAbsolutePath());
        glassFishProperties.setProperty("-domain", domainConfig.getDomainName());

        GlassFish glassfish = runtime.newGlassFish(glassFishProperties);
        glassfish.start();

        // Will always need DAS's name & config. No harm using the name 'server'
View Full Code Here

        GlassFishRuntime runtime = GlassFishRuntime.bootstrap(bootstrapProperties);

        File domDir = new File(domainConfig.getDomainRoot(),
                domainConfig.getDomainName());
        File configDir = new File(domDir, "config");
        GlassFishProperties glassFishProperties = new GlassFishProperties();
        glassFishProperties.setConfigFileURI(new File(configDir,
                "domain.xml").toURI().toString());
        glassFishProperties.setConfigFileReadOnly(false);
        glassFishProperties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
                "DomainCreation");
        glassFishProperties.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY,
                domDir.getAbsolutePath());
        glassFishProperties.setProperty("-domain", domainConfig.getDomainName());

        GlassFish glassfish = runtime.newGlassFish(glassFishProperties);
        glassfish.start();

        // Will always need DAS's name & config. No harm using the name 'server'
View Full Code Here

      {
         throw new RuntimeException("Could not setup GlassFish Embedded Bootstrap", e);
      }

      boolean cleanup = configuration.getCleanup();
      GlassFishProperties serverProps = new GlassFishProperties();
     
      if(configuration.getInstanceRoot() != null)
      {
         File instanceRoot = new File(configuration.getInstanceRoot());
         if (instanceRoot.exists())
         {
            cleanup = false;
         }
         serverProps.setInstanceRoot(configuration.getInstanceRoot());
         shouldSetPort = false;
      }
      if(configuration.getConfigurationXml() != null)
      {
         serverProps.setConfigFileURI(configuration.getConfigurationXml());
         shouldSetPort = false;
      }
      serverProps.setConfigFileReadOnly(configuration.isConfigurationReadOnly());
      if(shouldSetPort)
      {
          bindHttpPort = configuration.getBindHttpPort();
        serverProps.setPort("http-listener", bindHttpPort);
      }
     
      try
      {
         glassfish = glassfishRuntime.newGlassFish(serverProps);
View Full Code Here

      catch (Exception e)
      {
         throw new RuntimeException("Could not setup GlassFish Embedded Bootstrap", e);
      }

      GlassFishProperties serverProps = new GlassFishProperties();
     
      if(configuration.getInstanceRoot() != null)
      {
         File instanceRoot = new File(configuration.getInstanceRoot());
         if(!instanceRoot.exists())
         {
            instanceRoot.mkdirs();
         }
         serverProps.setInstanceRoot(configuration.getInstanceRoot());
      }
      if(configuration.getConfigurationXml() != null)
      {
         serverProps.setConfigFileURI(configuration.getConfigurationXml());
      }
      serverProps.setConfigFileReadOnly(configuration.isConfigurationReadOnly());
      serverProps.setPort("http-listener", configuration.getBindHttpPort());
      try
      {
         glassfish = glassfishRuntime.newGlassFish(serverProps);
      }
      catch (Exception e)
View Full Code Here

TOP

Related Classes of org.glassfish.embeddable.GlassFishProperties

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.