Package org.jboss.metadata.ear.spec

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


        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final DeploymentUnit parent = deploymentUnit.getParent();
        if (parent == null) {
            return;
        }
        final EarMetaData earConfig = parent.getAttachment(Attachments.EAR_METADATA);
        if (earConfig != null) {
            if (earConfig instanceof Ear6xMetaData) {
                final boolean inOrder = ((Ear6xMetaData) earConfig).getInitializeInOrder();
                if (inOrder && earConfig.getModules().size() > 1) {


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


        }

        //merge security roles from the ear
        DeploymentUnit parent = deploymentUnit.getParent();
        if (parent != null) {
            final EarMetaData earMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (earMetaData != null) {
                SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
                if(earSecurityRolesMetaData != null) {
                    if(mergedMetaData.getSecurityRoles() == null) {
                        mergedMetaData.setSecurityRoles(new SecurityRolesMetaData());
                    }
                    SecurityRolesMetaDataMerger.merge(mergedMetaData.getSecurityRoles(), mergedMetaData.getSecurityRoles(), earSecurityRolesMetaData);
View Full Code Here

     */
    private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) {
        String securityDomain = null;
        DeploymentUnit parent = deploymentUnit.getParent();
        if (parent != null) {
            final EarMetaData jbossAppMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (jbossAppMetaData instanceof JBossAppMetaData) {
                securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain();
            }
        }
        return securityDomain;
View Full Code Here

        try {
            inputStream = applicationXmlFile.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
            inputFactory.setXMLResolver(NoopXMLResolver.create());
            XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
            final EarMetaData earMetaData = EarMetaDataParser.parse(xmlReader);
            if (earMetaData != null) {
                deploymentUnit.putAttachment(Attachments.EAR_METADATA, earMetaData);
                if(earMetaData instanceof Ear6xMetaData) {
                    Ear6xMetaData metaData = (Ear6xMetaData)earMetaData;
                    if(metaData.getEarEnvironmentRefsGroup() != null) {
View Full Code Here

     */
    private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) {
        String securityDomain = null;
        DeploymentUnit parent = deploymentUnit.getParent();
        if (parent != null) {
            final EarMetaData jbossAppMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (jbossAppMetaData instanceof JBossAppMetaData) {
                securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain();
            }
        }
        return securityDomain;
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        if(deploymentUnit.getParent() == null) {
            return;
        }
        final EarMetaData earConfig = deploymentUnit.getParent().getAttachment(Attachments.EAR_METADATA);
        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) {
View Full Code Here

        ModuleRootMarker.mark(deploymentRoot, false);

        String libDirName = DEFAULT_LIB_DIR;
        //its possible that the ear metadata could come for jboss-app.xml
        final boolean appXmlPresent = deploymentRoot.getRoot().getChild("META-INF/application.xml").exists();
        final EarMetaData earMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
        if (earMetaData != null) {
            final String xmlLibDirName = earMetaData.getLibraryDirectory();
            if (xmlLibDirName != null) {
                libDirName = xmlLibDirName;
            }
        }

        // Process all the children
        try {
            final VirtualFile libDir;
            // process the lib directory
            if (!libDirName.isEmpty()) {
                libDir = virtualFile.getChild(libDirName);
                if (libDir.exists()) {
                    List<VirtualFile> libArchives = libDir.getChildren(CHILD_ARCHIVE_FILTER);
                    for (final VirtualFile child : libArchives) {
                        final Closeable closable = child.isFile() ? mount(child, false) : null;
                        final MountHandle mountHandle = new MountHandle(closable);
                        final ResourceRoot childResource = new ResourceRoot(child, mountHandle);
                        if (child.getName().toLowerCase(Locale.ENGLISH).endsWith(JAR_EXTENSION)) {
                            ModuleRootMarker.mark(childResource);
                            deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource);
                        }
                    }
                }
            } else {
                libDir = null;
            }
            // scan the ear looking for wars and jars
            final List<VirtualFile> childArchives = new ArrayList<VirtualFile>(virtualFile.getChildren(new SuffixMatchFilter(
                    CHILD_ARCHIVE_EXTENSIONS, new VisitorAttributes() {
                @Override
                public boolean isLeavesOnly() {
                    return false;
                }

                @Override
                public boolean isRecurse(VirtualFile file) {
                    // don't recurse into /lib
                    if (file.equals(libDir)) {
                        return false;
                    }
                    for (String suffix : CHILD_ARCHIVE_EXTENSIONS) {
                        if (file.getName().endsWith(suffix)) {
                            // don't recurse into sub deployments
                            return false;
                        }
                    }
                    return true;
                }
            })));

            // if there is no application.xml then look in the ear root for modules
            if (!appXmlPresent) {
                for (final VirtualFile child : childArchives) {
                    final boolean isWarFile = child.getName().toLowerCase(Locale.ENGLISH).endsWith(WAR_EXTENSION);
                    final boolean isRarFile = child.getName().toLowerCase(Locale.ENGLISH).endsWith(RAR_EXTENSION);
                    this.createResourceRoot(deploymentUnit, child, isWarFile || isRarFile, isWarFile);
                }
            } else {
                final Set<VirtualFile> subDeploymentFiles = new HashSet<VirtualFile>();
                // otherwise read from application.xml
                for (final ModuleMetaData module : earMetaData.getModules()) {

                    final VirtualFile moduleFile = virtualFile.getChild(module.getFileName());
                    if (!moduleFile.exists()) {
                        throw MESSAGES.cannotProcessEarModule(virtualFile, module.getFileName());
                    }
View Full Code Here

        }

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

         boolean scan = true;

         Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
         unmarshaller.setValidation(useValidation);
         EarMetaData specMetaData = null;
         JBossAppMetaData appMetaData = null;
         if (applicationXml != null)
         {
            InputStream in = applicationXml.openStream();
            try
View Full Code Here

   // FIXME This should all be in a seperate deployer
   @Override
   protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
   {
      super.createMetaData(unit, name, suffix);
      EarMetaData specMetaData = unit.getAttachment(EarMetaData.class);
      JBossAppMetaData metaData = unit.getAttachment(JBossAppMetaData.class);
      if(specMetaData == null && metaData == null)
         return;

      // If there no JBossMetaData was created from a jboss-app.xml, create one
View Full Code Here

TOP

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

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.