Package org.jboss.metadata.ear.jboss

Examples of org.jboss.metadata.ear.jboss.JBossAppMetaData


      return unmarshal(JBossAppMetaData.class);
   }

   public void testVersion40() throws Exception
   {
      JBossAppMetaData result = unmarshal();
      assertEquals("4.0", result.getVersion());
   }
View Full Code Here


      assertEquals("4.0", result.getVersion());
   }
  
   public void testVersion42() throws Exception
   {
      JBossAppMetaData result = unmarshal();
      assertEquals("4.2", result.getVersion());
   }
View Full Code Here

      assertEquals("4.2", result.getVersion());
   }
  
   public void testVersion50() throws Exception
   {
      JBossAppMetaData result = unmarshal();
      assertEquals("jboss-app_5_0-id", result.getId());
      assertEquals("5.0", result.getVersion());
   }
View Full Code Here

      assertEquals("5.0", result.getVersion());
   }

   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

      assertNull(module);
   }

   public void testModuleOrder() throws Exception
   {
      JBossAppMetaData result = unmarshal();
      assertEquals("4.0", result.getVersion());
      assertEquals(JBossAppMetaData.ModuleOrder.STRICT, result.getModuleOrderEnum());
   }
View Full Code Here

     * @param jbossWebMD jboss web meta data
     * @return context root
     */
    public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
        final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
        final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null : ASHelper.getOptionalAttachment(unit.getParent(),
                WSAttachmentKeys.JBOSS_APP_METADATA_KEY);

        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();
            }
        }
View Full Code Here

        resourceRoot.putAttachment(Attachments.INDEX_RESOURCE_ROOT, false);
        ModuleRootMarker.mark(resourceRoot, false);

        String libDirName = DEFAULT_LIB_DIR;

        final JBossAppMetaData appMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.JBOSS_APP_METADATA);
        final EarMetaData earMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
        if (appMetaData != null) {
            final String xmlLibDirName = appMetaData.getLibraryDirectory();
            if (xmlLibDirName != null) {
                libDirName = xmlLibDirName;
            }
        } else {
            if (earMetaData != null) {
View Full Code Here

/*     */   public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData)
/*     */     throws DeploymentException
/*     */   {
/* 287 */     this.log.debug("Begin deploy, " + metaData);
/*     */
/* 290 */     JBossAppMetaData earMetaData = (JBossAppMetaData)AttachmentLocator.search(unit, JBossAppMetaData.class);
/* 291 */     if (earMetaData != null)
/*     */     {
/* 293 */       String path = unit.getRelativePath();
/* 294 */       ModuleMetaData webModule = earMetaData.getModule(path);
/* 295 */       if (webModule != null)
/*     */       {
/* 298 */         String contextRoot = metaData.getContextRoot();
/* 299 */         if (contextRoot == null)
/*     */         {
/* 301 */           WebModuleMetaData wmodule = (WebModuleMetaData)webModule.getValue();
/* 302 */           contextRoot = wmodule.getContextRoot();
/* 303 */           metaData.setContextRoot(contextRoot);
/*     */         }
/*     */
/* 307 */         metaData.setAlternativeDD(webModule.getAlternativeDD());
/*     */       }
/*     */
/* 311 */       if ((metaData.getSecurityDomain() == null) && (earMetaData.getSecurityDomain() != null)) {
/* 312 */         metaData.setSecurityDomain(earMetaData.getSecurityDomain());
/*     */       }
/* 314 */       metaData.mergeSecurityRoles(earMetaData.getSecurityRoles());
/*     */     }
/*     */
/*     */     try
/*     */     {
/* 324 */       String warName = unit.getName();
View Full Code Here

/* 141 */       boolean scan = true;
/*     */
/* 143 */       UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
/* 144 */       Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
/* 145 */       EarMetaData specMetaData = null;
/* 146 */       JBossAppMetaData appMetaData = null;
/* 147 */       if (applicationXml != null)
/*     */       {
/* 149 */         InputStream in = applicationXml.openStream();
/*     */         try
/*     */         {
/* 152 */           specMetaData = (EarMetaData)unmarshaller.unmarshal(in, this.resolver);
/*     */         }
/*     */         finally
/*     */         {
/* 156 */           in.close();
/*     */         }
/* 158 */         scan = false;
/*     */       }
/* 160 */       if (jbossAppXml != null)
/*     */       {
/* 162 */         InputStream in = jbossAppXml.openStream();
/*     */         try
/*     */         {
/* 165 */           appMetaData = (JBossAppMetaData)unmarshaller.unmarshal(in, this.resolver);
/*     */         }
/*     */         finally
/*     */         {
/* 169 */           in.close();
/*     */         }
/*     */       }
/*     */
/* 173 */       if (appMetaData == null)
/*     */       {
/* 175 */         appMetaData = new JBossAppMetaData();
/*     */       }
/*     */
/* 178 */       appMetaData.merge(appMetaData, specMetaData);
/*     */
/* 181 */       String libDir = appMetaData.getLibraryDirectory() == null ? "lib" : appMetaData.getLibraryDirectory();
/* 182 */       if (trace)
/* 183 */         this.log.trace("Checking for ear lib directory: " + libDir);
/*     */       try
/*     */       {
/* 186 */         VirtualFile lib = file.findChild(libDir);
/* 187 */         if (lib != null)
/*     */         {
/* 189 */           if (trace)
/* 190 */             this.log.trace("Found ear lib directory: " + lib);
/* 191 */           List archives = lib.getChildren(this.earLibFilter);
/* 192 */           for (VirtualFile archive : archives)
/*     */           {
/* 194 */             super.addClassPath(root, archive, true, true, context);
/*     */             try
/*     */             {
/* 198 */               if (archive.findChild("META-INF/persistence.xml") != null)
/*     */               {
/* 200 */                 this.log.trace(archive.getName() + " in ear lib directory has persistence units");
/* 201 */                 if (!deployers.determineStructure(root, file, archive, metaData))
/*     */                 {
/* 203 */                   throw new RuntimeException(archive.getName() + " in lib directory has persistence.xml but is not a recognized deployment, .ear: " + file.getName());
/*     */                 }
/*     */
/*     */               }
/*     */
/*     */             }
/*     */             catch (IOException e)
/*     */             {
/* 212 */               if (trace) {
/* 213 */                 this.log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");
/*     */               }
/*     */             }
/*     */           }
/*     */         }
/*     */       }
/*     */       catch (IOException ignored)
/*     */       {
/* 221 */         if (trace) {
/* 222 */           this.log.trace("Ignoring exception while searching for lib dir", ignored);
/*     */         }
/*     */       }
/*     */
/* 226 */       super.addClassPath(root, file, false, true, context);
/*     */
/* 229 */       if (scan)
/*     */       {
/* 231 */         scanEar(file, appMetaData);
/*     */       }
/*     */
/* 235 */       ModulesMetaData modules = appMetaData.getModules();
/* 236 */       if (modules != null) {
/* 237 */         for (ModuleMetaData mod : modules)
/*     */         {
/* 239 */           String fileName = mod.getFileName();
/* 240 */           if ((fileName != null) && ((fileName = fileName.trim()).length() > 0))
View Full Code Here

/*     */   protected void createMetaData(DeploymentUnit unit, String name, String suffix)
/*     */     throws DeploymentException
/*     */   {
/* 144 */     super.createMetaData(unit, name, suffix);
/* 145 */     EarMetaData specMetaData = (EarMetaData)unit.getAttachment(EarMetaData.class);
/* 146 */     JBossAppMetaData metaData = (JBossAppMetaData)unit.getAttachment(JBossAppMetaData.class);
/* 147 */     if ((specMetaData == null) && (metaData == null)) {
/* 148 */       return;
/*     */     }
/*     */
/* 151 */     if (metaData == null)
/*     */     {
/* 153 */       metaData = new JBossAppMetaData();
/*     */     }
/*     */
/* 156 */     JBossAppMetaData mergedMetaData = new JBossAppMetaData();
/* 157 */     mergedMetaData.merge(metaData, specMetaData);
/*     */
/* 159 */     unit.getTransientManagedObjects().addAttachment(JBossAppMetaData.class, mergedMetaData);
/*     */
/* 161 */     unit.addAttachment("Raw" + JBossAppMetaData.class.getName(), metaData, JBossAppMetaData.class);
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ear.jboss.JBossAppMetaData

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.