8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster* $Id: Manifest.java,v 1.3 2009/02/17 18:41:41 kevinserwin Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class Manifest implements ManifestConstants{
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster verbose = Boolean.valueOf(DEFAULT_VERBOSE).booleanValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster recursive = Boolean.valueOf(DEFAULT_RECURSIVE).booleanValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster intoJar = Boolean.valueOf(DEFAULT_DIGEST_HANDLEJAR).booleanValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster intoWar = Boolean.valueOf(DEFAULT_DIGEST_HANDLEWAR).booleanValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster overwrite = Boolean.valueOf(DEFAULT_OVERWRITE).booleanValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster headerFilePath = System.getProperty(HEADER_FILE_PATH);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster srcFilePath = System.getProperty(SRC_FILE_PATH);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster destFilePath = System.getProperty(DEST_FILE_PATH);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster verbose = Boolean.valueOf(System.getProperty(VERBOSE_OPTION,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster recursive=Boolean.valueOf(System.getProperty(RECURSIVE,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster includePatternString = System.getProperty(INCLUDE_PATTERN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster excludePatternString = System.getProperty(EXCLUDE_PATTERN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster manifestName = System.getProperty(MANIFEST_NAME,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster wildCardString = System.getProperty(WILDCARD_CHAR);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster digestAlg=System.getProperty(DIGEST_ALG, SHA1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster intoJar = Boolean.valueOf(System.getProperty(DIGEST_HANDLEJAR,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster intoWar = Boolean.valueOf(System.getProperty(DIGEST_HANDLEWAR,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster overwrite = Boolean.valueOf(System.getProperty(OVERWRITE,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int index = includePatternString.indexOf(PATTERN_SEPARATOR, offset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster includePattern.add(includePatternString.substring(offset,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String tempPattern = includePatternString.substring(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster index = includePatternString.indexOf(PATTERN_SEPARATOR, offset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } while (true);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int index = excludePatternString.indexOf(PATTERN_SEPARATOR, offset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster excludePattern.add(excludePatternString.substring(offset,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String tempPattern = excludePatternString.substring(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster index = excludePatternString.indexOf(PATTERN_SEPARATOR, offset);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } while (true);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private boolean setSourceFile(String srcFilePath) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("Source file not specified!");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getProperty(String propertyName) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void removeProperty(String propertyName) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fout = new BufferedOutputStream(new FileOutputStream(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fout = new BufferedOutputStream(new FileOutputStream(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((parentFile != null) && (!parentFile.exists())) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fout = new BufferedOutputStream(new FileOutputStream(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((headerFile.exists()) && (headerFile.isFile())) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long currentTimeInMillis = System.currentTimeMillis();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create Date object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //Specify the desired date format
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //Create object of SimpleDateFormat and pass the desired date format.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster digester.digest(digestAlg, srcFile, digestResult, srcFilePath, intoJar,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public boolean createManifest(String srcFilePath, String destFilePath,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String headerFilePath, boolean intoJar, boolean intoWar) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.print("Creating Manifest file "+ destFilePath);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long currentTimeInMillis = System.currentTimeMillis();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create Date object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //Specify the desired date format
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster //Create object of SimpleDateFormat and pass the desired date format.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster digestResult.setProperty("identifier","generated-"+sdf.format(date));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return true;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster m.createManifest(srcFilePath, destFilePath, headerFilePath,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster true, true);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Prints the usage for using the patch generation utility
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public static void printUsage(PrintStream out){
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("Usage: java ARGUMENTS -jar Manifest.jar");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\t-D\"" + MANIFEST_CREATE_FILE + "=<RTM zip file>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tPath of RTM zip file [Required].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + LATEST_WAR_FILE +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<latest zip file>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tPath of the resulting patch file [Optional].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + IDENTIFIER_ENTRY +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<name of the entry which indicate version>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tName of the entry in manifest indicate identity " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "[Default: " + DEFAULT_IDENTIFIER_ENTRY + "].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + MANIFEST_PATTERN +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<pattern of manifest file>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tPattern of the manifest file in the war file " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "[Default: " + DEFAULT_MANIFEST_PATTERN + "].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + MANIFEST_FILE_NAME +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<name of the manifest file in the resulting file>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tName of the manifest file " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "[Required if " + VERSION_FILE + " is not defined].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + WILDCARD_CHAR +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<char to be used as wildcard>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tWild card character [Default: " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<properties file indicate version>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tProperties file indicate the version of patch " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "[Optional].");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\n\t-D\"" + PROPERTIES_FILE +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "=<propeties file has the above directive defined>\"");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster System.out.println("\tProperties file have above directives defined " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "[Optional].");