Package org.jboss.metadata.ear.spec

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


      assertTrue(result.isEE14());
      assertFalse(result.isEE5());
   }
   public void testVersion13() throws Exception
   {
      EarMetaData result = unmarshal();
      assertEquals("application_1_3-id", result.getId());
      assertEquals("1.3", result.getVersion());
      assertTrue(result.isEE13());
      assertFalse(result.isEE14());
      assertFalse(result.isEE5());
   }
View Full Code Here


      assertFalse(result.isEE5());
   }

   public void testDescriptionGroup() throws Exception
   {
      EarMetaData result = unmarshal();
      DescriptionGroupMetaData group = result.getDescriptionGroup();
      assertNotNull(group);
      Descriptions descriptions = group.getDescriptions();
      assertNotNull(descriptions);
     
      DescriptionImpl en = new DescriptionImpl();
View Full Code Here

      assertEquals(expectedicns, icons.value());
   }

   public void testDescriptionGroup13() throws Exception
   {
      EarMetaData result = unmarshal();
      DescriptionGroupMetaData group = result.getDescriptionGroup();
      assertNotNull(group);
      assertEquals("1.3 EE Client", group.getDescription());
      assertEquals("The cts.jar with an application client jar", group.getDisplayName());
      assertNotNull(result.getModules().get("cts.jar"));
   }
View Full Code Here

   }

   public void testSecurityRoles()
      throws Exception
   {
      EarMetaData specMetaData = unmarshal();
      JBossAppMetaData jbossMetaData = unmarshal("Ear4x_testJBossSecurityRoles.xml", JBossAppMetaData.class, null);
      JBossAppMetaData metaData = new JBossAppMetaData();
      metaData.merge(jbossMetaData, specMetaData);

      SecurityRolesMetaData secRoles = metaData.getSecurityRoles();
View Full Code Here

    * shows all of the application.xml information.
    */
   public void testAppXmlOnly()
      throws Exception
   {
      EarMetaData specMetaData = unmarshal();
      JBossAppMetaData metaData = new JBossAppMetaData();
      metaData.merge(metaData, specMetaData);

      assertEquals(6, metaData.getModules().size());
      ModuleMetaData rar = metaData.getModule("rar0.rar");
View Full Code Here

        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) {
                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);
                    this.createResourceRoot(deploymentUnit, child, isWarFile, isWarFile);
                }
            } else {
                Set<VirtualFile> subDeploymentFiles = new HashSet<VirtualFile>();
                // otherwise read from application.xml
                for (ModuleMetaData module : earMetaData.getModules()) {

                    VirtualFile moduleFile = virtualFile.getChild(module.getFileName());
                    if (!moduleFile.exists()) {
                        throw new DeploymentUnitProcessingException("Unable to process modules in application.xml for EAR ["
                                + virtualFile + "], module file " + module.getFileName() + " not found");
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

            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

                .addDependency(weldBootstrapServiceName, WeldBootstrapService.class, weldStartService.getBootstrap())
                .addDependencies(jpaServices);

        // make sure JNDI bindings are up
        startService.addDependency(JndiNamingDependencyProcessor.serviceName(deploymentUnit));
        final EarMetaData earConfig = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
        if (earConfig == null || !earConfig.getInitializeInOrder())  {
            // in-order install of sub-deployments may result in service dependencies deadlocks if the jndi dependency services of subdeployments are added as dependencies
            for (DeploymentUnit sub : subDeployments) {
                startService.addDependency(JndiNamingDependencyProcessor.serviceName(sub));
            }
        }
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(Attachments.EAR_METADATA);
            if (jbossAppMetaData instanceof JBossAppMetaData) {
                securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain();
            }
        }
        return securityDomain;
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.