Package org.jboss.metadata.ear.spec

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


        }

        //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


        final DeploymentUnit parent = deploymentUnit.getParent();
        if(parent == null || !DeploymentTypeMarker.isType(DeploymentType.EAR, parent)) {
            return// Only care if this war is nested in an EAR
        }

        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

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

        //merge security roles from the ear
        //TODO: is there somewhere better to put this?
        final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
        DeploymentUnit parent = unit.getParent();
        if (parent != null) {
            final EarMetaData earMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (earMetaData != null) {
                if (jbossWebMD.getSecurityRoles() == null) {
                    jbossWebMD.setSecurityRoles(new SecurityRolesMetaData());
                }

                SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
                if (earSecurityRolesMetaData != null) {
                    SecurityRolesMetaDataMerger.merge(jbossWebMD.getSecurityRoles(), jbossWebMD.getSecurityRoles(), earSecurityRolesMetaData);
                }
            }
        }
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

            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);
                }
                deploymentUnit.putAttachment(Attachments.JBOSS_APP_METADATA, appMetaData);
            }
View Full Code Here

     * @param deploymentUnit The deployment unit
     */
    private String getApplicationName(DeploymentUnit deploymentUnit) {
        final DeploymentUnit parentDU = deploymentUnit.getParent();
        if (parentDU == null) {
            final EarMetaData earMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (earMetaData != null && earMetaData instanceof Ear6xMetaData) {
                final String overriddenAppName = ((Ear6xMetaData) earMetaData).getApplicationName();
                if (overriddenAppName == null) {
                    return this.getEarName(deploymentUnit);
                }
View Full Code Here

        ModuleRootMarker.mark(deploymentRoot, 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) {
                if (earMetaData instanceof Ear5xMetaData) {
                    final String xmlLibDirName = Ear5xMetaData.class.cast(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().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 (earMetaData == null) {
                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 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

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
            return;
        }
        final EarMetaData md =deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
        if(md != null) {
            //if we have an application.xml we don't scan
            return;
        }
        // TODO: deal with application clients, we need the manifest information
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.