/** * Bootstrap a GlassFishRuntime with default {@link BootstrapProperties}. * * @return Bootstrapped GlassFishRuntime * @throws GlassFishException if the GlassFishRuntime is already bootstrapped. */ public static GlassFishRuntime bootstrap() throws GlassFishException { return bootstrap(new BootstrapProperties(), GlassFishRuntime.class.getClassLoader()); }
private void setBootstrapProperties(BootstrapProperties props, EmbeddedFileSystem fs) { props.setProperty("GlassFish_Platform", "Static"); if (fs != null) { String instanceRoot = fs.instanceRoot != null ? fs.instanceRoot.getAbsolutePath() : null; String installRoot = fs.installRoot != null ? fs.installRoot.getAbsolutePath() : instanceRoot; if (installRoot != null) { props.setInstallRoot(installRoot); } } }
public boolean handles(BootstrapProperties bsProps) { return EmbeddedOSGiGlassFishRuntimeBuilder.class.getName(). equals(bsProps.getProperties().getProperty(Constants.BUILDER_NAME_PROPERTY)); }
BootstrapProperties bootstrapProperties = new BootstrapProperties(); bootstrapProperties.setInstallRoot("C:\\applicationserverdir"); GlassFishRuntime glassfishRuntime = GlassFishRuntime.bootstrap(bootstrapProperties); GlassFishProperties glassfishProperties = new GlassFishProperties(); glassfishProperties.setInstanceRoot("C:\\applicationserverdir\\domains\\myJavaFXAppDomain"); glassfishProperties.setPort("http-listener", 8080); glassfishProperties.setPort("https-listener", 8181); GlassFish glassfish = glassfishRuntime.newGlassFish(glassfishProperties); glassfish.start();
private String getInstallRoot(BootstrapProperties props) { String installRootProp = props.getInstallRoot(); if(installRootProp == null) { File installRoot = MainHelper.findInstallRoot(); if(isValidInstallRoot(installRoot)) { installRootProp = installRoot.getAbsolutePath(); } } return installRootProp; }
BootstrapProperties bootstrapProperties = new BootstrapProperties(); bootstrapProperties.setInstallRoot(l.installed_root.getCanonicalPath());
private String getInstallRoot(BootstrapProperties props) { String installRootProp = props.getInstallRoot(); if(installRootProp == null) { File installRoot = MainHelper.findInstallRoot(); if(isValidInstallRoot(installRoot)) { installRootProp = installRoot.getAbsolutePath(); } } return installRootProp; }
BootstrapProperties bootstrapProperties = new BootstrapProperties(); glassFishProperties.setConfigFileURI(l.domain_file.toURI().toString()); bootstrapProperties.setInstallRoot(l.installed_root.getCanonicalPath());
/** * Bootstrap a GlassFishRuntime with default {@link BootstrapProperties}. * * @return Bootstrapped GlassFishRuntime * @throws GlassFishException if the GlassFishRuntime is already bootstrapped. */ public static GlassFishRuntime bootstrap() throws GlassFishException { return bootstrap(new BootstrapProperties(), GlassFishRuntime.class.getClassLoader()); }
private void setBootstrapProperties(BootstrapProperties props, EmbeddedFileSystem fs) { props.setProperty("GlassFish_Platform", "Static"); if (fs != null) { String instanceRoot = fs.instanceRoot != null ? fs.instanceRoot.getAbsolutePath() : null; String installRoot = fs.installRoot != null ? fs.installRoot.getAbsolutePath() : instanceRoot; if (installRoot != null) { props.setInstallRoot(installRoot); } } }
public boolean handles(BootstrapProperties bsProps) { return EmbeddedOSGiGlassFishRuntimeBuilder.class.getName(). equals(bsProps.getProperties().getProperty(Constants.BUILDER_NAME_PROPERTY)); }
public void setup(GlassFishConfiguration configuration) { this.configuration = configuration; BootstrapProperties bootstrapProps = new BootstrapProperties(); if (configuration.getInstallRoot() != null) { bootstrapProps.setInstallRoot(configuration.getInstallRoot());
public void start(BundleContext context) throws Exception { nonEmbedded = context.getProperty(Constants.BUILDER_NAME_PROPERTY) != null; if (nonEmbedded) { GlassFishRuntime embeddedGfr = new EmbeddedOSGiGlassFishRuntime(context); context.registerService(GlassFishRuntime.class.getName(), embeddedGfr, null); System.out.println("Registered " + embeddedGfr + " in service registry."); } else { Properties properties = prepareStartupContext(context); final BootstrapProperties bsProperties = new BootstrapProperties(properties); System.out.println(GlassFishRuntime.class + " is loaded by [" + GlassFishRuntime.class.getClassLoader() + "]"); GlassFishRuntime existingGfr = lookupGfr(context); if (existingGfr == null) { System.out.println("Bootstrapping a new GlassFishRuntime"); // Should we do the following in a separate thread? gfr = GlassFishRuntime.bootstrap(bsProperties, getClass().getClassLoader()); existingGfr = gfr; } else { System.out.println("Using existing GlassFishRuntime: [" + existingGfr + "]"); } gf = existingGfr.newGlassFish(new GlassFishProperties(properties)); gf.start(); } }
public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { configureBundles(bsProps); provisionBundles(bsProps); GlassFishRuntime gfr = new EmbeddedOSGiGlassFishRuntime(getBundleContext()); Properties props = bsProps.getProperties(); Dictionary properties = new Properties(); for (final String name: props.stringPropertyNames()) properties.put(name, props.getProperty(name)); getBundleContext().registerService(GlassFishRuntime.class.getName(), gfr, properties); return gfr; }
public void start(BundleContext context) throws Exception { nonEmbedded = context.getProperty(Constants.BUILDER_NAME_PROPERTY) != null; if (nonEmbedded) { GlassFishRuntime embeddedGfr = new EmbeddedOSGiGlassFishRuntime(context); context.registerService(GlassFishRuntime.class.getName(), embeddedGfr, null); System.out.println("Registered " + embeddedGfr + " in service registry."); } else { Properties properties = prepareStartupContext(context); final BootstrapProperties bsProperties = new BootstrapProperties(properties); System.out.println(GlassFishRuntime.class + " is loaded by [" + GlassFishRuntime.class.getClassLoader() + "]"); GlassFishRuntime existingGfr = lookupGfr(context); if (existingGfr == null) { System.out.println("Bootstrapping a new GlassFishRuntime"); // Should we do the following in a separate thread? gfr = GlassFishRuntime.bootstrap(bsProperties, getClass().getClassLoader()); existingGfr = gfr; } else { System.out.println("Using existing GlassFishRuntime: [" + existingGfr + "]"); } gf = existingGfr.newGlassFish(new GlassFishProperties(properties)); gf.start(); } }
private static RuntimeBuilder getRuntimeBuilder(BootstrapProperties bootstrapProperties, ClassLoader cl) throws GlassFishException { // StringBuilder sb = new StringBuilder("Launcher Class Loader = " + cl); // if (cl instanceof URLClassLoader) { // sb.append("has following Class Path: "); // for (URL url : URLClassLoader.class.cast(cl).getURLs()) { // sb.append(url).append(", "); // } // } // System.out.println(sb); Iterator<RuntimeBuilder> runtimeBuilders = ServiceLoader.load(RuntimeBuilder.class, cl).iterator(); while (runtimeBuilders.hasNext()) { try { RuntimeBuilder builder = runtimeBuilders.next(); logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "builder = {0}", new Object[]{builder}); if (builder.handles(bootstrapProperties)) { return builder; } } catch (ServiceConfigurationError sce) { // Ignore the exception and move ahead to the next builder. logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "Ignoring", sce); } catch (NoClassDefFoundError ncdfe) { // On IBM JDK, we seem to be getting NoClassDefFoundError instead of ServiceConfigurationError // when OSgiRuntimeBuilder is not able to be loaded in non-OSGi mode because of absence of // OSGi classes in classpath. So, we need to catch it and ignore. logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "Ignoring", ncdfe); } } throw new GlassFishException("No runtime builder available for this configuration: " + bootstrapProperties.getProperties(), null); }
public void launch(Properties ctx) throws Exception { addShutdownHook(); gfr = GlassFishRuntime.bootstrap(new BootstrapProperties(ctx), getClass().getClassLoader()); gf = gfr.newGlassFish(new GlassFishProperties(ctx)); if (Boolean.valueOf(Util.getPropertyOrSystemProperty(ctx, "GlassFish_Interactive", "false"))) { startConsole(); } else { gf.start(); } }
public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { configureBundles(bsProps); provisionBundles(bsProps); GlassFishRuntime gfr = new EmbeddedOSGiGlassFishRuntime(getBundleContext()); Properties props = bsProps.getProperties(); Dictionary properties = new Properties(); for (final String name: props.stringPropertyNames()) properties.put(name, props.getProperty(name)); getBundleContext().registerService(GlassFishRuntime.class.getName(), gfr, properties); return gfr; }
public void launch(Properties ctx) throws Exception { addShutdownHook(); gfr = GlassFishRuntime.bootstrap(new BootstrapProperties(ctx), getClass().getClassLoader()); gf = gfr.newGlassFish(new GlassFishProperties(ctx)); if (Boolean.valueOf(Util.getPropertyOrSystemProperty(ctx, "GlassFish_Interactive", "false"))) { startConsole(); } else { gf.start(); } }
private static RuntimeBuilder getRuntimeBuilder(BootstrapProperties bootstrapProperties, ClassLoader cl) throws GlassFishException { // StringBuilder sb = new StringBuilder("Launcher Class Loader = " + cl); // if (cl instanceof URLClassLoader) { // sb.append("has following Class Path: "); // for (URL url : URLClassLoader.class.cast(cl).getURLs()) { // sb.append(url).append(", "); // } // } // System.out.println(sb); Iterator<RuntimeBuilder> runtimeBuilders = ServiceLoader.load(RuntimeBuilder.class, cl).iterator(); while (runtimeBuilders.hasNext()) { try { RuntimeBuilder builder = runtimeBuilders.next(); logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "builder = {0}", new Object[]{builder}); if (builder.handles(bootstrapProperties)) { return builder; } } catch (ServiceConfigurationError sce) { // Ignore the exception and move ahead to the next builder. logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "Ignoring", sce); } catch (NoClassDefFoundError ncdfe) { // On IBM JDK, we seem to be getting NoClassDefFoundError instead of ServiceConfigurationError // when OSgiRuntimeBuilder is not able to be loaded in non-OSGi mode because of absence of // OSGi classes in classpath. So, we need to catch it and ignore. logger.logp(Level.FINE, "GlassFishRuntime", "getRuntimeBuilder", "Ignoring", ncdfe); } } throw new GlassFishException("No runtime builder available for this configuration: " + bootstrapProperties.getProperties(), null); }