Package org.jboss.metadata.ear.spec

Examples of org.jboss.metadata.ear.spec.ModuleMetaData


      if(children != null && modules != null)
      {
         for(DeploymentUnit child : children)
         {
            String moduleName = child.getSimpleName();
            ModuleMetaData module = modules.get(moduleName);
            if(module != null && module.getAlternativeDD() != null)
            {
               VirtualFile altDDFile = unit.getRoot().getChild(module.getAlternativeDD());
               if(altDDFile == null)
                  throw new IllegalStateException("Failed to locate alternative DD '" + module.getAlternativeDD() + "' in " + unit.getRoot().getPathName());
              
               String attachmentName;
               if(module.getType() == ModuleMetaData.ModuleType.Ejb)
                  attachmentName = EjbJarMetaData.class.getName();
               else if(module.getType() == ModuleMetaData.ModuleType.Web)
                  attachmentName = WebMetaData.class.getName();
               else if(module.getType() == ModuleMetaData.ModuleType.Client)
                  attachmentName = ApplicationClientMetaData.class.getName();
               else if(module.getType() == ModuleMetaData.ModuleType.Connector)
                  attachmentName = "org.jboss.resource.metadata.ConnectorMetaData";
               else
                  throw new IllegalStateException("Expected module types in an EAR are ejb, web, java and connector but got " + module.getType() + " for " + child.getName() + " in " + unit.getName());
              
               child.addAttachment(attachmentName + ".altDD", altDDFile);
               if(log.isTraceEnabled())
                  log.trace("attached alt-dd " + altDDFile + " for module " + child.getSimpleName());
            }
View Full Code Here


      if (modules == null)
      {
         throw new DeploymentException(unit + " has attached " + JBossAppMetaData.class.getSimpleName() +
               " but it has no associated " + ModulesMetaData.class.getSimpleName());
      }
      ModuleMetaData ourModule = null;
      String uniqueName = null;
      // Synchronize on the modules to ensure concurrent deployments of the
      // modules pass serially through this logic
      synchronized(modules)
      {
         ourModule = modules.get(modulePath);
         if (ourModule == null)
         {
            String parentUnitName = unit.getParent().getName();
            throw new DeploymentException("No module with relative path " +
                  modulePath + " found  in set of modules for " + parentUnitName + " "  + modules.keySet());
         }
        
          uniqueName = name;
          if (!isNameUnique(uniqueName, ourModule, modules))
          {
             // Try the relative path w/ extension removed
             uniqueName = trimExtension(unit.getRelativePath());
             if (uniqueName.equals(name) || !isNameUnique(uniqueName, ourModule, modules))
             {
                // Try leaving the extension
                uniqueName = unit.getRelativePath();
                if (!isNameUnique(uniqueName, ourModule, modules))
                {
                   // To get here, people would have to configure in xml a
                   // module name that conflicts with the relative path of
                   // another module. Not likely, but...
                   // Append a digit until the name is unique
                   int i = 0;
                   do
                   {
                      i++;
                      uniqueName = name + "-" + i;
                   }
                   while (!isNameUnique(uniqueName, ourModule, modules));
                }
             }
          }
         
          ourModule.setUniqueName(uniqueName);
        
      }
     
      // Log a WARN if we had to change the module name
      if (configuredName != null && !configuredName.equals(uniqueName))
View Full Code Here

  
   private static boolean isNameUnique(String uniqueName, ModuleMetaData ourModule, ModulesMetaData modules)
   {
      for (Iterator<ModuleMetaData> it = modules.iterator(); it.hasNext(); )
      {
         ModuleMetaData module = it.next();
         if (!ourModule.equals(module) && uniqueName.equals(module.getUniqueName()))
         {
            return false;
         }
      }
      return true;
View Full Code Here

         }
         for (VirtualFile vfArchive : archives)
         {
            String filename = earRelativePath(earPath, vfArchive.getPathName());
            // Check if the module already exists, i.e. it is declared in jboss-app.xml
            ModuleMetaData moduleMetaData = appMetaData.getModule(filename);
            int type = typeFromSuffix(filename, vfArchive);
            if (type >= 0 && moduleMetaData == null)
            {
               moduleMetaData = new ModuleMetaData();
               AbstractModule module = null;
               switch(type)
               {
                  case J2eeModuleMetaData.EJB:
                     module = new EjbModuleMetaData();
                     break;
                  case J2eeModuleMetaData.CLIENT:
                     module = new JavaModuleMetaData();
                     break;
                  case J2eeModuleMetaData.CONNECTOR:
                     module = new ConnectorModuleMetaData();
                     break;
                  case J2eeModuleMetaData.SERVICE:
                  case J2eeModuleMetaData.HAR:
                     module = new ServiceModuleMetaData();
                     break;
                  case J2eeModuleMetaData.WEB:
                     module = new WebModuleMetaData();
                     break;
               }
               module.setFileName(filename);
               moduleMetaData.setValue(module);
               modules.add(moduleMetaData);
            }
         }
      }
   }
View Full Code Here

      // Merge any settings from the ear level
      JBossAppMetaData earMetaData = AttachmentLocator.search(unit, JBossAppMetaData.class);
      if (earMetaData != null)
      {
         String path = unit.getRelativePath();
         ModuleMetaData webModule = earMetaData.getModule(path);
         if (webModule != null)
         {
            // Check for a context-root setting
            String contextRoot = metaData.getContextRoot();
            if (contextRoot == null)
            {
               WebModuleMetaData wmodule = (WebModuleMetaData)webModule.getValue();
               contextRoot = wmodule.getContextRoot();
               metaData.setContextRoot(contextRoot);
            }

            // Add any alt-dd setting
            metaData.setAlternativeDD(webModule.getAlternativeDD());
         }

         // Merge security domain/roles
         if (metaData.getSecurityDomain() == null && earMetaData.getSecurityDomain() != null)
            metaData.setSecurityDomain(earMetaData.getSecurityDomain());
View Full Code Here

      String contextRoot = null;

      if (jbossAppMD != null)
      {
         final ModuleMetaData moduleMD = jbossAppMD.getModule(dep.getSimpleName());
         if (moduleMD != null)
         {
            final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
            contextRoot = webModuleMD.getContextRoot();
         }
      }

      // prefer context root defined in application.xml over one defined in jboss-web.xml
View Full Code Here

                final Map<String, DeploymentUnit> deploymentUnitMap = new HashMap<String, DeploymentUnit>();
                for (final DeploymentUnit subDeployment : parent.getAttachment(org.jboss.as.server.deployment.Attachments.SUB_DEPLOYMENTS)) {

                    final ResourceRoot deploymentRoot = subDeployment.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
                    final ModuleMetaData moduleMetaData = deploymentRoot.getAttachment(Attachments.MODULE_META_DATA);
                    if (moduleMetaData != null) {
                        deploymentUnitMap.put(moduleMetaData.getFileName(), subDeployment);
                    }
                }


                final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
                final ModuleMetaData thisModulesMetadata = deploymentRoot.getAttachment(Attachments.MODULE_META_DATA);
                if (thisModulesMetadata != null && thisModulesMetadata.getType() != ModuleMetaData.ModuleType.Client) {
                    ModuleMetaData previous = null;
                    boolean found = false;
                    for (ModuleMetaData module : earConfig.getModules()) {
                        if (module.getType() != ModuleMetaData.ModuleType.Client) {
                            if (module.getFileName().equals(thisModulesMetadata.getFileName())) {
                                found = true;
                                break;
                            }
                            previous = module;
                        }
                    }
                    if (previous != null && found) {
                        //now we know the previous module we can setup the service dependencies
                        //we setup one on the deployment service, and also one on every component
                        final ServiceName serviceName = Services.deploymentUnitName(parent.getName(), previous.getFileName());
                        phaseContext.addToAttachmentList(org.jboss.as.server.deployment.Attachments.NEXT_PHASE_DEPS, serviceName.append(Phase.INSTALL.name()));
                        final DeploymentUnit prevDeployment = deploymentUnitMap.get(previous.getFileName());
                        final EEModuleDescription eeModuleDescription = prevDeployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
                        if (eeModuleDescription != null) {
                            for (final ComponentDescription component : eeModuleDescription.getComponentDescriptions()) {
                                phaseContext.addToAttachmentList(org.jboss.as.server.deployment.Attachments.NEXT_PHASE_DEPS, component.getStartServiceName());
                            }
View Full Code Here

        String contextRoot = null;

        // prefer context root defined in application.xml over one defined in jboss-web.xml
        if (jbossAppMD != null) {
            final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
            if (moduleMD != null) {
                final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
                contextRoot = webModuleMD.getContextRoot();
            }
        }

        if (contextRoot == null) {
View Full Code Here

                    }
                }
            }
        } else if (deploymentUnit.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
            final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
            final ModuleMetaData md = root.getAttachment(org.jboss.as.ee.structure.Attachments.MODULE_META_DATA);
            if (md != null) {
                if (md.getType() == ModuleMetaData.ModuleType.Client) {
                    DeploymentTypeMarker.setType(DeploymentType.APPLICATION_CLIENT, deploymentUnit);
                }
            } else {
                VirtualFile appclientClientXml = root.getRoot().getChild(META_INF_APPLICATION_CLIENT_XML);
                if (appclientClientXml.exists()) {
View Full Code Here

      if (unit.getParent() != null)
      {
         JBossAppMetaData appmd = unit.getParent().getAttachment(JBossAppMetaData.class);
         if (appmd != null)
         {
            ModuleMetaData module = appmd.getModule(dep.getSimpleName());
            if (module != null)
            {
               WebModuleMetaData web = (WebModuleMetaData) module.getValue();
               contextRoot = web.getContextRoot();
            }
         }
      }
     
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ear.spec.ModuleMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.