org.apache.geronimo.j2ee.deployment.Module类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(16.0k)|赞(0)|评价(0)|浏览(114)

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

Module介绍

暂无

代码示例

代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb-builder

installModule(module, earContext);
EARContext moduleContext;
if (module.isStandAlone()) {
  moduleContext = earContext;
  earContext.addToClassPath(DEFAULT_BUNDLE_CLASSPATH);
module.setEarContext(moduleContext);
module.setRootEarContext(earContext);
if (((EjbModule) module).getEjbJar().getAssemblyDescriptor() != null) {
  namingBuilder.buildEnvironment(null, null, module.getEnvironment());
LinkedHashSet<Module<?,?>> modules = module.getModules();
for (Module<?,?> subModule: modules) {
  if (subModule instanceof EjbModule)  {
    subModule.setEarContext(module.getEarContext());
    subModule.setRootEarContext(module.getRootEarContext());
      earContext = module.getEarContext();

代码示例来源:origin: org.apache.geronimo.modules/geronimo-concurrent-builder

private ResourceReferenceFactory buildManagedObjectReference(Module module, AbstractNameQuery containerId, Class iface) throws DeploymentException {
  Configuration localConfiguration = module.getEarContext().getConfiguration();
  try {
    // first, lookup in configuration
    localConfiguration.findGBean(containerId);
  } catch (GBeanNotFoundException e) {
    // second, lookup in kernel
    Set results = this.kernel.listGBeans(containerId);
    if (results == null || results.isEmpty()) {
      throw new DeploymentException("Cannot resolve managed object ref " + containerId);
    } else if (results.size() > 1) {
      throw new DeploymentException("Managed object ref resolved to multiple results " + containerId);
    }
  }
  return new ResourceReferenceFactory(module.getConfigId(), containerId, iface, module.getModuleName());
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat-builder

public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
    WebAppType webApp = (WebAppType) module.getSpecDD();
//        MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
    TomcatWebAppType gerWebApp = (TomcatWebAppType) module.getVendorDD();
//        GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();

//        ENCConfigBuilder.registerMessageDestinations(earContext, module.getName(), messageDestinations, gerMessageDestinations);
    getNamingBuilders().initContext(webApp, gerWebApp, module.getEarContext().getConfiguration(), earContext.getConfiguration(), module);
    if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
        !gerWebApp.isSetSecurityRealmName()) {
      throw new DeploymentException("web.xml for web app " + module.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
    }
    boolean hasSecurityRealmName = gerWebApp.isSetSecurityRealmName();
    buildSubstitutionGroups(gerWebApp, hasSecurityRealmName, module, earContext);
  }

代码示例来源:origin: org.apache.geronimo.modules/geronimo-web-2.5-builder

protected static Map<JndiKey, Map<String, Object>> shareJndi(Module parent) {
  return Module.share(Module.APP, parent == null ? null : parent.getJndiContext());
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-jaxws-builder

protected Set<String> getEJBWebServiceClassNames(Module module) {
  if (module.getModules().size() == 0) {
    return Collections.<String> emptySet();
  }
  Set<String> ejbWebServiceClassNames = new HashSet<String>();
  for (Module subModule : (LinkedHashSet<Module<?, ?>>) module.getModules()) {
    if (subModule.getType() == ConfigurationModuleType.EJB) {
      Set<String> currentEJBWebServiceClassNames = (Set<String>) subModule.getSharedContext().get(EJB_WEB_SERVICE_CLASS_NAMES);
      if (ejbWebServiceClassNames != null) {
        ejbWebServiceClassNames.addAll(currentEJBWebServiceClassNames);
      }
    }
  }
  return ejbWebServiceClassNames;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-jaxws-builder

public static void getModuleClasspath(Module module, DeploymentContext context, LinkedHashSet<URL> classpath) throws Exception {
  getModuleClasspath(module.getEarContext(), classpath);
  if (module.getRootEarContext() != module.getEarContext()) {
    getModuleClasspath(module.getRootEarContext(), classpath);
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6

AbstractName validatorName = module.getEarContext().getNaming().createChildName(module.getModuleName(), "ValidatorFactory", NameFactory.VALIDATOR_FACTORY);
connector = mergeMetadata(bundle, classFinder, connector);
addExportPackages(connector, module.getEnvironment(), bundle);
AbstractName resourceAdapterjsr77Name = earContext.getNaming().createChildName(resourceAdapterModuleName, module.getName(), NameFactory.RESOURCE_ADAPTER);
AbstractName jcaResourcejsr77Name = earContext.getNaming().createChildName(resourceAdapterjsr77Name, module.getName(), NameFactory.JCA_RESOURCE);
resourceAdapterModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
resourceAdapterModuleData.setAttribute("displayName", connector.getDisplayName());
resourceAdapterModuleData.setAttribute("description", connector.getDescription());
GerConnectorType geronimoConnector = (GerConnectorType) module.getVendorDD();

代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6

public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> sharedContext) throws DeploymentException {
  if ((module != null) && (module.getClassFinder() != null)) {
      ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), ResourceRefProcessor.INSTANCE);
      log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
  Map<String, GerResourceRefType> refMap = mapResourceRefs(gerResourceRefsUntyped);
  List<String> unresolvedRefs = new ArrayList<String>();
  Bundle bundle = module.getEarContext().getDeploymentBundle();
  for (Map.Entry<String, ResourceRef> entry : specDD.getResourceRefMap().entrySet()) {
    String name = entry.getKey();
      unresolvedRefs.add(name);
    } else {
      put(name, value, ReferenceType.RESOURCE, module.getJndiContext(), resourceRef.getInjectionTarget(), sharedContext);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-persistence-jpa20-builder

AbstractName childName = module.getEarContext().getNaming().createChildName(module.getModuleName(), persistenceUnitName, NameFactory.PERSISTENCE_UNIT);
persistenceUnitNameQuery = new AbstractNameQuery(null, childName.getName(), PERSISTENCE_UNIT_INTERFACE_TYPES);
try {

代码示例来源:origin: org.apache.geronimo.modules/geronimo-persistence-jpa20-builder

public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
  if (module.getDeployable() instanceof DeployableBundle) {
    return;
  XmlObject container = (XmlObject) module.getVendorDD();
  XmlObject[] raws = container.selectChildren(PERSISTENCE_QNAME);
    if (!module.isStandAlone() && module.getType() == ConfigurationModuleType.WAR) {
      resolveWARcp = true;
    final Collection<String> manifestcp = module.getClassPath();
    for (String classpath : manifestcp) {
      if (resolveWARcp) {
        manifestcpCopy.add(module.resolve(classpath).toString());
      } else {
        manifestcpCopy.add(classpath);
    if (module.isStandAlone() && module.getType() == ConfigurationModuleType.EJB) {
      manifestcpCopy.add("");
      EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
    GBeanData data = installPersistenceUnitGBean(persistenceUnit, module, module.getTargetPath());
    respectExcludeUnlistedClasses(data);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-j2ee-builder

Map<JndiKey, Map<String, Object>> jndiContext = Module.share(Module.APP, module.getJndiContext());
ApplicationInfo applicationInfo = new ApplicationInfo(module.getType(),
    module.getEnvironment(),
    module.getModuleName(),
    module.getName(),
    jarFile,
    null,

代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6

AbstractNameQuery transactionManager = module.getEarContext().getTransactionManagerName();
if (transactionManager != null) {
  Set<AbstractNameQuery> query = new HashSet<AbstractNameQuery>();
  query.add(transactionManager);
  GBeanReference transactionManagerRef = new GBeanReference(module.getConfigId(), query, TransactionManager.class);
  put("java:comp/TransactionManager", transactionManagerRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
  GBeanReference transactionSynchronizationRef = new GBeanReference(module.getConfigId(), query, TransactionSynchronizationRegistry.class);
  put("java:comp/TransactionSynchronizationRegistry", transactionSynchronizationRef, ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
put("java:comp/Bundle", new BundleReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptySet(), sharedContext);
put("java:comp/BundleContext", new BundleContextReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget> emptySet(), sharedContext);
Map<String, Map<String, GerMessageDestinationType>> messageDestinations = module.getRootEarContext().getMessageDestinations();
if (module.getClassFinder() != null) {
    ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), new AdminObjectRefProcessor(refMap, messageDestinations, module.getEarContext()));
    log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
Bundle bundle = module.getEarContext().getDeploymentBundle();
for (Map.Entry<String, ResourceEnvRef> entry : specDD.getResourceEnvRefMap().entrySet()) {
  String name = entry.getKey();
    unresolvedRefs.add(name);
  } else {
    put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), resourceEnvRef.getInjectionTarget(), sharedContext);
    put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), messageDestinationRef.getInjectionTarget(), sharedContext);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder

public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
  if ((module != null) && (module.getClassFinder() != null)) {
      ResourceAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder(), ResourceRefProcessor.INSTANCE);
      log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
  Map refMap = mapResourceRefs(gerResourceRefsUntyped);
  List unresolvedRefs = new ArrayList();
  ClassLoader cl = module.getEarContext().getClassLoader();                
  for (ResourceRefType resourceRef : resourceRefsUntyped) {
    String name = resourceRef.getResRefName().getStringValue().trim();
        Artifact[] moduleId = module.getConfigId();
        Map context = getJndiContextMap(componentContext);
        context.put(ENV + name, new ORBReference(moduleId, corbaName));
        unresolvedRefs.remove(name);
        EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), corbaEnvironment);
        AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, null, gerResourceRef);
        module.getEarContext().findGBean(containerId);
        Object ref = new ResourceReferenceFactory<ResourceException>(module.getConfigId(), containerId, iface);
        getJndiContextMap(componentContext).put(ENV + name, ref);
        for (Dependency dependency : module.getEnvironment().getDependencies()) {
          errorMessage.append(dependency).append("\n");

代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty6-builder

public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
  EARContext moduleContext = module.getEarContext();
  AbstractName moduleName = moduleContext.getModuleName();
  WebModule webModule = (WebModule) module;
      module.setOriginalSpecDD(module.getSpecDD().toString());
    webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
    if (!module.isStandAlone()) {
      ConfigurationData moduleConfigurationData = moduleContext.getConfigurationData();
      earContext.addChildConfiguration(module.getTargetPath(), moduleConfigurationData);
    throw new DeploymentException("Unable to initialize webapp GBean for " + module.getName(), e);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-openwebbeans-builder

EARContext moduleContext = module.getEarContext();
Map sharedContext = module.getSharedContext();
  webAppInfo.listeners.add(0, CONTEXT_LISTENER_NAME);
AbstractName moduleName = module.getModuleName();
Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-jaxws-builder

private URL getCatalog(String name) throws IOException {
  URL catalogURL = this.bundle.getResource(name);
  if (catalogURL == null) {
    File f = this.module.getEarContext().getTargetFile(URI.create(name));
    if (f.exists()) {
      catalogURL = f.toURI().toURL();
    }
  }
  return catalogURL;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-jasper-builder

EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
EARContext moduleContext = module.getEarContext();
Map sharedContext = module.getSharedContext();
AbstractName moduleName = module.getModuleName();
Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat-builder

public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
  EARContext moduleContext = module.getEarContext();
  ClassLoader webClassLoader = moduleContext.getClassLoader();
  AbstractName moduleName = moduleContext.getModuleName();
  try {
    webModuleData.setReferencePattern("J2EEServer", moduleContext.getServerName());
    if (!module.isStandAlone()) {
      webModuleData.setReferencePattern("J2EEApplication", earContext.getModuleName());
    webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
    Set securityRoles = collectRoleNames(webApp);
    Map rolePermissions = new HashMap();
    if (!module.isStandAlone()) {
      ConfigurationData moduleConfigurationData = moduleContext.getConfigurationData();
      earContext.addChildConfiguration(module.getTargetPath(), moduleConfigurationData);
    throw new DeploymentException("Unable to initialize GBean for web app " + module.getName(), e);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb-builder

Deployable deployable = parentModule.getDeployable();
  if (!(deployable instanceof DeployableJarFile)) {
    throw new IllegalArgumentException("Expected DeployableJarFile");
  standAlone = parentModule.isStandAlone();
      .getAppClientName() : parentModule.getModuleName();
  name = parentModule.getName();
} else if (ejbJar.getModuleName() != null) {
  name = ejbJar.getModuleName().trim();
  context = parentModule.getJndiContext();
} else if (parentModule != null) {
  context = Module.share(Module.APP, parentModule.getJndiContext());
    builder.createModule(module, plan, moduleFile, targetPath, specDDUrl, environment, null, parentModule == null ? null : parentModule.getModuleName(), naming, idBuilder);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-web-2.5-builder

if (module.isStandAlone()) {
  moduleContext = earContext;
} else {
  EnvironmentBuilder.mergeEnvironments(earContext.getEnvironment(), module.getEnvironment());
  moduleContext = new FragmentContext(earContext, ConfigurationModuleType.WAR);
module.setEarContext(moduleContext);
module.setRootEarContext(earContext);
try {
  Collection<String> manifestcp = module.getClassPath();
  JarFile warFile = module.getModuleFile();
  Enumeration<JarEntry> entries = warFile.entries();
  List<ZipEntry> libs = new ArrayList<ZipEntry>();
  while (entries.hasMoreElements()) {
    ZipEntry entry = entries.nextElement();
    URI targetPath = module.resolve(entry.getName());
    if (entry.getName().equals("WEB-INF/web.xml")) {
      moduleContext.addFile(targetPath, module.getOriginalSpecDD());
    } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar")) {
  moduleContext.addToClassPath(module.resolve("WEB-INF/classes").getPath());
  manifestcp.add("WEB-INF/classes");      // NOTE:  Spec requires there be no trailing "/" on this.
    URI targetPath = module.resolve(entry.getName());
    moduleContext.addInclude(targetPath, warFile, entry);
    manifestcp.add(entry.getName());

相关文章