org.glassfish.internal.deployment.Deployment类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(13.8k)|赞(0)|评价(0)|浏览(140)

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

Deployment介绍

[英]Deployment facility
[中]

代码示例

代码示例来源:origin: jersey/jersey

private ApplicationInfo getApplicationInfo(EjbContainerUtil ejbUtil) throws NamingException {
  ApplicationRegistry appRegistry = ejbUtil.getServices().getService(ApplicationRegistry.class);
  Applications applications = ejbUtil.getServices().getService(Applications.class);
  String appNamePrefix = (String) initialContext.lookup("java:app/AppName");
  Set<String> appNames = appRegistry.getAllApplicationNames();
  Set<String> disabledApps = new TreeSet<>();
  for (String appName : appNames) {
    if (appName.startsWith(appNamePrefix)) {
      Application appDesc = applications.getApplication(appName);
      if (appDesc != null && !ejbUtil.getDeployment().isAppEnabled(appDesc)) {
        // skip disabled version of the app
        disabledApps.add(appName);
      } else {
        return ejbUtil.getDeployment().get(appName);
      }
    }
  }
  // grab the latest one, there is no way to make
  // sure which one the user is actually enabling,
  // so use the best case, i.e. upgrade
  Iterator<String> it = disabledApps.iterator();
  String lastDisabledApp = null;
  while (it.hasNext()) {
    lastDisabledApp = it.next();
  }
  if (lastDisabledApp != null) {
    return ejbUtil.getDeployment().get(lastDisabledApp);
  }
  throw new NamingException("Application Information Not Found");
}

代码示例来源:origin: org.glassfish.deployment/deployment-admin

ArchiveHandler archiveHandler = deployment.getArchiveHandler(archive, type);
if (tracing!=null) {
  tracing.addMark(DeploymentTracing.Mark.ARCHIVE_HANDLER_OBTAINED);
boolean isRegistered = deployment.isRegistered(name);
isredeploy = isRegistered && force;
deployment.validateDeploymentTarget(target, name, isredeploy);
if (tracing!=null) {
  tracing.addMark(DeploymentTracing.Mark.TARGET_VALIDATED);
    deployment.getBuilder(logger, this, report).
        source(archive).archiveHandler(archiveHandler).build(initialContext);
if (tracing!=null) {
Transaction t = deployment.prepareAppConfigChanges(deploymentContext);
if (tracing!=null) {
  tracing.addMark(DeploymentTracing.Mark.DEPLOY);
  appInfo = deployment.deploy(deploymentContext);
} else {
  appInfo = deployment.deploy(deployment.prepareSniffersForOSGiDeployment(type, deploymentContext), deploymentContext);
    deployment.registerAppInDomainXML(appInfo, deploymentContext, t);
    suppInfo.setDeploymentContext(deploymentContext);
    deployment.undeploy(name, deploymentContext);
    deploymentContext.clean();
    throw e;

代码示例来源:origin: org.glassfish.deployment/deployment-admin

ArchiveHandler archiveHandler = deployment.getArchiveHandler(archive, type);
if (archiveHandler==null) {
  report.failure(logger,localStrings.getLocalString("deploy.unknownarchivetype","Archive type of {0} was not recognized",path.getName()));
ExtendedDeploymentContext deploymentContext = deployment.getBuilder(logger, this, report).source(archive).build();
  t = deployment.prepareAppConfigChanges(deploymentContext);
  appInfo = deployment.deploy(deploymentContext);
} else {
  appInfo = deployment.deploy(deployment.prepareSniffersForOSGiDeployment(type, deploymentContext), deploymentContext);
      deployment.registerAppInDomainXML(appInfo, deploymentContext, t, true);
    } else {
      deployment.registerAppInDomainXML(appInfo, deploymentContext, t);
    deployment.undeploy(name, deploymentContext);
    deploymentContext.clean();
    throw e;

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

deployment.validateDeploymentTarget(target, name, isredeploy);
if (tracing!=null) {
  tracing.addMark(DeploymentTracing.Mark.TARGET_VALIDATED);
    deployment.getBuilder(logger, this, report).
        source(initialContext.getSource()).archiveHandler(archiveHandler).build(initialContext);
if (tracing!=null) {
deploymentContext.addTransientAppMetaData(DeploymentProperties.PREVIOUS_ENABLED_ATTRIBUTES, previousEnabledAttributes);
Transaction t = deployment.prepareAppConfigChanges(deploymentContext);
if (tracing!=null) {
  tracing.addMark(DeploymentTracing.Mark.DEPLOY);
appInfo = deployment.deploy(deploymentContext);
    deployment.registerAppInDomainXML(appInfo, deploymentContext, t);
    if (tracing!=null) {
      tracing.addMark(DeploymentTracing.Mark.REGISTRATION);
    deployment.undeploy(name, deploymentContext);
    deploymentContext.clean();
    throw e;

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

if (deployment.isAppEnabled(systemApp) || loadAppOnDAS(systemApp.getName())) {
   Integer order = appOrderInfoMap.get(systemApp.getName());
   ApplicationOrderInfo info = new ApplicationOrderInfo(systemApp, order);
if (deployment.isAppEnabled(standaloneAdapter) || loadAppOnDAS(standaloneAdapter.getName())) {
 DeploymentOrder.addApplicationDeployment(new ApplicationOrderInfo(standaloneAdapter, appOrderInfoMap.get(standaloneAdapter.getName()).intValue()));
if (deployment.isAppEnabled(app) || loadAppOnDAS(app.getName())) {
 DeploymentOrder.addApplicationDeployment(new ApplicationOrderInfo(app, appOrderInfoMap.get(app.getName()).intValue()));
        ArchiveHandler handler = deployment.getArchiveHandler(sourceArchive);
        final String appName = handler.getDefaultApplicationName(sourceArchive);
        DeploymentContextImpl dummyContext = new DeploymentContextImpl(report, logger, sourceArchive, parameters, env);
    ExtendedDeploymentContext depContext = deployment.getBuilder(logger, parameters, report).source(sourceArchive).build();
    ApplicationInfo appInfo = deployment.deploy(depContext);
    if (appInfo==null) {

代码示例来源:origin: org.glassfish.deployment/deployment-admin

if (!deployment.isRegistered(name)) {
  report.setMessage(localStrings.getLocalString("application.notreg", "Application {0} not registered", name));
  report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        deployment.getBuilder(logger, commandParams, report).source(archive).build();
      deployment.deploy(deployment.getSniffersFromApp(app), deploymentContext);
    } else {
      ActionReport.ExitCode.SUCCESS)) {
      try {
        deployment.registerAppInDomainXML(null, deploymentContext, t, true);
      } catch(TransactionFailure e) {
        logger.warning("failed to create application ref for " + appName);
        deployment.prepareInstanceDeployParamMap(deploymentContext);
    final List<String> targets =
        new ArrayList<String>(Arrays.asList(commandParams.target.split(",")));

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

private void deployMEJB() throws IOException {
    _logger.info("Loading MEJB app on JNDI look up");
    ServerContext serverContext = habitat.getService(ServerContext.class);
    File mejbArchive = new File(serverContext.getInstallRoot(),
        "lib/install/applications/mejb.jar");
    DeployCommandParameters deployParams =
        new DeployCommandParameters(mejbArchive);
    String targetName = habitat.<Server>getService(Server.class, ServerEnvironment.DEFAULT_INSTANCE_NAME).getName();
    deployParams.target = targetName;
    deployParams.name = "mejb";
    ActionReport report = habitat.getService(ActionReport.class, "plain");
    Deployment deployment = habitat.getService(Deployment.class);
    ExtendedDeploymentContext dc = deployment.getBuilder(_logger, deployParams, report).source(mejbArchive).build();
    deployment.deploy(dc);

    if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) {
      throw new RuntimeException("Failed to deploy MEJB app: " +
          report.getFailureCause());
    }
  }
}

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

private void deployEJBTimerService(String target) {
  synchronized (lock) {
    Deployment deployment = habitat.getByContract(Deployment.class);
    boolean isRegistered = deployment.isRegistered(EjbContainerUtil.TIMER_SERVICE_APP_NAME);
            ExtendedDeploymentContext dc = deployment.getBuilder(
                _logger, params, report).source(app).build();
            dc.addTransientAppMetaData(DatabaseConstants.JTA_DATASOURCE_JNDI_NAME_OVERRIDE, resourceName);
            appProps.setProperty(ServerTags.OBJECT_TYPE, DeploymentProperties.SYSTEM_ALL);
            deployment.deploy(dc);

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

ArchiveHandler archiveHandler = null;
try {
  archiveHandler = deployment.getArchiveHandler(archive);
} catch (IOException e) {
  throw new RuntimeException(e);
  context = deployment.getBuilder(logger, params, report).source(archive).archiveHandler(archiveHandler).build(initialContext);
} catch (IOException e) {
  throw new RuntimeException(e);
  appInfo = deployment.deploy(context);
} catch(Exception e) {
  logger.log(Level.SEVERE, KernelLoggerInfo.deployException, e);

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

deploymentParams.target = deployment.getDefaultTarget(appName, deploymentParams.origin, deploymentParams._classicstyle);
ExtendedDeploymentContext depContext = deployment.getBuilder(logger, deploymentParams, report).source(archive).build();
if (tracing!=null) {
  depContext.addModuleMetaData(tracing);
deployment.deploy(deployment.getSniffersFromApp(app), depContext);
loadApplicationForTenants(app, appRef, report);
if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) {

代码示例来源:origin: org.glassfish.deployment/deployment-admin

deployment.unregisterAppFromDomainXML(appName, target, true);
} catch(Exception e) {
  report.failure(logger, e.getMessage());
ApplicationInfo appInfo = deployment.get(appName);
if (appInfo != null) {
  source = appInfo.getSource();
    deployment.getBuilder(logger, commandParams, report).source(source).build();
deploymentContext.getAppProps().putAll(
  application.getDeployProperties());
  deployment.unload(appInfo, deploymentContext);
      deployment.undeploy(appName, deploymentContext);
      deploymentContext.clean();
      if (!Boolean.valueOf(application.getDirectoryDeployed()) && source.exists()) {
        FileUtils.whack(new File(source.getURI()));
      deployment.unregisterAppFromDomainXML(appName, target);
    } else {
      deployment.unregisterAppFromDomainXML(appName, target, true);

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

deployment.getBuilder(KernelLoggerInfo.getLogger(), commandParams, subReport).source(archive).build();
  deploymentContext.setModulePropsMap(app.getModulePropertiesMap());
  deploymentContext.setTenant(tenant.getTenant(), app.getName());
  deployment.deploy(deployment.getSniffersFromApp(app), deploymentContext);
} else {
  logger.log(Level.SEVERE, KernelLoggerInfo.notFoundInOriginalLocation, app.getLocation());

代码示例来源:origin: org.glassfish.deployment/deployment-admin

String appName = (String)it.next();
ApplicationInfo info = deployment.get(appName);
deployment.validateUndeploymentTarget(target, appName);
    deployment.unregisterAppFromDomainXML(appName, target);
  } catch(TransactionFailure e) {
    logger.warning("Module " + appName + " not found in configuration");
    deployment.unregisterAppFromDomainXML(appName, target);
  } catch(TransactionFailure e) {
    logger.warning("Module " + appName + " not found in configuration");
  deploymentContext = deployment.getBuilder(logger, this, report).source(source).build();
} catch (IOException e) {
  logger.log(Level.SEVERE, "Cannot create context for undeployment ", e);
  deployment.undeploy(appName, deploymentContext);
    deployment.unregisterAppFromDomainXML(appName, target);
  } catch(TransactionFailure e) {
    logger.warning("Module " + appName + " not found in configuration");

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

ApplicationInfo appInfo  = info!=null?info.appInfo:null;
if (appInfo==null) {
  appInfo = deployment.get(name);
  deploymentContext = deployment.getBuilder(logger, params, report).source(source).build();
deployment.undeploy(name, deploymentContext);

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

try {
  deployment.validateSpecifiedTarget(target);
  archiveHandler = deployment.getArchiveHandler(archive, type);
  if (tracing!=null) {
    tracing.addMark(DeploymentTracing.Mark.ARCHIVE_HANDLER_OBTAINED);
    target = deployment.getDefaultTarget(name, origin, _classicstyle);
  boolean isRegistered = deployment.isRegistered(name);
  isredeploy = isRegistered && force;
  return true;

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

try
  appInfo = deployer.deploy(dc);
  if (appInfo != null)

代码示例来源:origin: org.glassfish.deployment/deployment-admin

if (!deployment.isRegistered(appName)) {
    if (env.isDas()) {
ApplicationInfo appInfo = deployment.get(appName);
if (env.isDas()) {
  try {
  if (!isundeploy) {
    try {
      deployment.updateAppEnabledAttributeInDomainXML(appName, target, false);
    } catch(TransactionFailure e) {
      logger.warning("failed to set enable attribute for " + appName);
  this.name = appName;
  deployment.disable(this, app, appInfo, report, logger);
} catch (Exception e) {
  logger.log(Level.SEVERE, "Error during disabling: ", e);
  if (!isundeploy && !report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
    try {
      deployment.updateAppEnabledAttributeInDomainXML(appName, target, false);
    } catch(TransactionFailure e) {
      logger.warning("failed to set enable attribute for " + appName);

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

parameters.origin = UndeployCommandParameters.Origin.unload;
parameters.target = server.getName();
ApplicationInfo appInfo = deployment.get(parameters.name);
if (appInfo == null) {
  continue;
  ExtendedDeploymentContext deploymentContext = deployment.getBuilder(KernelLoggerInfo.getLogger(), parameters, subReport).source(appInfo.getSource()).build();
  deployment.unload(appInfo, deploymentContext);

代码示例来源:origin: org.glassfish.main.concurrent/concurrent-impl

private boolean isApplicationEnabled(String appId) {
  if (appId != null) {
    Application app = applications.getApplication(appId);
    if (app != null)
      return deployment.isAppEnabled(app);
  }
  return false;
}

代码示例来源:origin: org.glassfish.deployment/deployment-admin

private void validateTarget(String target, String name) {
    List<String> referencedTargets = domain.getAllReferencedTargetsForApplication(name);
    if (referencedTargets.isEmpty()) {
      if (deployment.isRegistered(name)) {
        throw new IllegalArgumentException(localStrings.getLocalString("lifecycle.use.create_app_ref_2", "Lifecycle module {0} is already created in this domain. Please use create application ref to create application reference on target {1}", name, target));
      }
    } else {
      if (referencedTargets.contains(target)) {
        throw new IllegalArgumentException(localStrings.getLocalString("lifecycle.alreadyreg", "Lifecycle module {0} is already created on this target {1}", name, target));
      } else {
        throw new IllegalArgumentException(localStrings.getLocalString("lifecycle.use.create_app_ref", "Lifecycle module {0} is already referenced by other target(s). Please use create application ref to create application reference on target {1}", name, target));
      }
    }
  }
}

相关文章