static String getName(URI uri) { String path = Util.getURIName(uri); int lastDot = path.lastIndexOf('.'); int endOfName = (lastDot != -1) ? lastDot : path.length(); String name = path.substring(0, endOfName); return name; }
/** * Returns the name portion of the archive's URI. * <p> * For FileArhive the name is all of the path that follows * the last slash (ignoring a slash at the end of the path). * <p> * Here are some example archive names for the specified FileArchive paths: * <ul> * <li>/a/b/c/d/ -> d * <li>/a/b/c/d -> d * <li>/a/b/c.jar -> c.jar * </ul> * @return the name of the archive * */ @Override public String getName() { return Util.getURIName(getURI()); }
@Override public File getScratchDir(String subDirName) { String modulePortion = Util.getURIName( getSource().getURI()); return (new File(super.getScratchDir(subDirName), modulePortion)); }
/** * check whether the archive is a .rar * @param archive archive to be tested * @return status of .rar or not */ public static boolean isRAR(ReadableArchive archive){ boolean isRar = false; try{ if (Util.getURIName(archive.getURI()).endsWith(RAR_EXTENSION)) { return true; } isRar = archive.exists(RA_XML); }catch(IOException ioe){ //ignore } return isRar; }
@Override public File getScratchDir(String subDirName) { String modulePortion = Util.getURIName( getSource().getURI()); return (new File(super.getScratchDir( subDirName), modulePortion)); } };
public static boolean isWebArchive(ReadableArchive archive) { try { if (Util.getURIName(archive.getURI()).endsWith(WAR_EXTENSION)) { return true; } if (archive.exists(WEB_INF)) { return true; } Enumeration<String> entries = archive.entries(); while (entries.hasMoreElements()) { String entryName = entries.nextElement(); if (entryName.endsWith(JSP_SUFFIX)) { return true; } } return false; } catch (IOException ioe) { // ignore } return false; }
@Override public boolean handles(ReadableArchive archive) { try { if (Util.getURIName(archive.getURI()).endsWith(WAR_EXTENSION)) { return true; } if (archive.exists(WEB_INF)) { return true; } if (archive.exists(AVATAR)) { return true; } Enumeration<String> entries = archive.entries(); while (entries.hasMoreElements()) { String entryName = entries.nextElement(); if (entryName.endsWith(JSP_SUFFIX)) { return true; } } return false; } catch (IOException ioe) { // ignore } return false; }
/** * {@inheritDoc} */ public boolean handles(ReadableArchive archive) throws IOException { boolean handles = false; try{ if (Util.getURIName(archive.getURI()).endsWith(RAR_EXTENSION)) { return true; } handles = archive.exists(RA_XML); }catch(IOException ioe){ //ignore } if (!handles && (archive instanceof FileArchive)) { GenericAnnotationDetector detector = new GenericAnnotationDetector(connectorAnnotations); handles = detector.hasAnnotationInArchive(archive); } return handles; } }
@Override public boolean handles(ReadableArchive archive) throws IOException { boolean isEar = false; try{ if (Util.getURIName(archive.getURI()).endsWith(EAR_EXTENSION)) { return true; } isEar = archive.exists(APPLICATION_XML) || archive.exists(SUN_APPLICATION_XML) || archive.exists(GF_APPLICATION_XML); if (!isEar) { isEar = isEARFromIntrospecting(archive); } }catch(IOException ioe){ //ignore } return isEar; }
/** * check whether the archive is a .ear * @param archive archive to be tested * @return status of .ear or not */ public static boolean isEAR(ReadableArchive archive){ boolean isEar = false; try{ if (Util.getURIName(archive.getURI()).endsWith(EAR_EXTENSION)) { return true; } isEar = archive.exists(APPLICATION_XML) || archive.exists(SUN_APPLICATION_XML) || archive.exists(GF_APPLICATION_XML); if (!isEar) { isEar = isEARFromIntrospecting(archive); } }catch(IOException ioe){ //ignore } return isEar; }
ClassLoader cl = null; try { String archiveName = Util.getURIName(archive.getURI()); ArchiveHandler archiveHandler = deployment.getArchiveHandler(archive); if (archiveHandler==null) {