Package org.glassfish.embeddable

Examples of org.glassfish.embeddable.GlassFishProperties


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

      GlassFishProperties serverProps = new GlassFishProperties();
     
      boolean shouldSetPort = true;
      if(configuration.getInstanceRoot() != null)
      {
         File instanceRoot = new File(configuration.getInstanceRoot());
         if(!instanceRoot.exists())
         {
            instanceRoot.mkdirs();
         }
         serverProps.setInstanceRoot(configuration.getInstanceRoot());
         shouldSetPort = false;
      }
      if(configuration.getConfigurationXml() != null)
      {
         serverProps.setConfigFileURI(configuration.getConfigurationXml());
         shouldSetPort = false;
      }
      serverProps.setConfigFileReadOnly(configuration.isConfigurationReadOnly());
      if(shouldSetPort)
      {
        serverProps.setPort("http-listener", configuration.getBindHttpPort());
      }
      try
      {
         glassfish = glassfishRuntime.newGlassFish(serverProps);
      }
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 = 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

                }
            }

            if (glassfish == null) {
                try {                
                    GlassFishProperties gfProperties = new GlassFishProperties();
                    gfProperties.setPort("http-listener", getBaseUri().getPort());

                    glassfish = gfr.newGlassFish(gfProperties);
                    // use glassfish
                } catch (GlassFishException ngfex) {
                    throw new TestContainerException(ngfex);
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

        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

            // 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

                bootstrapProperties.setInstallRoot(installRoot);
            }
            glassfishRuntime = GlassFishRuntime.bootstrap(bootstrapProperties);
        }

        GlassFishProperties glassfishProperties = new GlassFishProperties();
        if (instanceRoot != null) {
            glassfishProperties.setInstanceRoot(instanceRoot);
        }
        if (configFileURI != null) {
            glassfishProperties.setConfigFileURI(configFileURI);
            glassfishProperties.setConfigFileReadOnly(configFileReadOnly);
        }

        if (instanceRoot==null && configFileURI==null) {
            // only set port if embedded domain.xml is used
            if (httpPort != -1) {
                glassfishProperties.setPort("http-listener", httpPort);
            }
        }

        glassfish = glassfishRuntime.newGlassFish(glassfishProperties);
        glassfish.start();
View Full Code Here

                bootstrapProperties.setInstallRoot(installRoot);
            }
            glassfishRuntime = GlassFishRuntime.bootstrap(bootstrapProperties);
        }

        GlassFishProperties glassfishProperties = new GlassFishProperties();
        if (instanceRoot != null) {
            glassfishProperties.setInstanceRoot(instanceRoot);
        }
        if (configFileURI != null) {
            glassfishProperties.setConfigFileURI(configFileURI);
            glassfishProperties.setConfigFileReadOnly(configFileReadOnly);
        }
        if (httpPort != -1) {
            glassfishProperties.setPort("http-listener", httpPort);
        }

        glassfish = glassfishRuntime.newGlassFish(glassfishProperties);
        glassfish.start();
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);
      }
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 = 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

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.