Refine search
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; }
if ((path.getScheme().equals("file")) || //NOI18N (path.getScheme().equals("jar"))) { //NOI18N return factory.openArchive(path); } else { return factory.createArchive(path);
public ReadableArchive openArchive(File path) throws java.io.IOException { try { return openArchive(prepareArchiveURI(path)); } catch(java.net.URISyntaxException e) { return null; } }
public WritableArchive createArchive(String protocol, File path) throws java.io.IOException { try { /* *Use the expanded constructor so illegal characters (such as embedded blanks) in the path *will be encoded. */ return createArchive(protocol, prepareArchiveURI(path)); } catch(java.net.URISyntaxException e) { return null; } }
Map<String, Properties> modulePropsMap = app.getModulePropertiesMap(); ApplicationConfigInfo savedAppConfig = new ApplicationConfigInfo(app); URI uri = new URI(app.getLocation()); File file = new File(uri); archive = archiveFactory.openArchive(file); try { if (archive != null) { archive.close();
uri = new URI(application.getLocation()); } catch (URISyntaxException e) { logger.severe("Cannot determine original location for application : " + e.getMessage()); if (location.exists()) { try { source = archiveFactory.openArchive(location); } catch (IOException e) { logger.log(Level.INFO, e.getMessage(),e ); File sourceFile = new File(source.getURI()); if (!source.exists()) { logger.log(Level.WARNING, "Cannot find application bits at " + sourceFile.getPath()); if ( (! keepreposdir) && !isDirectoryDeployed && source.exists()) {
/** * Creates a new archivist using the URL as the path. The URL * protocol will define the type of desired archive (jar, file, etc) * @param path to the archive * @return the apropriate archive */ public WritableArchive createArchive(URI path) throws IOException { String protocol = path.getScheme(); return createArchive(protocol, path); }
for ( URI oneAppLib : appLibs ) { for ( String oneInstalledLibrary : installedLibraries ) { if ( oneAppLib.getPath().endsWith( oneInstalledLibrary ) ) { ReadableArchive libArchive = null; try { libArchive = archiveFactory.openArchive(oneAppLib); if ( libArchive.exists( WeldUtils.META_INF_BEANS_XML ) ) { String bdaId = archive.getName() + "_" + libArchive.getName(); RootBeanDeploymentArchive rootBda = new RootBeanDeploymentArchive(libArchive,
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; }
private void addScanTargetsFromURIList(final ReadableArchive archive, final String relativeURIList, final Map<String,ReadableArchive> candidates) throws IOException { if (relativeURIList == null || relativeURIList.isEmpty()) { return; } final String[] relativeURIs = relativeURIList.split(" "); for (String uriText : relativeURIs) { final URI scanTargetURI = archive.getURI().resolve(uriText); candidates.put(uriText, archiveFactory.openArchive(scanTargetURI)); } }
String appRoot = archive.getURI().getSchemeSpecificPart(); //archive is a directory if (appRoot.endsWith(File.separator)) { appRoot = appRoot.substring(0, appRoot.length() - 1); try { try { subArchive = archiveFactory.openArchive(subModule); } catch (IOException ex) { logger.log(Level.WARNING, ex.getMessage()); if (acArchivist.hasStandardDeploymentDescriptor(subArchive) || acArchivist.hasRuntimeDeploymentDescriptor(subArchive) || acArchivist.getMainClassName(subArchive.getManifest()) != null) { md.setManifest(subArchive.getManifest()); app.addModule(md); continue; new AnnotationDetector(new EjbComponentAnnotationScanner()); for (int i = 0; i < unknowns.size(); i++) { File jarFile = new File(unknowns.get(i).getURI().getSchemeSpecificPart()); try { if (detector.hasAnnotationInArchive(unknowns.get(i))) {
File sourceFile = new File(archive.getURI().getSchemeSpecificPart()); initial.getAppProps().put(ServerTags.DEFAULT_APP_NAME, DeploymentUtils.getDefaultEEName(sourceFile.getName())); final WritableArchive expandedArchive = archiveFactory.createArchive(expansionDir); archiveHandler.expand(archive, expandedArchive, initial); if (logger.isLoggable(Level.FINE)) { archive.close(); } catch(IOException e) { logger.log(Level.SEVERE, KernelLoggerInfo.errorClosingArtifact, new Object[] { archive.getURI().getSchemeSpecificPart(), e}); throw e;
for (ModuleDescriptor aModule : a.getModules()) { entriesAdded.add(aModule.getArchiveUri()); ReadableArchive subSource = source.getSubArchive(aModule.getArchiveUri()); WritableArchive subTarget = target.createSubArchive(aModule.getArchiveUri()); Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType()); ReadableArchive subArchive = archiveFactory.openArchive(subTarget.getURI()); subSource.setParentArchive(subArchive); newArchivist.copyInto(subSource, subTarget, overwriteManifest); target.closeEntry(subTarget); String subModulePath = subSource.getURI().getSchemeSpecificPart(); String parentPath = source.getURI().getSchemeSpecificPart(); if (subModulePath.startsWith(parentPath)) { subModulePath = subModulePath.substring(parentPath.length()+File.separator.length());
oldArchive = archiveFactory.openArchive(new File(outPath)); } catch (IOException ioe) { try { File outputFile=null; if (oldArchive != null && oldArchive.exists() && !(oldArchive instanceof WritableArchive)) { out = archiveFactory.createArchive(outputFile); oldArchive.close(); } else { out = archiveFactory.createArchive(new File(outPath)); in.close(); ReadableArchive finalArchive = archiveFactory.openArchive(new File(outPath)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(outPath);
ReadableArchive source = archiveFactory.openArchive(moduleDir); WritableArchive target = archiveFactory.createArchive("jar", tempJar); Enumeration<String> e = source.entries(); while (e.hasMoreElements()) { String entryName = e.nextElement(); continue; InputStream sis = source.getEntry(entryName); if (sis != null) { InputStream is = new BufferedInputStream(sis); try { os = target.putNextEntry(entryName); FileUtils.copy(is, os, source.getEntrySize(entryName)); } finally { if (os!=null) {
/** * writes the content of an archive to a JarFile * * @param out jar output stream to write to */ protected void writeContents(WritableArchive out) throws IOException { ReadableArchive in = archiveFactory.openArchive(new File(path)); writeContents(in, out); in.close(); }
/** * extract a entry of this archive to a file * * @param entryName entry name * @param out file to copy the entry into */ public void extractEntry(String entryName, File out) throws IOException { ReadableArchive archive = archiveFactory.openArchive(new File(path)); InputStream is = archive.getEntry(entryName); OutputStream os = new BufferedOutputStream(new FileOutputStream(out)); ArchivistUtils.copy(new BufferedInputStream(is), os); archive.close(); }
public void open(URI... uris) throws IOException { archives = new ReadableArchive[uris.length]; int slot = 0; for (URI uri : uris) { archives[slot++] = archiveFactory.openArchive(uri); } }
archive = archiveFactory.openArchive(file); return; throw new IOException("Not able to expand " + archive.getName() + " in " + tmpFile); if (tmpFile.mkdirs()) WritableArchive targetArchive = archiveFactory.createArchive(tmpFile); new OSGiArchiveHandler().expand(archive, targetArchive, dc); logger.logp(Level.INFO, "OSGiDeploymentRequest", "expand", "Expanded at {0}", new Object[]{targetArchive.getURI()}); archive = archiveFactory.openArchive(tmpFile); } else { throw new IOException("Not able to expand " + archive.getName() + " in " + tmpFile);