@Override public <T> T getService(Class<T> serviceType, String serviceName) throws GlassFishException { return decoratedGf.getService(serviceType, serviceName); }
@Override public <T> T getService(Class<T> serviceType) throws GlassFishException { return decoratedGf.getService(serviceType); }
@Override public <T> T getService(Class<T> serviceType, String serviceName) throws GlassFishException { return decoratedGf.getService(serviceType, serviceName); }
@Override public <T> T getService(Class<T> serviceType) throws GlassFishException { return decoratedGf.getService(serviceType); }
public Deployer getDeployer() { try { return gf.get().getService(Deployer.class, null); } catch (Exception e) { log.error("GlassFish not ready, yet.", e); fail(); } return null; }
//Start GF GlassFishRuntime gfRuntime = GlassFishRuntime.bootstrap(); GlassFish gf = gfRuntime.newGlassFish(); gf.start(); //Deploy application with EJBs Deployer deployer = gf.getService(Deployer.class); String deployedApp = deployer.deploy(new File(...), "--force=true"); //Create InitialContext Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory"); props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming"); props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"); props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); InitialContext ic = new InitialContext(props); //Lookup EJBs ic.lookup(...) //Stop GF gf.stop(); gfRuntime.shutdown(); //CORBA stuck thread, have to kill it manually System.exit(0);
events = gf.getService(Events.class); listener = new EventListener() { public void event(Event event) {
/** * Construct new EJBContainerImpl instance */ EJBContainerImpl(GlassFish server) throws GlassFishException { this.server = server; this.server.start(); this.habitat = server.getService(ServiceLocator.class); deployer = server.getDeployer(); state = RUNNING; cleanup = new Cleanup(this); }
/** * Construct new EJBContainerImpl instance */ EJBContainerImpl(GlassFish server) throws GlassFishException { this.server = server; this.server.start(); this.habitat = server.getService(Habitat.class); deployer = server.getDeployer(); state = RUNNING; cleanup = new Cleanup(this); }
continue; Deployer deployer = gf.getService(Deployer.class, null); String[] tokens = command.split("\\s"); if (tokens.length < 2) { continue; Deployer deployer = gf.getService(Deployer.class, null); String name = command.substring(command.indexOf(" ")).trim(); deployer.undeploy(name);
continue; Deployer deployer = gf.getService(Deployer.class, null); String[] tokens = command.split("\\s"); if (tokens.length < 2) { continue; Deployer deployer = gf.getService(Deployer.class, null); String name = command.substring(command.indexOf(" ")).trim(); deployer.undeploy(name);
EmbeddedSecurity es = server.getService(EmbeddedSecurity.class); ServiceLocator habitat = server.getService(ServiceLocator.class); archiveFactory = server.getService(ArchiveFactory.class); Sniffer sniffer = server.getService(Sniffer.class, "Ejb"); ejbAnnotations = sniffer.getAnnotationTypes(); } catch (Exception e) {
EmbeddedSecurity es = server.getService(EmbeddedSecurity.class); Habitat habitat = server.getService(Habitat.class); archiveFactory = server.getService(ArchiveFactory.class); Sniffer sniffer = server.getService(Sniffer.class, "Ejb"); ejbAnnotations = sniffer.getAnnotationTypes(); } catch (Exception e) {
public void findServlets(HTTPContext httpContext, String[] webArchiveNames) throws GlassFishException { WebContainer webContainer = glassfish.getService(WebContainer.class); for (String deploymentName : webArchiveNames) { for (VirtualServer server : webContainer.getVirtualServers()) { WebModule webModule = null; for (Context serverContext : server.getContexts()) { if (serverContext instanceof WebModule) { if (((WebModule) serverContext).getID().startsWith(deploymentName)) { webModule = (WebModule) serverContext; } } } if (webModule == null) { if (server instanceof com.sun.enterprise.web.VirtualServer) { Container child = ((com.sun.enterprise.web.VirtualServer) server).findChild("/" + deploymentName); if (child instanceof WebModule) { webModule = (WebModule) child; } } } if (webModule != null) { for (Map.Entry<String, ? extends ServletRegistration> servletRegistration : webModule.getServletRegistrations() .entrySet()) { httpContext.add(new Servlet(servletRegistration.getKey(), webModule.getContextPath())); } } } } }
habitat = glassfish.getService(Habitat.class); habitat.add(Inhabitants.create(this)); fileSystem = new ExistingSingletonInhabitant<EmbeddedFileSystem>(fs);
habitat = glassfish.getService(ServiceLocator.class); ServiceLocatorUtilities.addOneConstant(habitat, this); fileSystem = habitat.getServiceHandle(