User: jung
Date: 00/12/22 07:43:22
Modified: src/de/infor/ce/console Console.java ConsoleException.java
ConsoleFactory.java Environment.java
SystemConsoleFactoryImpl.java
SystemConsoleImpl.java console.dfPackage
Log:
repackaged thread pooling. Coherent environment. Exception extensions.
Revision Changes Path
1.2 +21 -15 zoap/src/de/infor/ce/console/Console.java
Index: Console.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/Console.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Console.java 2000/12/22 08:34:42 1.1
+++ Console.java 2000/12/22 15:43:20 1.2
@@ -1,20 +1,26 @@
-package de.infor.ce.console;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-/**
- * $Id: Console.java,v 1.1 2000/12/22 08:34:42 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/console/Console.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+package de.infor.ce.console;
+
import java.io.InputStream;
import java.io.PrintStream;
@@ -24,8 +30,8 @@
* interface in order to plugin modules into different deployment
scenarios.
*
* @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * @author jung
+ * @version $Revision: 1.2 $
*/
public interface Console {
1.2 +71 -16 zoap/src/de/infor/ce/console/ConsoleException.java
Index: ConsoleException.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/ConsoleException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConsoleException.java 2000/12/22 08:34:42 1.1
+++ ConsoleException.java 2000/12/22 15:43:20 1.2
@@ -1,23 +1,78 @@
-package de.infor.ce.console;
-
-/**
- * $Id: ConsoleException.java,v 1.1 2000/12/22 08:34:42 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/console/ConsoleException.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+package de.infor.ce.console;
+
/**
- * <Description>
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * An exception that is thrown, if the creation of some console
+ * went wrong. We do not want to produce any exception upon failures
+ * inside the logging - that could easily cause recursive trouble!
+ * @author jung
+ * @version $Revision: 1.2 $
*/
+
public class ConsoleException extends Exception {
+
+ /** an embedded exception */
+ Throwable actualThrowable;
+
+ /** constructor for embedding an arbitrary throwable */
+ public ConsoleException(Throwable throwable) {
+ super();
+ actualThrowable = throwable;
+ }
+
+ /** message-based constructor for embedding an arbitrary throwable */
+ public ConsoleException(String message, Throwable throwable) {
+ super(message);
+ actualThrowable = throwable;
+ }
+
+ public ConsoleException(String message) {
+ super(message);
+ }
+
+ /** default constructor */
+ public ConsoleException() {
+ }
+
+ /** accesses the embedded throwable */
+ public Throwable getActualThrowable() {
+ return actualThrowable;
+ }
+
+ /** accesses the embedded throwable */
+ public void setActualThrowable(Throwable throwable) {
+ actualThrowable = throwable;
+ }
+
+ /** manipulate the toString method to also show the embedded throwable */
+ public String toString() {
+ return super.toString() + ": embedded exception " +
actualThrowable.toString();
+ }
+
+ /** the printStackTrace method produces recursive traces */
+ public void printStackTrace() {
+ super.printStackTrace();
+ if (actualThrowable != null)
+ actualThrowable.printStackTrace();
+ }
}
1.2 +24 -16 zoap/src/de/infor/ce/console/ConsoleFactory.java
Index: ConsoleFactory.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/ConsoleFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConsoleFactory.java 2000/12/22 08:34:43 1.1
+++ ConsoleFactory.java 2000/12/22 15:43:20 1.2
@@ -1,27 +1,35 @@
-package de.infor.ce.console;
-
-/**
- * $Id: ConsoleFactory.java,v 1.1 2000/12/22 08:34:43 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/console/ConsoleFactory.java,v
$
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+package de.infor.ce.console;
+
/**
- * A factory for consoles
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * An interface for console factories
+ * @author jung
+ * @version $Revision: 1.2 $
*/
public interface ConsoleFactory {
+ /** takes the @arg moduleName as the input */
public Console createConsole(String moduleName) throws ConsoleException;
-}
+} // ConsoleFactory
1.2 +179 -76 zoap/src/de/infor/ce/console/Environment.java
Index: Environment.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/Environment.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Environment.java 2000/12/22 08:34:43 1.1
+++ Environment.java 2000/12/22 15:43:20 1.2
@@ -1,93 +1,196 @@
-/**
- * $Id: Environment.java,v 1.1 2000/12/22 08:34:43 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source: /products/cvs/ejboss/zoap/src/de/infor/ce/console/Environment.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package de.infor.ce.console;
import java.util.Properties;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
/**
- * Environment provides a hook for all package-local configurations.
- *
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * Environment contains static variables and other helping stuff that either
influence
+ * the compilation of the package or initialise its runtime environment
from config files.
+ * @author jung
+ * @version $Revision: 1.2 $
*/
public abstract class Environment {
- /** how this module is called */
- public static final String MODULE_NAME = "console";
+ //
+ // Place your non-final public statics here
+ //
+
+ /** the console factory class defaults to the system console factory */
+ public static Class CONSOLE_FACTORY_CLASS = SystemConsoleFactoryImpl.class;
+
+ /** the logger factory we apply, is set for bootstrapping purposes */
+ public static ConsoleFactory CONSOLE_FACTORY=new SystemConsoleFactoryImpl();
+
+ //
+ // non-final public system statics
+ //
+
+ /** runtime logging settings */
+ public static int LOG_LEVEL = 1;
+
+ /** the properties belonging to this module */
+ public static Properties PROPERTIES = System.getProperties();
+
+ /** the logger for this module, is set for bootstrapping purposes */
+ public static Console CONSOLE = new SystemConsoleImpl();
+
+ //
+ // final public system static
+ //
+
+ /** whether debug messages are produced, compile-time switch */
+ public static final int DEBUG_LEVEL = 0;
+
+ /** how this module is called */
+ public static final String MODULE_NAME =
Environment.class.getName().substring(0,
+ Environment.class.getName().length() - 12);
+
+ /** where the resources needed to configure this module are found */
+ public static final String RESOURCE_PATH = "";
+
+ /** whether a config file is loaded */
+ public static final boolean READ_CONFIG_FILE = false;
+
+ /** where the resources needed to configure this module are found */
+ public static final String CONFIG_FILE_SUFFIX = ".conf";
+
+ //
+ // static initialisation part, DO NOT MODIFY
+ //
+
+ /** initialisation is done at class loading time */
+ static {
+
+ // this is an exception to the usual Environment design
+ // for bootstrapping the console
+
+ if (READ_CONFIG_FILE) {
+ try {
+
+ if (DEBUG_LEVEL > 0)
+ CONSOLE.log(Environment.class.toString() +
+ "_static initializer: trying to load
configuration resource file " +
+ RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX);
+
+ // and add your personal configuration file
+ PROPERTIES.load(Environment.class.getClassLoader().
+ getResourceAsStream(RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX));
+ } catch (Exception e) {
+
+ if (DEBUG_LEVEL > 0) {
+ CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " + e + "
while trying to load configuration resource file " +
+ RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX);
+ CONSOLE.exception(e);
+ }
+ }
+ }
+
+ try {
+ Field[] fields = Environment.class.getFields();
+
+ for (int count = 0; count < fields.length; count++) {
+ try {
+ if
(PROPERTIES.containsKey(fields[count].getName()) &&
+
Modifier.isStatic(fields[count].getModifiers()) &&
+
!Modifier.isFinal(fields[count].getModifiers())) {
+
+
+ if (DEBUG_LEVEL > 0)
+
CONSOLE.log(Environment.class.toString() +
+ "_static initializer: trying
to initialize field " + fields[count].getName()
+ + " with configuration
property " +
+
PROPERTIES.getProperty(fields[count].getName()));
+
+ fields[count].setAccessible(true);
+
+ if
(fields[count].getType().equals(boolean.class) ||
+
fields[count].getType().equals(Boolean.class)) {
+
fields[count].set(Environment.class,
+ new
Boolean(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(int.class) ||
+
fields[count].getType().equals(Integer.class)) {
+
fields[count].set(Environment.class,
+ new
Integer(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(double.class) ||
+
fields[count].getType().equals(Double.class)) {
+
fields[count].set(Environment.class,
+ new
Double(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(float.class) ||
+
fields[count].getType().equals(Float.class)) {
+
fields[count].set(Environment.class,
+ new
Float(PROPERTIES.getProperty(fields[count].getName())));
+ } else if
(fields[count].getType().equals(String.class)) {
+
fields[count].set(Environment.class, PROPERTIES.
+
getProperty(fields[count].getName()));
+ } else if
(fields[count].getType().equals(Class.class)) {
+
fields[count].set(Environment.class, Class.forName(PROPERTIES.
+
getProperty(fields[count].getName())));
+ } else {
+
+ if (DEBUG_LEVEL > 0)
+
CONSOLE.warning(Environment.class.toString() +
+ "_static initializer:
type " + fields[count].getType().getName() + " of field " +
+
fields[count].getName() + " is not supported by the reflection configurator.");
+
+ }
+
+ }
+ } catch (Exception e) {
+ if (DEBUG_LEVEL > 0) {
+
CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " +
e + " while trying to initialise field " + fields[count].getName());
+ CONSOLE.exception(e);
+ }
+ }
+ }
+ } catch (Exception e) {
+ if (DEBUG_LEVEL > 0) {
+ CONSOLE.error(Environment.class.toString() +
+ "_static initializer: encountered " + e + " while
trying to get class fields");
+ CONSOLE.exception(e);
+ }
+ }
- /** where the resources needed to configure this module are found */
- public static final String RESOURCE_PATH = "";
-
- /** where the resources needed to configure this module are found */
- public static final String CONFIG_FILE_SUFFIX = ".conf";
-
- /** whether debug messages are produced, compile-time switch */
- public static final int DEBUG_LEVEL = 0;
-
- /** runtime logging settings */
- public static int LOG_LEVEL = 1;
-
- /** the logger factory we apply */
- public static ConsoleFactory CONSOLE_FACTORY=
- SystemConsoleFactoryImpl.getConsoleFactory();
-
- /** whether a config file is loaded */
- public static final boolean READ_CONFIG_FILE = true;
-
- /** the properties belonging to this module */
- public static Properties PROPERTIES = System.getProperties();
-
- /** initialisation is done at class loading time */
- static {
- if (READ_CONFIG_FILE) {
- try {
- // and add your personal configuration file
- PROPERTIES.load(Environment.class.getClassLoader().
- getResourceAsStream(RESOURCE_PATH + MODULE_NAME +
CONFIG_FILE_SUFFIX));
- } catch (Exception e) {
- }
- }
- if (PROPERTIES.containsKey(MODULE_NAME + ".LOG_LEVEL")) {
- try {
- LOG_LEVEL = new Integer(PROPERTIES.getProperty(MODULE_NAME
- + ".LOG_LEVEL")).intValue();
- } catch (Exception e) {
- }
- }
- if (PROPERTIES.containsKey(MODULE_NAME + ".CONSOLE_FACTORY")) {
- try {
- CONSOLE_FACTORY= (ConsoleFactory)
- Class.forName(PROPERTIES.getProperty(MODULE_NAME +
- ".CONSOLE_FACTORY"),true,Thread.currentThread().
- getContextClassLoader()).newInstance();
- } catch (Exception e) {
- }
- }
-
- } // static
-
- /** set up a new logging facility */
- public static Console CONSOLE;
-
- static{
+ // set the console factory
try{
- CONSOLE=de.infor.ce.console.Environment.CONSOLE_FACTORY.
- createConsole(MODULE_NAME);
+ CONSOLE_FACTORY=(ConsoleFactory) CONSOLE_FACTORY_CLASS.newInstance();
} catch(Exception e) {
+ if(DEBUG_LEVEL>0)
+ CONSOLE.error(Environment.class.toString()+"_static initializer:
encountered "+e+" while trying to initialise console factory from class "+
+ CONSOLE_FACTORY_CLASS.toString()+".");
}
- }
+
+ try {
+ CONSOLE = CONSOLE_FACTORY.createConsole(MODULE_NAME);
+ } catch (Exception e) {
+ if(DEBUG_LEVEL>0)
+ CONSOLE.error(Environment.class.toString()+"_static initializer:
encountered "+e+" while trying to construct proper console from factory
"+CONSOLE_FACTORY);
+ }
+
+ } // static
-}
+} // Environment
1.2 +32 -30 zoap/src/de/infor/ce/console/SystemConsoleFactoryImpl.java
Index: SystemConsoleFactoryImpl.java
===================================================================
RCS file:
/products/cvs/ejboss/zoap/src/de/infor/ce/console/SystemConsoleFactoryImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SystemConsoleFactoryImpl.java 2000/12/22 08:34:43 1.1
+++ SystemConsoleFactoryImpl.java 2000/12/22 15:43:21 1.2
@@ -1,38 +1,40 @@
-package de.infor.ce.console;
-
-/**
- * $Id: SystemConsoleFactoryImpl.java,v 1.1 2000/12/22 08:34:43 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/console/SystemConsoleFactoryImpl.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+package de.infor.ce.console;
+
/**
- * Factory for system consoles
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * SystemConsoleFactoryImpl produces console wrappers around System.in, System.out,
System.err
+ * @author jung
+ * @version $Revision: 1.2 $
*/
public class SystemConsoleFactoryImpl implements ConsoleFactory {
-
- private SystemConsoleFactoryImpl() {
- }
-
- public Console createConsole(String moduleName) {
- return SystemConsoleImpl.getConsole();
- }
-
- private static ConsoleFactory singleton = new SystemConsoleFactoryImpl();
-
- public static ConsoleFactory getConsoleFactory() {
- return singleton;
- }
-}
+ /** public constructor, not much resources - why should we hide it? */
+ public SystemConsoleFactoryImpl() {
+ }
+
+ /** the factory method uses the SystemConsole singleton and forgets the module
name */
+ public Console createConsole(String moduleName) {
+ return SystemConsoleImpl.getConsole();
+ }
+} // SystemConsoleFactory
1.2 +52 -22 zoap/src/de/infor/ce/console/SystemConsoleImpl.java
Index: SystemConsoleImpl.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/SystemConsoleImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SystemConsoleImpl.java 2000/12/22 08:34:43 1.1
+++ SystemConsoleImpl.java 2000/12/22 15:43:21 1.2
@@ -1,91 +1,121 @@
-package de.infor.ce.console;
-
-/**
- * $Id: SystemConsoleImpl.java,v 1.1 2000/12/22 08:34:43 jung Exp $
- * Copyright 2000 by infor: business solutions AG
- * Hauerstra�e 12, D-66299 Friedrichsthal, Germany
- * All rights reserved.
+/*
+ * $Source:
/products/cvs/ejboss/zoap/src/de/infor/ce/console/SystemConsoleImpl.java,v $
+ * The Zero-effort Object Access Package is a library to support XML/SOAP
serialisation and invocation.
+ * Copyright (c) 2000 infor business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * This software is the confidential and proprietary information
- * of infor: business solutions AG ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with infor AG.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+package de.infor.ce.console;
+
import java.io.InputStream;
import java.io.PrintStream;
/**
* A simple console that is tight to System.in, System.out and System.err.
- * @see <related>
- * @author $Author: jung $
- * @version $Revision: 1.1 $
+ * @author jung
+ * @version $Revision: 1.2 $
*/
public class SystemConsoleImpl implements Console {
- private InputStream in;
- private PrintStream out;
- private PrintStream err;
+ /** we cache the stream references, in case somebody wants to redirect us*/
+ protected InputStream in;
+ /** we cache the stream references, in case somebody wants to redirect us*/
+ protected PrintStream out;
+ /** we cache the stream references, in case somebody wants to redirect us*/
+ protected PrintStream err;
- protected SystemConsoleImpl() {
+ /** constructor is public, there is no need to restrict it in terms of
resources */
+ public SystemConsoleImpl() {
in=System.in;
err=System.err;
out=System.out;
}
+ /** access the streams */
public InputStream getIn(){
return in;
}
+ /** access the streams */
public PrintStream getErr(){
return err;
}
+ /** access the streams */
public PrintStream getOut(){
return err;
}
+ /** logging writes to out */
+
public void log(String type, String message)
{
getOut().println(message);
}
+ /** logging writes to out */
+
public void log(String message)
{
log("Information", message);
}
+ /** error writes to err */
+
public void error(String message)
{
getErr().println(message);
}
-
+
+ /** warning writes to err */
+
public void warning(String message)
{
getErr().println(message);
}
-
+
+ /** debug writes to out */
+
public void debug(String message)
{
log("Debug", message);
}
-
+
+ /** exception writes to err */
+
public void exception(Throwable exception)
{
exception.printStackTrace(getErr());
}
+ /** reporting writes to out */
+
public void reportProgress(double report) {
log("Progress","progress: "+report);
}
+ /** quasi-"singleton" reference */
private static Console singleton=new SystemConsoleImpl();
+ /** access the quasi-singleton */
public static Console getConsole() {
return singleton;
}
-}
+} //SystemConsoleImpl
1.2 +6 -1 zoap/src/de/infor/ce/console/console.dfPackage
Index: console.dfPackage
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/console/console.dfPackage,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- console.dfPackage 2000/12/22 08:34:43 1.1
+++ console.dfPackage 2000/12/22 15:43:21 1.2
@@ -6,7 +6,12 @@
@__modelType diagram
*/
class diagram {
-}/**
+/**
+@__ref <oiref:java#Class#de.infor.ce.console.Environment:oiref><oihard>
+@__modelType reference
+*/
+class reference7 {
+}}/**
@__tags
@shapeType ClassDiagram
*/