/** * XML parser error handler. */ public void error(SAXParseException ex) throws SAXException { XMLUtil.printError("Error", ex); }
/** * Prints the stack trace of a given <code>Exception</code> object as the installation error * message. * * @param error * The given <code>Exception</code> object. */ protected synchronized void setInstallationError(Exception error) { _installationMsg = StringUtil.errorStackTraceContent(error); }
/** * Terminates the <code>MessageRouter</code> thread. This method should be called after all the * processing is finished. */ public void terminate() { _msgRouter.terminate(); }
/** * Extracts all files in a given JAR directory (including all its subdirectories) from a given JAR * file to a given target directory. * * @param jarFile * The given JAR file. * @param dirPath * The given JAR directory. * @param targetDir * The given target directory. * @return Total number of bytes extracted. * @throws IOException * If any I/O exception occurred. */ public static long extractDirectoryFromJar(JarFile jarFile, String dirPath, File targetDir) throws IOException { return extractFilesFromJar(jarFile, targetDir, new DirFileFilter(dirPath, null)); }
/** * Extracts all files from a given JAR file to a given target directory. * * @param jarFile * The given JAR file. * @param targetDir * The given target directory. * @return Total number of bytes extracted. * @throws IOException * If any I/O exception occurred. */ public static long extractFilesFromJar(JarFile jarFile, File targetDir) throws IOException { return extractFilesFromJar(jarFile, targetDir, null); }
/** * Creates list of files in a given directory, including all its subdirectories. * * @return <code>Collection</code> of <code>File</code> objects in the given directory, * including all its subdirectories. * @param filesDir * The given directory. * * @exception java.io.IOException * If any I/O exception occurs. */ public static Collection<File> createFileList(File filesDir) throws IOException { return createFileList(filesDir, true); }
/** * Deletes all temporary directories and files after the merging operation is completed. * * @throws IOException * If an I/O exception occurred. */ public void cleanUp() throws IOException { logInfoMessage("[" + PEAR_MERGER + "]: " + "deleting temporary files"); FileUtil.deleteDirectory(_outAggRootDir); }
/** * Allows the caller to wait for the completion of the process. * * @return Process exit code. */ public int waitFor() { return waitFor(0); }
/** * @return Error message writer for intraprocess messaging. */ protected PrintWriter getErrMsgWriter() { return _msgRouter.errWriter(); }
/** * @return Output message writer for intraprocess messaging. */ protected PrintWriter getOutMsgWriter() { return _msgRouter.outWriter(); }
/** * Adds a given object, implementing the <code>MessageRouter.StdChannelListener</code> interface * to the list of standard channel listeners. * * @param listener * The given <code>MessageRouter.StdChannelListener</code> object to be added to the * list. */ public void addMsgListener(MessageRouter.StdChannelListener listener) { _msgRouter.addChannelListener(listener); }
/** * Removes a given <code>MessageRouter.StdChannelListener</code> object from the list of * standard channel listeners. * * @param listener * The given <code>MessageRouter.StdChannelListener</code> object to be removed from * the list. */ public void removeMsgListener(MessageRouter.StdChannelListener listener) { _msgRouter.removeChannelListener(listener); }
/** * Creates list of subdirectories in a given root directory, including all its subdirectories. * * @param rootDir * The given root directory. * @return <code>Collection</code> of <code>File</code> objects, representing subdirectories * in the given root directory and all its subdirectories. * * @throws java.io.IOException * If any I/O exception occurs. */ public static Collection<File> createDirList(File rootDir) throws IOException { return createDirList(rootDir, true); }
/** * Prints entries of a given <code>Properties</code> object as XML elements to a given * <code>PrintWriter</code>, maintaining a given indentation level. * * @param elements * The given <code>Properties</code> object. * @param oWriter * The given <code>PrintWriter</code> object. * @param level * The given indentation level. * @throws IOException * if any I/O exception occurred. */ public static void printAllXMLElements(Properties elements, PrintWriter oWriter, int level) throws IOException { printAllXMLElements(elements, null, oWriter, level); }
/** * Sorts a given list of files by the 'last modified' time in the descending order. * * @param fileList * The given list of files. * @return The list of files sorted by the 'last modified' time in the descending order. */ public static SortedSet<File> sortFileListByTime(Collection<File> fileList) { TreeSet<File> set = new TreeSet<File>(new FileTimeComparator()); set.addAll(fileList); return set; }
/** * Extracts all files that have a given extension from a given JAR file to a given target * directory. To extract files without extension, use <code>null</code> as the * <code>fileExt</code> parameter. * * @param jarFile * The given JAR file. * @param fileExt * The given file extension. * @param targetDir * The given target directory. * @return Total number of bytes extracted. * @throws IOException * If any I/O exception occurred. */ public static long extractFilesWithExtFromJar(JarFile jarFile, String fileExt, File targetDir) throws IOException { return extractFilesFromJar(jarFile, targetDir, new DirFileFilter(null, fileExt)); }
/** * XML parser warning handler. */ public void warning(SAXParseException ex) throws SAXException { XMLUtil.printError("Warning", ex); } }
/** * Prints the stack trace of a given <code>Exception</code> object as the verification error * message. * * @param error * The given <code>Exception</code> object. */ protected synchronized void setVerificationError(Exception error) { _verificationMsg = StringUtil.errorStackTraceContent(error); }
/** * Overrides standard <code>finalize</code> method. */ protected void finalize() { _msgRouter.terminate(); }
/** * XML parser fatal error handler. */ public void fatalError(SAXParseException ex) throws SAXException { XMLUtil.printError("Fatal Error", ex); throw ex; }