Examples of JBossAppMetaData


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

        try {
            inputStream = applicationXmlFile.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            inputFactory.setXMLResolver(NoopXmlResolver.create());
            XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
            final JBossAppMetaData appMetaData = JBossAppMetaDataParser.parse(xmlReader);
            if (appMetaData != null) {
                final EarMetaData earMetaData = deploymentUnit.getAttachment(Attachments.EAR_METADATA);
                if(earMetaData != null) {
                    JBossAppMetaDataMerger.merge(appMetaData, null, earMetaData);
                }
View Full Code Here

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

      JBossWebMetaData jbossWebMetaData = unit.getAttachment(JBossWebMetaData.class);
      dep.addAttachment(JBossWebMetaData.class, jbossWebMetaData);

      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

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

     * @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

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

        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
        final VirtualFile deploymentFile = deploymentRoot.getRoot();

        EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
        JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit);
        if (earMetaData == null && jbossMetaData == null) {
            return;
        }
        // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit
        if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) {
            deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName());
        }
        JBossAppMetaData merged;
        if (earMetaData != null) {
            merged = new JBossAppMetaData(earMetaData.getEarVersion());
        } else {
            merged = new JBossAppMetaData();
        }
        JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData);

        deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged);
        if (merged.getEarEnvironmentRefsGroup() != null) {
            final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup());
            deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
        }

    }
View Full Code Here

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

        try {
            inputStream = applicationXmlFile.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            inputFactory.setXMLResolver(NoopXMLResolver.create());
            XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
            final JBossAppMetaData appMetaData = JBossAppMetaDataParser.parse(xmlReader);
            if (appMetaData != null) {
                final EarMetaData earMetaData = deploymentUnit.getAttachment(Attachments.EAR_METADATA);
                if(earMetaData != null) {
                    JBossAppMetaDataMerger.merge(appMetaData, null, earMetaData);
                }
View Full Code Here

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

     * @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.getModule(dep.getSimpleName());
            if (moduleMD != null) {
                final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
                contextRoot = webModuleMD.getContextRoot();
            }
        }
View Full Code Here

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

        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
        final VirtualFile deploymentFile = deploymentRoot.getRoot();

        EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
        JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
        if (earMetaData == null && jbossMetaData == null) {
            return;
        }
        // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit
        if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) {
            deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName());
        }
        JBossAppMetaData merged;
        if (earMetaData != null) {
            merged = new JBossAppMetaData(earMetaData.getEarVersion());
        } else {
            merged = new JBossAppMetaData();
        }
        JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData);

        deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged);
        if (merged.getEarEnvironmentRefsGroup() != null) {
            final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup());
            deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
        }

    }
View Full Code Here

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

         // Also need to include the ear lib dir entries
         VFSDeploymentUnit earUnit = unit.getParent();
         if(earUnit != null)
         {
            List<VirtualFile> earClassPath = earUnit.getClassPath();
            JBossAppMetaData earMD = earUnit.getAttachment(JBossAppMetaData.class);
            if(earMD != null)
            {
               String libDir = earMD.getLibraryDirectory();
               if(libDir == null)
                  libDir = "lib";
               String libDirPrefix = libDir + "/";
               for(VirtualFile vf : earClassPath)
               {
View Full Code Here

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

         boolean scan = true;

         Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
         unmarshaller.setValidation(useValidation);
         EarMetaData specMetaData = null;
         JBossAppMetaData appMetaData = null;
         if (applicationXml != null)
         {
            InputStream in = applicationXml.openStream();
            try
            {
               specMetaData = (EarMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
            scan = false;
         }
         if (jbossAppXml != null)
         {
            InputStream in = jbossAppXml.openStream();
            try
            {
               appMetaData = (JBossAppMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
         }
         // Need a metadata instance and there will not be one if there are no descriptors
         if (appMetaData == null)
         {
            appMetaData = new JBossAppMetaData();
         }
         // Create the merged view
         appMetaData.merge(appMetaData, specMetaData);

         String libDir = appMetaData.getLibraryDirectory();
         if (libDir == null || libDir.length() > 0)
         {
            if (libDir == null)
               libDir = "lib";
           
            // Add the ear lib contents to the classpath
            if(trace)
               log.trace("Checking for ear lib directory: "+libDir);
            try
            {
               lib = file.getChild(libDir);
               if (lib != null)
               {
                  if(trace)
                     log.trace("Found ear lib directory: "+lib);
                  List<VirtualFile> archives = lib.getChildren(earLibFilter);
                  for (VirtualFile archive : archives)
                  {
                     addClassPath(structureContext, archive, true, true, context);
                     try
                     {
                        // add any jars with persistence.xml as a deployment
                        if (archive.getChild("META-INF/persistence.xml") != null)
                        {
                           log.trace(archive.getName() + " in ear lib directory has persistence units");
                           if (structureContext.determineChildStructure(archive) == false)
                           {
                              throw new RuntimeException(archive.getName()
                                    + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
                                    + file.getName());
                           }
                        }
                        else if (trace)
                           log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");

                     }
                     catch(IOException e)
                     {
                        // TODO - should we throw this fwd?
                        log.warn("Exception searching for META-INF/persistence.xml in " + archive.getPathName() + ", " + e);
                     }
                  }
               }
               else if (trace)
                  log.trace("No lib directory in ear archive.");
            }
            catch (IOException e)
            {
               // TODO - should we throw this fwd?
               log.warn("Exception while searching for lib dir: " + e);
            }
         }
         else if (trace)
         {
            log.trace("Ignoring library directory, got empty library-directory element.");
         }

         // Add the ear manifest locations?
         addClassPath(structureContext, file, includeEarRootInClasspath, true, context);

         // TODO: need to scan for annotationss
         if( scan )
         {
            scanEar(file, appMetaData);
         }

         // Create subdeployments for the ear modules
         ModulesMetaData modules = appMetaData.getModules();
         if(modules != null)
         {
            for (ModuleMetaData mod : modules)
            {
               String fileName = mod.getFileName();
View Full Code Here

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

   public void deploy(DeploymentUnit unit, JBossWebMetaData metaData) throws DeploymentException
   {
      log.debug("Begin deploy, " + metaData);

      // 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());
         // TODO
         metaData.mergeSecurityRoles(earMetaData.getSecurityRoles());
      }

      try
      {
         /* Unpack wars to the tmp directory for now until tomcat can use the vfs directly. */
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.