com.sun.enterprise.deployment.Application.getModuleByUri()方法的使用及代码示例

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

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

Application.getModuleByUri介绍

[英]Lookup module by uri.
[中]通过uri查找模块。

代码示例

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

/**
 * Get a target bundle descriptor based on an input bundle descriptor and
 * a relative uri from the perspective of the input bundle descriptor.
 *
 * @param origin            bundle descriptor within this application
 * @param relativeTargetUri relative uri from the given bundle descriptor
 *                          to another bundle within the application.
 * @return target BundleDescriptor or null if not found.
 */
public BundleDescriptor getRelativeBundle(BundleDescriptor origin,
                     String relativeTargetUri) {
  String targetBundleUri = getTargetUri(origin, relativeTargetUri);
  BundleDescriptor targetBundle = null;
  if (targetBundleUri != null) {
    targetBundle = getModuleByUri(targetBundleUri);
  }
  return targetBundle;
}

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

/**
 * Get a target bundle descriptor based on an input bundle descriptor and
 * a relative uri from the perspective of the input bundle descriptor.
 *
 * @param origin            bundle descriptor within this application
 * @param relativeTargetUri relative uri from the given bundle descriptor
 *                          to another bundle within the application.
 * @return target BundleDescriptor or null if not found.
 */
public BundleDescriptor getRelativeBundle(BundleDescriptor origin,
                     String relativeTargetUri) {
  String targetBundleUri = getTargetUri(origin, relativeTargetUri);
  BundleDescriptor targetBundle = null;
  if (targetBundleUri != null) {
    Descriptor module = getModuleByUri(targetBundleUri);
    targetBundle = (module instanceof BundleDescriptor) ?
        (BundleDescriptor) module : null;
  }
  return targetBundle;
}

代码示例来源:origin: org.glassfish.main.deployment/deployment-javaee-full

@Override
  public <T> T getModuleMetaData(Class<T> metadataType) {
    try {
      return metadataType.cast(application.getModuleByUri(moduleUri));
    } catch (Exception e) {
      // let's first try the extensions mechanisms...
      if (RootDeploymentDescriptor.class.isAssignableFrom(metadataType)) {
        for (RootDeploymentDescriptor extension  : application.getModuleByUri(moduleUri).getExtensionsDescriptors((Class<RootDeploymentDescriptor>) metadataType)) {
          // we assume there can only be one type of
          if (extension!=null) {
            try {
              return metadataType.cast(extension);
            } catch (Exception e1) {
              // next one...
            }
          }
        }
        
      }
      return context.getModuleMetaData(metadataType);
    }
  }
};

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

public static BundleDescriptor getCurrentBundleForContext(
  DeploymentContext context) {
  ExtendedDeploymentContext ctx = (ExtendedDeploymentContext)context;
  Application application = context.getModuleMetaData(Application.class);
  if (application == null) return null; // this can happen for non-JavaEE type deployment. e.g., issue 15869
  if (ctx.getParentContext() == null) {
    if (application.isVirtual()) {
      // standalone module
      return application.getStandaloneBundleDescriptor();
    } else {
      // top level 
      return application;
    }
  } else {
    // a sub module of ear
    return application.getModuleByUri(ctx.getModuleUri());
  }
}

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

public static BundleDescriptor getCurrentBundleForContext(
    DeploymentContext context) {
    ExtendedDeploymentContext ctx = (ExtendedDeploymentContext)context;
    Application application = context.getModuleMetaData(Application.class);
    if (application == null) return null; // this can happen for non-JavaEE type deployment. e.g., issue 15869
    if (ctx.getParentContext() == null) {
      if (application.isVirtual()) {
        // standalone module
        return application.getStandaloneBundleDescriptor();
      } else {
        // top level 
        return application;
      }
    } else {
      // a sub module of ear
      return application.getModuleByUri(ctx.getModuleUri());
    }
  }
}

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

subComponents = getAppLevelComponents(app, type, subComponentsMap);
} else {
  BundleDescriptor bundleDesc = app.getModuleByUri(modulename);
  if (bundleDesc == null) {
    report.setMessage(localStrings.getLocalString("listsubcomponents.invalidmodulename", "Invalid module name", appname, modulename));

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

/**
   * Entry point from the framework into the command execution
   * @param context context for the command.
   */
  public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();

    ActionReport.MessagePart part = report.getTopMessagePart();

    ApplicationInfo appInfo = appRegistry.get(appname);
    if (appInfo != null) {
      Application app = appInfo.getMetaData(Application.class);
      if (app != null) {
        BundleDescriptor bundleDesc = app.getModuleByUri(modulename);
        if (bundleDesc != null &&
          bundleDesc instanceof WebBundleDescriptor) {
          String contextRoot = ((WebBundleDescriptor)bundleDesc).getContextRoot();
          part.addProperty(DeploymentProperties.CONTEXT_ROOT, contextRoot);
          part.setMessage(contextRoot);
        }
      }
    }
  }
}

代码示例来源:origin: org.glassfish.main.deployment/deployment-javaee-full

public ModuleInfo doBundle(ModuleDescriptor bundle) throws Exception {
  ExtendedDeploymentContext sContext = subContext(application, context, bundle.getArchiveUri());
  ModuleInfo info = prepareBundle(bundle, application, 
    sContext);
  if (info == null) {
    sContext.getActionReport().setActionExitCode(ActionReport.ExitCode.WARNING);
    String msg = localStrings.getLocalString("skipmoduleprocessing", "Skipped processing for module {0} as its module type was not recognized", bundle.getArchiveUri());
    sContext.getActionReport().setMessage(msg);
    deplLogger.log(Level.WARNING,
            UNRECOGNIZED_MODULE_TYPE,
            bundle.getArchiveUri());
    return null;
  }
  info.addMetaData(application);
  BundleDescriptor bundleDesc = application.getModuleByUri(
    bundle.getArchiveUri());
  info.addMetaData(bundleDesc);
  for (RootDeploymentDescriptor ext : 
    bundleDesc.getExtensionsDescriptors()) {
    info.addMetaData(ext);
  }
  appInfo.addModule(info);
  return info;
}

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

BundleDescriptor refereeJar = null;
if( referringJar instanceof Application ) {
  refereeJar = ((Application)referringJar).getModuleByUri(jarPath);
} else {
 refereeJar =

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

BundleDescriptor refereeJar = null;
if( referringJar instanceof Application ) {
  refereeJar = ((Application)referringJar).getModuleByUri(jarPath);
} else {
 refereeJar =

相关文章

微信公众号

最新文章

更多

Application类方法