@Override public GlassFish newGlassFish(GlassFishProperties glassfishProperties) throws GlassFishException { GlassFish embeddedGf = super.newGlassFish(glassfishProperties); int finalStartLevel = Integer.parseInt(glassfishProperties.getProperties().getProperty( Constants.FINAL_START_LEVEL_PROP, "2")); return new OSGiGlassFishImpl(embeddedGf, framework.getBundleContext(), finalStartLevel); }
@Override public GlassFish newGlassFish(GlassFishProperties glassfishProperties) throws GlassFishException { GlassFish embeddedGf = super.newGlassFish(glassfishProperties); int finalStartLevel = Integer.parseInt(glassfishProperties.getProperties().getProperty( Constants.FINAL_START_LEVEL_PROP, "2")); return new OSGiGlassFishImpl(embeddedGf, framework.getBundleContext(), finalStartLevel); }
glassfishProperties.getProperties().store(gbw, this.getClass().getName()); deployProperties.store(dbw, this.getClass().getName()); Files.delete(zipfs.getPath("META-INF/MANIFEST.MF"));
gfProps.getProperties().setProperty(Constants.INSTALL_ROOT_PROP_NAME, installRoot.getAbsolutePath()); gfProps.getProperties().setProperty(Constants.INSTALL_ROOT_URI_PROP_NAME, installRoot.toURI().toString());
private String createTempInstanceRoot(GlassFishProperties gfProps) throws Exception { String tmpDir = gfProps.getProperties().getProperty("glassfish.embedded.tmpdir", System.getProperty("glassfish.embedded.tmpdir")); if (tmpDir == null) { ex.printStackTrace(); String autoDeleteVal = gfProps.getProperties().getProperty(autoDelete, "true"); gfProps.getProperties().setProperty(autoDelete, autoDeleteVal); return instanceRoot.getAbsolutePath();
@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); } } } } };
private String createTempInstanceRoot(GlassFishProperties gfProps) throws Exception { String tmpDir = gfProps.getProperties().getProperty("glassfish.embedded.tmpdir", System.getProperty("glassfish.embedded.tmpdir")); if (tmpDir == null) { ex.printStackTrace(); String autoDeleteVal = gfProps.getProperties().getProperty(autoDelete, "true"); gfProps.getProperties().setProperty(autoDelete, autoDeleteVal); return instanceRoot.getAbsolutePath();
gfProps.getProperties().setProperty(Constants.INSTALL_ROOT_PROP_NAME, installRoot.getAbsolutePath()); gfProps.getProperties().setProperty(Constants.INSTALL_ROOT_URI_PROP_NAME, installRoot.toURI().toString());
@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); } } } } };
private void start() { try ( InputStream gpis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_glassfish.properties"); InputStream dpis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_deploy.properties"); InputStream wis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_application.war")) { GlassFishProperties glassfishProperties = new GlassFishProperties(); glassfishProperties.getProperties().load(gpis); URL url = this.getClass().getClassLoader().getResource("uber-jar_domain.xml"); if (url != null) { glassfishProperties.setConfigFileURI(url.toURI().toString()); } DeployProperties deployProperties = new DeployProperties(); deployProperties.load(dpis); GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(glassfishProperties); glassfish.start(); glassfish.getDeployer().deploy(wis, deployProperties.getDeployOptions()); } catch (Throwable th) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Server was stopped.", th); System.exit(1); } } }
@Override public synchronized GlassFish newGlassFish(GlassFishProperties gfProps) throws GlassFishException { try { // set env props before updating config, because configuration update may actually trigger // some code to be executed which may be depending on the environment variable values. setEnv(gfProps.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties()); final ServiceTracker hk2Tracker = new ServiceTracker(getBundleContext(), Main.class.getName(), null); hk2Tracker.open(); final Main main = (Main) hk2Tracker.waitForService(0); hk2Tracker.close(); final ModulesRegistry mr = ModulesRegistry.class.cast(getBundleContext().getService(getBundleContext().getServiceReference(ModulesRegistry.class.getName()))); ServiceLocator serviceLocator = main.createServiceLocator(mr, startupContext, null, null); final ModuleStartup gfKernel = main.findStartupService(mr, serviceLocator, null, startupContext); GlassFish glassFish = createGlassFish(gfKernel, serviceLocator, gfProps.getProperties()); gfs.add(glassFish); return glassFish; } catch (BootException ex) { throw new GlassFishException(ex); } catch (InterruptedException ex) { throw new GlassFishException(ex); } }
@Override public synchronized GlassFish newGlassFish(GlassFishProperties gfProps) throws GlassFishException { try { // set env props before updating config, because configuration update may actually trigger // some code to be executed which may be depending on the environment variable values. setEnv(gfProps.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties()); final ServiceTracker hk2Tracker = new ServiceTracker(getBundleContext(), Main.class.getName(), null); hk2Tracker.open(); final Main main = (Main) hk2Tracker.waitForService(0); hk2Tracker.close(); final ModulesRegistry mr = ModulesRegistry.class.cast(getBundleContext().getService(getBundleContext().getServiceReference(ModulesRegistry.class.getName()))); ServiceLocator serviceLocator = main.createServiceLocator(mr, startupContext, null, null); final ModuleStartup gfKernel = main.findStartupService(mr, serviceLocator, null, startupContext); GlassFish glassFish = createGlassFish(gfKernel, serviceLocator, gfProps.getProperties()); gfs.add(glassFish); return glassFish; } catch (BootException ex) { throw new GlassFishException(ex); } catch (InterruptedException ex) { throw new GlassFishException(ex); } }
cloned.putAll(glassFishProperties.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties()); GlassFishImpl gfImpl = new GlassFishImpl(gfKernel, serviceLocator, gfProps.getProperties()) { @Override public void dispose() throws GlassFishException {
cloned.putAll(glassFishProperties.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties()); GlassFishImpl gfImpl = new GlassFishImpl(gfKernel, serviceLocator, gfProps.getProperties()) { @Override public void dispose() throws GlassFishException {