protected synchronized static void shutdownInternal() throws GlassFishException { if (me == null) { throw new GlassFishException("Already shutdown", null); } me = null; }
protected synchronized static void shutdownInternal() throws GlassFishException { if (me == null) { throw new GlassFishException("Already shutdown", null); } me = null; }
/** * 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; }
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); } }
@Override public String deploy(URI archive, String... params) throws GlassFishException { File file; try { file = convertToFile(archive); } catch (IOException e) { throw new GlassFishException("Unable to make a file out of " + archive, e); } return deploy(file, params); }
@Override public String deploy(InputStream is, String... params) throws GlassFishException { try { return deploy(createFile(is), params); } catch (IOException e) { throw new GlassFishException(e); } }
@Override public String deploy(URI archive, String... params) throws GlassFishException { File file; try { file = convertToFile(archive); } catch (IOException e) { throw new GlassFishException("Unable to make a file out of " + archive, e); } return deploy(file, params); }
@Override public Collection<String> getDeployedApplications() throws GlassFishException { try { CommandExecutorImpl executer = habitat.getService(CommandExecutorImpl.class); ActionReport report = executer.executeCommand("list-components"); Properties props = report.getTopMessagePart().getProps(); return new ArrayList<String>(props.stringPropertyNames()); } catch (Exception e) { throw new GlassFishException(e); } }
@Override public Collection<String> getDeployedApplications() throws GlassFishException { try { CommandExecutorImpl executer = habitat.getComponent(CommandExecutorImpl.class); ActionReport report = executer.executeCommand("list-components"); Properties props = report.getTopMessagePart().getProps(); return new ArrayList<String>(props.stringPropertyNames()); } catch (Exception e) { throw new GlassFishException(e); } }
/** * Stops the given <tt>context</tt> and removes it from this * <tt>VirtualServer</tt>. */ public void removeContext(Context context) throws GlassFishException { try { Deployer deployer = Globals.getDefaultHabitat().getComponent(Deployer.class); deployer.undeploy(context.getContextPath()); } catch (Exception ex) { throw new GlassFishException(new ConfigException( "Context with context path " + context.getContextPath() + " cannot be removed from virtual server " + getID())); } }