diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
| commit | b086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch) | |
| tree | 8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/process/AbstractMain.java | |
| parent | 22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff) | |
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/process/AbstractMain.java')
| -rw-r--r-- | source/com/c2kernel/process/AbstractMain.java | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/source/com/c2kernel/process/AbstractMain.java b/source/com/c2kernel/process/AbstractMain.java deleted file mode 100644 index 7401d1b..0000000 --- a/source/com/c2kernel/process/AbstractMain.java +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************
- * AbstractMain
- *
- * $Revision: 1.67 $
- * $Date: 2004/10/25 15:27:35 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.process;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-
-import com.c2kernel.utils.FileStringUtility;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/25 15:27:35 $
- * @version $Revision: 1.67 $
- **************************************************************************/
-abstract public class AbstractMain
-{
- public static boolean runningAsWrapper = false;
-
- /**************************************************************************
- *
- **************************************************************************/
- static protected void usage()
- {
- System.out.println();
- System.out.println("USAGE: com.c2kernel.process.AbstractMain \n" +
- " -config <server/client config file> \n" +
- " [-connect <LC connect file> ] (or LocalCentre in conf)\n" +
- " [-resURL c2kernel/resources] (or KernelResourceURL in conf)\n" +
- " [-domResURL domain/resources] (or DomainResourceURL in conf)\n" +
- " [-h] [-help] \n" +
- " [-logLevel 0-19] \n" +
- " [-logFile <path to log file>]");
- Logger.die("Initialisation error");
- }
-
- /**************************************************************************
- * reading and setting the standard c2k input paramaters
- **************************************************************************/
- static public java.util.Properties readC2KArgs( String[] args )
- {
- int i = 0;
- String configPath = null;
- String connectPath = null;
- java.util.Properties c2kProps = null;
- int logLevel = 0;
- PrintStream logStream = System.out;
- String centreId = null;
-
- try
- {
- if( args != null )
- {
- while( i < args.length )
- {
- if( args[i].equals("-h") || args[i].equals("-help") )
- {
- usage();
- }
- else if(args[i].equals("-config"))
- {
- if( (i+1) >= args.length )
- {
- System.out.println("AbstractMain::readC2KArgs() - argument expected " +
- "for -config");
- usage();
- }
- System.out.println("Config file: "+args[i+1]);
- configPath = args[++i];
-
- }
- else if(args[i].equals("-connect"))
- {
- if( (i+1) < args.length ) // batch file will have no arg if no cmd line arg
- {
- connectPath = args[++i];
- }
- }
- else if(args[i].equals("-logLevel"))
- {
- if( (i+1) >= args.length )
- {
- System.out.println("AbstractMain::readC2KArgs() - argument expected " +
- "for -logLevel");
- usage();
- }
- logLevel = Integer.parseInt(args[++i]);
- }
- else if(args[i].equals("-logFile"))
- {
- if( (i+1) >= args.length )
- {
- System.out.println("AbstractMain::readC2KArgs() - argument expected " +
- "for -logFile");
- usage();
- }
- logStream = new PrintStream(new FileOutputStream(args[++i], true));
- }
- i++;
- }
-
- // Set up log stream
- Logger.addLogStream(logStream, logLevel);
-
- if (configPath == null) {
- System.out.println("No config file specified");
- usage();
- }
-
- // Load config & connect files into c2kprops
- c2kProps = FileStringUtility.loadConfigFile( configPath );
-
- if (connectPath == null) {
- // see if LC is listed in the config
- Logger.msg(6, "No connect file specified in arguments. Looking in config.");
- centreId = c2kProps.getProperty("LocalCentre");
- if (centreId!= null) connectPath = "connect/"+centreId+".clc";
- }
-
- if (connectPath != null) {
- Logger.msg(6, "Connect file: "+connectPath);
- if (centreId == null) {
- String connectFileName = new File(connectPath).getName();
- centreId = connectFileName.substring(0, connectFileName.lastIndexOf(".clc"));
- c2kProps.setProperty("LocalCentre", centreId);
- }
- FileStringUtility.appendConfigFile( c2kProps, connectPath);
- }
- else {
- System.out.println("No connect file specified in args nor config file. Cannot continue.");
- usage();
- }
- }
- else
- {
- System.out.println("AbstractMain::readC2KArgs() - no arguments!");
- usage();
- }
- }
- catch( Exception ex )
- {
- System.out.println("Main::readC2KArgs() - bad arguments! ");
- ex.printStackTrace();
- usage();
- }
-
- Logger.msg(7, "AbstractMain::standardSetUp() - readC2KArgs() DONE.");
-
- return c2kProps;
- }
-
-}
|
