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);
}
}
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;
}
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;
}
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;
}
Aggregations