protected synchronized static void shutdownInternal() throws GlassFishException { if (me == null) { throw new GlassFishException("Already shutdown", null); } me = null; }
@Override public void run() { try { shutdownInternal(); } catch (GlassFishException exc) { exc.printStackTrace(); } if (tmpBeansXml != null) { tmpBeansXml.delete(); tmpDir.delete(); } } });
@Override public synchronized void shutdown() throws GlassFishException { for (Object gf : gfMap.values()) { try { ((GlassFish) gf).dispose(); } catch (IllegalStateException ex) { // ignore. } } gfMap.clear(); try { shutdownInternal(); } catch (GlassFishException ex) { logger.log(Level.WARNING, LogFacade.CAUGHT_EXCEPTION, ex.getMessage()); } }
@Override public synchronized void shutdown() throws GlassFishException { for (Object gf : gfMap.values()) { try { ((GlassFish) gf).dispose(); } catch (IllegalStateException ex) { // ignore. } } gfMap.clear(); try { shutdownInternal(); } catch (GlassFishException ex) { logger.log(Level.WARNING, LogFacade.CAUGHT_EXCEPTION, ex.getMessage()); } }
protected synchronized static void shutdownInternal() throws GlassFishException { if (me == null) { throw new GlassFishException("Already shutdown", null); } me = null; }
public synchronized void shutdown() throws GlassFishException { // make a copy to avoid ConcurrentModificationException for (GlassFish gf : new ArrayList<GlassFish>(gfs)) { if (gf.getStatus() != GlassFish.Status.DISPOSED) { try { gf.dispose(); } catch (GlassFishException e) { e.printStackTrace(); } } } gfs.clear(); shutdownInternal(); System.out.println("Completed shutdown of GlassFish runtime"); }
/** * Sets the HTTP methods that should be protected * * @param httpMethods the HTTP methods * * @throws GlassFishException if HttpMethodOmissions is already defined */ public void setHttpMethods(Set<String> httpMethods) throws GlassFishException { if (httpMethodOmissions != null) { throw new GlassFishException( "Invalid content was found starting with element 'http-method'. " + "One of 'http-method' or 'http-method-omission' is expected."); } this.httpMethods = httpMethods; }
public synchronized void shutdown() throws GlassFishException { // make a copy to avoid ConcurrentModificationException for (GlassFish gf : new ArrayList<GlassFish>(gfs)) { if (gf.getStatus() != GlassFish.Status.DISPOSED) { try { gf.dispose(); } catch (GlassFishException e) { e.printStackTrace(); } } } gfs.clear(); shutdownInternal(); System.out.println("Completed shutdown of GlassFish runtime"); }
/** * Sets the HTTP methods to be omitted from protection * * @param httpMethodOmissions the HTTP methods to be * omitted from protection * * @throws GlassFishException if HttpMethods is already defined */ public void setHttpMethodOmissions(Set<String> httpMethodOmissions) throws GlassFishException { if (httpMethods != null) { throw new GlassFishException( "Invalid content was found starting with element 'http-method-omission'. " + "One of 'http-method' or 'http-method-omission' is expected."); } this.httpMethodOmissions = httpMethodOmissions; }
private void deleteHK2Cache(Properties properties) throws GlassFishException { // This is a HACK - thanks to some weired optimization trick // done for GlassFish. HK2 maintains a cache of inhabitants and // that needs to be recreated when there is a change in modules dir. final String cacheDir = properties.getProperty(HK2_CACHE_DIR); if (cacheDir != null) { File inhabitantsCache = new File(cacheDir, INHABITANTS_CACHE); if (inhabitantsCache.exists()) { if (!inhabitantsCache.delete()) { throw new GlassFishException("cannot delete cache:" + inhabitantsCache.getAbsolutePath()); } } } }
private void deleteHK2Cache(Properties properties) throws GlassFishException { // This is a HACK - thanks to some weired optimization trick // done for GlassFish. HK2 maintains a cache of inhabitants and // that needs to be recreated when there is a change in modules dir. final String cacheDir = properties.getProperty(HK2_CACHE_DIR); if (cacheDir != null) { File inhabitantsCache = new File(cacheDir, INHABITANTS_CACHE); if (inhabitantsCache.exists()) { if (!inhabitantsCache.delete()) { throw new GlassFishException("cannot delete cache:" + inhabitantsCache.getAbsolutePath()); } } } }
/** * Enables this component. * * @throws GlassFishException if this component fails to be enabled */ public void enable() throws GlassFishException { try { start(); } catch (LifecycleException e) { throw new GlassFishException(e); } }
/** * Disables this component. * * @throws LifecycleException if this component fails to be disabled */ public void disable() throws GlassFishException { try { stop(); } catch (LifecycleException e) { throw new GlassFishException(e); } }
@Override public void undeploy(String appName, String... params) throws GlassFishException { String[] newParams = new String[params.length + 1]; System.arraycopy(params, 0, newParams, 0, params.length); newParams[params.length] = appName; CommandExecutorImpl executer = habitat.getService(CommandExecutorImpl.class); try { ActionReport actionReport = executer.executeCommand("undeploy", newParams); actionReport.writeReport(System.out); } catch (CommandException e) { throw new GlassFishException(e); } catch (IOException e) { throw new GlassFishException(e); } }
private synchronized static GlassFishRuntime _bootstrap(BootstrapProperties bootstrapProperties, ClassLoader cl) throws GlassFishException { if (me != null) { throw new GlassFishException("Already bootstrapped", null); } RuntimeBuilder runtimeBuilder = getRuntimeBuilder(bootstrapProperties, cl != null ? cl : GlassFishRuntime.class.getClassLoader()); me = runtimeBuilder.build(bootstrapProperties); return me; }
private synchronized static GlassFishRuntime _bootstrap(BootstrapProperties bootstrapProperties, ClassLoader cl) throws GlassFishException { if (me != null) { throw new GlassFishException("Already bootstrapped", null); } RuntimeBuilder runtimeBuilder = getRuntimeBuilder(bootstrapProperties, cl != null ? cl : GlassFishRuntime.class.getClassLoader()); me = runtimeBuilder.build(bootstrapProperties); return me; }
@Override public void undeploy(String appName, String... params) throws GlassFishException { String[] newParams = new String[params.length + 1]; System.arraycopy(params, 0, newParams, 0, params.length); newParams[params.length] = appName; CommandExecutorImpl executer = habitat.getComponent(CommandExecutorImpl.class); try { ActionReport actionReport = executer.executeCommand("undeploy", newParams); actionReport.writeReport(System.out); } catch (CommandException e) { throw new GlassFishException(e); } catch (IOException e) { throw new GlassFishException(e); } }
private GlassFishRuntime getGlassFishRuntime() throws GlassFishException { final ServiceReference reference = framework.getBundleContext().getServiceReference(GlassFishRuntime.class.getName()); if (reference != null) { GlassFishRuntime embeddedGfr = (GlassFishRuntime) framework.getBundleContext().getService(reference); return new OSGiGlassFishRuntime(embeddedGfr, framework); } throw new GlassFishException("No GlassFishRuntime available"); }
private GlassFishRuntime getGlassFishRuntime() throws GlassFishException { final ServiceReference reference = framework.getBundleContext().getServiceReference(GlassFishRuntime.class.getName()); if (reference != null) { GlassFishRuntime embeddedGfr = (GlassFishRuntime) framework.getBundleContext().getService(reference); return new OSGiGlassFishRuntime(embeddedGfr, framework); } throw new GlassFishException("No GlassFishRuntime available"); }
@Override public String deploy(InputStream is, String... params) throws GlassFishException { try { return deploy(createFile(is), params); } catch (IOException e) { throw new GlassFishException(e); } }