[svn r392] some small fixes
This commit is contained in:
parent
c540c7e531
commit
349a636e66
6
.project
6
.project
|
@ -5,6 +5,11 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
|
@ -19,5 +24,6 @@
|
|||
<natures>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -3,7 +3,7 @@
|
|||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.idcanet</groupId>
|
||||
<artifactId>foei</artifactId>
|
||||
<artifactId>foei-main</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<name>foei</name>
|
||||
|
@ -99,6 +99,17 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Package source -->
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals><goal>jar</goal></goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Generate site -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
|
|
|
@ -83,16 +83,27 @@ public class Filter extends AbstractEventObjectStepController {
|
|||
*/
|
||||
@Override
|
||||
public Object processEventSteps(Object object) {
|
||||
Object o = object;
|
||||
for (int i=0;i<getEventSteps().size();i++) {
|
||||
EventStep e = getEventSteps().get(i); // faster then useing iterator object in j5 for loop
|
||||
if(o==null) {
|
||||
if (object==null) {
|
||||
return null;
|
||||
}
|
||||
o = e.processObject(object);
|
||||
if (getEventSteps().isEmpty()) {
|
||||
return object; // no steps so no filtering
|
||||
}
|
||||
Object result = null;
|
||||
Object resultOld = null;
|
||||
for (int i=0;i<getEventSteps().size();i++) {
|
||||
EventStep e = getEventSteps().get(i); // faster then useing iterator object in j5 for loop
|
||||
result = e.processObject(object);
|
||||
if (e.getEventStepOperand()!=null && i>0) {
|
||||
boolean op = e.getEventStepOperand().execute(result!=null, resultOld!=null);
|
||||
if (op==false) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
resultOld = result;
|
||||
}
|
||||
// Check for for last(or only) EventStep
|
||||
if(o==null) {
|
||||
if(result==null) {
|
||||
return null;
|
||||
}
|
||||
return object;
|
||||
|
|
|
@ -31,7 +31,7 @@ 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;
|
||||
import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
|
||||
|
||||
/**
|
||||
* Gets the property of an Bean
|
||||
|
@ -51,7 +51,7 @@ public class GetBeanProperty extends AbstractEventObject {
|
|||
|
||||
//private Object propertyValue = null;
|
||||
|
||||
private DefaultElementParameterHelper helper = null;
|
||||
private DefaultElementObjectPropertyValue helper = null;
|
||||
|
||||
/**
|
||||
* Creates an SetBeanProperty
|
||||
|
@ -60,7 +60,7 @@ public class GetBeanProperty extends AbstractEventObject {
|
|||
addInputPort(EventPort.INPUT,Object.class);
|
||||
//addInputPort(PROPERTY,Object.class);
|
||||
addOutputPort(EventPort.OUTPUT);
|
||||
helper = new DefaultElementParameterHelper();
|
||||
helper = new DefaultElementObjectPropertyValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ public class GetBeanProperty extends AbstractEventObject {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
object = helper.getParameter(object,property); // todo: fix error this wil only return String !!!!!!!!!!!!!!!!!
|
||||
object = helper.getProperty(object,property); // todo: fix error this wil only return String !!!!!!!!!!!!!!!!!
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,7 @@ 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;
|
||||
import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
|
||||
|
||||
/**
|
||||
* Sets an property of an bean which is set on the propery input port.
|
||||
|
@ -50,7 +50,7 @@ public class SetBeanProperty extends AbstractEventObject {
|
|||
|
||||
private Object propertyValue = null;
|
||||
|
||||
private DefaultElementParameterHelper helper = null;
|
||||
private DefaultElementObjectPropertyValue helper = null;
|
||||
|
||||
/**
|
||||
* Creates an SetBeanProperty
|
||||
|
@ -59,7 +59,7 @@ public class SetBeanProperty extends AbstractEventObject {
|
|||
addInputPort(EventPort.INPUT,Object.class);
|
||||
addInputPort(PROPERTY,Object.class);
|
||||
addOutputPort(EventPort.OUTPUT);
|
||||
helper = new DefaultElementParameterHelper();
|
||||
helper = new DefaultElementObjectPropertyValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ public class SetBeanProperty extends AbstractEventObject {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
helper.setParameter(object,property,propertyValue);
|
||||
helper.setProperty(object,property,propertyValue);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
package com.idcanet.foei.components.steps.lang;
|
||||
|
||||
import com.idcanet.foei.event.AbstractEventStepController;
|
||||
import com.idcanet.x4o.impl.DefaultElementParameterHelper;
|
||||
import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
|
||||
|
||||
/**
|
||||
* Gets the property of an java bean.
|
||||
|
@ -42,10 +42,10 @@ public class GetBeanPropertyStep extends AbstractEventStepController {
|
|||
/** Holds the key which contains the object in the map. */
|
||||
private String property = null;
|
||||
|
||||
private DefaultElementParameterHelper helper = null;
|
||||
private DefaultElementObjectPropertyValue helper = null;
|
||||
|
||||
public GetBeanPropertyStep() {
|
||||
helper = new DefaultElementParameterHelper();
|
||||
helper = new DefaultElementObjectPropertyValue();
|
||||
}
|
||||
|
||||
//----------- get/set functions
|
||||
|
@ -70,7 +70,7 @@ public class GetBeanPropertyStep extends AbstractEventStepController {
|
|||
}
|
||||
Object result = null;
|
||||
try {
|
||||
result = helper.getParameter(object,property);
|
||||
result = helper.getProperty(object,property);
|
||||
} catch (Exception e) {
|
||||
//logger.log(Level.WARNING,"property:"+property+" is not an property of object: "+object.getClass().getName(),e);
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.idcanet.foei.event.EventStep;
|
|||
import com.idcanet.foei.event.EventStepController;
|
||||
import com.idcanet.x4o.element.AbstractElementBindingHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementBindingException;
|
||||
import com.idcanet.x4o.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ public class FoeiEventBindingRuleHandler extends AbstractElementBindingHandler {
|
|||
* @param object2
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
public void doBind(Element element) throws ElementBindingException {
|
||||
public void doBind(Element element) throws ElementBindingHandlerException {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
if(parent==null) {
|
||||
|
|
|
@ -40,7 +40,6 @@ import java.util.List;
|
|||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.naming.Context;
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
package com.idcanet.foei.core.impl;
|
||||
|
||||
import com.idcanet.foei.core.FoeiProcess;
|
||||
import com.idcanet.foei.core.FoeiProcessFactory;
|
||||
import com.idcanet.foei.core.X2OExecutor;
|
||||
import com.idcanet.x4o.core.X4OParser;
|
||||
|
||||
|
@ -65,15 +63,9 @@ public class X2OExecutorImpl implements X2OExecutor {
|
|||
try {
|
||||
|
||||
// config parser
|
||||
FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess();
|
||||
//FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess();
|
||||
X4OParser parser = new X4OParser("foei");
|
||||
|
||||
for (String key:foeiProcess.getFoeiContext().getStartProperties().keySet()) {
|
||||
String value = foeiProcess.getFoeiContext().getStartProperties().get(key);
|
||||
parser.setProperty(key, value);
|
||||
}
|
||||
|
||||
|
||||
logger.info("Executing X2O Parsing.");
|
||||
|
||||
if(parseFileName!=null) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.idcanet.foei.core.FoeiProcessFactory;
|
|||
import com.idcanet.foei.event.EventInput;
|
||||
import com.idcanet.foei.event.EventOutput;
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
import com.idcanet.x4o.element.AbstractElementParameterHandler;
|
||||
import com.idcanet.x4o.element.AbstractElementAttributeHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementConfiguratorException;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
|
@ -42,14 +42,14 @@ import com.idcanet.x4o.element.ElementException;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2006
|
||||
*/
|
||||
public class BindAttributeHandler extends AbstractElementParameterHandler {
|
||||
public class BindAttributeHandler extends AbstractElementAttributeHandler {
|
||||
|
||||
/**
|
||||
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String)
|
||||
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doConfigElement(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
String parameterValue = element.getAttributes().get(getParameterName());
|
||||
String parameterValue = element.getAttributes().get(getAttributeName());
|
||||
String[] port = parameterValue.split(":");
|
||||
if(port.length!=2) {
|
||||
return;
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.idcanet.foei.event.EventStep;
|
|||
import com.idcanet.foei.event.EventStepController;
|
||||
import com.idcanet.x4o.element.AbstractElementBindingHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementBindingException;
|
||||
import com.idcanet.x4o.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,7 +58,7 @@ public class EventStepBindRuleHandler extends AbstractElementBindingHandler {
|
|||
/**
|
||||
* @see com.idca.foei.xml.x2o.eld.BindingRuleHandler#doBind(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void doBind(Element element) throws ElementBindingException {
|
||||
public void doBind(Element element) throws ElementBindingHandlerException {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
((EventStepController)parent).addEventStep((EventStep)child);
|
||||
|
|
|
@ -29,7 +29,7 @@ package com.idcanet.foei.core.x4o;
|
|||
import com.idcanet.foei.core.FoeiBindingException;
|
||||
import com.idcanet.foei.core.FoeiProcess;
|
||||
import com.idcanet.foei.core.FoeiProcessFactory;
|
||||
import com.idcanet.x4o.element.AbstractElementParameterHandler;
|
||||
import com.idcanet.x4o.element.AbstractElementAttributeHandler;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementConfiguratorException;
|
||||
|
||||
|
@ -39,15 +39,15 @@ import com.idcanet.x4o.element.ElementConfiguratorException;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 8, 2006
|
||||
*/
|
||||
public class IdAttributeHandler extends AbstractElementParameterHandler {
|
||||
public class IdAttributeHandler extends AbstractElementAttributeHandler {
|
||||
|
||||
/**
|
||||
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String)
|
||||
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doConfigElement(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
// add to objext context
|
||||
String parameterValue = element.getAttributes().get(getParameterName());
|
||||
String parameterValue = element.getAttributes().get(getAttributeName());
|
||||
if(element.getElementObject()==null | "".equals(parameterValue)) {
|
||||
parameterValue= "auto."+Integer.toHexString(element.getElementObject().hashCode());
|
||||
//logger.finest("Generated auto id: "+parameterValue);
|
||||
|
|
|
@ -34,4 +34,19 @@ package com.idcanet.foei.event;
|
|||
*/
|
||||
abstract public class AbstractEventStep implements EventStep {
|
||||
|
||||
private EventStepOperand eventStepOperand = null;
|
||||
|
||||
/**
|
||||
* @return the eventStepOperand
|
||||
*/
|
||||
public EventStepOperand getEventStepOperand() {
|
||||
return eventStepOperand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eventStepOperand the eventStepOperand to set
|
||||
*/
|
||||
public void setEventStepOperand(EventStepOperand eventStepOperand) {
|
||||
this.eventStepOperand = eventStepOperand;
|
||||
}
|
||||
}
|
|
@ -36,6 +36,30 @@ import java.io.Serializable;
|
|||
*/
|
||||
public interface EventStep extends Serializable {
|
||||
|
||||
public enum EventStepOperand {
|
||||
AND,NAND,
|
||||
OR,NOR,XOR;
|
||||
|
||||
public boolean execute(boolean A,boolean B) {
|
||||
if (this==AND) {
|
||||
return A&B;
|
||||
}
|
||||
if (this==NAND) {
|
||||
return !A&!B;
|
||||
}
|
||||
if (this==OR) {
|
||||
return A|B;
|
||||
}
|
||||
if (this==NOR) {
|
||||
return !A|!B;
|
||||
}
|
||||
if (this==XOR) {
|
||||
return A^B;
|
||||
}
|
||||
throw new IllegalStateException("Can execute unknow EventStepOperand: "+this.name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an object and gives it back.
|
||||
*
|
||||
|
@ -43,4 +67,8 @@ public interface EventStep extends Serializable {
|
|||
* @returns An object or null if not succesfull.
|
||||
*/
|
||||
public Object processObject(Object object) throws ClassCastException;
|
||||
|
||||
|
||||
public void setEventStepOperand(EventStepOperand operand);
|
||||
public EventStepOperand getEventStepOperand();
|
||||
}
|
Loading…
Reference in a new issue