org.glassfish.embeddable.GlassFish.getService()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.glassfish.embeddable.GlassFish.getService()方法的一些代码示例,展示了GlassFish.getService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GlassFish.getService()方法的具体详情如下:
包路径:org.glassfish.embeddable.GlassFish
类名称:GlassFish
方法名:getService

GlassFish.getService介绍

[英]A service has a service interface and optionally a name. For a service which is just a class with no interface, then the service class is the service interface. This method is used to look up a service.
[中]服务具有服务接口和名称(可选)。对于只是一个没有接口的类的服务,那么服务类就是服务接口。此方法用于查找服务。

代码示例

代码示例来源:origin: org.glassfish.main.core/glassfish

@Override
public <T> T getService(Class<T> serviceType, String serviceName) throws GlassFishException {
  return decoratedGf.getService(serviceType, serviceName);
}

代码示例来源:origin: eclipse-ee4j/glassfish

@Override
public <T> T getService(Class<T> serviceType) throws GlassFishException {
  return decoratedGf.getService(serviceType);
}

代码示例来源:origin: eclipse-ee4j/glassfish

@Override
public <T> T getService(Class<T> serviceType, String serviceName) throws GlassFishException {
  return decoratedGf.getService(serviceType, serviceName);
}

代码示例来源:origin: org.glassfish.main.core/glassfish

@Override
public <T> T getService(Class<T> serviceType) throws GlassFishException {
  return decoratedGf.getService(serviceType);
}

代码示例来源:origin: com.java-adventures.junit/glassfish-junit-rule

public Deployer getDeployer() {
  try {
    return gf.get().getService(Deployer.class, null);
  } catch (Exception e) {
    log.error("GlassFish not ready, yet.", e);
    fail();
  }
  return null;
}

代码示例来源:origin: stackoverflow.com

//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);

代码示例来源:origin: org.glassfish.fighterfish/osgi-javaee-base

events = gf.getService(Events.class);
listener = new EventListener() {
  public void event(Event event) {

代码示例来源:origin: org.glassfish.main.ejb/ejb-container

/**
 * 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);
}

代码示例来源:origin: org.glassfish.ejb/ejb-container

/**
 * 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);
}

代码示例来源:origin: org.glassfish.main.core/glassfish

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);

代码示例来源:origin: eclipse-ee4j/glassfish

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);

代码示例来源:origin: org.glassfish.main.ejb/ejb-container

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) {

代码示例来源:origin: org.glassfish.ejb/ejb-container

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) {

代码示例来源:origin: org.jboss.arquillian.container/arquillian-glassfish-embedded-3.1

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()));
        }
      }
    }
  }
}

代码示例来源:origin: org.glassfish.common/internal-api

habitat = glassfish.getService(Habitat.class);
habitat.add(Inhabitants.create(this));
fileSystem = new ExistingSingletonInhabitant<EmbeddedFileSystem>(fs);

代码示例来源:origin: eclipse-ee4j/glassfish

habitat = glassfish.getService(ServiceLocator.class);
ServiceLocatorUtilities.addOneConstant(habitat, this);
fileSystem = habitat.getServiceHandle(

相关文章