Search in sources :

Example 41 with ModuleDescriptor

use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.

the class DescriptorArchivist method write.

/**
 * writes an application deployment descriptors
 * @param the application object
 * @param the abstract archive
 */
public void write(Application application, ReadableArchive in, WritableArchive out) throws IOException {
    if (application.isVirtual()) {
        ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next();
        Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType());
        write((BundleDescriptor) aModule.getDescriptor(), moduleArchivist, in, out);
    } else {
        // let's start by writing out all submodules deployment descriptors
        for (ModuleDescriptor aModule : application.getModules()) {
            Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType());
            WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri());
            ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri());
            write((BundleDescriptor) aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive);
        }
        // now let's write the application descriptor
        ApplicationArchivist archivist = archivistProvider.get();
        archivist.setDescriptor(application);
        archivist.writeDeploymentDescriptors(in, out);
    }
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) WritableArchive(org.glassfish.api.deployment.archive.WritableArchive)

Example 42 with ModuleDescriptor

use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.

the class ApplicationRuntimeNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param nodeName the node name
 * @param application the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, Application application) {
    Node appNode = super.writeDescriptor(parent, nodeName, application);
    // web*
    for (ModuleDescriptor module : application.getModules()) {
        if (module.getModuleType().equals(DOLUtils.warType())) {
            Node web = appendChild(appNode, RuntimeTagNames.WEB);
            appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri());
            appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot());
        }
    }
    // pass-by-reference ?
    if (application.isPassByReferenceDefined()) {
        appendTextChild(appNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(application.getPassByReference()));
    }
    // NOTE : unique-id is no longer written out to sun-ejb-jar.xml.  It is persisted via
    // domain.xml deployment context properties instead.
    // security-role-mapping*
    List<SecurityRoleMapping> roleMappings = application.getSecurityRoleMappings();
    for (int i = 0; i < roleMappings.size(); i++) {
        SecurityRoleMappingNode srmn = new SecurityRoleMappingNode();
        srmn.writeDescriptor(appNode, RuntimeTagNames.SECURITY_ROLE_MAPPING, roleMappings.get(i));
    }
    // realm?
    appendTextChild(appNode, RuntimeTagNames.REALM, application.getRealm());
    // references
    RuntimeDescriptorNode.writeCommonComponentInfo(appNode, application);
    RuntimeDescriptorNode.writeMessageDestinationInfo(appNode, application);
    // archive-name
    appendTextChild(appNode, RuntimeTagNames.ARCHIVE_NAME, application.getArchiveName());
    // compatibility
    appendTextChild(appNode, RuntimeTagNames.COMPATIBILITY, application.getCompatibility());
    // keep-state
    appendTextChild(appNode, RuntimeTagNames.KEEP_STATE, String.valueOf(application.getKeepState()));
    return appNode;
}
Also used : SecurityRoleMappingNode(com.sun.enterprise.deployment.node.runtime.common.SecurityRoleMappingNode) ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) SecurityRoleMapping(com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping) SecurityRoleMappingNode(com.sun.enterprise.deployment.node.runtime.common.SecurityRoleMappingNode) ApplicationNode(com.sun.enterprise.deployment.node.ApplicationNode) Node(org.w3c.dom.Node) ResourcePropertyNode(com.sun.enterprise.deployment.node.ResourcePropertyNode)

Example 43 with ModuleDescriptor

use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.

the class ListSubComponentsCommand method getAppLevelComponents.

private Map<String, String> getAppLevelComponents(com.sun.enterprise.deployment.Application application, String type, Map<String, String> subComponentsMap) {
    Map<String, String> subComponentList = new LinkedHashMap<String, String>();
    if (application.isVirtual()) {
        // for standalone module, get servlets or ejbs
        BundleDescriptor bundleDescriptor = application.getStandaloneBundleDescriptor();
        subComponentList = getModuleLevelComponents(bundleDescriptor, type, subComponentsMap);
    } else {
        // for ear case, get modules
        Collection<ModuleDescriptor<BundleDescriptor>> modules = getSubModuleListForEar(application, type);
        for (ModuleDescriptor module : modules) {
            StringBuffer sb = new StringBuffer();
            String moduleName = module.getArchiveUri();
            sb.append("<");
            String moduleType = getModuleType(module);
            sb.append(moduleType);
            sb.append(">");
            subComponentList.put(moduleName, sb.toString());
            subComponentsMap.put(module.getArchiveUri(), moduleType);
        }
    }
    return subComponentList;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) LinkedHashMap(java.util.LinkedHashMap)

Example 44 with ModuleDescriptor

use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.

the class ListSubComponentsCommand method getSubModulesForEar.

// list sub components for ear
private List<String> getSubModulesForEar(com.sun.enterprise.deployment.Application application, String type) {
    List<String> moduleInfoList = new ArrayList<String>();
    Collection<ModuleDescriptor<BundleDescriptor>> modules = getSubModuleListForEar(application, type);
    for (ModuleDescriptor moduleDesc : modules) {
        String moduleInfo = moduleDesc.getArchiveUri() + ":" + moduleDesc.getModuleType();
        if (moduleDesc.getModuleType().equals(DOLUtils.warType())) {
            moduleInfo = moduleInfo + ":" + moduleDesc.getContextRoot();
        }
        moduleInfoList.add(moduleInfo);
    }
    return moduleInfoList;
}
Also used : ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) ArrayList(java.util.ArrayList)

Aggregations

ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)44 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)13 Application (com.sun.enterprise.deployment.Application)8 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)7 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)6 RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)6 DOLUtils.setExtensionArchivistForSubArchivist (com.sun.enterprise.deployment.util.DOLUtils.setExtensionArchivistForSubArchivist)5 File (java.io.File)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)4 InputStream (java.io.InputStream)4 ApplicationDeploymentDescriptorFile (com.sun.enterprise.deployment.io.ApplicationDeploymentDescriptorFile)3 ConfigurationDeploymentDescriptorFile (com.sun.enterprise.deployment.io.ConfigurationDeploymentDescriptorFile)3 DeploymentDescriptorFile (com.sun.enterprise.deployment.io.DeploymentDescriptorFile)3 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 Enumeration (java.util.Enumeration)2 Vector (java.util.Vector)2