|
From: Michael K. <ko...@us...> - 2004-08-11 15:12:36
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13085/src/org/cobricks/cwall Modified Files: CWall.java Log Message: Index: CWall.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall/CWall.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- CWall.java 26 Jul 2004 07:16:38 -0000 1.10 +++ CWall.java 11 Aug 2004 15:12:26 -0000 1.11 @@ -213,6 +213,8 @@ } } + } else { + configMap.put(aname, avalue); } } //end of while |
|
From: Michael K. <ko...@us...> - 2004-09-16 14:39:52
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13455/src/org/cobricks/cwall Modified Files: CWall.java Log Message: Index: CWall.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall/CWall.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- CWall.java 27 Aug 2004 06:45:41 -0000 1.12 +++ CWall.java 16 Sep 2004 14:39:43 -0000 1.13 @@ -96,12 +96,14 @@ this.printHelp(); return; } else if (tmps.equals("-c") || tmps.equals("--configDir")) { - configDir = args[i+1]; + configDir = args[i+1]; File testFile = new File(configDir); if (!testFile.isDirectory()) { this.exitProgram("The config directory '" + configDir + " does not exist"); - } + } else { + ResourceUtil.setConfigDir(configDir); + } i = i+2; continue; } else if (tmps.equals("-e") || tmps.equals("--endpoint")) { |
|
From: Michael K. <ko...@us...> - 2005-02-08 15:56:14
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5725 Modified Files: CWall.java Log Message: Index: CWall.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall/CWall.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- CWall.java 20 Sep 2004 08:08:56 -0000 1.14 +++ CWall.java 8 Feb 2005 15:56:04 -0000 1.15 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Cobricks Group. All rights reserved. + * Copyright (c) 2004, 2005 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software @@ -34,7 +34,7 @@ public class CWall { - static Logger logger = Logger.getLogger(CWall.class); + static Logger logger = null; /** configDir (relative or absolute path) */ private String configDir = null; @@ -88,8 +88,8 @@ */ public void init(String[] args) { - logger.info("Checking command line parameters"); - + Properties overwriteProperties = new Properties(); + for (int i=0; i<args.length; ) { String tmps = args[i]; if (tmps.equals("-h") || tmps.equals("--help")) { @@ -97,7 +97,7 @@ return; } else if (tmps.equals("-c") || tmps.equals("--configDir")) { configDir = args[i+1]; - File testFile = new File(configDir); + File testFile = new File(configDir); if (!testFile.isDirectory()) { this.exitProgram("The config directory '" + configDir + " does not exist"); @@ -122,38 +122,69 @@ configMap.put("cwall.view.defaultView", args[i+1]); i = i+2; continue; + } else if (tmps.startsWith("-D")) { + if (tmps.equals("-D")) { + String tmps2 = args[i+1]; + int pos = tmps2.indexOf("="); + if (pos > -1) { + String aname = tmps2.substring(0, pos); + String avalue = tmps2.substring(pos+1); + overwriteProperties.put(aname, avalue); + } else { + System.err.println("Illegal properties definition in command line: " + +tmps2); + } + i = i+2; + } else { + String tmps2 = tmps.substring(2); + int pos = tmps2.indexOf("="); + if (pos > -1) { + String aname = tmps2.substring(0, pos); + String avalue = tmps2.substring(pos+1); + overwriteProperties.put(aname, avalue); + } else { + System.err.println("Illegal properties definition in command line: " + +tmps2); + } + i = i+1; + } + continue; } else { - logger.error("wrong input: " +tmps); - logger.info("Display Help:"); + System.err.println("wrong input: " +tmps); + System.out.println("Display Help:"); this.printHelp(); return; } } - // Check if all the required command line parameters are present - if (configDir == null) { - this.exitProgram("Please specify a config directory by starting the " - +"program with the according parameter."); - } - ResourceUtil.setConfigDir(configDir); - if (!configMap.containsKey("user")) { - this.exitProgram("Please specify a username for the access to " - +"the Cobricks platform by starting the program with " - +"the according parameter."); - } - if (!configMap.containsKey("password")) { - this.exitProgram("Please specify a password for the access to " - +"the Cobricks platform by starting the program with " - +"the according parameter."); - } - // configure logger - PropertyConfigurator.configure(configDir + File.separator - +"log.properties"); + if (configDir != null) { + PropertyConfigurator.configure(configDir + File.separator + +"log.properties"); + } else { + // try to load log configuration properties from resource + InputStream in = this.getClass().getResourceAsStream("/conf/log.properties"); + if (in != null) { + // load it + Properties logproperties = new Properties(); + try { + logproperties.load(in); + in.close(); + PropertyConfigurator.configure(logproperties); + } catch (Exception e) { + logger.warn("Failed loading log properties from resources: " + +e.toString()); + } + } else { + logger.warn("Failed loading log properties from resources"); + } + } + logger = Logger.getLogger(CWall.class); // read properties (from config file) - this.readProperties(configDir); - configMap.put("configDir", configDir); + this.readProperties(configDir, overwriteProperties); + if (configDir != null) + configMap.put("configDir", configDir); // initialize ViewManager viewManager = new ViewManager(); @@ -167,10 +198,16 @@ * in the configMap * @param configDir Relative or absolute Path to the config directory - There * the files properties.txt and localproperties.txt are searched + * @param overwriteProperties A set of properties that overwrite the ones loaded from + * the configuration files - e.g. being provided in the command line */ - private void readProperties(String configDir) - { - logger.info("Reading configuration from "+configDir); + private void readProperties(String configDir, Properties overwriteProperties) + { + if (configDir == null) { + logger.info("Reading configuration from resources"); + } else { + logger.info("Reading configuration from directory "+configDir); + } Properties properties = new Properties(); PropertiesUtil.loadPropertiesResource("org.cobricks.cwall", "properties.txt", properties, null); @@ -183,10 +220,21 @@ PropertiesUtil.loadPropertiesFile(configDir, "localproperties.txt", properties, false); + // overwrite properties + Iterator i; + if (overwriteProperties != null) { + i = overwriteProperties.keySet().iterator(); + while (i.hasNext()) { + String aname = (String)i.next(); + String avalue = (String)overwriteProperties.get(aname); + properties.put(aname, avalue); + } + } + /* configMap will hold one entry for every view "view.XXX" and entries * for all other attributes (that do not start with "cwall.view.") */ - Iterator i = properties.entrySet().iterator(); + i = properties.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry)i.next(); String aname = (String)entry.getKey(); @@ -260,8 +308,8 @@ */ private void exitProgram(String message) { - logger.error(message); - logger.error("exiting program..."); + System.err.println(message); + System.err.println("exiting program..."); System.exit(0); } @@ -272,20 +320,22 @@ private void printHelp() { // display Options - logger.info("\nThis client interfaces with the platform via the"); - logger.info("WebServices interface and retrieves content to be"); - logger.info("displayed on a large screen display!\n"); - logger.info("Options:"); - logger.info("-h/--help: print this help message"); - logger.info("-c/--config: a local file (relative or absolute path)"); - logger.info(" holding properties for configuration"); - logger.info(" the client (necessary!)"); - logger.info("-e/--endpoint: the URL of the SOAP endpoint of the "); - logger.info(" platform the client should"); - logger.info(" connect to (necessary!)"); - logger.info("-u/--user: the user name of the platform"); - logger.info("-p/--password: the password for authenticating"); - logger.info(" on the platform"); - logger.info("-v/--view: the view to launch at the beginning"); + System.out.println("\nThis client interfaces with the platform via the"); + System.out.println("WebServices interface and retrieves content to be"); + System.out.println("displayed on a large screen display!\n"); + System.out.println("Options:"); + System.out.println("-h/--help: print this help message"); + System.out.println("-c/--config: a local file (relative or absolute path)"); + System.out.println(" holding properties for configuration"); + System.out.println(" the client (necessary!)"); + System.out.println("-e/--endpoint: the URL of the SOAP endpoint of the "); + System.out.println(" platform the client should"); + System.out.println(" connect to (necessary!)"); + System.out.println("-u/--user: the user name of the platform"); + System.out.println("-p/--password: the password for authenticating"); + System.out.println(" on the platform"); + System.out.println("-v/--view: the view to launch at the beginning"); + System.out.println("-D aname=avalue: define property"); + System.out.println("-Daname=avalue"); } } |
|
From: thammer <mth...@us...> - 2005-04-29 14:36:26
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11306/src/org/cobricks/cwall Modified Files: CWall.java Log Message: Index: CWall.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall/CWall.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- CWall.java 8 Feb 2005 15:56:04 -0000 1.15 +++ CWall.java 29 Apr 2005 14:36:16 -0000 1.16 @@ -25,7 +25,7 @@ /** * Main class of the Community Wall (CWall) client - a client that * accesses information from the community platform via SOAP and - * visualizes it on a lage screen display. + * visualizes it on a large screen display. * * @author mic...@ac... * @version $Date$ |
|
From: Michael K. <ko...@us...> - 2006-07-11 10:27:07
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16693/src/org/cobricks/cwall Modified Files: CWall.java Log Message: Index: CWall.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/cwall/CWall.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- CWall.java 31 Aug 2005 13:24:04 -0000 1.17 +++ CWall.java 11 Jul 2006 10:27:03 -0000 1.18 @@ -277,8 +277,8 @@ Class testClass = Class.forName(avalue); } catch (ClassNotFoundException e) { this.exitProgram("The class '" + avalue + - "' given in the config-file does " + - "not exist."); + "' used in the config-file " + + "could not be loaded."); } } } |