public String getName() { return delegate.getName(); }
@Override public String getDefaultApplicationName(ReadableArchive archive) { String appName = archive.getName(); int lastDot = appName.lastIndexOf('.'); if (lastDot != -1) { appName = appName.substring(0, lastDot); } return appName; }
@Override public String getDefaultApplicationName(ReadableArchive archive) { String appName = archive.getName(); int lastDot = appName.lastIndexOf('.'); if (lastDot != -1) { appName = appName.substring(0, lastDot); } return appName; }
@Override public String getName() { final StringBuilder name = new StringBuilder(); for (ReadableArchive a : archives) { if (name.length() > 0) { name.append(","); } name.append(a.getName()); } return name.toString(); } }
public RootBeanDeploymentArchive(ReadableArchive archive, Collection<EjbDescriptor> ejbs, DeploymentContext deploymentContext, String moduleBdaID) { super("root_" + archive.getName(), Collections.<Class<?>>emptyList(), Collections.<URL>emptyList(), Collections.<EjbDescriptor>emptyList(), deploymentContext); createModuleBda(archive, ejbs, deploymentContext, moduleBdaID); }
public String getDefaultApplicationNameFromArchiveName(ReadableArchive archive) { String appName = archive.getName(); int lastDot = appName.lastIndexOf('.'); if (lastDot != -1) { if (appName.substring(lastDot).equalsIgnoreCase("." + getArchiveType())) { appName = appName.substring(0, lastDot); } } return appName; }
public static String getApplicationName(DeploymentContext context) { String applicationName = null; ReadableArchive parentArchive = context.getSource().getParentArchive(); if (parentArchive != null) { applicationName = parentArchive.getName(); }else{ applicationName = context.getSource().getName(); } return applicationName; }
public ServiceMetadata getServices(ReadableArchive archive) throws Exception { ServiceDependencyDiscoveryState state = habitat.getByType(ServiceDependencyDiscoveryState.class); PaaSDeploymentContext pc = new PaaSDeploymentContext(archive.getName(), archive); return state.getServiceDependencyMetadata(pc, archive.getName(), archive); }
protected DeployCommandParameters getDeployParams() throws Exception { assert(archive != null); DeployCommandParameters parameters = new DeployCommandParameters(); parameters.name = archive.getName(); parameters.enabled = Boolean.TRUE; parameters.origin = DeployCommandParameters.Origin.deploy; parameters.force = false; parameters.target = getInstanceName(); return parameters; }
protected DeployCommandParameters getDeployParams() throws Exception { assert(archive != null); DeployCommandParameters parameters = new DeployCommandParameters(); parameters.name = archive.getName(); parameters.enabled = Boolean.TRUE; parameters.origin = DeployCommandParameters.Origin.deploy; parameters.force = false; parameters.target = getInstanceName(); return parameters; }
private void createLibJarBda(ReadableArchive libJarArchive, Collection<EjbDescriptor> ejbs, String libDir ) { RootBeanDeploymentArchive rootBda = new RootBeanDeploymentArchive(libJarArchive, ejbs, context, libDir + SEPARATOR_CHAR + libJarArchive.getName()); createLibJarBda(rootBda); }
private void retrieveResourcesXMLFromArchive(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) { if(DeploymentUtils.hasResourcesXML(archive)){ String archivePath = archive.getURI().getPath(); String fileName ; if(DeploymentUtils.isWebArchive(archive)){ fileName = archivePath + RESOURCES_XML_WEB_INF; }else{ 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); } }
private void retrieveResourcesXMLFromArchive(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) { if(ResourceUtil.hasResourcesXML(archive, locator)){ String archivePath = archive.getURI().getPath(); String fileName ; if(DeploymentUtils.isArchiveOfType(archive, DOLUtils.warType(), locator)){ fileName = archivePath + RESOURCES_XML_WEB_INF; }else{ 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); } }
public List<URI> getAppLibs() throws URISyntaxException { List<URI> libURIs = new ArrayList<URI>(); if (parameters.libraries() != null) { URL[] urls = ASClassLoaderUtil.getDeployParamLibrariesAsURLs( parameters.libraries(), env); for (URL url : urls) { libURIs.add(url.toURI()); } } Set<String> extensionList = null; try{ extensionList = InstalledLibrariesResolver.getInstalledLibraries(source); }catch(IOException ioe){ throw new RuntimeException(ioe); } URL[] extensionListLibraries = ASClassLoaderUtil.getLibrariesAsURLs(extensionList, env); for (URL url : extensionListLibraries) { libURIs.add(url.toURI()); if(logger.isLoggable(Level.FINEST)){ logger.log(Level.FINEST, "Detected [EXTENSION_LIST]" + " installed-library [ " + url + " ] for archive [ "+source.getName()+ "]"); } } return libURIs; }
public void retrieveAllResourcesXMLs(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException { if(DeploymentUtils.isEAR(archive)){ //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); } }
public BeanDeploymentArchiveImpl(ReadableArchive archive, Collection<com.sun.enterprise.deployment.EjbDescriptor> ejbs, DeploymentContext ctx, String bdaID) { this.beanClasses = new ArrayList<Class<?>>(); this.beanClassNames = new ArrayList<String>(); this.moduleClasses = new ArrayList<Class<?>>(); this.moduleClassNames = new ArrayList<String>(); this.beansXmlURLs = new CopyOnWriteArrayList<URL>(); this.archive = archive; if (bdaID == null) { this.id = archive.getName(); } else { this.id = bdaID; } this.friendlyId = this.id; this.ejbDescImpls = new HashSet<EjbDescriptor<?>>(); this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>(); this.context = ctx; populate(ejbs); populateEJBsForThisBDA(ejbs); try { this.archive.close(); } catch (Exception e) { } this.archive = null; // This assigns moduleClassLoaderForBDA getClassLoader(); }
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); } }
/** * Produce <code>BeanDeploymentArchive</code>s for this <code>Deployment</code> * from information from the provided <code>ReadableArchive</code>. */ public DeploymentImpl(ReadableArchive archive, Collection<EjbDescriptor> ejbs, DeploymentContext context, ArchiveFactory archiveFactory) { if ( logger.isLoggable( FINE ) ) { logger.log(FINE, CDILoggerInfo.CREATING_DEPLOYMENT_ARCHIVE, new Object[]{ archive.getName()}); } this.archiveFactory = archiveFactory; this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>(); this.context = context; // Collect /lib Jar BDAs (if any) from the parent module. // If we've produced BDA(s) from any /lib jars, <code>return</code> as // additional BDA(s) will be produced for any subarchives (war/jar). libJarRootBdas = scanForLibJars(archive, ejbs, context); if ((libJarRootBdas != null) && libJarRootBdas.size() > 0) { return; } createModuleBda(archive, ejbs, context); ApplicationHolder holder = context.getModuleMetaData(ApplicationHolder.class); if ((holder != null) && (holder.app != null)) { appName = holder.app.getAppName(); } else { appName = "CDIApp"; } }
public boolean hasAnnotationInArchive(ReadableArchive archive) { scanArchive(archive); if (found) { return found; } ArchiveFactory archiveFactory = null; if (Globals.getDefaultHabitat() != null) { archiveFactory = Globals.getDefaultHabitat().getComponent(ArchiveFactory.class); } if (archiveFactory != null) { List<URI> externalLibs = DeploymentUtils.getExternalLibraries(archive); for (URI externalLib : externalLibs) { try { scanArchive(archiveFactory.openArchive(new File(externalLib.getPath()))); } catch(FileNotFoundException fnfe) { logger.log(Level.WARNING, "Cannot find archive " + externalLib.getPath() + " referenced from archive " + archive.getName() + ", it will be ignored for annotation scanning"); } catch (Exception e) { logger.log(Level.WARNING, e.getMessage(), e); } } } return found; }
contextRoot = wbd.getModuleDescriptor().getModuleName(); if(contextRoot==null) contextRoot = dc.getSource().getName();