User: jung
Date: 00/12/04 04:35:54
Modified: src/de/infor/ce/util Component.java Environment.java
ObjectFactory.java ThreadPool.java URN.java
util.dfPackage
Log:
adopted to latest jboss container,
added decimal and date
removed some problems due to forward-referencing in meta-data
added serialisation policy
Revision Changes Path
1.2 +197 -197 zoap/src/de/infor/ce/util/Component.java
Index: Component.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/Component.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Component.java 2000/08/10 21:06:46 1.1
+++ Component.java 2000/12/04 12:35:51 1.2
@@ -1,197 +1,197 @@
-/*
- * $Id: Component.java,v 1.1 2000/08/10 21:06:46 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package de.infor.ce.util;
-
-import java.util.Stack;
-import java.util.EmptyStackException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The explicit representation of an in-VM component in the infor:Component Engine.
<br>
- * Components are dedicated memory-apartments inside a VM that are generalisations
of the
- * classloader concept. Components carry their own classes, but in addition, their
own
- * meta-data and resources. Components are organised in a hierarchy in which
subordinate components depend on higher-level
- * components, but not vice-versa. <br> In order to cross the component boundary,
we must use techniques such as
- * serialisation, distributed transactions, etc., but maybe in a lightweight
format. <br>
- * @author $Author: jung $
- * @version $Version:$
- */
-
-public class Component {
-
- /** each component can have a parent */
- final private Component parent;
-
- /** each component has an associated classloader */
- final private ClassLoader associatedClassLoader;
-
- /** a stack of components that the current thread has been entering */
-
- private static ThreadLocal componentInformation = new ThreadLocal();
-
- /** this is to annotate the classLoader of the thread before he entered any
component */
-
- private static ThreadLocal outsideComponent = new ThreadLocal();
-
- /** a map that associated classloaders with components */
- private static Map classLoader2Components = new HashMap();
-
- /**
- * a public exception that is thrown if one has tried to initialise two
- * components with the same classloader
- */
-
- public static class DoubleComponentException extends RuntimeException {
- }
-
-
- /** constructor is private, only we can create new components */
- public Component(ClassLoader associatedClassLoader) throws
DoubleComponentException {
-
- if (classLoader2Components.containsKey(associatedClassLoader)) {
- throw new DoubleComponentException();
- } else {
- this.associatedClassLoader = associatedClassLoader;
-
- classLoader2Components.put(associatedClassLoader, this);
-
- Component parent = null;
-
- while (associatedClassLoader.getParent() != null && parent ==
null) {
- associatedClassLoader =
associatedClassLoader.getParent();
- parent = getComponentFor(associatedClassLoader);
- }
-
- this.parent = parent;
- }
- }
-
- /** this method enters a component and its associated classloader and gives
back the just left component */
-
- final public void enter() {
-
- Stack currentStack = (Stack)componentInformation.get();
-
- if (currentStack == null) {
- currentStack = new Stack();
- componentInformation.set(currentStack);
- }
-
- if (currentStack.isEmpty()) {
-
outsideComponent.set(Thread.currentThread().getContextClassLoader());
- }
-
- Thread.currentThread().setContextClassLoader(associatedClassLoader);
- currentStack.push(this);
- }
-
- /** this method leaves the current component and reinstalls the former
component association */
-
- final public static void leave() throws EmptyStackException {
-
- Stack currentStack = (Stack)componentInformation.get();
-
- currentStack.pop();
-
- if (currentStack.isEmpty()) {
-
Thread.currentThread().setContextClassLoader((ClassLoader)outsideComponent.get());
- } else {
-
Thread.currentThread().setContextClassLoader(getCurrentComponent().associatedClassLoader);
- }
- }
-
- /** the equals method is overridden to map to equality on classloaders */
-
- final public boolean equals(Object other) {
-
- try {
-
- return (other == this ||
(associatedClassLoader.equals(((Component)other).
- associatedClassLoader)));
-
- } catch (ClassCastException e) {
- return false;
- }
-
- }
-
- /** the hashCode is mapped to the classloader hashCode */
-
- final public int hashCode() {
- return associatedClassLoader.hashCode();
- }
-
-
- /** this is a static accessor to access the component that the current thread
is flowing through. */
-
- final public static Component getCurrentComponent() {
-
- try {
-
- return (Component)((Stack)componentInformation.get()).peek();
-
- } catch (NullPointerException e) {
-
- return null;
-
- } catch (EmptyStackException e) {
-
- return null;
-
- }
-
- }
-
- /**
- * method to retrieve a component associated to a particular classloader
- */
-
- final public static Component getComponentFor(ClassLoader classLoader) {
- return (Component) classLoader2Components.get(classLoader);
- }
-
-
-}
+/*
+ * $Id: Component.java,v 1.2 2000/12/04 12:35:51 jung Exp $
+ * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * License Statement
+ *
+ * Redistribution and use of this software and associated documentation
("Software"), with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright statements and
notices.
+ * Redistributions must also contain a copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
+ * conditions and the following disclaimer in the documentation and/or
other materials provided
+ * with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
must include the following
+ * acknowledgment: "This product includes software developed by infor:
business solutions AG
+ * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "infor" must not be used to endorse or promote products
derived from this
+ * Software without prior written permission of infor: business solutions
AG.
+ * For written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
+ * in their names without prior written permission of infor: business
solutions AG. infor
+ * is a registered trademark of infor:business solutions AG.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *
+ * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.infor.ce.util;
+
+import java.util.Stack;
+import java.util.EmptyStackException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The explicit representation of an in-VM component in the infor:Component Engine.
<br>
+ * Components are dedicated memory-apartments inside a VM that are generalisations
of the
+ * classloader concept. Components carry their own classes, but in addition, their
own
+ * meta-data and resources. Components are organised in a hierarchy in which
subordinate components depend on higher-level
+ * components, but not vice-versa. <br> In order to cross the component boundary,
we must use techniques such as
+ * serialisation, distributed transactions, etc., but maybe in a lightweight
format. <br>
+ * @author $Author: jung $
+ * @version $Version:$
+ */
+
+public class Component {
+
+ /** each component can have a parent */
+ final private Component parent;
+
+ /** each component has an associated classloader */
+ final private ClassLoader associatedClassLoader;
+
+ /** a stack of components that the current thread has been entering */
+
+ private static ThreadLocal componentInformation = new ThreadLocal();
+
+ /** this is to annotate the classLoader of the thread before he entered any
component */
+
+ private static ThreadLocal outsideComponent = new ThreadLocal();
+
+ /** a map that associated classloaders with components */
+ private static Map classLoader2Components = new HashMap();
+
+ /**
+ * a public exception that is thrown if one has tried to initialise two
+ * components with the same classloader
+ */
+
+ public static class DoubleComponentException extends RuntimeException {
+ }
+
+
+ /** constructor is private, only we can create new components */
+ public Component(ClassLoader associatedClassLoader) throws
DoubleComponentException {
+
+ if (classLoader2Components.containsKey(associatedClassLoader)) {
+ throw new DoubleComponentException();
+ } else {
+ this.associatedClassLoader = associatedClassLoader;
+
+ classLoader2Components.put(associatedClassLoader, this);
+
+ Component parent = null;
+
+ while (associatedClassLoader.getParent() != null && parent ==
null) {
+ associatedClassLoader =
associatedClassLoader.getParent();
+ parent = getComponentFor(associatedClassLoader);
+ }
+
+ this.parent = parent;
+ }
+ }
+
+ /** this method enters a component and its associated classloader and gives
back the just left component */
+
+ final public void enter() {
+
+ Stack currentStack = (Stack)componentInformation.get();
+
+ if (currentStack == null) {
+ currentStack = new Stack();
+ componentInformation.set(currentStack);
+ }
+
+ if (currentStack.isEmpty()) {
+
outsideComponent.set(Thread.currentThread().getContextClassLoader());
+ }
+
+ Thread.currentThread().setContextClassLoader(associatedClassLoader);
+ currentStack.push(this);
+ }
+
+ /** this method leaves the current component and reinstalls the former
component association */
+
+ final public static void leave() throws EmptyStackException {
+
+ Stack currentStack = (Stack)componentInformation.get();
+
+ currentStack.pop();
+
+ if (currentStack.isEmpty()) {
+
Thread.currentThread().setContextClassLoader((ClassLoader)outsideComponent.get());
+ } else {
+
Thread.currentThread().setContextClassLoader(getCurrentComponent().associatedClassLoader);
+ }
+ }
+
+ /** the equals method is overridden to map to equality on classloaders */
+
+ final public boolean equals(Object other) {
+
+ try {
+
+ return (other == this ||
(associatedClassLoader.equals(((Component)other).
+ associatedClassLoader)));
+
+ } catch (ClassCastException e) {
+ return false;
+ }
+
+ }
+
+ /** the hashCode is mapped to the classloader hashCode */
+
+ final public int hashCode() {
+ return associatedClassLoader.hashCode();
+ }
+
+
+ /** this is a static accessor to access the component that the current thread
is flowing through. */
+
+ final public static Component getCurrentComponent() {
+
+ try {
+
+ return (Component)((Stack)componentInformation.get()).peek();
+
+ } catch (NullPointerException e) {
+
+ return null;
+
+ } catch (EmptyStackException e) {
+
+ return null;
+
+ }
+
+ }
+
+ /**
+ * method to retrieve a component associated to a particular classloader
+ */
+
+ final public static Component getComponentFor(ClassLoader classLoader) {
+ return (Component) classLoader2Components.get(classLoader);
+ }
+
+
+}
1.2 +174 -170 zoap/src/de/infor/ce/util/Environment.java
Index: Environment.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/Environment.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Environment.java 2000/08/10 21:06:47 1.1
+++ Environment.java 2000/12/04 12:35:51 1.2
@@ -1,173 +1,183 @@
-/*
- * $Id: Environment.java,v 1.1 2000/08/10 21:06:47 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package de.infor.ce.util;
-
-import java.util.Properties;
-
-import java.io.PrintStream;
-import java.io.InputStream;
-
-/**
- * Environment is an abstract container for administration and configuration
- * of the present package.
- * @author $Author: jung $
- * @version $Version:$
- */
-
-public abstract class Environment {
-
- /**
- * compile-time debugging output configuration
- */
-
- public final static boolean DEBUG_UTIL=false;
- public final static boolean DEBUG_FACTORY=true;
- public final static boolean DEBUG_THREADPOOL=true;
-
- /**
- * runtime logging settings
- */
-
- public static int LOG_UTIL=1;
- public static int LOG_FACTORY=1;
- public static int LOG_THREADPOOL=1;
-
- /**
- * compile-time constants
- */
-
- public final static String PROPERTY_FACTORY="factory";
- public final static String CONFIG_FILE="util.conf";
-
- /**
- * runtime streams
- */
-
- public final static PrintStream out=System.out;
- public final static InputStream in=System.in;
- public final static PrintStream err=System.err;
-
- //
- // static initialisation
- //
-
- static{
-
- if(DEBUG_UTIL) {
- out.print(Environment.class.toString()+".static initializer\n");
- }
-
- // clone the system settings where defaults could have been installed
- Properties properties = new Properties(System.getProperties());
-
- try{
-
- // and add your personal configuration file
- properties.load(Thread.currentThread().getContextClassLoader().
- getResourceAsStream(CONFIG_FILE));
-
- } catch(Exception e) {
-
- if(DEBUG_UTIL) {
- err.print(Environment.class.toString()+".static initializer:"+
- " encountered error while trying to load properties."+
- " Maybe the config file does not exist. "+e+"\n");
- }
-
- }
-
- // take over the properties to influence the environment
-
- if(properties.containsKey(PROPERTY_FACTORY+".defaultObjectFactory.class")) {
-
- // we have found a defaultObjectFactory class for creation
- try{
-
- // so do it
- Class.forName(properties.getProperty(PROPERTY_FACTORY+
- ".defaultObjectFactory.class"),true,
- Thread.currentThread().getContextClassLoader()).newInstance();
-
- } catch (Exception e) {
-
- if(DEBUG_UTIL || LOG_UTIL>0 ) {
- err.print("de.infor.ce.util.Environment.static initializer:"+
- " encountered error while accessing factory class "+
-
properties.getProperty(PROPERTY_FACTORY+".defaultObjectFactory.class")+
- " "+e+"\n");
- } // if
-
- } // try
-
- } // if
-
- } // static
-
-}
-
-/*
+/*
+ * $Id: Environment.java,v 1.2 2000/12/04 12:35:51 jung Exp $
+ * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * License Statement
+ *
+ * Redistribution and use of this software and associated documentation
("Software"), with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright statements and
notices.
+ * Redistributions must also contain a copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
+ * conditions and the following disclaimer in the documentation and/or
other materials provided
+ * with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
must include the following
+ * acknowledgment: "This product includes software developed by infor:
business solutions AG
+ * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "infor" must not be used to endorse or promote products
derived from this
+ * Software without prior written permission of infor: business solutions
AG.
+ * For written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
+ * in their names without prior written permission of infor: business
solutions AG. infor
+ * is a registered trademark of infor:business solutions AG.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *
+ * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.infor.ce.util;
+
+import java.util.Properties;
+
+import java.io.PrintStream;
+import java.io.InputStream;
+
+/**
+ * Environment is an abstract container for administration and configuration
+ * of the present package.
+ * @author $Author: jung $
+ * @version $Version:$
+ */
+
+public abstract class Environment {
+
+ /**
+ * compile-time debugging output configuration
+ */
+
+ public final static boolean DEBUG_UTIL=false;
+ public final static boolean DEBUG_FACTORY=false;
+ public final static boolean DEBUG_THREADPOOL=false;
+
+ /**
+ * runtime logging settings
+ */
+
+ public static int LOG_UTIL=1;
+ public static int LOG_FACTORY=1;
+ public static int LOG_THREADPOOL=1;
+
+ /**
+ * compile-time constants
+ */
+
+ public final static String PROPERTY_FACTORY="factory";
+ public final static String CONFIG_FILE="util.conf";
+
+ /**
+ * runtime streams
+ */
+
+ public final static PrintStream out=System.out;
+ public final static InputStream in=System.in;
+ public final static PrintStream err=System.err;
+
+ //
+ // static initialisation
+ //
+
+ static{
+
+ if(DEBUG_UTIL) {
+ out.print(Environment.class.toString()+".static initializer\n");
+ }
+
+ // clone the system settings where defaults could have been installed
+ Properties properties = new Properties(System.getProperties());
+
+ try{
+
+ // and add your personal configuration file
+ properties.load(Thread.currentThread().getContextClassLoader().
+ getResourceAsStream(CONFIG_FILE));
+
+ } catch(Exception e) {
+
+ if(DEBUG_UTIL) {
+ err.print(Environment.class.toString()+".static initializer:"+
+ " encountered error while trying to load properties."+
+ " Maybe the config file does not exist. "+e+"\n");
+ }
+
+ }
+
+ // take over the properties to influence the environment
+
+ if(properties.containsKey(PROPERTY_FACTORY+".defaultObjectFactory.class")) {
+
+ // we have found a defaultObjectFactory class for creation
+ try{
+
+ // so do it
+ Class.forName(properties.getProperty(PROPERTY_FACTORY+
+ ".defaultObjectFactory.class"),true,
+ Thread.currentThread().getContextClassLoader()).newInstance();
+
+ } catch (Exception e) {
+
+ if(DEBUG_UTIL || LOG_UTIL>0 ) {
+ err.print("de.infor.ce.util.Environment.static initializer:"+
+ " encountered error while accessing factory class "+
+
properties.getProperty(PROPERTY_FACTORY+".defaultObjectFactory.class")+
+ " "+e+"\n");
+ } // if
+
+ } // try
+
+ } // if
+
+ } // static
+
+}
+
+/*
* $Log: Environment.java,v $
- * Revision 1.1 2000/08/10 21:06:47 jung
- * Initial revision
- *
- * Revision 1.1.1.1.2.3 2000/08/04 17:20:18 jung
- * close to beta stadium. Meta-Data import now works.
- *
- * Revision 1.1.1.1.2.2 2000/07/17 12:46:15 jung
- * refactored package and meta-model
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:27 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- */
+ * Revision 1.2 2000/12/04 12:35:51 jung
+ * adopted to latest jboss container,
+ *
+ * added decimal and date
+ *
+ * removed some problems due to forward-referencing in meta-data
+ *
+ * added serialisation policy
+ *
+ * Revision 1.1.1.1 2000/08/10 21:06:47 jung
+ * Initial import.
+ *
+ *
+ * Revision 1.1.1.1.2.3 2000/08/04 17:20:18 jung
+ * close to beta stadium. Meta-Data import now works.
+ *
+ * Revision 1.1.1.1.2.2 2000/07/17 12:46:15 jung
+ * refactored package and meta-model
+ *
+ * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
+ * package renaming, most of the zoap stuff now under org.zoap
+ * util and http stay infor.ce, containerInvoker etc move to org.jboss
+ *
+ * changed the makefile, adopted most of the licenses
+ *
+ * Revision 1.1.1.1 2000/07/06 14:11:27 jung
+ * Import of a pre beta version of ZOAP source with a new directory structure,
+ * ant-based make, apache-kind of license, etc.
+ *
+ * jars are coming later because of cvs-history reasons.
+ *
+ */
1.2 +264 -260 zoap/src/de/infor/ce/util/ObjectFactory.java
Index: ObjectFactory.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/ObjectFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ObjectFactory.java 2000/08/10 21:06:48 1.1
+++ ObjectFactory.java 2000/12/04 12:35:51 1.2
@@ -1,263 +1,273 @@
-/*
- * $Id: ObjectFactory.java,v 1.1 2000/08/10 21:06:48 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package de.infor.ce.util;
-
-import java.util.Map;
-import java.util.HashMap;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * This is an extensible factory for objects. The idea is that, instead of calling
- * "new" directly, you call the newInstance method in this factory which
- * then decides about "replacing" the requested class with some more appropriate,
- * specific one. Useful, if you hide a framework behind "ordinary" objects such
- * that the framework gets them to know or can fake them.
- *
- * For the factory to work correctly, you must ensure that the mapped classes expose
- * the same form of constructors.
- *
- * We call the pattern used for overriding the "singleton" factory in the system
- * "abstract singleton", because in creating a new instance, this instance will
automatically
- * become the singleton factory in the system.
- */
-
-public class ObjectFactory {
-
- /**
- * constructor: override the static singleton reference to point to yourself
- */
-
- public ObjectFactory() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
- Environment.out.println("de.infor.ce.util.ObjectFactory()");
-
- objectFactory=this;
- }
-
- /**
- * this is a map that hashes classes to more specific classes which
- * should be used to replace them
- */
-
- private Map classMapping;
-
- /**
- * accesses the class mapping lazily and thread-safe
- */
-
- private Map getClassMapping() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
- Environment.out.println("de.infor.ce.util.ObjectFactory.getClassMapping()");
-
- if(classMapping==null) {
- synchronized(this) {
- if(classMapping==null) {
- classMapping=new HashMap();
- }
- }
- }
-
- return classMapping;
- } // getClassMapping
-
- /**
- * this function is used to add or override a class mapping that maps
- * @arg forClass to @arg targetClass in the factory. The method returns the
@return
- * Class that the @arg forClass has been formerly mapped to. Note: @arg
targetClass
- * must be assignable from @arg forClass (and both non-null,
- * else an @exception IllegalMappingException is thrown.
- */
-
- public Class addClassMapping(Class forClass, Class targetClass)
- throws IllegalMappingException {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
- Environment.out.println("de.infor.ce.util.ObjectFactory.addClassMapping("+
- forClass+","+targetClass+")");
-
- // check for valid arguments
- if(forClass==null || targetClass==null ||
- !forClass.isAssignableFrom(targetClass)) {
- throw new IllegalMappingException();
- }
-
- // use the lazy map accessor to put the mapping in
- return (Class) getClassMapping().put(forClass,targetClass);
- } // addClassMapping
-
- /**
- * this method removes an existing class mapping assigned to @arg fromClass
- * from the factory. returns the @return Class that the @arg fromClass has been
- * formerly mapped to.
- */
- public Class removeClassMapping(Class forClass) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
- Environment.out.println("ObjectFactory.removeClassMapping("+forClass+")");
-
- // goes directly to the map in order to save resources
- if(classMapping!=null) {
- return (Class) classMapping.remove(forClass);
- } else {
- return null;
- }
-
- } // removeClassMapping
-
- /**
- * the most important method of the factory creates a new instance of an
- * @arg ofClass using its constructor with the argument classes @arg argClasses
- * and the actual constructor arguments @arg arguments. This method will
- * replace the class by a mapped one, if it is available, otherwise the
- * given class is taken. @throws NoSuchMethodException if a suitable
- * constructor could not be found. @throws
java.lang.reflect.InvocationTargetException
- * if the application of the constructor yielded an exception. @throws
IllegalAccessException
- * if the present context has not the required permissions to create the target
object.
- * @throws InstantiationException if any other error appeared during
instantiation.
- */
-
- public Object newInstance(Class ofClass, Class[] argClasses, Object[] arguments)
- throws FactoryException,
NoSuchMethodException,InvocationTargetException,
- IllegalAccessException, InstantiationException {
-
- if((Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY) ||
- (Environment.LOG_UTIL>0 && Environment.LOG_FACTORY>0))
- Environment.out.println(toString()+".newInstance("+ofClass+
- ","+argClasses+","+arguments+")");
-
- Class targetClass=null;
-
- // access the mapping
- if(classMapping!=null) {
- targetClass=(Class) classMapping.get(ofClass);
- }
-
- // use the default, if empty
- if(targetClass==null) {
- targetClass=ofClass;
- }
-
- return targetClass.getConstructor(argClasses).newInstance(arguments);
- } // newInstance
-
- /**
- * inner exception class, the most generic exception thrown by this class
- */
-
- public static class FactoryException extends Exception {
- }
-
- /**
- * inner exception class is thrown if an illegal mapping has been tried to add
- */
-
- public static class IllegalMappingException extends FactoryException {
- }
-
- /**
- * singleton reference
- */
-
- private static ObjectFactory objectFactory;
-
- /**
- * lazy and thread-safe singleton accessor, sets the default object factory to
- * an instance of this class, if not otherwise created
- */
-
- public static ObjectFactory getObjectFactory() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
- Environment.out.print(ObjectFactory.class.toString()+".getObjectFactory()");
- if(objectFactory==null) {
-
- synchronized(ObjectFactory.class) {
-
- try{
-
Class.forName("de.infor.ce.util.Environment",true,Thread.currentThread().getContextClassLoader());
- } catch(ClassNotFoundException e) {
- e.printStackTrace();
- }
-
- if(objectFactory==null) {
- if(objectFactory==null) {
- objectFactory=new ObjectFactory();
- }
- }
- }
- }
-
- return objectFactory;
- }
-
-} // ObjectFactory
-
-/*
+/*
+ * $Id: ObjectFactory.java,v 1.2 2000/12/04 12:35:51 jung Exp $
+ * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * License Statement
+ *
+ * Redistribution and use of this software and associated documentation
("Software"), with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright statements and
notices.
+ * Redistributions must also contain a copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
+ * conditions and the following disclaimer in the documentation and/or
other materials provided
+ * with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
must include the following
+ * acknowledgment: "This product includes software developed by infor:
business solutions AG
+ * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "infor" must not be used to endorse or promote products
derived from this
+ * Software without prior written permission of infor: business solutions
AG.
+ * For written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
+ * in their names without prior written permission of infor: business
solutions AG. infor
+ * is a registered trademark of infor:business solutions AG.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *
+ * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.infor.ce.util;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This is an extensible factory for objects. The idea is that, instead of calling
+ * "new" directly, you call the newInstance method in this factory which
+ * then decides about "replacing" the requested class with some more appropriate,
+ * specific one. Useful, if you hide a framework behind "ordinary" objects such
+ * that the framework gets them to know or can fake them.
+ *
+ * For the factory to work correctly, you must ensure that the mapped classes expose
+ * the same form of constructors.
+ *
+ * We call the pattern used for overriding the "singleton" factory in the system
+ * "abstract singleton", because in creating a new instance, this instance will
automatically
+ * become the singleton factory in the system.
+ */
+
+public class ObjectFactory {
+
+ /**
+ * constructor: override the static singleton reference to point to yourself
+ */
+
+ public ObjectFactory() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
+ Environment.out.println("de.infor.ce.util.ObjectFactory()");
+
+ objectFactory=this;
+ }
+
+ /**
+ * this is a map that hashes classes to more specific classes which
+ * should be used to replace them
+ */
+
+ private Map classMapping;
+
+ /**
+ * accesses the class mapping lazily and thread-safe
+ */
+
+ private Map getClassMapping() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
+ Environment.out.println("de.infor.ce.util.ObjectFactory.getClassMapping()");
+
+ if(classMapping==null) {
+ synchronized(this) {
+ if(classMapping==null) {
+ classMapping=new HashMap();
+ }
+ }
+ }
+
+ return classMapping;
+ } // getClassMapping
+
+ /**
+ * this function is used to add or override a class mapping that maps
+ * @arg forClass to @arg targetClass in the factory. The method returns the
@return
+ * Class that the @arg forClass has been formerly mapped to. Note: @arg
targetClass
+ * must be assignable from @arg forClass (and both non-null,
+ * else an @exception IllegalMappingException is thrown.
+ */
+
+ public Class addClassMapping(Class forClass, Class targetClass)
+ throws IllegalMappingException {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
+ Environment.out.println("de.infor.ce.util.ObjectFactory.addClassMapping("+
+ forClass+","+targetClass+")");
+
+ // check for valid arguments
+ if(forClass==null || targetClass==null ||
+ !forClass.isAssignableFrom(targetClass)) {
+ throw new IllegalMappingException();
+ }
+
+ // use the lazy map accessor to put the mapping in
+ return (Class) getClassMapping().put(forClass,targetClass);
+ } // addClassMapping
+
+ /**
+ * this method removes an existing class mapping assigned to @arg fromClass
+ * from the factory. returns the @return Class that the @arg fromClass has been
+ * formerly mapped to.
+ */
+ public Class removeClassMapping(Class forClass) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
+ Environment.out.println("ObjectFactory.removeClassMapping("+forClass+")");
+
+ // goes directly to the map in order to save resources
+ if(classMapping!=null) {
+ return (Class) classMapping.remove(forClass);
+ } else {
+ return null;
+ }
+
+ } // removeClassMapping
+
+ /**
+ * the most important method of the factory creates a new instance of an
+ * @arg ofClass using its constructor with the argument classes @arg argClasses
+ * and the actual constructor arguments @arg arguments. This method will
+ * replace the class by a mapped one, if it is available, otherwise the
+ * given class is taken. @throws NoSuchMethodException if a suitable
+ * constructor could not be found. @throws
java.lang.reflect.InvocationTargetException
+ * if the application of the constructor yielded an exception. @throws
IllegalAccessException
+ * if the present context has not the required permissions to create the target
object.
+ * @throws InstantiationException if any other error appeared during
instantiation.
+ */
+
+ public Object newInstance(Class ofClass, Class[] argClasses, Object[] arguments)
+ throws FactoryException,
NoSuchMethodException,InvocationTargetException,
+ IllegalAccessException, InstantiationException {
+
+ if((Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY) ||
+ (Environment.LOG_UTIL>0 && Environment.LOG_FACTORY>0))
+ Environment.out.println(toString()+".newInstance("+ofClass+
+ ","+argClasses+","+arguments+")");
+
+ Class targetClass=null;
+
+ // access the mapping
+ if(classMapping!=null) {
+ targetClass=(Class) classMapping.get(ofClass);
+ }
+
+ // use the default, if empty
+ if(targetClass==null) {
+ targetClass=ofClass;
+ }
+
+ return targetClass.getConstructor(argClasses).newInstance(arguments);
+ } // newInstance
+
+ /**
+ * inner exception class, the most generic exception thrown by this class
+ */
+
+ public static class FactoryException extends Exception {
+ }
+
+ /**
+ * inner exception class is thrown if an illegal mapping has been tried to add
+ */
+
+ public static class IllegalMappingException extends FactoryException {
+ }
+
+ /**
+ * singleton reference
+ */
+
+ private static ObjectFactory objectFactory;
+
+ /**
+ * lazy and thread-safe singleton accessor, sets the default object factory to
+ * an instance of this class, if not otherwise created
+ */
+
+ public static ObjectFactory getObjectFactory() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_FACTORY)
+ Environment.out.print(ObjectFactory.class.toString()+".getObjectFactory()");
+ if(objectFactory==null) {
+
+ synchronized(ObjectFactory.class) {
+
+ try{
+
Class.forName("de.infor.ce.util.Environment",true,Thread.currentThread().getContextClassLoader());
+ } catch(ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ if(objectFactory==null) {
+ if(objectFactory==null) {
+ objectFactory=new ObjectFactory();
+ }
+ }
+ }
+ }
+
+ return objectFactory;
+ }
+
+} // ObjectFactory
+
+/*
* $Log: ObjectFactory.java,v $
- * Revision 1.1 2000/08/10 21:06:48 jung
- * Initial revision
- *
- * Revision 1.1.1.1.2.3 2000/08/04 17:20:18 jung
- * close to beta stadium. Meta-Data import now works.
- *
- * Revision 1.1.1.1.2.2 2000/07/19 09:59:18 jung
- * moved and renamed the makefile to etc/makefiles
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:27 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- */
+ * Revision 1.2 2000/12/04 12:35:51 jung
+ * adopted to latest jboss container,
+ *
+ * added decimal and date
+ *
+ * removed some problems due to forward-referencing in meta-data
+ *
+ * added serialisation policy
+ *
+ * Revision 1.1.1.1 2000/08/10 21:06:48 jung
+ * Initial import.
+ *
+ *
+ * Revision 1.1.1.1.2.3 2000/08/04 17:20:18 jung
+ * close to beta stadium. Meta-Data import now works.
+ *
+ * Revision 1.1.1.1.2.2 2000/07/19 09:59:18 jung
+ * moved and renamed the makefile to etc/makefiles
+ *
+ * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
+ * package renaming, most of the zoap stuff now under org.zoap
+ * util and http stay infor.ce, containerInvoker etc move to org.jboss
+ *
+ * changed the makefile, adopted most of the licenses
+ *
+ * Revision 1.1.1.1 2000/07/06 14:11:27 jung
+ * Import of a pre beta version of ZOAP source with a new directory structure,
+ * ant-based make, apache-kind of license, etc.
+ *
+ * jars are coming later because of cvs-history reasons.
+ *
+ */
1.2 +385 -382 zoap/src/de/infor/ce/util/ThreadPool.java
Index: ThreadPool.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/ThreadPool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ThreadPool.java 2000/08/10 21:06:48 1.1
+++ ThreadPool.java 2000/12/04 12:35:51 1.2
@@ -1,385 +1,394 @@
-/*
- * $Id: ThreadPool.java,v 1.1 2000/08/10 21:06:48 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package de.infor.ce.util;
-
-import java.util.Stack;
-import java.util.Iterator;
-
-/**
- * Implementation of a threadpool
- */
-
-public class ThreadPool {
-
- /** we pool the threads in a stack */
- private final Stack pool = new Stack();
-
- /** we log the number of yet created threads */
- private int active;
-
- /** the maximum size of that pool */
- private int maxSize;
-
- /** whether the pool blocks on non-availability */
- private boolean blocks;
-
- /** the name associated to the threads */
- private String threadName;
-
- /** whether threads are started in demon mode */
- private boolean daemon;
-
- /**
- * constructor takes the @arg maxSize of that pool and the @arg blocks
- * flag as its arguments.
- */
-
- public ThreadPool(int maxSize, boolean blocks, String threadName, boolean
whetherDaemon) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(toString()+"("+maxSize+","+blocks+","+
- threadName+","+whetherDaemon+")");
-
- this.maxSize=maxSize;
- this.blocks=blocks;
- this.threadName=threadName;
- this.daemon=whetherDaemon;
- }
-
- /** sets the maximum size */
- public void setMaxSize(int maxSize) {
- this.maxSize=maxSize;
- }
-
- /** gets the maximum size */
- public int getMaxSize() {
- return maxSize;
- }
-
- /** asks whether this pool is in blocking mode */
- public boolean doesBlock() {
- return blocks;
- }
-
- /** sets the blocking mode and awakes all the waiting threads */
- public void setBlocks(boolean blocks) {
- this.blocks=blocks;
- pool.notifyAll();
- }
-
- /**
- * use an available thread from your pool to run the given runnable @arg work
- * if the pool is empty and we are in blocking mode this method will block until
- * a thread is returned to the pool
- * otherwise a new thread is returned in each case
- */
-
- public void run(Runnable runnable) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL ||
- (Environment.LOG_UTIL>0 && Environment.LOG_THREADPOOL>0))
- Environment.out.println(toString()+".run("+runnable+")");
-
- // first synchronized on the stack
- synchronized(pool) {
-
- // the pool is empty
- if(pool.isEmpty()) {
-
- // and we have been given out all the threads that we can afford in
blocking mode
- if(doesBlock() && active>=maxSize) {
-
- // then wait until something is returned into the pool
- try{
- pool.wait();
- } catch(InterruptedException e) {}
- // and try again, hope that the stack will not be too deep by that call!
- run(runnable);
-
- } else {
-
- // in non-blocking mode or in the case of an undersatisfied pool,
- // we can create as many threads as we like
- active++;
-
- // when creating such a thread, it is started immediately
- new PooledThread(runnable).start();
-
- } // if(doesBlock())
-
- } else {
-
- // the pool is not empty, so we give out the last returned thread to
- // be equipped with the runnable
- ((PooledThread) pool.pop()).run(runnable);
-
- } // if pool.isEmpty()
-
- } // sync
-
- } // run
-
- /**
- * destroys the thread-pool
- * although its called finalize, the garbage collector will not
- * be able to get a hold on this, because the individual threads
- * have an (inner-class specific) reference to this.
- */
-
- public void finalize() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(toString()+".finalize()");
-
- // resets the max size, so no threads will come back to continue their work
- maxSize=0;
-
- // get a thread-safe grab onto the pool
- synchronized(pool) {
-
- // loop through the pool
- Iterator iterator=pool.iterator();
-
- while(iterator.hasNext()) {
-
- // and mark each (waiting) thread as being finished
- ((PooledThread) iterator.next()).finalize();
-
- // remove from the stack
- iterator.remove();
- } // while
- } // sync
- } // finalize
-
- /**
- * this private method is called by the pooled threads that like to
- * return into the pool
- */
-
- private void returnThread(PooledThread thread) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(toString()+".returnThread("+thread+")");
-
- // thread-safe grab onto the pool
- synchronized(pool) {
- // only if we have not superseded the maximum size of the pool
- if (pool.size() < maxSize) {
- // push this thread to the stack
- pool.push(thread);
- // and awake one of the blocked threads waiting for this
- // thread to become available
- pool.notify();
- } else {
- thread.finalize();
- } // if (pool.size())
- } // sync
-
- } // returnPooledThread
-
- /**
- * inner class that implements poolable threads
- */
-
- private class PooledThread {
-
- /** should this thread keep on running? */
- private boolean running;
-
- /** what would be the next task to perform? */
- private Runnable runnable;
-
- /** you can equip a pooled thread with a runnable at creation time */
- PooledThread(Runnable runnable) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+"("+runnable+")");
-
- running=true;
- this.runnable=runnable;
- }
-
- public void start()
- {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".start()");
-
- Thread newThread=new Thread(threadName) {
- public void run() {
- PooledThread.this.run();
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+"-.start():"+
- " coming to end.");
-
- }
- };
-
- newThread.setDaemon(daemon);
-
- newThread.start();
-
- }
-
- /**
- * do something
- * meaningful over a longer period of time
- */
-
- private void run() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".run()");
-
- while (running) {
-
- if (runnable != null) {
-
- try {
- runnable.run();
- } catch (Exception e) {
- // catch any internal exception to continue
working
- }
-
- // Clear work, this is safe as the thread
should be non-pooled in this state
- runnable = null;
- }
-
- // Return to pool
- returnThread(this);
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".run():"+
- " going to sleep.");
-
- // Wait for work to become available
- synchronized (this) {
- if(running && runnable==null) {
- try {
- this.wait();
- } catch (InterruptedException e){
- }
- }
- }
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".run(): awake.");
-
- } // while
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".run(): dead.");
-
- } // run
-
- /**
- * this method allows to start an arbitrary runnable in this thread,
- * is guarantueed to run only once
- */
-
- public void run(Runnable runnable) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".run("+runnable+")");
-
- synchronized(this) {
- if(running && this.runnable==null) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.print(this.toString()+".run("+runnable+"): has
lock.\n");
-
- this.runnable = runnable;
- this.notify();
- } else {
- // this should never, never happen
- throw new RuntimeException("Could not run runnable on because pooled
thread is dead or occupied.");
- }
- }
- }
-
- /** and finally, the signal to die ASAP */
- public void finalize() {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.println(this.toString()+".finalize()");
-
- synchronized(this) {
- if(running && runnable==null) {
-
- if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
- Environment.out.print(this.toString()+".finalize(): has lock.\n");
-
- running = false;
- this.notify();
- } else {
- throw new RuntimeException("could not finalize finalized or tasked thread");
- } // if
- } // sync
- } // die
-
- } // PooledThread
-
-} // ThreadPool
-
-/*
+/*
+ * $Id: ThreadPool.java,v 1.2 2000/12/04 12:35:51 jung Exp $
+ * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * License Statement
+ *
+ * Redistribution and use of this software and associated documentation
("Software"), with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright statements and
notices.
+ * Redistributions must also contain a copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
+ * conditions and the following disclaimer in the documentation and/or
other materials provided
+ * with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
must include the following
+ * acknowledgment: "This product includes software developed by infor:
business solutions AG
+ * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "infor" must not be used to endorse or promote products
derived from this
+ * Software without prior written permission of infor: business solutions
AG.
+ * For written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
+ * in their names without prior written permission of infor: business
solutions AG. infor
+ * is a registered trademark of infor:business solutions AG.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *
+ * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.infor.ce.util;
+
+import java.util.Stack;
+import java.util.Iterator;
+
+/**
+ * Implementation of a threadpool
+ */
+
+public class ThreadPool {
+
+ /** we pool the threads in a stack */
+ private final Stack pool = new Stack();
+
+ /** we log the number of yet created threads */
+ private int active;
+
+ /** the maximum size of that pool */
+ private int maxSize;
+
+ /** whether the pool blocks on non-availability */
+ private boolean blocks;
+
+ /** the name associated to the threads */
+ private String threadName;
+
+ /** whether threads are started in demon mode */
+ private boolean daemon;
+
+ /**
+ * constructor takes the @arg maxSize of that pool and the @arg blocks
+ * flag as its arguments.
+ */
+
+ public ThreadPool(int maxSize, boolean blocks, String threadName, boolean
whetherDaemon) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(toString()+"("+maxSize+","+blocks+","+
+ threadName+","+whetherDaemon+")");
+
+ this.maxSize=maxSize;
+ this.blocks=blocks;
+ this.threadName=threadName;
+ this.daemon=whetherDaemon;
+ }
+
+ /** sets the maximum size */
+ public void setMaxSize(int maxSize) {
+ this.maxSize=maxSize;
+ }
+
+ /** gets the maximum size */
+ public int getMaxSize() {
+ return maxSize;
+ }
+
+ /** asks whether this pool is in blocking mode */
+ public boolean doesBlock() {
+ return blocks;
+ }
+
+ /** sets the blocking mode and awakes all the waiting threads */
+ public void setBlocks(boolean blocks) {
+ this.blocks=blocks;
+ pool.notifyAll();
+ }
+
+ /**
+ * use an available thread from your pool to run the given runnable @arg work
+ * if the pool is empty and we are in blocking mode this method will block until
+ * a thread is returned to the pool
+ * otherwise a new thread is returned in each case
+ */
+
+ public void run(Runnable runnable) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(toString()+".run("+runnable+")");
+
+ // first synchronized on the stack
+ synchronized(pool) {
+
+ // the pool is empty
+ if(pool.isEmpty()) {
+
+ // and we have been given out all the threads that we can afford in
blocking mode
+ if(doesBlock() && active>=maxSize) {
+
+ // then wait until something is returned into the pool
+ try{
+ pool.wait();
+ } catch(InterruptedException e) {}
+ // and try again, hope that the stack will not be too deep by that call!
+ run(runnable);
+
+ } else {
+
+ // in non-blocking mode or in the case of an undersatisfied pool,
+ // we can create as many threads as we like
+ active++;
+
+ // when creating such a thread, it is started immediately
+ new PooledThread(runnable).start();
+
+ } // if(doesBlock())
+
+ } else {
+
+ // the pool is not empty, so we give out the last returned thread to
+ // be equipped with the runnable
+ ((PooledThread) pool.pop()).run(runnable);
+
+ } // if pool.isEmpty()
+
+ } // sync
+
+ } // run
+
+ /**
+ * destroys the thread-pool
+ * although its called finalize, the garbage collector will not
+ * be able to get a hold on this, because the individual threads
+ * have an (inner-class specific) reference to this.
+ */
+
+ public void finalize() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(toString()+".finalize()");
+
+ // resets the max size, so no threads will come back to continue their work
+ maxSize=0;
+
+ // get a thread-safe grab onto the pool
+ synchronized(pool) {
+
+ // loop through the pool
+ Iterator iterator=pool.iterator();
+
+ while(iterator.hasNext()) {
+
+ // and mark each (waiting) thread as being finished
+ ((PooledThread) iterator.next()).finalize();
+
+ // remove from the stack
+ iterator.remove();
+ } // while
+ } // sync
+ } // finalize
+
+ /**
+ * this private method is called by the pooled threads that like to
+ * return into the pool
+ */
+
+ private void returnThread(PooledThread thread) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(toString()+".returnThread("+thread+")");
+
+ // thread-safe grab onto the pool
+ synchronized(pool) {
+ // only if we have not superseded the maximum size of the pool
+ if (pool.size() < maxSize) {
+ // push this thread to the stack
+ pool.push(thread);
+ // and awake one of the blocked threads waiting for this
+ // thread to become available
+ pool.notify();
+ } else {
+ thread.finalize();
+ } // if (pool.size())
+ } // sync
+
+ } // returnPooledThread
+
+ /**
+ * inner class that implements poolable threads
+ */
+
+ private class PooledThread {
+
+ /** should this thread keep on running? */
+ private boolean running;
+
+ /** what would be the next task to perform? */
+ private Runnable runnable;
+
+ /** you can equip a pooled thread with a runnable at creation time */
+ PooledThread(Runnable runnable) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+"("+runnable+")");
+
+ running=true;
+ this.runnable=runnable;
+ }
+
+ public void start()
+ {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".start()");
+
+ Thread newThread=new Thread(threadName) {
+ public void run() {
+ PooledThread.this.run();
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+"-.start():"+
+ " coming to end.");
+
+ }
+ };
+
+ newThread.setDaemon(daemon);
+
+ newThread.start();
+
+ }
+
+ /**
+ * do something
+ * meaningful over a longer period of time
+ */
+
+ private void run() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".run()");
+
+ while (running) {
+
+ if (runnable != null) {
+
+ try {
+ runnable.run();
+ } catch (Exception e) {
+ // catch any internal exception to continue
working
+ }
+
+ // Clear work, this is safe as the thread
should be non-pooled in this state
+ runnable = null;
+ }
+
+ // Return to pool
+ returnThread(this);
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".run():"+
+ " going to sleep.");
+
+ // Wait for work to become available
+ synchronized (this) {
+ if(running && runnable==null) {
+ try {
+ this.wait();
+ } catch (InterruptedException e){
+ }
+ }
+ }
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".run(): awake.");
+
+ } // while
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".run(): dead.");
+
+ } // run
+
+ /**
+ * this method allows to start an arbitrary runnable in this thread,
+ * is guarantueed to run only once
+ */
+
+ public void run(Runnable runnable) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".run("+runnable+")");
+
+ synchronized(this) {
+ if(running && this.runnable==null) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.print(this.toString()+".run("+runnable+"): has
lock.\n");
+
+ this.runnable = runnable;
+ this.notify();
+ } else {
+ // this should never, never happen
+ throw new RuntimeException("Could not run runnable on because pooled
thread is dead or occupied.");
+ }
+ }
+ }
+
+ /** and finally, the signal to die ASAP */
+ public void finalize() {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.println(this.toString()+".finalize()");
+
+ synchronized(this) {
+ if(running && runnable==null) {
+
+ if(Environment.DEBUG_UTIL && Environment.DEBUG_THREADPOOL)
+ Environment.out.print(this.toString()+".finalize(): has lock.\n");
+
+ running = false;
+ this.notify();
+ } else {
+ throw new RuntimeException("could not finalize finalized or tasked thread");
+ } // if
+ } // sync
+ } // die
+
+ } // PooledThread
+
+} // ThreadPool
+
+/*
* $Log: ThreadPool.java,v $
- * Revision 1.1 2000/08/10 21:06:48 jung
- * Initial revision
- *
- * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:27 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- */
-
+ * Revision 1.2 2000/12/04 12:35:51 jung
+ * adopted to latest jboss container,
+ *
+ * added decimal and date
+ *
+ * removed some problems due to forward-referencing in meta-data
+ *
+ * added serialisation policy
+ *
+ * Revision 1.1.1.1 2000/08/10 21:06:48 jung
+ * Initial import.
+ *
+ *
+ * Revision 1.1.1.1.2.1 2000/07/13 12:46:17 jung
+ * package renaming, most of the zoap stuff now under org.zoap
+ * util and http stay infor.ce, containerInvoker etc move to org.jboss
+ *
+ * changed the makefile, adopted most of the licenses
+ *
+ * Revision 1.1.1.1 2000/07/06 14:11:27 jung
+ * Import of a pre beta version of ZOAP source with a new directory structure,
+ * ant-based make, apache-kind of license, etc.
+ *
+ * jars are coming later because of cvs-history reasons.
+ *
+ */
+
1.2 +236 -232 zoap/src/de/infor/ce/util/URN.java
Index: URN.java
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/URN.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URN.java 2000/08/10 21:06:49 1.1
+++ URN.java 2000/12/04 12:35:52 1.2
@@ -1,235 +1,245 @@
-/*
- * $Id: URN.java,v 1.1 2000/08/10 21:06:49 jung Exp $
- * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
- * D-66299 Friedrichsthal, Germany. All Rights Reserved.
- *
- * License Statement
- *
- * Redistribution and use of this software and associated documentation
("Software"), with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain copyright statements and
notices.
- * Redistributions must also contain a copy of this document.
- *
- * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
- * conditions and the following disclaimer in the documentation and/or
other materials provided
- * with the distribution.
- *
- * 3. The end-user documentation included with the redistribution, if any,
must include the following
- * acknowledgment: "This product includes software developed by infor:
business solutions AG
- * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The name "infor" must not be used to endorse or promote products
derived from this
- * Software without prior written permission of infor: business solutions
AG.
- * For written permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
- * in their names without prior written permission of infor: business
solutions AG. infor
- * is a registered trademark of infor:business solutions AG.
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- *
- * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package de.infor.ce.util;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * URN is a generalisation of a URN that allows to introduce alternative naming
conventions for resolution (in the short-term
- * future ;-) equality of urns means that they have a non-empty intersection of
alternative names.
- * has anybody an idea how to write a reasonable hashCode for this beast? At the
moment,
- * we assume that the first name produces a hashCode that is representative for the
equality class.
- * @author $Author: jung $
- * @version $Revision: 1.1 $
- */
-
-public class URN {
-
- /** the urn keeps a set of equivalent names for it */
- final private String[] names;
-
- /**
- * construct a new URN with the given set of @arg names which must be non-null,
- * otherwise you will get a @throws java.lang.NullPointerException
- */
-
- public URN(String[] names) {
- this.names = names;
- }
-
- /** construct a new URN with the canonical @arg name */
-
- public URN(String name) {
- this(new String[] { name });
- }
-
- /** construct a new URN from an absolute URN and relative one simply means to
concatenate the names */
-
- public URN(URN absolute, URN relative) {
-
- if (absolute == null && relative != null)
- this.names = relative.getNames();
-
- else if (relative == null && absolute != null)
- this.names = absolute.getNames();
-
- else if (relative != null && absolute != null) {
- String[] absoluteNames = absolute.getNames();
- String[] relativeNames = relative.getNames();
-
- java.util.Vector combinedNames = new java.util.Vector();
-
- for (int count = 0; count < absoluteNames.length; count++) {
- for (int count2 = 0; count < relativeNames.length;
count++) {
- String absoluteName = absoluteNames[count];
- String relativeName = relativeNames[count];
-
- try {
- while (relativeName.startsWith("../"))
{
- absoluteName =
absoluteName.substring(0, absoluteName.
- substring(0,
absoluteName.lastIndexOf("/")).
- lastIndexOf("/") + 1);
- relativeName =
relativeName.substring(3);
- }
-
- combinedNames.add(absoluteName +
relativeName);
- } catch (IndexOutOfBoundsException e) {
- }
- }
- }
-
- this.names = (String[]) combinedNames.toArray(new
String[combinedNames.size()]);
- } else
- this.names = null;
-
- }
-
- /** produce a @return int hashcode for this URN */
-
- public int hashCode() {
-
- try {
- return names[0].hashCode();
- } catch (NullPointerException e) {
- return super.hashCode();
- } catch (ArrayIndexOutOfBoundsException e) {
- return super.hashCode();
- }
-
- }
-
- /** return the array of names that this URN has */
-
- final public String[] getNames() {
- return names;
- }
-
- /** produces a new URN that stands as the parent-URN for this URN */
-
- final public URN getParent() {
-
- try {
- String[] parentNames = new String[names.length];
-
- for (int count = 0; count < names.length; count++) {
- if (names[count].indexOf("/") != -1)
- parentNames[count] = names[count].substring(0,
names[count].
- lastIndexOf("/") + 1);
- else
- parentNames[count] = "";
- }
-
- return new URN(parentNames);
- } catch (NullPointerException e) {
- return null;
- }
-
- }
-
- /** two URNs are equal if they are pointer-wise equal or if they share some
name this must be somehow made more efficient */
-
- public boolean equals(Object other) {
-
- if (other == this)
- return true;
-
- if (other != null && other instanceof URN && names != null) {
-
- String[] otherNames = ((URN)other).getNames();
-
- if (otherNames != null) {
- boolean equals = false;
- for (int count = 0; count < names.length && equals ==
false; count++) {
- for (int count2 = 0; count2 <
otherNames.length && equals == false; count2++) {
- equals =
names[count].equals(otherNames[count2]);
- }
- }
- return equals;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
- /** string representation of this URN */
-
- public String toString() {
- try {
- return names[0].toString();
- } catch (NullPointerException e) {
- return "";
- } catch (ArrayIndexOutOfBoundsException e) {
- return "";
- }
- }
-
- /** open up a stream that leads to this URN */
-
- public java.io.InputStream openStream() throws java.io.IOException {
- return new URL(toString()).openStream();
- }
-
-}
-
-/*
+/*
+ * $Id: URN.java,v 1.2 2000/12/04 12:35:52 jung Exp $
+ * Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
+ * D-66299 Friedrichsthal, Germany. All Rights Reserved.
+ *
+ * License Statement
+ *
+ * Redistribution and use of this software and associated documentation
("Software"), with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright statements and
notices.
+ * Redistributions must also contain a copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the attached copyright
notice, this list of
+ * conditions and the following disclaimer in the documentation and/or
other materials provided
+ * with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
must include the following
+ * acknowledgment: "This product includes software developed by infor:
business solutions AG
+ * (http://www.infor.de/)." Alternately, this acknowledgment may appear
in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The name "infor" must not be used to endorse or promote products
derived from this
+ * Software without prior written permission of infor: business solutions
AG.
+ * For written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this Software may not be called "infor" nor may
"infor" appear
+ * in their names without prior written permission of infor: business
solutions AG. infor
+ * is a registered trademark of infor:business solutions AG.
+ *
+ * Disclaimer
+ *
+ * THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS
IS" AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *
+ * IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.infor.ce.util;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * URN is a generalisation of a URN that allows to introduce alternative naming
conventions for resolution (in the short-term
+ * future ;-) equality of urns means that they have a non-empty intersection of
alternative names.
+ * has anybody an idea how to write a reasonable hashCode for this beast? At the
moment,
+ * we assume that the first name produces a hashCode that is representative for the
equality class.
+ * @author $Author: jung $
+ * @version $Revision: 1.2 $
+ */
+
+public class URN {
+
+ /** the urn keeps a set of equivalent names for it */
+ final private String[] names;
+
+ /**
+ * construct a new URN with the given set of @arg names which must be non-null,
+ * otherwise you will get a @throws java.lang.NullPointerException
+ */
+
+ public URN(String[] names) {
+ this.names = names;
+ }
+
+ /** construct a new URN with the canonical @arg name */
+
+ public URN(String name) {
+ this(new String[] { name });
+ }
+
+ /** construct a new URN from an absolute URN and relative one simply means to
concatenate the names */
+
+ public URN(URN absolute, URN relative) {
+
+ if (absolute == null && relative != null)
+ this.names = relative.getNames();
+
+ else if (relative == null && absolute != null)
+ this.names = absolute.getNames();
+
+ else if (relative != null && absolute != null) {
+ String[] absoluteNames = absolute.getNames();
+ String[] relativeNames = relative.getNames();
+
+ java.util.Vector combinedNames = new java.util.Vector();
+
+ for (int count = 0; count < absoluteNames.length; count++) {
+ for (int count2 = 0; count < relativeNames.length;
count++) {
+ String absoluteName = absoluteNames[count];
+ String relativeName = relativeNames[count];
+
+ try {
+ while (relativeName.startsWith("../"))
{
+ absoluteName =
absoluteName.substring(0, absoluteName.
+ substring(0,
absoluteName.lastIndexOf("/")).
+ lastIndexOf("/") + 1);
+ relativeName =
relativeName.substring(3);
+ }
+
+ combinedNames.add(absoluteName +
relativeName);
+ } catch (IndexOutOfBoundsException e) {
+ }
+ }
+ }
+
+ this.names = (String[]) combinedNames.toArray(new
String[combinedNames.size()]);
+ } else
+ this.names = null;
+
+ }
+
+ /** produce a @return int hashcode for this URN */
+
+ public int hashCode() {
+
+ try {
+ return names[0].hashCode();
+ } catch (NullPointerException e) {
+ return super.hashCode();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return super.hashCode();
+ }
+
+ }
+
+ /** return the array of names that this URN has */
+
+ final public String[] getNames() {
+ return names;
+ }
+
+ /** produces a new URN that stands as the parent-URN for this URN */
+
+ final public URN getParent() {
+
+ try {
+ String[] parentNames = new String[names.length];
+
+ for (int count = 0; count < names.length; count++) {
+ if (names[count].indexOf("/") != -1)
+ parentNames[count] = names[count].substring(0,
names[count].
+ lastIndexOf("/") + 1);
+ else
+ parentNames[count] = "";
+ }
+
+ return new URN(parentNames);
+ } catch (NullPointerException e) {
+ return null;
+ }
+
+ }
+
+ /** two URNs are equal if they are pointer-wise equal or if they share some
name this must be somehow made more efficient */
+
+ public boolean equals(Object other) {
+
+ if (other == this)
+ return true;
+
+ if (other != null && other instanceof URN && names != null) {
+
+ String[] otherNames = ((URN)other).getNames();
+
+ if (otherNames != null) {
+ boolean equals = false;
+ for (int count = 0; count < names.length && equals ==
false; count++) {
+ for (int count2 = 0; count2 <
otherNames.length && equals == false; count2++) {
+ equals =
names[count].equals(otherNames[count2]);
+ }
+ }
+ return equals;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /** string representation of this URN */
+
+ public String toString() {
+ try {
+ return names[0].toString();
+ } catch (NullPointerException e) {
+ return "";
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return "";
+ }
+ }
+
+ /** open up a stream that leads to this URN */
+
+ public java.io.InputStream openStream() throws java.io.IOException {
+ return new URL(toString()).openStream();
+ }
+
+}
+
+/*
* $Log: URN.java,v $
- * Revision 1.1 2000/08/10 21:06:49 jung
- * Initial revision
- *
- * Revision 1.1.2.2 2000/08/04 17:20:18 jung
- * close to beta stadium. Meta-Data import now works.
- *
- * Revision 1.1.2.1 2000/07/17 14:02:49 jung
- * refactored package and meta-model
- *
- * Revision 1.1.2.1 2000/07/13 12:46:24 jung
- * package renaming, most of the zoap stuff now under org.zoap
- * util and http stay infor.ce, containerInvoker etc move to org.jboss
- *
- * changed the makefile, adopted most of the licenses
- *
- * Revision 1.1.1.1 2000/07/06 14:11:27 jung
- * Import of a pre beta version of ZOAP source with a new directory structure,
- * ant-based make, apache-kind of license, etc.
- *
- * jars are coming later because of cvs-history reasons.
- *
- */
+ * Revision 1.2 2000/12/04 12:35:52 jung
+ * adopted to latest jboss container,
+ *
+ * added decimal and date
+ *
+ * removed some problems due to forward-referencing in meta-data
+ *
+ * added serialisation policy
+ *
+ * Revision 1.1.1.1 2000/08/10 21:06:49 jung
+ * Initial import.
+ *
+ *
+ * Revision 1.1.2.2 2000/08/04 17:20:18 jung
+ * close to beta stadium. Meta-Data import now works.
+ *
+ * Revision 1.1.2.1 2000/07/17 14:02:49 jung
+ * refactored package and meta-model
+ *
+ * Revision 1.1.2.1 2000/07/13 12:46:24 jung
+ * package renaming, most of the zoap stuff now under org.zoap
+ * util and http stay infor.ce, containerInvoker etc move to org.jboss
+ *
+ * changed the makefile, adopted most of the licenses
+ *
+ * Revision 1.1.1.1 2000/07/06 14:11:27 jung
+ * Import of a pre beta version of ZOAP source with a new directory structure,
+ * ant-based make, apache-kind of license, etc.
+ *
+ * jars are coming later because of cvs-history reasons.
+ *
+ */
1.2 +71 -70 zoap/src/de/infor/ce/util/util.dfPackage
Index: util.dfPackage
===================================================================
RCS file: /products/cvs/ejboss/zoap/src/de/infor/ce/util/util.dfPackage,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util.dfPackage 2000/08/10 21:06:49 1.1
+++ util.dfPackage 2000/12/04 12:35:52 1.2
@@ -1,70 +1,71 @@
-package idqnwuc9pgodo2c9pqkznw;
-
-/**
-@version 2.0
-@physicalPackage
-@__modelType diagram
-*/
-class diagram {
-/**
-@__ref <oiref:java#Class#de.infor.ce.util.ObjectFactory:oiref><oihard>
-@__modelType reference
-*/
-class reference {
-}/**
-@__ref <oiref:java#Class#de.infor.ce.util.Environment:oiref><oihard>
-@__modelType reference
-*/
-class reference68 {
-}/**
-@__ref <oiref:java#Class#de.infor.ce.util.ThreadPool:oiref><oihard>
-@__modelType reference
-*/
-class reference5 {
-}/**
-@__ref <oiref:design#Class#id2p4gtcamcwfvycamcygzi.diagram:oiref><oihard>
-@__modelType reference
-*/
-class reference6 {
-}/**
-@__ref <oiref:java#Class#de.infor.ce.util.URN:oiref><oihard>
-@__modelType reference
-*/
-class reference1 {
-}/**
-@shapeType NoteLink
-@__modelType link
-@__ref <oiref:design#Class#id2e2vrc9pgodo2c9pgqtl6.node32:oiref><oihard>
-*/
-class link {
-}/**
-@__ref <oiref:java#Class#de.infor.ce.util.Component:oiref><oihard>
-@__modelType reference
-*/
-class reference7 {
-}}/**
-This package contains useful helper functions.
-@__tags
-@shapeType ClassDiagram
-*/
-class __tags {
-}/**
-@__options
-*/
-class __options {
-}/**
-@__positions
<oigroup:<oiref:design#Class#id2p4gtcamcwfvycamcygzi.diagram:oiref>=155,1,90,72,1:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory.IllegalMappingException:oiref>=282,278,146,59,1:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.ThreadPool:oiref>=263,173,160,261,1:oigroup>
-<oigroup:<oiref:java#Extends#de.infor.ce.util.ObjectFactory.IllegalMappingException#de.infor.ce.util.ObjectFactory.FactoryException:oiref>=163,248,235,255:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.URN:oiref>=471,227,218,214,1:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory.FactoryException:oiref>=235,242,107,77,1:oigroup>
-<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.ObjectFactory#defaultObjectFactory:oiref>=395,315,395,362,479,362,479,278,432,278:oigroup>
-<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.Component#parent:oiref>=669,329,669,379,759,379,759,289,709,289:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.Environment:oiref>=256,19,203,258,1:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.Component:oiref>=506,68,203,261,1:oigroup>
-<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory:oiref>=40,143,203,223,1:oigroup>
-<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.ObjectFactory#objectFactory:oiref>=203,366,203,416,293,416,293,326,243,326:oigroup>
-*/
-class __positions {
-}
\ No newline at end of file
+package idqnwuc9pgodo2c9pqkznw;
+
+/**
+@version 2.0
+@physicalPackage
+@__modelType diagram
+*/
+class diagram {
+/**
+@__ref <oiref:java#Class#de.infor.ce.util.ObjectFactory:oiref><oihard>
+@__modelType reference
+*/
+class reference {
+}/**
+@__ref <oiref:java#Class#de.infor.ce.util.Environment:oiref><oihard>
+@__modelType reference
+*/
+class reference68 {
+}/**
+@__ref <oiref:java#Class#de.infor.ce.util.ThreadPool:oiref><oihard>
+@__modelType reference
+*/
+class reference5 {
+}/**
+@__ref <oiref:design#Class#id2p4gtcamcwfvycamcygzi.diagram:oiref><oihard>
+@__modelType reference
+*/
+class reference6 {
+}/**
+@__ref <oiref:java#Class#de.infor.ce.util.URN:oiref><oihard>
+@__modelType reference
+*/
+class reference1 {
+}/**
+@shapeType NoteLink
+@__modelType link
+@__ref <oiref:design#Class#id2e2vrc9pgodo2c9pgqtl6.node32:oiref><oihard>
+*/
+class link {
+}/**
+@__ref <oiref:java#Class#de.infor.ce.util.Component:oiref><oihard>
+@__modelType reference
+*/
+class reference7 {
+}}/**
+This package contains useful helper functions.
+@__tags
+@shapeType ClassDiagram
+@number txmiidc
+*/
+class __tags {
+}/**
+@__options
+*/
+class __options {
+}/**
+@__positions
<oigroup:<oiref:design#Class#id2p4gtcamcwfvycamcygzi.diagram:oiref>=155,1,90,72,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory.IllegalMappingException:oiref>=282,278,146,59,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.ThreadPool:oiref>=263,173,160,261,1:oigroup>
+<oigroup:<oiref:java#Extends#de.infor.ce.util.ObjectFactory.IllegalMappingException#de.infor.ce.util.ObjectFactory.FactoryException:oiref>=163,248,235,255:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.URN:oiref>=471,227,218,214,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory.FactoryException:oiref>=235,242,107,77,1:oigroup>
+<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.ObjectFactory#defaultObjectFactory:oiref>=395,315,395,362,479,362,479,278,432,278:oigroup>
+<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.Component#parent:oiref>=669,329,669,379,759,379,759,289,709,289:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.Environment:oiref>=256,19,203,258,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.Component:oiref>=506,68,203,261,1:oigroup>
+<oigroup:<oiref:java#Class#de.infor.ce.util.ObjectFactory:oiref>=40,143,203,223,1:oigroup>
+<oigroup:MemberLink#<oiref:java#Member#de.infor.ce.util.ObjectFactory#objectFactory:oiref>=203,366,203,416,293,416,293,326,243,326:oigroup>
+*/
+class __positions {
+}