Package org.jboss.metadata.ear.spec

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


   {
      List<VirtualFile> archives = root.getChildren();
      if (archives != null)
      {
         String earPath = root.getPathName();
         ModulesMetaData modules = appMetaData.getModules();
         if (modules == null)
         {
            modules = new ModulesMetaData();
            appMetaData.setModules(modules);
         }
         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


      }
      else if(original5x != null && original5x.getLibraryDirectory() != null)
         setLibraryDirectory(original5x.getLibraryDirectory());

      if(modules == null)
         modules = new ModulesMetaData();
      ModulesMetaData overrideModules = null;
      ModulesMetaData originalModules = null;
      if(override != null)
         overrideModules = override.getModules();
      if(original != null)
         originalModules = original.getModules();
      modules.merge(overrideModules, originalModules);
View Full Code Here

        final EarMetaData earMetaData = parent.getAttachment(Attachments.EAR_METADATA);
        if(earMetaData == null) {
            return; // Nothing to see here
        }

        final ModulesMetaData modulesMetaData = earMetaData.getModules();
        if(modulesMetaData != null) for(ModuleMetaData moduleMetaData : modulesMetaData) {
            if(Web.equals(moduleMetaData.getType()) && moduleMetaData.getFileName().equals(deploymentRoot.getRootName())) {
                String contextRoot = WebModuleMetaData.class.cast(moduleMetaData.getValue()).getContextRoot();

                if(contextRoot == null && (warMetaData.getJbossWebMetaData() == null || warMetaData.getJbossWebMetaData().getContextRoot() == null)) {
View Full Code Here

      }
      else if(original5x != null && original5x.getLibraryDirectory() != null)
         setLibraryDirectory(original5x.getLibraryDirectory());

      if(modules == null)
         modules = new ModulesMetaData();
      ModulesMetaData overrideModules = null;
      ModulesMetaData originalModules = null;
      if(override != null)
         overrideModules = override.getModules();
      if(original != null)
         originalModules = original.getModules();
      modules.merge(overrideModules, originalModules);
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

      else
         assertEquals("lib0", ear.getLibraryDirectory());
   }
   protected void assertModules(JBossAppMetaData ear)
   {
      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

   public void testWhitespace()
      throws Exception
   {
      Ear5xMetaData result = unmarshal();
      ModulesMetaData modules = result.getModules();
      assertEquals(4, modules.size());
      assertEquals("transport_ejb_vehicle_client.jar", modules.get(0).getName());
      assertEquals("transport_ejb_vehicle_ejb.jar", modules.get(1).getName());
      assertEquals("transport_jsp_vehicle_web.war", modules.get(2).getName());
      assertEquals("transport_servlet_vehicle_web.war", modules.get(3).getName());
      assertEquals("transport_servlet_vehicle", ((WebModuleMetaData)modules.get(3).getValue()).getContextRoot());
   }
View Full Code Here

   public void testNoDtd() throws Exception
   {
      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

   {
      assertEquals("lib0", ear.getLibraryDirectory());
   }
   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

      }
      else if(original5x != null && original5x.getLibraryDirectory() != null)
         setLibraryDirectory(original5x.getLibraryDirectory());

      if(modules == null)
         modules = new ModulesMetaData();
      ModulesMetaData overrideModules = null;
      ModulesMetaData originalModules = null;
      if(override != null)
         overrideModules = override.getModules();
      if(original != null)
         originalModules = original.getModules();
      modules.merge(overrideModules, originalModules);
View Full Code Here

TOP

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

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.