3
0
Fork 0

simple split to multi module project

This commit is contained in:
willem.cazander 2010-09-25 18:34:44 +02:00
parent 5c13908f8e
commit 2906c482d1
182 changed files with 396 additions and 589 deletions

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
foei-components/.project Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>foei-components</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
#Sat Sep 25 01:02:55 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,9 @@
#Sat Sep 25 01:02:54 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

20
foei-components/pom.xml Normal file
View file

@ -0,0 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.idcanet.foei</groupId>
<artifactId>foei-base</artifactId>
<version>0.8-SNAPSHOT</version>
</parent>
<groupId>com.idcanet.foei</groupId>
<artifactId>foei-components</artifactId>
<version>0.8-SNAPSHOT</version>
<name>foei-components</name>
<description>foei-component</description>
<dependencies>
<dependency>
<groupId>com.idcanet.foei</groupId>
<artifactId>foei-core</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,72 @@
/*
* 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.components.io;
import com.idcanet.foei.event.AbstractEventInputStepController;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.EventPortType;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.IllegalEventPortNameException;
/**
* Prints the EventSteps to the System.err
*
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
public class ErrorOutput extends AbstractEventInputStepController
{
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Creates an ErrorOutput
*/
public ErrorOutput() {
addInputPort(EventPort.INPUT);
}
// ----------- EventInput
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(EventPortType.input!=eventPort.getEventPortType()) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
System.err.println(processEventSteps(object));
}
public Object processEventSteps(Object object) {
StringBuffer buff = new StringBuffer();
for(EventStep e:getEventSteps()) {
if(object==null) {
return null;
}
buff.append((String)e.processObject(object));
}
return buff;
}
}

View file

@ -0,0 +1,36 @@
package com.idcanet.foei.components.io;
/*
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
public class FileOutput extends AbstractEventInput
{
static final String INPUT = "input";
private ArrayList printers = new ArrayList(4);
public FileOutput()
{
inputList.add(INPUT);
}
// ----------- EventInput
public void doEvent(String inputName,Object object)
{
Iterator printerWalker = printers.iterator();
//System.out.print("STDOUT:");
while(printerWalker.hasNext())
{
EventStep eventStep = (EventStep)printerWalker.next();
String out = (String)eventStep.processObject(object);
System.out.print(out);
}
System.out.println("");
}
}
*/

View file

@ -0,0 +1,73 @@
/*
* 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.components.io;
import com.idcanet.foei.event.AbstractEventInputStepController;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.EventPortType;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.IllegalEventPortNameException;
/**
* Prints the EventSteps to the System.out
*
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
public class StandardOutput extends AbstractEventInputStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Creates an StandardOutput
*
*/
public StandardOutput() {
addInputPort(EventPort.INPUT);
}
// ----------- EventInput
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(EventPortType.input!=eventPort.getEventPortType()) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
System.out.println(processEventSteps(object));
}
public Object processEventSteps(Object object) {
StringBuffer buff = new StringBuffer();
for(EventStep e:getEventSteps()) {
if(object==null) {
return null;
}
buff.append((String)e.processObject(object));
}
return buff;
}
}

View file

@ -0,0 +1,106 @@
/*
* 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.components.lang;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventInput;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.EventPortType;
import com.idcanet.foei.event.IllegalEventPortNameException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Destroys an FoeiContext
*
* @author Willem Cazander
* @version 1.0 Mar 3, 2006
*/
public class DestroyFoeiProcess extends AbstractEventInput {
/** v1.0 */
static final long serialVersionUID = 10l;
private Integer delayTime = null;
private Logger logger = null;
public void setDelayTime(Integer delayTime) {
this.delayTime=delayTime;
}
public Integer getDelayTime() {
return delayTime;
}
/**
* Creates the output port
*/
public DestroyFoeiProcess() {
logger = Logger.getLogger(DestroyFoeiProcess.class.getName());
addInputPort(EventPort.INPUT,Object.class);
getInputPort(EventPort.INPUT).setImmediate(false);
setDelayTime(5000);
}
/**
* Stops the running FoeiProcess.
* (running event wil stil run !!)
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(EventPortType.input!=eventPort.getEventPortType()) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
FoeiProcess process = FoeiProcessFactory.getFoeiProcess();
if (process.getWorkQueue().isEmpty()==false) {
logger.info("WorkQueue not empty sleeping a bit and sending retrigger myself q="+process.getWorkQueue().size()+" for proc: "+process.getName());
try {
Thread.sleep(delayTime+500); // add some minual d
} catch (Exception e) {
logger.log(Level.WARNING,"Error sleeping: "+e.getMessage(),e);
}
process.executeEvent(getInputPort(EventPort.INPUT), "null");
return;
}
if(delayTime!=null) {
try {
logger.info("Sleeping "+delayTime+" ms before destoying process: "+process.getName());
Thread.sleep(delayTime);
} catch (Exception e) {
logger.log(Level.WARNING,"Error sleeping: "+e.getMessage(),e);
}
}
// the impl prints an destory line
process.getFoeiContext().getFoeiProcessManager().destroyFoeiProcess(process.getName());
}
}

View file

@ -0,0 +1,51 @@
/*
* 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.components.lang;
import com.idcanet.foei.event.AbstractEventOutput;
import com.idcanet.foei.event.EventPort;
/**
* Defines an DummyOutputPort
*
* @author Willem Cazander
* @version 1.0 Feb 12, 2006
*
*
*/
public class DummyOutputPort extends AbstractEventOutput {
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Creates the output port
*/
public DummyOutputPort() {
addOutputPort(EventPort.OUTPUT,Object.class);
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.components.lang;
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.EventPortType;
import com.idcanet.foei.event.IllegalEventPortNameException;
/**
* This is a sort of dummy object.
* It only resends its events to the output.
*
* @author Willem Cazander
* @version 1.0 Feb 27, 2005
*/
public class EventProxy extends AbstractEventObject {
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Creates an EventProxy
*/
public EventProxy() {
addInputPort(EventPort.INPUT,Object.class); // define an input source
addOutputPort(EventPort.OUTPUT,Object.class); // define the outputs source.
}
/**
* Only proxies the object from the input to the output
* @param inputName
* @param object
* @throws IllegalEventPortNameException
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(EventPortType.input!=eventPort.getEventPortType()) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),object);
}
}

View file

@ -0,0 +1,112 @@
/*
* 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.components.lang;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventObjectStepController;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.EventPortType;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.IllegalEventPortNameException;
/**
* Fiters the object on the Input port throw all
* eventsteps and outputs to pass or drop.
*
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
/*
@SetEventPorts(ports={
@SetEventPort(type=EventPortType.input,name=EventPort.INPUT,immediate=EventPort.TRUE),
@SetEventPort(type=EventPortType.output,name=EventPort.DROP),
@SetEventPort(type=EventPortType.output,name=EventPort.PASS),
})
*/
public class Filter extends AbstractEventObjectStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Creates an Filter
*/
public Filter() {
addInputPort(EventPort.INPUT,Object.class); // define an input source
addOutputPort(EventPort.DROP); // define the outputs source.
addOutputPort(EventPort.PASS); // defaults to Object.class)
}
/**
* Filters the object with EventSteps
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(EventPortType.input!=eventPort.getEventPortType()) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
Object filtered = processEventSteps(object);
if(filtered==null) {
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.DROP),object);
} else {
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.PASS),object);
}
}
/**
* Make sure that all steps are given the org object ..
*/
@Override
public Object processEventSteps(Object object) {
if (object==null) {
return null;
}
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(result==null) {
return null;
}
return object;
}
}

View file

@ -0,0 +1,105 @@
/*
* 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.components.lang;
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.DefaultElementObjectPropertyValue;
/**
* Gets the property of an Bean
*
* @author Willem Cazander
* @version 1.0 Jun 5, 2006
*
*/
public class GetBeanProperty extends AbstractEventObject {
/** v1.0 */
static final long serialVersionUID = 10l;
/** The Property name */
//static final public String PROPERTY = "property";
private String property = null;
//private Object propertyValue = null;
private DefaultElementObjectPropertyValue helper = null;
/**
* Creates an SetBeanProperty
*/
public GetBeanProperty() {
addInputPort(EventPort.INPUT,Object.class);
//addInputPort(PROPERTY,Object.class);
addOutputPort(EventPort.OUTPUT);
helper = new DefaultElementObjectPropertyValue();
}
/**
* Filters the object with EventSteps
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
//if(PROPERTY.equals(eventPort.getName())) {
// propertyValue=object;
// return;
//}
if(EventPort.INPUT.equals(eventPort.getName())) {
if(property==null) {
return;
}
try {
object = helper.getProperty(object,property); // todo: fix error this wil only return String !!!!!!!!!!!!!!!!!
} catch (Exception e) {
e.printStackTrace();
return;
}
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),object);
return;
}
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
/**
* @return Returns the property.
*/
public String getProperty() {
return property;
}
/**
* @param property The property to set.
*/
public void setProperty(String property) {
this.property = property;
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2006 IDCA. All rights reserved.
* IDCA PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.idcanet.foei.components.lang;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventObject;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.IllegalEventPortNameException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
/**
* Buffers the object and check if it changes
*
* @author Willem Cazander
* @version 1.0 May 22, 2006
*/
public class ObjectChangedBuffer extends AbstractEventObject {
/** v1.0 */
static final long serialVersionUID = 10l;
/** The logger to log to. */
private Logger logger = null;
/** The last object */
private Map<Class<?>,Object> bufferedObjects = null;
public static final String NO_CHANGE = "noChange";
/**
* Creates an TapFlowWriter
*
*/
public ObjectChangedBuffer() {
logger = Logger.getLogger(ObjectChangedBuffer.class.getName());
addInputPort(EventPort.INPUT);
addOutputPort(EventPort.OUTPUT);
addOutputPort(NO_CHANGE);
bufferedObjects = Collections.synchronizedMap(new HashMap<Class<?>,Object>(2));
}
/**
* @see com.idcanet.foei.event.AbstractEventObject#doEvent(com.idcanet.foei.event.EventPort, java.lang.Object)
*/
@Override
public void doEvent(EventPort eventPort, Object object) throws IllegalEventPortNameException {
if(!EventPort.INPUT.equals(eventPort.getName())) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
if(object==null) {
logger.warning("object null; returning");
return;
}
if(bufferedObjects.containsKey(object.getClass())) {
if(object.equals(bufferedObjects.get(object.getClass()))) {
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(NO_CHANGE),object);
return;
}
}
bufferedObjects.put(object.getClass(),object);
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),object);
}
}

View file

@ -0,0 +1,117 @@
/*
* 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.components.lang;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventInput;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.IllegalEventPortNameException;
/**
* This is a sort of dummy object.
* It only resends its events to the output.
*
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
public class SendEvent extends AbstractEventInput {
/** v1.0 */
static final long serialVersionUID = 10l;
/** The output name */
private String inputName = null;
/** The FoeiContext jndi name of the EventInput object to send the event to */
private String to = null;
/**
* Creates an SendEvent object.
*/
public SendEvent() {
// define an input source
addInputPort(EventPort.INPUT,Object.class);
}
/**
* Sets the inputName
* @param inputName The inputName to set.
*/
public void setInputName(String inputName) {
this.inputName=inputName;
}
/**
* Gets the inputName
* @return Returns the inputName.
*/
public String getInputName() {
return inputName;
}
/**
* Sets the to
* @param to The to to set.
*/
public void setTo(String to) {
this.to=to;
}
/**
* Returns the to.
* @return The to to set.
*/
public String getTo() {
return to;
}
/**
* Send an event to "to" an input port "inputname"
* @param inputName
* @param object
* @throws IllegalEventPortNameException
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(!EventPort.INPUT.equals(eventPort.getName())) {
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
if(to==null) {
return;
}
if(inputName==null) {
return;
}
Object eo = FoeiProcessFactory.getFoeiProcess().getEventObject(to);
if(!(eo instanceof EventInput)) {
return;
}
EventPort port = ((EventInput)eo).getInputPort(inputName);
FoeiProcessFactory.getFoeiProcess().executeEvent(port,object);
}
}

View file

@ -0,0 +1,104 @@
/*
* 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.components.lang;
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.DefaultElementObjectPropertyValue;
/**
* Sets an property of an bean which is set on the propery input port.
*
* @author Willem Cazander
* @version 1.0 Feb 12, 2006
*/
public class SetBeanProperty extends AbstractEventObject {
/** v1.0 */
static final long serialVersionUID = 10l;
/** The Property name */
static final public String PROPERTY = "property";
private String property = null;
private Object propertyValue = null;
private DefaultElementObjectPropertyValue helper = null;
/**
* Creates an SetBeanProperty
*/
public SetBeanProperty() {
addInputPort(EventPort.INPUT,Object.class);
addInputPort(PROPERTY,Object.class);
addOutputPort(EventPort.OUTPUT);
helper = new DefaultElementObjectPropertyValue();
}
/**
* Filters the object with EventSteps
* @see EventInput#doEvent(EventPort, Object)
*/
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException {
if(PROPERTY.equals(eventPort.getName())) {
propertyValue=object;
return;
}
if(EventPort.INPUT.equals(eventPort.getName())) {
if(property==null) {
return;
}
try {
helper.setProperty(object,property,propertyValue);
} catch (Exception e) {
e.printStackTrace();
return;
}
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),object);
return;
}
throw new IllegalEventPortNameException("Not excisting input EventPort: "+eventPort.getName());
}
/**
* @return Returns the property.
*/
public String getProperty() {
return property;
}
/**
* @param property The property to set.
*/
public void setProperty(String property) {
this.property = property;
}
}

View file

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
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.
-->
</head>
<body bgcolor="white">
Some wrappers for standaard java object.<br/>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,64 @@
package com.idcanet.foei.components.logging;
/*
package com.mbuyu.foei.handlers.log4j;
import java.net.*;
import java.io.*;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Layout;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.Layout;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.WriterAppender;
import org.apache.log4j.net.SocketNode;
public class RequestCollector implements Runnable {
private Socket reqSocket;
private SocketNode reqNode;
private String host;
private int port;
static final String fileName = "rtrace";
static final Logger logger = Logger.getLogger("RequestCollector.class");
public RequestCollector (int port, String host) {
super();
this.host = host;
this.port = port;
}
public void run() {
try {
BasicConfigurator.configure();
PrintWriter writer = new PrintWriter (new FileWriter(fileName));
Layout layout = new PatternLayout("%d{ABSOLUTE} %c{1} %m\n");
WriterAppender appender = new WriterAppender(layout, writer);
appender.setImmediateFlush(true);
LogManager.getRootLogger().removeAllAppenders();
LogManager.getRootLogger().addAppender(appender);
appender.activateOptions();
logger.addAppender(appender);
reqSocket = new Socket(host, port);
System.out.println("Created Socket");
reqNode = new SocketNode(reqSocket, LogManager.getLoggerRepository());
System.out.println("Created SocketNode");
new Thread(reqNode).start();
System.out.println("After thread (reqNode)");
} catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
}
public static void main (String args[]) {
System.out.println("B4 Starting");
RequestCollector rq = new RequestCollector(9998, "some-host");
new Thread(rq).start();
System.out.println("Completed");
}
}
*/

View file

@ -0,0 +1,64 @@
/*
* 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.components.logging;
import java.util.HashMap;
import java.util.logging.Logger;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
/**
*
*
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
public class LoggerHandler extends Handler {
private Logger logger = Logger.getLogger(this.getClass().getName());
private LoggerInput loggerInput = null;
public LoggerHandler(LoggerInput loggerInput) {
this.loggerInput=loggerInput;
logger.addHandler(this);
}
// ------------ handler
public void publish(LogRecord record) {
HashMap<String,String> event = new HashMap<String,String>();
event.put("message",record.getMessage());
event.put("level",record.getLevel().getName());
loggerInput.sendMessage(event);
}
public void flush() {
}
public void close() {
}
}

View file

@ -0,0 +1,65 @@
/*
* 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.components.logging;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.AbstractEventOutput;
import com.idcanet.foei.event.EventPort;
import java.util.Map;
/**
* Reseives java logging messages
*
* @author Willem Cazander
* @version 1.0 Jan 25, 2006
*/
public class LoggerInput extends AbstractEventOutput {
/** v1.0 */
static final long serialVersionUID = 10l;
/** */
static final String OUTPUT = "output";
/**
* Creates an LoggerInput
*
*/
public LoggerInput() {
// define an outpur source.
addOutputPort(OUTPUT,Map.class);
new LoggerHandler(this);
}
/**
*
* @param event
*/
public void sendMessage(Map<String,String> event) {
FoeiProcessFactory.getFoeiProcess().executeEvent(getOutputPort(EventPort.OUTPUT),event);
}
}

View file

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
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.
-->
</head>
<body bgcolor="white">
Some EventObjects for log handing.<br/>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,79 @@
/*
* 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.components.steps.filters;
import com.idcanet.foei.event.AbstractEventStepController;
/**
* Filters an object and checks for the className.
*
* @author Willem Cazander
* @version 1.0 26/01/2005
*/
public class ClassFilter extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/** The class name to match */
private String className = null;
/**
* Sets the className which the filtered object has to have.
* @param className The className.
*/
public void setClassName(String className) {
this.className=className;
}
/**
* Returns the className on which this filter filters.
* @return The className.
*/
public String getClassName() {
return className;
}
/**
* Process an object.<br>
* 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) {
return null;
}
Class<?>[] classes = object.getClass().getClasses();
for(int i=0;i<classes.length;i++) {
if(classes[i].getName().equals(className)) {
Object object2 = processEventSteps(object);
return object2;
}
}
// no match found.
return null;
}
}

View file

@ -0,0 +1,66 @@
/*
* 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.components.steps.filters;
import com.idcanet.foei.event.AbstractEventStepController;
import java.util.Date;
/**
* Filters an Date object.
*
* @author Willem Cazander
* @version 1.0 26/01/2005
*/
public class DateFilter extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
private Date minDate=null;
private Date maxDate=null;
public void setMinDate(Date minDate) {
this.minDate=minDate;
}
public Date getMinDate() {
return minDate;
}
public void setMaxDate(Date maxDate) {
this.maxDate=maxDate;
}
public Date getMaxDate() {
return maxDate;
}
public Object processObject(Object object) {
processEventSteps(object);
return object;
}
}

View file

@ -0,0 +1,96 @@
/*
* 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.components.steps.filters;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Comparator;
import java.util.Locale;
/**
*
*
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
@SuppressWarnings("unchecked")
public class NumberComparator implements Comparator {
private Locale locale = null;
/**
* @return Returns the locale.
*/
public Locale getLocale() {
return locale;
}
/**
* @param locale The locale to set.
*/
public void setLocale(Locale locale) {
this.locale = locale;
}
/**
* Compares two String as number.
* @param o1
* @param o2
* @return
* @see Comparator#compare(T, T)
*/
public int compare(Object o1, Object o2) {
Double d1 = getDoubleValue((String)o1,locale);
Double d2 = getDoubleValue((String)o2,locale);
return d1.compareTo(d2);
}
/**
* Converts an String to an Number wich is converted to a Double
* @param test The String to parse.
* @param locale The locale of the numberFormat.
* @return An Double
*/
static public Double getDoubleValue(String text,Locale locale) {
try {
NumberFormat nf = NumberFormat.getInstance(locale);
Number n = nf.parse(text);
if(n instanceof Double) {
return (Double)n;
}
if(n instanceof Integer) {
return ((Integer)n).doubleValue();
}
if(n instanceof Long) {
return ((Long)n).doubleValue();
}
} catch(ParseException pe) {
} catch (NumberFormatException e) {
}
return 0.0;
}
}

View file

@ -0,0 +1,115 @@
/*
* 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.components.steps.filters;
import com.idcanet.foei.event.AbstractEventStepController;
import java.util.Locale;
/**
* Checks when the object is an string/number for the min/max of the number
*
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
public class NumberFilter extends AbstractEventStepController {
/** */
static final long serialVersionUID = 10l;
/** */
private Locale locale = null;
/** */
private String minValue = null;
/** */
private String maxValue = null;
/**
* @return Returns the locale.
*/
public Locale getLocale() {
return locale;
}
/**
* @param locale The locale to set.
*/
public void setLocale(Locale locale) {
this.locale = locale;
}
/**
* @return Returns the maxValue.
*/
public String getMaxValue() {
return maxValue;
}
/**
* @param maxValue The maxValue to set.
*/
public void setMaxValue(String maxValue) {
if("".equals(maxValue)) {
maxValue=null;
}
this.maxValue = maxValue;
}
/**
* @return Returns the minValue.
*/
public String getMinValue() {
return minValue;
}
/**
* @param minValue The minValue to set.
*/
public void setMinValue(String minValue) {
if("".equals(minValue)) {
minValue=null;
}
this.minValue = minValue;
}
/**
*
*/
public Object processObject(Object object) {
if(locale==null) {
locale=Locale.getDefault();
}
NumberComparator c = new NumberComparator();
c.setLocale(locale);
if(minValue!=null && c.compare(object,minValue)<0) {
return null;
}
if(maxValue!=null && c.compare(object,maxValue)>0) {
return null;
}
return object;
}
}

View file

@ -0,0 +1,150 @@
/*
* 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.components.steps.filters;
import com.idcanet.foei.event.AbstractEventStepController;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Filters an String object.
*
* @author Willem Cazander
* @version 1.0 26/01/2005
*/
public class StringFilter extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
private int minLength=0;
private int maxLength=0;
private Pattern pattern = null;
// -------------- (bean)properties.
/**
* Sets the regulare expression on which this object filters an String.<br>
* <br>
* When set to <code>Null</code> matching is disabled.<br>
*
* @param regex The regulare expression to match to.
*/
public void setRegEx(String regex) {
pattern = Pattern.compile(regex);
}
/**
* Returns the current regulare expression.
* @return The regulare expression.
*/
public String getRegEx() {
if(pattern==null) {
return null;
}
return pattern.pattern();
}
/**
* Set the minimal length the filtered object has to be.<br>
* <br>
* When set to -1 testing is disabled.<br>
*
* @param minLength The minimal length to match.
*/
public void setMinLength(int minLength) {
this.minLength=minLength;
}
/**
* Returns the current minimal length of this filter.
* @return The minimal length.
*/
public int getMinLength() {
return minLength;
}
/**
* Set the maximal length of the filters string object.<br>
* <br>
* When set to -1 testing is disabled.<br>
*
* @param maxLength
*/
public void setMaxLength(int maxLength) {
this.maxLength=maxLength;
}
/**
* Returns the current maximal length.
* @return the maximal length.
*/
public int getMaxLength() {
return maxLength;
}
// -------------- eventStep
/**
* Filters an Object.
* If it not an String then null will be returned.
* Likewise when the String object has not matched to an certain
* propertie then also null will be returned.
*
* @param object The Object thats get filtered.
* @return null if object was not mached else the object returns.
*/
public Object processObject(Object object) {
if(!(object instanceof String)) {
return null;
}
String string = (String)object;
if(pattern==null) {
}
if(pattern!=null) {
// test if regex matches
Matcher m = pattern.matcher(string);
if(!m.find()) {
return null;
}
}
// test min length
if(minLength!=0 && string.length()>minLength) {
return null;
}
// test max length
if(maxLength!=0 && string.length()<maxLength) {
return null;
}
object = processEventSteps(object);
return object;
}
}

View file

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
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.
-->
</head>
<body bgcolor="white">
EventSteps which filter an Object.<br/>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,82 @@
/*
* 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.components.steps.lang;
import com.idcanet.foei.event.AbstractEventStepController;
import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
/**
* Gets the property of an java bean.
*
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
public class GetBeanPropertyStep extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/** Holds the key which contains the object in the map. */
private String property = null;
private DefaultElementObjectPropertyValue helper = null;
public GetBeanPropertyStep() {
helper = new DefaultElementObjectPropertyValue();
}
//----------- get/set functions
public void setProperty(String property) {
this.property=property;
}
public String getProperty() {
return property;
}
// -------------------- EventStep
/**
* Proces an Object, when property is correcly found then
* it is processed by the eventSteps of the object.
*/
public Object processObject(Object object) {
if(property==null) {
return null;
}
Object result = null;
try {
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();
return null;
}
return processEventSteps(result);
}
}

View file

@ -0,0 +1,82 @@
/*
* 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.components.steps.lang;
import com.idcanet.foei.event.AbstractEventStepController;
import java.util.List;
/**
* Gets an Value out of an List
*
* @author Willem Cazander
* @version 1.0 Feb 9, 2006
*/
public class ListValue extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/** Holds the index which contains the object in the map. */
private String index = null;
static private final String FIRST = "FIRST";
static private final String LAST = "LAST";
// bean
public void setIndex(String index) {
this.index=index;
}
public String getIndex() {
return index;
}
@SuppressWarnings("unchecked")
public Object processObject(Object object) {
if(!(object instanceof List)) {
return null;
}
List list = (List)object;
if(FIRST.equalsIgnoreCase(index)) {
return processEventSteps(list.get(0));
}
if(LAST.equalsIgnoreCase(index)) {
return processEventSteps(list.get(list.size()));
}
try {
int listIndex = new Integer(index);
return processEventSteps(list.get(listIndex));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -0,0 +1,89 @@
/*
* 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.components.steps.lang;
import com.idcanet.foei.event.AbstractEventStepController;
import java.util.Map;
/**
* This EventStep can have nesting EventSteps.
* It it get the object out of the map object which is processed and
* let is process by an added EventStep object.
*
* @author Willem Cazander
* @version 1.0 28/03/2004
*/
public class MapValue extends AbstractEventStepController {
/** v1.0 */
static final long serialVersionUID = 10l;
/** Holds the key which contains the object in the map. */
private String key = null;
//----------- get/set functions
/**
* Sets the key which is used to lookup an object in an Map.<br>
* Which gets returned by the processObject() of EventStep.<br>
* @param key The key of an object in an Map.
*/
public void setKey(String key) {
this.key=key;
}
/**
* Gets the key of the Map.
* @return The current key.
*/
public String getKey() {
return key;
}
// -------------------- EventStep
/**
* Process an object.<br>
* This is done by the EventStep Object which is added.<br>
* <Br>
* Current implementation returns only the object which is returned<br>
* by the last EventStep in the List.<br>
*
*/
@SuppressWarnings("unchecked")
public Object processObject(Object object) {
if(key==null) {
return null;
}
Map map = (Map)object;
object = map.get(key);
return processEventSteps(object);
}
}

View file

@ -0,0 +1,57 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
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.
-->
</head>
<body bgcolor="white">
EventSteps which Gets of object from an Object.<br/>
<h2>Package Specification</h2>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,88 @@
/*
* 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.components.steps.printers;
import com.idcanet.foei.event.AbstractEventStep;
import java.util.Date;
import java.text.SimpleDateFormat;
/**
* Print an <code>Date</code> object.
*
* @author Willem Cazander
* @version 1.0 26/01/2005
*/
public class DatePrinter extends AbstractEventStep
{
/** v1.0 */
static final long serialVersionUID = 10l;
/** An SimpleDateFormat formated date format template string */
private SimpleDateFormat dateFormat=null;
/**
* Emty constructor
*/
public DatePrinter() {
}
/**
* Set the format in which the Date object is printed.
* @param pattern An SimpleDateFormat formatted string.
*/
public void setSimpleDateFormat(String pattern) {
// else use defaults !!!
// TODO log this event ... but don't let is stop it.
try {
dateFormat = new SimpleDateFormat(pattern);
} catch (NullPointerException npe) {
dateFormat = new SimpleDateFormat();
} catch (IllegalArgumentException iae) {
dateFormat = new SimpleDateFormat();
}
}
/**
* Returns the SimpleDateFormat formatted string being used to format an Date.
* @return The SimpleDateFormat string.
*/
public String getSimpleDateFormat() {
return dateFormat.toPattern();
}
/**
* Prints an Date object.<br>
* <br>
* If object is not an Date "" is printed.<br>
*
* @param object The Object being printed.
* @return The String format of the object.
*/
public Object processObject(Object object) {
Date date = (Date)object;
return dateFormat.format(date);
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.components.steps.printers;
import com.idcanet.foei.event.AbstractEventStep;
/**
* Prints the toString of any java object.<br>
* With an optioneal pre/post-fix.<br>
*
* @author Willem Cazander
* @version 1.0 17/11/2004
*/
public class DefaultPrinter extends AbstractEventStep
{
/** v1.0 */
static final long serialVersionUID = 10l;
/** The preFix */
private String preFix = null;
/** The postFix */
private String postFix = null;
/**
* Sets the prefix
* @param preFix The String printed before the object.
*/
public void setPreFix(String preFix) {
this.preFix=preFix;
}
/**
* Returns the prefix.
* @return The String printed before the object.
*/
public String getPreFix() {
return preFix;
}
/**
* Sets the postfix.
* @param postFix The String printed after the object.
*/
public void setPostFix(String postFix) {
this.postFix=postFix;
}
/**
* Returns the postfix.
* @return The String printed after the object.
*/
public String getPostFix() {
return postFix;
}
/**
*This methode returns an String represantation of an object
*in the default toSting() of the object.
*@param object The object which need to be printed.
*@return The string represantation of the object.
*/
public Object processObject(Object object) {
String returnString = "";
if(preFix!=null) {
returnString = preFix;
}
if(object!=null) {
returnString += object.toString();
}
if(postFix!=null) {
returnString += postFix;
}
return returnString;
}
}

View file

@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
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.
-->
</head>
<body bgcolor="white">
EventSteps which print objects<br/>
<h2>Package Specification</h2>
<ul>
<li>Full J2SE 5 compatible</li>
<li>Small package</li>
</ul>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file