diff --git a/.classpath b/.classpath
index 03744ea..e934150 100644
--- a/.classpath
+++ b/.classpath
@@ -4,7 +4,6 @@
-
diff --git a/lib/commons-beanutils.jar b/lib/commons-beanutils.jar
deleted file mode 100644
index b1b89c9..0000000
Binary files a/lib/commons-beanutils.jar and /dev/null differ
diff --git a/lib/idcanet-x4o-bin.jar b/lib/idcanet-x4o-bin.jar
index 1a5c7aa..5a7c348 100644
Binary files a/lib/idcanet-x4o-bin.jar and b/lib/idcanet-x4o-bin.jar differ
diff --git a/src/com/idcanet/foei/components/lang/EventProxy.java b/src/com/idcanet/foei/components/lang/EventProxy.java
index bd635bc..aaa5893 100644
--- a/src/com/idcanet/foei/components/lang/EventProxy.java
+++ b/src/com/idcanet/foei/components/lang/EventProxy.java
@@ -40,8 +40,8 @@ import com.idcanet.foei.event.IllegalEventPortNameException;
* @author Willem Cazander
* @version 1.0 Feb 27, 2005
*/
-public class EventProxy extends AbstractEventObject
-{
+public class EventProxy extends AbstractEventObject {
+
/** v1.0 */
static final long serialVersionUID = 10l;
diff --git a/src/com/idcanet/foei/components/lang/Filter.java b/src/com/idcanet/foei/components/lang/Filter.java
index 288702b..bc1b6cf 100644
--- a/src/com/idcanet/foei/components/lang/Filter.java
+++ b/src/com/idcanet/foei/components/lang/Filter.java
@@ -48,8 +48,8 @@ import com.idcanet.foei.event.IllegalEventPortNameException;
@SetEventPort(type=EventPortType.output,name=EventPort.PASS),
})
*/
-public class Filter extends AbstractEventObjectStepController
-{
+public class Filter extends AbstractEventObjectStepController {
+
/** v1.0 */
static final long serialVersionUID = 10l;
diff --git a/src/com/idcanet/foei/components/lang/GetBeanProperty.java b/src/com/idcanet/foei/components/lang/GetBeanProperty.java
index 929d760..dd08f7a 100644
--- a/src/com/idcanet/foei/components/lang/GetBeanProperty.java
+++ b/src/com/idcanet/foei/components/lang/GetBeanProperty.java
@@ -26,13 +26,12 @@
package com.idcanet.foei.components.lang;
-import org.apache.commons.beanutils.BeanUtils;
-
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventObject;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.IllegalEventPortNameException;
+import com.idcanet.x4o.impl.DefaultElementParameterHelper;
/**
* Gets the property of an Bean
@@ -41,8 +40,8 @@ import com.idcanet.foei.event.IllegalEventPortNameException;
* @version 1.0 Jun 5, 2006
*
*/
-public class GetBeanProperty extends AbstractEventObject
-{
+public class GetBeanProperty extends AbstractEventObject {
+
/** v1.0 */
static final long serialVersionUID = 10l;
/** The Property name */
@@ -51,6 +50,9 @@ public class GetBeanProperty extends AbstractEventObject
private String property = null;
//private Object propertyValue = null;
+
+ private DefaultElementParameterHelper helper = null;
+
/**
* Creates an SetBeanProperty
*/
@@ -58,6 +60,7 @@ public class GetBeanProperty extends AbstractEventObject
addInputPort(EventPort.INPUT,Object.class);
//addInputPort(PROPERTY,Object.class);
addOutputPort(EventPort.OUTPUT);
+ helper = new DefaultElementParameterHelper();
}
/**
@@ -75,7 +78,7 @@ public class GetBeanProperty extends AbstractEventObject
return;
}
try {
- object = BeanUtils.getProperty(object,property); // todo: fix error this wil only return String !!!!!!!!!!!!!!!!!
+ object = helper.getParameter(object,property); // todo: fix error this wil only return String !!!!!!!!!!!!!!!!!
} catch (Exception e) {
e.printStackTrace();
return;
diff --git a/src/com/idcanet/foei/components/lang/SendEvent.java b/src/com/idcanet/foei/components/lang/SendEvent.java
index 3b471cf..279ca3b 100644
--- a/src/com/idcanet/foei/components/lang/SendEvent.java
+++ b/src/com/idcanet/foei/components/lang/SendEvent.java
@@ -39,8 +39,8 @@ import com.idcanet.foei.event.IllegalEventPortNameException;
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
-public class SendEvent extends AbstractEventInput
-{
+public class SendEvent extends AbstractEventInput {
+
/** v1.0 */
static final long serialVersionUID = 10l;
diff --git a/src/com/idcanet/foei/components/lang/SetBeanProperty.java b/src/com/idcanet/foei/components/lang/SetBeanProperty.java
index 6305955..445ef75 100644
--- a/src/com/idcanet/foei/components/lang/SetBeanProperty.java
+++ b/src/com/idcanet/foei/components/lang/SetBeanProperty.java
@@ -26,13 +26,12 @@
package com.idcanet.foei.components.lang;
-import org.apache.commons.beanutils.BeanUtils;
-
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventObject;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.IllegalEventPortNameException;
+import com.idcanet.x4o.impl.DefaultElementParameterHelper;
/**
* Sets an property of an bean which is set on the propery input port.
@@ -40,8 +39,8 @@ import com.idcanet.foei.event.IllegalEventPortNameException;
* @author Willem Cazander
* @version 1.0 Feb 12, 2006
*/
-public class SetBeanProperty extends AbstractEventObject
-{
+public class SetBeanProperty extends AbstractEventObject {
+
/** v1.0 */
static final long serialVersionUID = 10l;
/** The Property name */
@@ -50,6 +49,9 @@ public class SetBeanProperty extends AbstractEventObject
private String property = null;
private Object propertyValue = null;
+
+ private DefaultElementParameterHelper helper = null;
+
/**
* Creates an SetBeanProperty
*/
@@ -57,6 +59,7 @@ public class SetBeanProperty extends AbstractEventObject
addInputPort(EventPort.INPUT,Object.class);
addInputPort(PROPERTY,Object.class);
addOutputPort(EventPort.OUTPUT);
+ helper = new DefaultElementParameterHelper();
}
/**
@@ -74,7 +77,7 @@ public class SetBeanProperty extends AbstractEventObject
return;
}
try {
- BeanUtils.setProperty(object,property,propertyValue);
+ helper.setParameter(object,property,propertyValue);
} catch (Exception e) {
e.printStackTrace();
return;
diff --git a/src/com/idcanet/foei/components/logging/LoggerHandler.java b/src/com/idcanet/foei/components/logging/LoggerHandler.java
index e25767c..52e3717 100644
--- a/src/com/idcanet/foei/components/logging/LoggerHandler.java
+++ b/src/com/idcanet/foei/components/logging/LoggerHandler.java
@@ -37,13 +37,12 @@ import java.util.logging.LogRecord;
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
-public class LoggerHandler extends Handler
-{
+public class LoggerHandler extends Handler {
+
private Logger logger = Logger.getLogger(this.getClass().getName());
private LoggerInput loggerInput = null;
- public LoggerHandler(LoggerInput loggerInput)
- {
+ public LoggerHandler(LoggerInput loggerInput) {
this.loggerInput=loggerInput;
logger.addHandler(this);
}
@@ -51,7 +50,7 @@ public class LoggerHandler extends Handler
// ------------ handler
public void publish(LogRecord record) {
- HashMap event = new HashMap();
+ HashMap event = new HashMap();
event.put("message",record.getMessage());
event.put("level",record.getLevel().getName());
loggerInput.sendMessage(event);
diff --git a/src/com/idcanet/foei/components/logging/LoggerInput.java b/src/com/idcanet/foei/components/logging/LoggerInput.java
index 704c132..e7a1cb3 100644
--- a/src/com/idcanet/foei/components/logging/LoggerInput.java
+++ b/src/com/idcanet/foei/components/logging/LoggerInput.java
@@ -38,8 +38,8 @@ import java.util.Map;
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
-public class LoggerInput extends AbstractEventOutput
-{
+public class LoggerInput extends AbstractEventOutput {
+
/** v1.0 */
static final long serialVersionUID = 10l;
/** */
@@ -59,9 +59,7 @@ public class LoggerInput extends AbstractEventOutput
*
* @param event
*/
- public void sendMessage(Map event) {
+ public void sendMessage(Map event) {
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),event);
- //FoeiInstance foeiInstance = FoeiServer.getFoeiInstance();
- //foeiInstance.getObjectBindingsManager().sendEventOutput(getID(),OUTPUT,event);
}
}
\ No newline at end of file
diff --git a/src/com/idcanet/foei/components/steps/filters/ClassFilter.java b/src/com/idcanet/foei/components/steps/filters/ClassFilter.java
index 84caf0f..e50112b 100644
--- a/src/com/idcanet/foei/components/steps/filters/ClassFilter.java
+++ b/src/com/idcanet/foei/components/steps/filters/ClassFilter.java
@@ -34,8 +34,8 @@ import com.idcanet.foei.event.AbstractEventStepController;
* @author Willem Cazander
* @version 1.0 26/01/2005
*/
-public class ClassFilter extends AbstractEventStepController
-{
+public class ClassFilter extends AbstractEventStepController {
+
/** v1.0 */
static final long serialVersionUID = 10l;
/** The class name to match */
@@ -45,8 +45,7 @@ public class ClassFilter extends AbstractEventStepController
* Sets the className which the filtered object has to have.
* @param className The className.
*/
- public void setClassName(String className)
- {
+ public void setClassName(String className) {
this.className=className;
}
@@ -54,8 +53,7 @@ public class ClassFilter extends AbstractEventStepController
* Returns the className on which this filter filters.
* @return The className.
*/
- public String getClassName()
- {
+ public String getClassName() {
return className;
}
@@ -64,21 +62,14 @@ public class ClassFilter extends AbstractEventStepController
* This checks if the objects class equals that of the className.
* @return The object or null is not succesfull.
*/
- public Object processObject(Object object)
- {
- if(object==null)
- {
+ public Object processObject(Object object) {
+ if(object==null) {
return null;
}
- Class[] classes = object.getClass().getClasses();
- System.out.println("ClassFilter filter: "+object+" on "+className+" classes: "+classes.length);
- for(int i=0;i[] classes = object.getClass().getClasses();
+ for(int i=0;i
*
*/
+ @SuppressWarnings("unchecked")
public Object processObject(Object object) {
if(key==null) {
return null;
diff --git a/src/com/idcanet/foei/core/impl/FoeiConfiguratorImpl.java b/src/com/idcanet/foei/core/impl/FoeiConfiguratorImpl.java
index 34a0e0f..e260c7f 100644
--- a/src/com/idcanet/foei/core/impl/FoeiConfiguratorImpl.java
+++ b/src/com/idcanet/foei/core/impl/FoeiConfiguratorImpl.java
@@ -121,7 +121,7 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
if(className==null) {
return new ObjectBindingsManagerImpl();
}
- return (ObjectBindingsManager)Class.forName(className).newInstance();
+ return (ObjectBindingsManager)loadClass(className).newInstance();
}
/**
@@ -138,7 +138,7 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
if(className==null) {
return new MemoryContextFactory().getInitialContext(new Hashtable(properties));
}
- return ((InitialContextFactory)Class.forName(className).newInstance()).getInitialContext(new Hashtable(properties));
+ return ((InitialContextFactory)loadClass(className).newInstance()).getInitialContext(new Hashtable(properties));
}
/**
@@ -154,7 +154,7 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
if(className==null) {
return new EventExecutorManagerImpl();
}
- return (EventExecutorManager)Class.forName(className).newInstance();
+ return (EventExecutorManager)loadClass(className).newInstance();
}
/**
@@ -171,7 +171,7 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
}
for(String className:classNames.split(",")) {
logger.finest("Loading class: "+className);
- EventThreadListener eventThreadListener = (EventThreadListener)Class.forName(className).newInstance();
+ EventThreadListener eventThreadListener = (EventThreadListener)loadClass(className).newInstance();
eventExecutorManager.addEventThreadListener(eventThreadListener);
}
}
@@ -229,7 +229,7 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
if(className==null) {
return EventExecutorImpl.class;
}
- return Class.forName(className);
+ return loadClass(className);
}
/**
@@ -258,7 +258,22 @@ public class FoeiConfiguratorImpl implements FoeiConfigurator {
if(className==null) {
return new FoeiProcessManagerImpl();
}
- return (FoeiProcessManager)Class.forName(className).newInstance();
+ return (FoeiProcessManager)loadClass(className).newInstance();
}
+
+ /**
+ * Loads a Class from the ContextClassLoader and if that is not set, then
+ * uses the class of the String parameters
+ * @param className The class name to load
+ * @return The loaded class
+ * @throws Exception throws exception if class not loaded.
+ */
+ static public Class> loadClass(String className) throws ClassNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = className.getClass().getClassLoader(); // fallback
+ }
+ return cl.loadClass(className);
+ }
}
\ No newline at end of file
diff --git a/src/com/idcanet/foei/utils/beans/BeanProperty.java b/src/com/idcanet/foei/utils/beans/BeanProperty.java
deleted file mode 100644
index ff03b37..0000000
--- a/src/com/idcanet/foei/utils/beans/BeanProperty.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2004-2006 IDCA. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
- * following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
- * the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- * and the following disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 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 IDCA OR
- * 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.
- *
- * The views and conclusions contained in the software and documentation are those of the authors and
- * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
- */
-
-package com.idcanet.foei.utils.beans;
-
-/**
- * Gets ans Set properties of an java bean
- *
- *
- * @author Willem Cazander
- * @version 1.0 Jan 18, 2006
- */
-public class BeanProperty {
-
-
-
-}
\ No newline at end of file
diff --git a/src/com/idcanet/foei/utils/beans/BeanPropertyComparator.java b/src/com/idcanet/foei/utils/beans/BeanPropertyComparator.java
deleted file mode 100644
index b21b3c5..0000000
--- a/src/com/idcanet/foei/utils/beans/BeanPropertyComparator.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2004-2006 IDCA. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
- * following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
- * the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- * and the following disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 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 IDCA OR
- * 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.
- *
- * The views and conclusions contained in the software and documentation are those of the authors and
- * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
- */
-
-package com.idcanet.foei.utils.beans;
-
-import java.lang.Comparable;
-import java.util.Comparator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.commons.beanutils.BeanUtils;
-
-/**
- * Compares a property of a java bean.
- * The property should be Comparable.
- *
- * @author Willem Cazander
- * @version 1.0 Jan 11, 2006
- */
-public class BeanPropertyComparator implements Comparator {
-
- /** The propery of the bean to compare. */
- private String property = null;
- /** The logger to log to. */
- private Logger logger = null;
- /** The ascending */
- private boolean ascending = true;
-
- /**
- * The constructor inits the logger.
- */
- public BeanPropertyComparator() {
- logger = Logger.getLogger(BeanPropertyComparator.class.getName());
- }
-
- /**
- * Creates an BeanPropertyComparator with an property
- * @param property
- */
- public BeanPropertyComparator(String property) {
- this();
- setProperty(property);
- }
-
- /**
- * Creates an BeanPropertyComparator with an property
- * @param property
- */
- public BeanPropertyComparator(String property,boolean ascending) {
- this();
- setProperty(property);
- setAscending(ascending);
- }
-
- /**
- * Compares 2 objects by the propery
- * @see Comparator#compare(T, T);
- * @param o1 Object 1
- * @param o2 Object 2
- * @return the differce between the objects.
- */
- public int compare(Object o1,Object o2) throws ClassCastException {
-
- Comparable c1 = getComparableProperty(o1);
- Comparable c2 = getComparableProperty(o2);
-
- if(c1==null && c2==null) {
- return 0;
- }
- if(c1==null) {
- if(ascending) {
- return 1;
- } else {
- return -1;
- }
- }
- if(c2==null) {
- if(ascending) {
- return 1;
- } else {
- return -1;
- }
- }
-
- if(ascending) {
- return c1.compareTo(c2);
- } else {
- return c2.compareTo(c1);
- }
- }
-
- /**
- * Returns the Comparable property of the object.
- * @param object
- * @return
- * @throws ClassCastException
- */
- private Comparable getComparableProperty(Object object) throws ClassCastException {
-
- if(property==null) {
- throw new IllegalStateException("property is not set.");
- }
- Object result = null;
- try {
- result = BeanUtils.getProperty(object,property);
- } catch (Exception e) {
- logger.log(Level.WARNING,"property:"+property+" is not an property of object: "+object.getClass().getName(),e);
- }
- try {
- Comparable c = (Comparable)result;
- return c;
- } catch (ClassCastException e) {
- logger.log(Level.WARNING,"property:"+property+" is not Comparable",e);
- throw e;
- }
- }
-
- /**
- * @return Returns the property.
- */
- public String getProperty() {
- return property;
- }
-
- /**
- * @param property The property to set.
- */
- public void setProperty(String property) {
- if(property==null) {
- throw new NullPointerException("property may not be null");
- }
- this.property = property;
- logger.finest("property="+property);
- }
-
- /**
- * @return Returns the ascending.
- */
- public boolean isAscending() {
- return ascending;
- }
-
- /**
- * @param ascending The ascending to set.
- */
- public void setAscending(boolean ascending) {
- this.ascending = ascending;
- logger.finest("ascending="+ascending);
- }
-}
-
diff --git a/src/com/idcanet/foei/utils/beans/package.html b/src/com/idcanet/foei/utils/beans/package.html
deleted file mode 100644
index 547a56e..0000000
--- a/src/com/idcanet/foei/utils/beans/package.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-Provides some handy classes for working with java beans.
-
-Package Specification
-
-
- - Full J2SE 5 compatible
- - Small package
-
-
-
-Related Documentation
-
-None.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/com/idcanet/foei/utils/jndi/MemoryContext.java b/src/com/idcanet/foei/utils/jndi/MemoryContext.java
index 3906a4a..7e20496 100644
--- a/src/com/idcanet/foei/utils/jndi/MemoryContext.java
+++ b/src/com/idcanet/foei/utils/jndi/MemoryContext.java
@@ -52,9 +52,10 @@ import javax.naming.spi.NamingManager;
* @author Willem Cazander
* @version 1.0 Jan 18, 2006
*/
-public class MemoryContext implements Context
-{
- protected Hashtable myEnv;
+@SuppressWarnings("unchecked")
+public class MemoryContext implements Context {
+
+ protected Hashtable myEnv;
protected Hashtable bindings = new Hashtable(11);
protected final static NameParser myParser = new MemoryContextNameParser();
protected MemoryContext parent = null;
diff --git a/src/com/idcanet/foei/utils/jndi/MemoryContextFactory.java b/src/com/idcanet/foei/utils/jndi/MemoryContextFactory.java
index 1759b50..d38ac66 100644
--- a/src/com/idcanet/foei/utils/jndi/MemoryContextFactory.java
+++ b/src/com/idcanet/foei/utils/jndi/MemoryContextFactory.java
@@ -39,8 +39,8 @@ import javax.naming.NamingException;
* @version 1.0 Jan 18, 2006
*
*/
-public class MemoryContextFactory implements InitialContextFactory
-{
+public class MemoryContextFactory implements InitialContextFactory {
+
/** Stores the jvm wide instance of the FoeiContext */
static private Context context = null;
@@ -50,9 +50,9 @@ public class MemoryContextFactory implements InitialContextFactory
* @return
* @throws NamingException
*/
+ @SuppressWarnings("unchecked")
public Context getInitialContext(Hashtable environment) throws NamingException {
-
- if(context!=null) {
+ if (context!=null) {
return context;
}
context = new MemoryContext(environment);