public PaaSDeploymentContext(String appName, DeploymentContext dc){ this.appName = appName; this.dc = dc; if(dc != null){ this.archive = dc.getSource(); } }
protected String getObjectType(DeploymentContext context) { try{ Manifest manifest = context.getSource().getManifest(); if(manifest==null) return null; Attributes attrs = manifest.getMainAttributes(); return attrs.getValue(APPLICATION_TYPE); }catch(IOException e){ // by default resource-type will be assigned "user". return null; } }
public static List<URL> getManifestLibraries(DeploymentContext context) throws IOException { return getManifestLibraries(context.getSource()); }
public static boolean isEmbedded(DeploymentContext context) { ReadableArchive archive = context.getSource(); return (archive != null && archive.getParentArchive() != null); }
public static List<URL> getManifestLibraries(DeploymentContext context, Manifest manifest) throws IOException { return getManifestLibraries(context.getSource(), manifest); }
public void initCompositeMetaData(DeploymentContext context) { // populate ear level metadata getApplicationHolder(context.getSource(), context, true); }
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 List<URL> getManifestLibraries(DeploymentContext context) { try { Manifest manifest = getManifest(context.getSource()); return DeploymentUtils.getManifestLibraries(context, manifest); }catch (IOException ioe) { _logger.log(Level.WARNING, "Exception while getting manifest classpath: ", ioe); return new ArrayList<URL>(); } }
private List<ReadableArchive> getExternalLibraries( DeploymentContext context) throws IOException { List<ReadableArchive> externalLibArchives = new ArrayList<ReadableArchive>(); String skipScanExternalLibProp = context.getAppProps().getProperty( DeploymentProperties.SKIP_SCAN_EXTERNAL_LIB); if (Boolean.valueOf(skipScanExternalLibProp)) { // if we skip scanning external libraries, we should just // return an empty list here return Collections.EMPTY_LIST; } List<URI> externalLibs = DeploymentUtils.getExternalLibraries(context.getSource()); for (URI externalLib : externalLibs) { externalLibArchives.add(archiveFactory.openArchive(new File(externalLib.getPath()))); } return externalLibArchives; }
private boolean scanForPURRootsInEarRoot(DeploymentContext ctx, Set<ModuleDescriptor<BundleDescriptor>> modules) { boolean puPresentInEarRoot = false; Enumeration<String> entriesInEar = ctx.getSource().entries(); while(entriesInEar.hasMoreElements() && !puPresentInEarRoot) { String entry = entriesInEar.nextElement(); puPresentInEarRoot = PersistenceArchivist.isProbablePuRootJar(entry) && !EARBasedPersistenceHelper.isComponentJar(entry, modules); } return puPresentInEarRoot; } }
private List<ReadableArchive> getExternalLibraries( DeploymentContext context) throws IOException { List<ReadableArchive> externalLibArchives = new ArrayList<ReadableArchive>(); String skipScanExternalLibProp = context.getAppProps().getProperty( DeploymentProperties.SKIP_SCAN_EXTERNAL_LIB); if (Boolean.valueOf(skipScanExternalLibProp)) { // if we skip scanning external libraries, we should just // return an empty list here return Collections.EMPTY_LIST; } List<URI> externalLibs = DeploymentUtils.getExternalLibraries(context.getSource()); for (URI externalLib : externalLibs) { externalLibArchives.add(archiveFactory.openArchive(new File(externalLib.getPath()))); } return externalLibArchives; }
/** * Returns true if the passed file or directory is recognized by this * composite sniffer. * @param context deployment context * @return true if the location is recognized by this sniffer */ public boolean handles(DeploymentContext context) { return handles(context.getSource(), context.getClassLoader()); } }
@Override public String getApplicationLocation() { // Get source for current bundle. If it has not parent, it is the top level application // else continue traversing up till we find one with not parent. ReadableArchive archive = deploymentContext.getSource(); boolean appRootFound = false; while (!appRootFound) { ReadableArchive parentArchive = archive.getParentArchive(); if(parentArchive != null) { archive = parentArchive; } else { appRootFound = true; } } return archive.getURI().getPath(); }
@Override public void event(@RestrictTo(Deployment.DEPLOYMENT_FAILURE_NAME) Event event) { if( ! event.is(Deployment.DEPLOYMENT_FAILURE) ) return; DeploymentContext dc = Deployment.DEPLOYMENT_FAILURE.getHook(event); if (!archive.equals(dc.getSource())) return; // Will destroy all underlying services disposeServiceLocator(); }
/** * Returns a collection of sniffers that recognized some parts of the * passed archive as components their container handle. * * If no sniffer recognize the passed archive, an empty collection is * returned. * * @param context the deployment context * @return possibly empty collection of sniffers that handle the passed * archive. */ public Collection<Sniffer> getSniffers(DeploymentContext context) { ReadableArchive archive = context.getSource(); ArchiveHandler handler = context.getArchiveHandler(); List<URI> uris = handler.getClassPathURIs(archive); Types types = context.getTransientAppMetaData(Types.class.getName(), Types.class); return getSniffers(context, uris, types); }
/** * Returns true if the passed file or directory is recognized by this * composite sniffer. * @param context deployment context * @return true if the location is recognized by this sniffer */ public boolean handles(DeploymentContext context) { ArchiveType archiveType = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType()); if (archiveType != null && !supportsArchiveType(archiveType)) { return false; } return handles(context.getSource()); }
/** * Returns true if the passed file or directory is recognized by this * composite 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; } return DeploymentUtils.isArchiveOfType(context.getSource(), earType, context, locator); }
/** * 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; } return DeploymentUtils.isArchiveOfType(context.getSource(), warType, context, locator); }
/** * 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; } return DeploymentUtils.isArchiveOfType(context.getSource(), rarType, context, locator); }
/** * 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()); }