Source code for /engineering/autohit-2003/src/autohit/common/deployment/KickConfigure.javaOriginal file KickConfigure.java
   1 /**
   2  * AUTOHIT 2003
   3  * Copyright Erich P Gatejen (c) 1989,1997,2003,2004
   4  * 
   5  * This program is free software; you can redistribute it and/or modify 
   6  * it under the terms of the GNU General Public License as published by 
   7  * the Free Software Foundation; either version 2 of the License, or (at
   8  * your option) any later version.
   9  * This program is distributed in the hope that it will be useful, but
  10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12  * more details.
  13  * 
  14  * You should have received a copy of the GNU General Public License along
  15  * with this program; if not, write to the Free Software Foundation, Inc.,
  16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17  *
  18  * Additional license information can be found in the documentation.
  19  * @author Erich P Gatejen
  20  */
  21 package autohit.common.deployment;
  22 
  23 import java.io.File;
  24 import org.apache.commons.collections.ExtendedProperties;
  25 import autohit.common.AutohitProperties;
  26 
  27 /**
  28  * A deployment manager.  It will handle configuration, installation, and checkpointing.
  29  *
  30  * @author Erich P. Gatejen
  31  * @version 1.0
  32  * <i>Version History</i>
  33  * <code>EPG - Initial - 25Apr03 
  34  * 
  35  */
  36 public class KickConfigure {
  37 
  38 	/**
  39 	 * Command system
  40 	 */
  41 	public ExtendedProperties props;
  42 
  43 	/**
  44 	 *  Default constructor. 
  45 	 */
  46 	public KickConfigure() {
  47 	}
  48 
  49 	/**
  50 	 *  Object main
  51 	 */
  52 	public void go(String it, String javaexec) {
  53 
  54 		try {
  55 			DeploymentConfigure dc = new DeploymentConfigure();
  56 
  57 			// validate it
  58 			File f = new File(it + AutohitProperties.vKICK_VERIFICATION_FILE);
  59 			if (!f.exists()) {
  60 				help();
  61 				return;
  62 			}
  63 
  64 			props = new ExtendedProperties();
  65 			props.put(AutohitProperties.CONFIG_ROOT_CONFIG, it);
  66 			props.put(AutohitProperties.CONFIG_JAVA_CONFIG, javaexec);
  67 			dc.configure(AutohitProperties.vKICK_STORE, it, props);
  68 		} catch (Exception e) {
  69 			System.out.println("Catastrophic ERROR.  System is likely corrupt.");
  70 			System.out.println("The error is= " + e.getMessage());
  71 			return;
  72 
  73 		}
  74 	}
  75 
  76 	/**
  77 	 * help
  78 	 */
  79 	public static void help() {
  80 		System.out.println("KickConfigure.call AUTOHIT_ROOT JAVA_EXEC");
  81 		System.out.println("You MUST call this with two parameters, no more or less.");
  82 		System.out.println("AUTOHIT_ROOT : The root of the install.");
  83 		System.out.println("JAVA_EXEC    : Path to a java executable.  It should be qualified, if not in the path.");
  84 	}
  85 
  86 	/**
  87 	 * main interface
  88 	 */
  89 	public static void main(String[] args) {
  90 
  91 		// handle arguments
  92 		if (args.length != 2) {
  93 			help();
  94 			return;
  95 		}
  96 
  97 		try {
  98 			KickConfigure me = new KickConfigure();
  99 			me.go(args[0], args[1]);
 100 		} catch (Exception e) {
 101 			e.printStackTrace();
 102 		}
 103 	}
 104 }