/** * @return the module type for this bundle descriptor */ public ArchiveType getModuleType() { return DOLUtils.earType(); }
/** * @return the module type handled by this archivist * as defined in the application DTD * */ @Override public ArchiveType getModuleType() { return DOLUtils.earType(); }
@Override public boolean supportsModuleType(ArchiveType moduleType) { return moduleType!=null && moduleType.equals(DOLUtils.earType()); }
public void retrieveAllResourcesXMLs(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException { if(DeploymentUtils.isArchiveOfType(archive, DOLUtils.earType(), locator)){ //Look for top-level META-INF/glassfish-resources.xml if(archive.exists(RESOURCES_XML_META_INF)){ String archivePath = archive.getURI().getPath(); String fileName = archivePath + RESOURCES_XML_META_INF; if(_logger.isLoggable(Level.FINEST)){ _logger.finest("GlassFish-Resources Deployer - fileName : " + fileName + " - parent : " + archive.getName()); } fileNames.put(actualArchiveName, fileName); } //Lok for sub-module level META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml Enumeration<String> entries = archive.entries(); while(entries.hasMoreElements()){ String element = entries.nextElement(); if(element.endsWith(".jar") || element.endsWith(".war") || element.endsWith(".rar") || element.endsWith("_jar") || element.endsWith("_war") || element.endsWith("_rar")){ ReadableArchive subArchive = archive.getSubArchive(element); if(subArchive != null ){ retrieveResourcesXMLFromArchive(fileNames, subArchive, subArchive.getName()); } } } }else{ //Look for standalone archive's META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml retrieveResourcesXMLFromArchive(fileNames, archive, actualArchiveName); } }
/** * Returns true if the passed file or directory is recognized by this * instance. * * @param location the file or directory to explore * @return true if this sniffer handles this application type */ @Override public boolean handles(ReadableArchive location) { return (DeploymentUtils.isArchiveOfType(location, DOLUtils.warType(), habitat) || DeploymentUtils.isArchiveOfType(location, DOLUtils.earType(), habitat) || isJar(location)); }
/** * retain old resource configuration for the new archive being deployed. * @param dc DeploymentContext * @param allResources all resources (app scoped, module scoped) of old application * @throws Exception when unable to retain old resource configuration. */ public void retainResourceConfig(DeploymentContext dc, Map<String, Resources> allResources) throws Exception { String appName = getAppNameFromDeployCmdParams(dc); Application application = dc.getTransientAppMetaData(ServerTags.APPLICATION, Application.class); Resources appScopedResources = allResources.get(appName); if(appScopedResources != null){ application.setResources(appScopedResources); } if(DeploymentUtils.isArchiveOfType(dc.getSource(), DOLUtils.earType(), locator)){ List<Module> modules = application.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = allResources.get(module.getName()); if(moduleScopedResources != null){ module.setResources(moduleScopedResources); } } } } }
/** * check whether the archive is a JavaEE archive * @param archive archive to be tested * @param context deployment context * @param habitat * @return whether the archive is a JavaEE archive */ public static boolean isJavaEE(ReadableArchive archive, DeploymentContext context, ServiceLocator habitat) { if (DeploymentUtils.isArchiveOfType(archive,DOLUtils.earType(), context, habitat) || DeploymentUtils.isArchiveOfType(archive, DOLUtils.warType(), context, habitat) || DeploymentUtils.isArchiveOfType(archive, DOLUtils.carType(), context, habitat) || DeploymentUtils.isArchiveOfType(archive, DOLUtils.rarType(), context, habitat) || DeploymentUtils.isArchiveOfType(archive, DOLUtils.ejbType(), context, habitat)) { return true; } return false; } }
/** * Returns true if the passed file or directory is recognized by this * sniffer. * * @param context deployment context * @return true if the location is recognized by this sniffer */ @Override public boolean handles(DeploymentContext context) { ArchiveType archiveType = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType()); if (archiveType != null && !supportsArchiveType(archiveType)) { return false; } if (archiveType != null && (archiveType.equals(DOLUtils.warType()) || archiveType.equals(DOLUtils.earType()) || archiveType.equals(DOLUtils.ejbType()))) return true; return handles(context.getSource()); }
public final static String [] getDescriptorsList (ArchiveType moduleType) { if (moduleType == null) return null; if (moduleType.equals(DOLUtils.earType())) { return (String[])earList.clone(); } else if (moduleType.equals(DOLUtils.ejbType())) { return (String[])ejbList.clone(); } else if (moduleType.equals(DOLUtils.warType())) { return (String[])warList.clone(); } else if (moduleType.equals(DOLUtils.rarType())) { return (String[])rarList.clone(); } else if (moduleType.equals(DOLUtils.carType())) { return (String[])carList.clone(); } return null; } }