public static boolean isEmbedded(DeploymentContext context) { ReadableArchive archive = context.getSource(); return (archive != null && archive.getParentArchive() != null); }
public static List<URI> getExternalLibraries(ReadableArchive archive) { List<URI> externalLibURIs = new ArrayList<URI>(); try { List<URL> manifestURLs = getManifestLibraries(archive); URI archiveURI = archive.getURI(); if (archive.getParentArchive() != null) { archiveURI = archive.getParentArchive().getURI(); } for (URL manifestURL : manifestURLs) { URI manifestLibURI = archiveURI.relativize(manifestURL.toURI()); if (manifestLibURI.isAbsolute()) { File externalLib = new File(manifestLibURI); if (externalLib.exists()) { externalLibURIs.add(manifestLibURI); } } } } catch (Exception e) { Logger.getAnonymousLogger().log(Level.WARNING, e.getMessage(), e); } return externalLibURIs; }
private static List<URL> getManifestLibraries(ReadableArchive archive, Manifest manifest) { String appRootPath = null; ReadableArchive parentArchive = archive.getParentArchive(); if (parentArchive != null) { appRootPath = (new File(parentArchive.getURI())).getPath(); } else { try { appRootPath = (new File(archive.getURI().getPath())).getParent(); } catch (Exception e) { // ignore, this is the jar inside jar case } } // add libraries referenced through manifest return ASClassLoaderUtil.getManifestClassPathAsURLs( manifest, appRootPath); }
@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(); }
public static List<URI> getLibraryJarURIs(Application app, ReadableArchive archive) throws Exception { List<URL> libraryURLs = new ArrayList<URL>(); List<URI> libraryURIs = new ArrayList<URI>(); // add libraries referenced through manifest libraryURLs.addAll(DeploymentUtils.getManifestLibraries(archive)); ReadableArchive parentArchive = archive.getParentArchive(); if (parentArchive == null) { return Collections.emptyList(); } File appRoot = new File(parentArchive.getURI()); // add libraries jars inside application lib directory libraryURLs.addAll(ASClassLoaderUtil.getAppLibDirLibrariesAsList( appRoot, app.getLibraryDirectory(), null)); for (URL url : libraryURLs) { libraryURIs.add(Util.toURI(url)); } return libraryURIs; }
private void addOtherNondeployedScanTargets(final ReadableArchive clientArchive, final ApplicationClientDescriptor acDescr, final Map<String,ReadableArchive> candidates) { /* * The archive is a non-deployed one. We know from an earlier check * that this is not a stand-alone app client, so we can use the * app client archive's parent archive to get to the containing EAR for * use in a subarchive scanner. */ final ReadableArchive earArchive = clientArchive.getParentArchive(); EARBasedPersistenceHelper.addLibraryAndTopLevelCandidates(earArchive, acDescr.getApplication(), true, candidates); }
private void addOtherNondeployedScanTargets(final ReadableArchive clientArchive, final ApplicationClientDescriptor acDescr, final Map<String,ReadableArchive> candidates) { /* * The archive is a non-deployed one. We know from an earlier check * that this is not a stand-alone app client, so we can use the * app client archive's parent archive to get to the containing EAR for * use in a subarchive scanner. */ final ReadableArchive earArchive = clientArchive.getParentArchive(); EARBasedPersistenceHelper.addLibraryAndTopLevelCandidates(earArchive, acDescr.getApplication(), true, candidates); }
public static List<URL> getLibraryJars(BundleDescriptor bundleDesc, ReadableArchive archive) throws IOException { List<URL> libraryURLs = new ArrayList<URL>(); // add libraries referenced through manifest libraryURLs.addAll(DeploymentUtils.getManifestLibraries(archive)); ReadableArchive parentArchive = archive.getParentArchive(); if (parentArchive == null || bundleDesc == null) { // ear level or standalone module return libraryURLs; } File appRoot = new File(parentArchive.getURI()); ModuleDescriptor moduleDesc = ((BundleDescriptor)bundleDesc).getModuleDescriptor(); Application app = ((BundleDescriptor)moduleDesc.getDescriptor()).getApplication(); // add libraries jars inside application lib directory libraryURLs.addAll(ASClassLoaderUtil.getAppLibDirLibrariesAsList( appRoot, app.getLibraryDirectory(), null)); return libraryURLs; }
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; }
if (!app.isVirtual()) { ReadableArchive parentArchive = ctx.getSource().getParentArchive();
public boolean hasAnnotationInArchiveWithNoScanning(ReadableArchive archive) throws IOException { Types types = null; if (archive.getParentArchive() != null) { types = archive.getParentArchive().getExtraData(Types.class); } else { types = archive.getExtraData(Types.class);
String appLoc = dc.getSource().getParentArchive().getURI().getPath(); altDDName = appLoc + altDDName;
List<URI> classPathURIs = handler.getClassPathURIs(archive); classPathURIs.addAll(getLibraryJarURIs(app, archive)); Types types = archive.getParentArchive().getExtraData(Types.class); DeployCommandParameters parameters = archive.getParentArchive().getArchiveMetaData(DeploymentProperties.COMMAND_PARAMS, DeployCommandParameters.class); Properties appProps = archive.getParentArchive().getArchiveMetaData(DeploymentProperties.APP_PROPS, Properties.class); ExtendedDeploymentContext context = new DeploymentContextImpl(null, archive, parameters, habitat.<ServerEnvironment>getService(ServerEnvironment.class)); if (appProps != null) { Hashtable sniffersTable = archive.getParentArchive().getExtraData(Hashtable.class); if (sniffersTable == null) { sniffersTable = new Hashtable<String, Collection<Sniffer>>(); archive.getParentArchive().setExtraData(Hashtable.class, sniffersTable);
private ModuleInfo prepareBundle(final ModuleDescriptor md, Application application, final ExtendedDeploymentContext bundleContext) throws Exception { List<EngineInfo> orderedContainers = null; ProgressTracker tracker = bundleContext.getTransientAppMetaData(ExtendedDeploymentContext.TRACKER, ProgressTracker.class); try { // let's get the previously stored list of sniffers Hashtable<String, Collection<Sniffer>> sniffersTable = bundleContext.getSource().getParentArchive().getExtraData(Hashtable.class); Collection<Sniffer> sniffers = sniffersTable.get(md.getArchiveUri()); // let's get the list of containers interested in this module orderedContainers = deployment.setupContainerInfos(null, sniffers, bundleContext); if (orderedContainers == null) { return null; } } catch(Exception e) { deplLogger.log(Level.WARNING, ERROR_OCCURRED, e); throw e; } return deployment.prepareModule(orderedContainers, md.getArchiveUri(), bundleContext, tracker); }
public boolean hasAnnotationInArchiveWithNoScanning(ReadableArchive archive) throws IOException { Types types = null; if (archive.getParentArchive() != null) { types = archive.getParentArchive().getExtraData(Types.class); } else { types = archive.getExtraData(Types.class);
@Override public void run(Habitat habitat, DeploymentContext context, String cp) throws Exception { rootLocation_ = new FileArchive(); BundleDescriptor bundle = DOLUtils.getCurrentBundleForContext(context); if (bundle.hasWebServiceClients() && (bundle instanceof ApplicationClientDescriptor)) { hasWebServiceClients = true; } if(bundle.isStandalone()) { rootLocation_.open(context.getSourceDir().toURI()); } else { rootLocation_.open(context.getSource().getParentArchive().getURI()); } this.context = context; this.habitat = habitat; this.moduleClassPath = cp; Application application = context.getModuleMetaData(Application.class); application.visit((ApplicationVisitor) this); }
if (archive.getParentArchive() != null) { parser = archive.getParentArchive().getExtraData(Parser.class); } else { parser = archive.getExtraData(Parser.class);
if (archive.getParentArchive() != null) { parser = archive.getParentArchive().getExtraData(Parser.class); } else { parser = archive.getExtraData(Parser.class);