Package org.jboss.metadata.ear.spec

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


                WSAttachmentKeys.JBOSS_APP_METADATA_KEY);

        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


   public void testEmptyMetaData()
   {
      JBossAppMetaData appMetaData = new JBoss50AppMetaData();
      ModulesMetaData modules = new ModulesMetaData();
      appMetaData.setModules(modules);
      ModuleMetaData module = appMetaData.getModule("something");
      assertNull(module);
   }
View Full Code Here

      ModulesMetaData modules = ear.getModules();
      if(hasJBossAppOverride)
         assertEquals(9, modules.size());
      else
         assertEquals(6, modules.size());
      ModuleMetaData connector = modules.get(0);
      assertEquals("connector0", connector.getId());
      ConnectorModuleMetaData connectorMD = (ConnectorModuleMetaData) connector.getValue();
      assertEquals("rar0.rar", connectorMD.getConnector());
      ModuleMetaData java = modules.get(1);
      assertEquals("java0", java.getId());
      JavaModuleMetaData javaMD = (JavaModuleMetaData)java.getValue();
      assertEquals("client0.jar", javaMD.getClientJar());
      ModuleMetaData ejb0 = modules.get(2);
      assertEquals("ejb0", ejb0.getId());
      EjbModuleMetaData ejb0MD = (EjbModuleMetaData)ejb0.getValue();
      assertEquals("ejb-jar0.jar", ejb0MD.getEjbJar());
      ModuleMetaData ejb1 = modules.get(3);
      assertEquals("ejb1", ejb1.getId());
      EjbModuleMetaData ejb1MD = (EjbModuleMetaData)ejb1.getValue();
      assertEquals("ejb-jar1.jar", ejb1MD.getEjbJar());
      ModuleMetaData web0 = modules.get(4);
      assertEquals("web0", web0.getId());
      WebModuleMetaData web0MD = (WebModuleMetaData) web0.getValue();
      assertEquals("/web0", web0MD.getContextRoot());
      assertEquals("web-app0.war", web0MD.getWebURI());
      ModuleMetaData web1 = modules.get(5);
      assertEquals("web1", web1.getId());
      WebModuleMetaData web1MD = (WebModuleMetaData) web1.getValue();
      if(hasJBossAppOverride)
         assertEquals("/web1-override", web1MD.getContextRoot());
      else
         assertEquals("/web1", web1MD.getContextRoot());
      assertEquals("web-app1.war", web1MD.getWebURI());
      if(hasJBossAppOverride)
      {
         // Validate the sar, web2, har added in jboss-app.xml
         ModuleMetaData sar = modules.get(6);
         assertEquals("sar0", sar.getId());
         ServiceModuleMetaData sarMD = (ServiceModuleMetaData) sar.getValue();
         assertEquals("sar0.sar", sarMD.getSar());
         ModuleMetaData web2 = modules.get(7);
         assertEquals("web2", web2.getId());
         WebModuleMetaData web2MD = (WebModuleMetaData) web2.getValue();
         assertEquals("/web2", web2MD.getContextRoot());
         assertEquals("web-app2.war", web2MD.getWebURI());        
         ModuleMetaData har = modules.get(8);
         assertEquals("har0", har.getId());
         ServiceModuleMetaData harMD = (ServiceModuleMetaData) har.getValue();
         assertEquals("har0.har", harMD.getSar());
      }
      // Validate lookup by module file name
      ModuleMetaData mmd = modules.get("rar0.rar");
      assertEquals(connector, mmd);
      mmd = modules.get("ejb-jar1.jar");
      assertEquals(ejb1, mmd);
      mmd = modules.get("web-app0.war");
      assertEquals(web0, mmd);
View Full Code Here

      EarMetaData result = unmarshal();
      assertEquals("JBossTest Web Container Testsuite", result.getDescriptionGroup().getDisplayName());
      ModulesMetaData modules = result.getModules();
      assertNotNull(modules);
      assertEquals(1, modules.size());
      ModuleMetaData module = modules.get(0);
      assertEquals("manifest-web.war", module.getFileName());
      WebModuleMetaData webModule = (WebModuleMetaData) module.getValue();
      assertEquals("/manifest", webModule.getContextRoot());
   }
View Full Code Here

      EarMetaData specMetaData = unmarshal();
      JBossAppMetaData metaData = new JBossAppMetaData();
      metaData.merge(metaData, specMetaData);

      assertEquals(6, metaData.getModules().size());
      ModuleMetaData rar = metaData.getModule("rar0.rar");
      assertEquals("connector0", rar.getId());
      assertEquals(ModuleType.Connector, rar.getType());
      assertEquals("META-INF/alt-ra.xml", rar.getAlternativeDD());
      ModuleMetaData car = metaData.getModule("client0.jar");
      assertEquals("java0", car.getId());
      assertEquals(ModuleType.Client, car.getType());
      assertEquals("META-INF/alt-application-client.xml", car.getAlternativeDD());
      ModuleMetaData ejb1 = metaData.getModule("ejb-jar1.jar");
      assertEquals("ejb1", ejb1.getId());
      assertEquals(ModuleType.Ejb, ejb1.getType());
      assertEquals("META-INF/alt-ejb-jar.xml", ejb1.getAlternativeDD());
      ModuleMetaData web1 = metaData.getModule("web-app1.war");
      assertEquals("web1", web1.getId());
      assertEquals(ModuleType.Web, web1.getType());
      assertEquals("WEB-INF/alt-web.xml", web1.getAlternativeDD());
      WebModuleMetaData wm1 = (WebModuleMetaData) web1.getValue();
      assertEquals("/web1", wm1.getContextRoot());

      SecurityRolesMetaData roles = metaData.getSecurityRoles();
      assertEquals(2, roles.size());
      SecurityRoleMetaData r0 = roles.get("role0");
View Full Code Here

        if(earConfig != null) {
            if(earConfig instanceof Ear6xMetaData) {
                boolean inOrder=((Ear6xMetaData) earConfig).getInitializeInOrder();
                if(inOrder) {
                    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
                    ModuleMetaData thisModulesMetadata = deploymentRoot.getAttachment(Attachments.MODULE_META_DATA);
                    if(thisModulesMetadata != null && thisModulesMetadata.getType() != ModuleMetaData.ModuleType.Client) {
                        ModuleMetaData previous = null;
                        for(ModuleMetaData module : earConfig.getModules()) {
                            if(module.getFileName().equals(thisModulesMetadata.getFileName())) {
                                break;
                            }
                        }
                        if(previous != null) {
                            final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getParent().getName(), previous.getFileName());
                            phaseContext.addToAttachmentList(org.jboss.as.server.deployment.Attachments.NEXT_PHASE_DEPS,serviceName.append(Phase.INSTALL.name()));
                        }
                    }
                }
            }
View Full Code Here

   }
   protected void assertModules(Ear5xMetaData ear)
   {
      ModulesMetaData modules = ear.getModules();
      assertEquals(6, modules.size());
      ModuleMetaData connector = modules.get(0);
      assertEquals("connector0", connector.getId());
      assertEquals("META-INF/alt-ra.xml", connector.getAlternativeDD());
      ConnectorModuleMetaData connectorMD = (ConnectorModuleMetaData) connector.getValue();
      assertEquals("rar0.rar", connectorMD.getConnector());
      ModuleMetaData java = modules.get(1);
      assertEquals("java0", java.getId());
      assertEquals("META-INF/alt-application-client.xml", java.getAlternativeDD());
      JavaModuleMetaData javaMD = (JavaModuleMetaData)java.getValue();
      assertEquals("client0.jar", javaMD.getClientJar());
      ModuleMetaData ejb0 = modules.get(2);
      assertEquals("ejb0", ejb0.getId());
      assertEquals("META-INF/alt-ejb-jar.xml", ejb0.getAlternativeDD());
      EjbModuleMetaData ejb0MD = (EjbModuleMetaData)ejb0.getValue();
      assertEquals("ejb-jar0.jar", ejb0MD.getEjbJar());
      ModuleMetaData ejb1 = modules.get(3);
      assertEquals("ejb1", ejb1.getId());
      assertEquals("META-INF/alt-ejb-jar.xml", ejb1.getAlternativeDD());
      EjbModuleMetaData ejb1MD = (EjbModuleMetaData)ejb1.getValue();
      assertEquals("ejb-jar1.jar", ejb1MD.getEjbJar());
      ModuleMetaData web0 = modules.get(4);
      assertEquals("web0", web0.getId());
      assertEquals("WEB-INF/alt-web.xml", web0.getAlternativeDD());
      WebModuleMetaData web0MD = (WebModuleMetaData) web0.getValue();
      assertEquals("/web0", web0MD.getContextRoot());
      assertEquals("web-app0.war", web0MD.getWebURI());
      ModuleMetaData web1 = modules.get(5);
      assertEquals("web1", web1.getId());
      assertEquals("WEB-INF/alt-web.xml", web1.getAlternativeDD());
      WebModuleMetaData web1MD = (WebModuleMetaData) web1.getValue();
      assertEquals("/web1", web1MD.getContextRoot());
      assertEquals("web-app1.war", web1MD.getWebURI());
   }
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

        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

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

                        phaseContext.addToAttachmentList(org.jboss.as.server.deployment.Attachments.NEXT_PHASE_DEPS, DeploymentCompleteServiceProcessor.serviceName(prevDeployment.getServiceName()));
                    }
                }
            }
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.