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

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

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

GlassFish.getDeployer介绍

[英]Gets a Deployer instance to deploy an application. Each invocation of this method returns a new Deployer object. Calling this method is equivalent to calling getService(Deployer.class, null)
[中]获取部署应用程序的部署器实例。此方法的每次调用都会返回一个新的Deployer对象。调用此方法相当于调用getService(Deployer.class, null)

代码示例

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

@Override
public Deployer getDeployer() throws GlassFishException {
  return decoratedGf.getDeployer();
}

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

@Override
public Deployer getDeployer() throws GlassFishException {
  return decoratedGf.getDeployer();
}

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

/**
 * Undeploys all deployed modules in reverse order.
 */
private void undeployModules() {
  try {
    Deployer deployer = glassFish.getDeployer();
    while (!deployed.isEmpty()) {
      String applicationName = deployed.pop();
      deployer.undeploy(applicationName);
    }
  }
  catch (GlassFishException exc) {
    throw new TestContainerException(exc);
  }
}

代码示例来源:origin: fujitsu/launcher

private void launch() {
  try {
    GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(glassfishProperties);
    glassfish.start();
    glassfish.getDeployer().deploy(new File(inputWar), deployProperties.getDeployOptions());
  } catch (Throwable th) {
    Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Server was stopped.", th);
    System.exit(1);
  }
}

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

String port = System.getenv("PORT");
GlassFishProperties gfProps = new GlassFishProperties();
gfProps.setPort("http-listener", Integer.parseInt(port));
GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
glassfish.start();          
Deployer deployer = glassfish.getDeployer();            
File file = new File("YourSimpleMavenWebapplication.war");      
deployer.deploy(file);

代码示例来源:origin: com.googlecode.jeeunit/jeeunit-glassfish

private void deployWar(URI warUri) throws GlassFishException {
  Deployer deployer = glassFish.getDeployer();
  String appName = deployer.deploy(warUri, 
      "--name", getApplicationName(),
      "--contextroot", getContextRoot());
  if (! getApplicationName().equals(appName)) {
    throw new RuntimeException("error deploying WAR");
  }
}

代码示例来源:origin: fujitsu/launcher

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

代码示例来源:origin: com.googlecode.jeeunit/jeeunit-glassfish

private void shutdownInternal() throws GlassFishException {
  if (glassFish != null) {
    glassFish.getDeployer().undeploy(getApplicationName());
    glassFish.stop();
    glassFish = null;
  }
}

代码示例来源: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: ops4j/org.ops4j.pax.exam2

Deployer deployer = glassFish.getDeployer();

代码示例来源:origin: ops4j/org.ops4j.pax.exam2

contextRoot = applicationName;
Deployer deployer = glassFish.getDeployer();
deployer.deploy(uri, "--name", applicationName, "--contextroot", applicationName);
deployed.push(applicationName);

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

public void undeploy(Archive<?> archive) throws DeploymentException {
  try {
    glassfish.getDeployer().undeploy(createDeploymentName(archive.getName()));
  } catch (Exception e) {
    throw new DeploymentException("Could not undeploy " + archive.getName(), e);
  }
}

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

glassFish.start();
deployer = glassFish.getDeployer();
ScatteredArchive archive = new ScatteredArchive("glassfish-ejb-validation", Type.JAR);
archive.addClassPath(new File("target", "classes"));

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

public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
  String deploymentName = createDeploymentName(archive.getName());
  try {
    URL deploymentUrl = ShrinkWrapUtil.toURL(archive);
    glassfish.getDeployer().deploy(deploymentUrl.toURI(), "--name", deploymentName);
  } catch (Exception e) {
    throw new DeploymentException("Could not deploy " + archive.getName(), e);
  }
  try {
    HTTPContext httpContext = new HTTPContext(ADDRESS, bindHttpPort);
    findServlets(httpContext, resolveWebArchiveNames(archive));
    return new ProtocolMetaData()
      .addContext(httpContext);
  } catch (GlassFishException e) {
    throw new DeploymentException("Could not probe GlassFish embedded for environment", e);
  }
}

相关文章