[svn r114] added foei
This commit is contained in:
parent
786e6731c1
commit
a9ea03e737
7
.classpath
Normal file
7
.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tests"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
94
src/com/idcanet/foei/components/lang/DestroyFoeiProcess.java
Normal file
94
src/com/idcanet/foei/components/lang/DestroyFoeiProcess.java
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* 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(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());
|
||||
}
|
||||
}
|
51
src/com/idcanet/foei/components/lang/DummyOutputPort.java
Normal file
51
src/com/idcanet/foei/components/lang/DummyOutputPort.java
Normal 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);
|
||||
}
|
||||
}
|
69
src/com/idcanet/foei/components/lang/EventProxy.java
Normal file
69
src/com/idcanet/foei/components/lang/EventProxy.java
Normal 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);
|
||||
}
|
||||
}
|
102
src/com/idcanet/foei/components/lang/Filter.java
Normal file
102
src/com/idcanet/foei/components/lang/Filter.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.idcanet.foei.event.annotations.SetEventPort;
|
||||
import com.idcanet.foei.event.annotations.SetEventPorts;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
Object o = object;
|
||||
for(EventStep e:getEventSteps()) {
|
||||
if(o==null) {
|
||||
return null;
|
||||
}
|
||||
o = e.processObject(object);
|
||||
}
|
||||
// Check for for last(or only) EventStep
|
||||
if(o==null) {
|
||||
return null;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
102
src/com/idcanet/foei/components/lang/GetBeanProperty.java
Normal file
102
src/com/idcanet/foei/components/lang/GetBeanProperty.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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 org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
import com.idcanet.foei.core.FoeiProcessFactory;
|
||||
import com.idcanet.foei.event.AbstractEventObject;
|
||||
import com.idcanet.foei.event.EventInput;
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
import com.idcanet.foei.event.IllegalEventPortNameException;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Creates an SetBeanProperty
|
||||
*/
|
||||
public GetBeanProperty() {
|
||||
addInputPort(EventPort.INPUT,Object.class);
|
||||
//addInputPort(PROPERTY,Object.class);
|
||||
addOutputPort(EventPort.OUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = BeanUtils.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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
117
src/com/idcanet/foei/components/lang/SendEvent.java
Normal file
117
src/com/idcanet/foei/components/lang/SendEvent.java
Normal 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);
|
||||
}
|
||||
}
|
101
src/com/idcanet/foei/components/lang/SetBeanProperty.java
Normal file
101
src/com/idcanet/foei/components/lang/SetBeanProperty.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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 org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
import com.idcanet.foei.core.FoeiProcessFactory;
|
||||
import com.idcanet.foei.event.AbstractEventObject;
|
||||
import com.idcanet.foei.event.EventInput;
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
import com.idcanet.foei.event.IllegalEventPortNameException;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Creates an SetBeanProperty
|
||||
*/
|
||||
public SetBeanProperty() {
|
||||
addInputPort(EventPort.INPUT,Object.class);
|
||||
addInputPort(PROPERTY,Object.class);
|
||||
addOutputPort(EventPort.OUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
BeanUtils.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;
|
||||
}
|
||||
}
|
55
src/com/idcanet/foei/components/lang/package.html
Normal file
55
src/com/idcanet/foei/components/lang/package.html
Normal 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>
|
57
src/com/idcanet/foei/core/EventExecutor.java
Normal file
57
src/com/idcanet/foei/core/EventExecutor.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
|
||||
/**
|
||||
* Reuables EventExecutor wich are executed
|
||||
* in the EcentExecutorManager
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 19, 2006
|
||||
*/
|
||||
public interface EventExecutor extends Runnable {
|
||||
|
||||
/**
|
||||
* Sets the object to process.
|
||||
* @param object
|
||||
*/
|
||||
public void setEventObject(Object object);
|
||||
|
||||
/**
|
||||
* Sets the eventPort to/from the object needs to go.
|
||||
* @param eventPort
|
||||
*/
|
||||
public void setEventPort(EventPort eventPort);
|
||||
|
||||
/**
|
||||
* Returns true when this EventExecutor is ready
|
||||
* @return
|
||||
*/
|
||||
public boolean isReady();
|
||||
}
|
81
src/com/idcanet/foei/core/EventExecutorManager.java
Normal file
81
src/com/idcanet/foei/core/EventExecutorManager.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The EventExecutionManager executes the event that
|
||||
* executes the filter object flow.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 19, 2006
|
||||
*/
|
||||
public interface EventExecutorManager extends EventPortExecutor {
|
||||
|
||||
/**
|
||||
* Executes an runnable object mostly this will be<br/>
|
||||
* an reused EventExecutor.
|
||||
* @param runnable The runnable to run.
|
||||
*/
|
||||
public void execute(Runnable runnable,FoeiProcess foeiProcess);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventPort
|
||||
* @param eventObject
|
||||
* @param foeiProcess
|
||||
*/
|
||||
public void executeEvent(EventPort eventPort,Object eventObject,FoeiProcess foeiProcess);
|
||||
|
||||
/**
|
||||
*Starts the EventExecutionManager
|
||||
*/
|
||||
public void start(FoeiContext foeiContext);
|
||||
|
||||
/**
|
||||
* Stops the EventExecutionManager
|
||||
*/
|
||||
public void stop(FoeiContext foeiContext);
|
||||
|
||||
/**
|
||||
* Gets all EventThreadListeners<br/>
|
||||
* These are call when a new Thread is created or stops in the Threadpool of<br/>
|
||||
* the EventExecutorManager.<br/>
|
||||
* @return Returns all EventThreadListeners
|
||||
*/
|
||||
public List<EventThreadListener> getEventThreadListeners();
|
||||
|
||||
/**
|
||||
* Adds an EventThreadListener
|
||||
* @param eventThreadListen er The EventThreadListener to add.
|
||||
* @throws IllegalStateException When we are started we can't add listeners.
|
||||
*/
|
||||
public void addEventThreadListener(EventThreadListener eventThreadListener) throws IllegalStateException;
|
||||
}
|
46
src/com/idcanet/foei/core/EventPortExecutor.java
Normal file
46
src/com/idcanet/foei/core/EventPortExecutor.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
|
||||
/**
|
||||
* Executecuts an executeEvent method
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 2, 2006
|
||||
*
|
||||
*/
|
||||
public interface EventPortExecutor {
|
||||
|
||||
/**
|
||||
* Send the EventObject to the eventPort
|
||||
* @param eventObject
|
||||
* @param eventPort
|
||||
*/
|
||||
public void executeEvent(EventPort eventPort,Object eventObject);
|
||||
}
|
49
src/com/idcanet/foei/core/EventThreadListener.java
Normal file
49
src/com/idcanet/foei/core/EventThreadListener.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
/**
|
||||
* With this interface its possible to inject some
|
||||
* threadlocals in a foei event thread.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 22, 2006
|
||||
*/
|
||||
public interface EventThreadListener {
|
||||
|
||||
/**
|
||||
* Gets called when a new Thread is created for the foei thread pool.
|
||||
* @param foeiContext
|
||||
*/
|
||||
public void startThread(FoeiContext foeiContext);
|
||||
|
||||
/**
|
||||
* Gets callled when a thread is closed in the tread pool.
|
||||
* @param foeiContext
|
||||
*/
|
||||
public void stopThread(FoeiContext foeiContext);
|
||||
}
|
86
src/com/idcanet/foei/core/FoeiConfigurator.java
Normal file
86
src/com/idcanet/foei/core/FoeiConfigurator.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.idcanet.foei.core.impl.FoeiConfiguratorImpl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Start the FoeiContext from which foei in managed.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 20, 2006
|
||||
*/
|
||||
public interface FoeiConfigurator {
|
||||
|
||||
/** The key of the foei fontext name */
|
||||
static public final String CONTEXT_NAME = "foei.context_name";
|
||||
|
||||
/** The key of the root path */
|
||||
static public final String ROOT_PATH = "foei.root_path";
|
||||
|
||||
/** The key of the className of the ObjectBindingsManager */
|
||||
static public final String OBJECT_BINDINGS_MANAGER = "foei.object_bindings_manager";
|
||||
|
||||
/** The key of the className of the EventExecutor */
|
||||
static public final String EVENT_EXECUTOR = "foei.event_executor";
|
||||
|
||||
/** The key of the className of the EventExecutorManager */
|
||||
static public final String EVENT_EXECUTOR_MANAGER = "foei.event_executor_manager";
|
||||
|
||||
/** The key of the integer of the EventExecutor pool core size */
|
||||
static public final String EVENT_EXECUTOR_POOL_CORE_SIZE = "foei.event_executor_manager.pool_core_size";
|
||||
|
||||
/** The key of the integer of the EventExecutor pool max size */
|
||||
static public final String EVENT_EXECUTOR_POOL_MAX_SIZE = "foei.event_executor_manager.pool_max_size";
|
||||
|
||||
/** The key of the integer of the EventExecutor pool keep alive */
|
||||
static public final String EVENT_EXECUTOR_POOL_KEEP_ALIVE = "foei.event_executor_manager.pool_keep_alive";
|
||||
|
||||
/** The key of the className of the ObjectContextFactory */
|
||||
static public final String OBJECT_CONTEXT_FACTORY = "foei.initial_object_context_factory";
|
||||
|
||||
/** The key of the classNames (',' seperated) of the EventThreadListener */
|
||||
static public final String EVENT_THREAD_LISTENERS = "foei.event_thread_listeners";
|
||||
|
||||
/** The key of the className of the FoeiProcessManager */
|
||||
static public final String FOEI_PROCESS_MANAGER = "foei.process_manager";
|
||||
|
||||
/** The key of the rootTag of the X2O parser */
|
||||
static public final String X2O_ROOT_TAG = "foei.x2o_root_tag";
|
||||
|
||||
/** The default FoeiConfigurator */
|
||||
static public final Class DEFAULT_FOEI_CONFIGURATOR = FoeiConfiguratorImpl.class;
|
||||
|
||||
/**
|
||||
* Starts an FoeiContext
|
||||
* @param properties
|
||||
* @return
|
||||
*/
|
||||
public FoeiContext buildFoeiContext(Map<String,String> properties) throws FoeiContextBuildingException;
|
||||
}
|
81
src/com/idcanet/foei/core/FoeiContext.java
Normal file
81
src/com/idcanet/foei/core/FoeiContext.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.naming.Context;
|
||||
|
||||
/**
|
||||
* Defines the FoeiContext.<br/>
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 19, 2005
|
||||
*/
|
||||
public interface FoeiContext {
|
||||
|
||||
/**
|
||||
* Gets the name of the context.
|
||||
* @return Returns the name of the context.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Gets the root path.
|
||||
* @return returns the root path.
|
||||
*/
|
||||
public String getRootPath();
|
||||
|
||||
/**
|
||||
* Gets the EventObjectContext.
|
||||
* @return Returns the Context
|
||||
*/
|
||||
public Context getEventObjectContext();
|
||||
|
||||
/**
|
||||
* Gets the EventExecutorManager
|
||||
* @return Returns the EventExecutorManager
|
||||
*/
|
||||
public EventExecutorManager getEventExecutorManager();
|
||||
|
||||
/**
|
||||
* Gets the map of the start properties of this context.
|
||||
* @return
|
||||
*/
|
||||
public Map<String,String> getStartProperties();
|
||||
|
||||
/**
|
||||
* Gets the FoeiProcessManager
|
||||
* @return Returns the FoeiProcessManager
|
||||
*/
|
||||
public FoeiProcessManager getFoeiProcessManager();
|
||||
|
||||
/**
|
||||
* Stops all stuff in this context
|
||||
*/
|
||||
public void destroy();
|
||||
}
|
71
src/com/idcanet/foei/core/FoeiContextBuildingException.java
Normal file
71
src/com/idcanet/foei/core/FoeiContextBuildingException.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
/**
|
||||
* Can gets thrown when building an FoeiContext implementation object.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 24, 2006
|
||||
*/
|
||||
public class FoeiContextBuildingException extends Exception
|
||||
{
|
||||
/** v1.0 */
|
||||
static final long serialVersionUID = 10l;
|
||||
|
||||
/**
|
||||
* Constructs an FoeiContextBuildingException without a detail message.
|
||||
*/
|
||||
public FoeiContextBuildingException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an FoeiContextBuildingException with a detail message.
|
||||
* @param message The message of this Exception
|
||||
*/
|
||||
public FoeiContextBuildingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an FoeiContextBuildingException from a parent exception and a message
|
||||
* @param e The parent exception.
|
||||
* @param message An detail message.
|
||||
*/
|
||||
public FoeiContextBuildingException(String message,Exception e) {
|
||||
super(message,e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an FoeiContextBuildingException from a parent exception.
|
||||
* @param e The parant exception
|
||||
*/
|
||||
public FoeiContextBuildingException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
69
src/com/idcanet/foei/core/FoeiProcess.java
Normal file
69
src/com/idcanet/foei/core/FoeiProcess.java
Normal 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.core;
|
||||
|
||||
import javax.naming.Context;
|
||||
|
||||
/**
|
||||
* Defines an FoeiProcess interface<br/>
|
||||
* The FoeiProcess is only accesable from an injected thread local.<br/>
|
||||
* From the FoeiProcess we can bind object and fire events.<br/>
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 2, 2006
|
||||
*/
|
||||
public interface FoeiProcess extends ObjectBindingsManager,ObjectContextManager,EventPortExecutor {
|
||||
|
||||
/**
|
||||
* Gets the name of the process.
|
||||
* @return Returns the name of the process.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Gets the EventObjectContext.
|
||||
* @return Returns the Context
|
||||
*/
|
||||
public Context getEventObjectContext();
|
||||
|
||||
/**
|
||||
* Gets the ObjectBindingsManager
|
||||
* @return Retuns the ObjectBindingsManager
|
||||
*/
|
||||
public ObjectBindingsManager getObjectBindingsManager();
|
||||
|
||||
/**
|
||||
* Gets the FoeiContext
|
||||
* @return
|
||||
*/
|
||||
public FoeiContext getFoeiContext();
|
||||
|
||||
/**
|
||||
* Stops all stuff in this process
|
||||
*/
|
||||
public void destroy();
|
||||
}
|
72
src/com/idcanet/foei/core/FoeiProcessFactory.java
Normal file
72
src/com/idcanet/foei/core/FoeiProcessFactory.java
Normal 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.core;
|
||||
|
||||
/**
|
||||
* This is the only class of the core which is hardcoded.<br/>
|
||||
* It retreives the FoeiProcess from the ThreadLocal.
|
||||
* which is set in the EventExecutor
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 2, 2006
|
||||
*/
|
||||
public class FoeiProcessFactory {
|
||||
|
||||
/** The threadlocal storing the FoeiProcess */
|
||||
private static final ThreadLocal<FoeiProcess> threadLocal = new ThreadLocal<FoeiProcess>();
|
||||
|
||||
/**
|
||||
* Gets the FoeiProcess for the current thread.
|
||||
* @return Returns the FoeiProcess for the current thread.
|
||||
* @throws IllegalStateException When no FoeiProcess is set in the current Thread.
|
||||
*/
|
||||
static public FoeiProcess getFoeiProcess() {
|
||||
FoeiProcess foeiProcess = (FoeiProcess)threadLocal.get();
|
||||
if(foeiProcess==null) {
|
||||
throw new IllegalStateException("No FoeiProcess set in current thread ThreadLocal");
|
||||
}
|
||||
return foeiProcess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds an FoeiProcess to the currentThread.
|
||||
* @param foeiContext The FoeiProcess to bind.
|
||||
*/
|
||||
static public void bindFoeiProcess(FoeiProcess foeiProcess) {
|
||||
threadLocal.set(foeiProcess);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbinds the current FoeiProcess.
|
||||
*/
|
||||
static public void unbindFoeiProcess() {
|
||||
if(threadLocal.get()==null) {
|
||||
throw new NullPointerException("Can't unbind from an non binded thread.");
|
||||
}
|
||||
threadLocal.set(null);
|
||||
}
|
||||
}
|
66
src/com/idcanet/foei/core/FoeiProcessManager.java
Normal file
66
src/com/idcanet/foei/core/FoeiProcessManager.java
Normal 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.core;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* The FoeiProcessManager manages all the FoeiProcesses
|
||||
* which are running in the FoeiContext.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 2, 2006
|
||||
*/
|
||||
public interface FoeiProcessManager {
|
||||
|
||||
/**
|
||||
* Creates an new FoeiProcess.
|
||||
* @param name The name of the process
|
||||
* @param foeiContext The FoeiContext
|
||||
* @return Returns an FoeiProcess
|
||||
*/
|
||||
public FoeiProcess createFoeiProcess(String name,FoeiContext foeiContext);
|
||||
|
||||
/**
|
||||
* destroy a FoeiProcess by its name.
|
||||
* @param name
|
||||
*/
|
||||
public void destroyFoeiProcess(String name);
|
||||
|
||||
/**
|
||||
* Gets an FoeiProcess by its id.
|
||||
* @param name
|
||||
* @return Returns an FoeiProcess
|
||||
*/
|
||||
public FoeiProcess getFoeiProcess(String name);
|
||||
|
||||
/**
|
||||
* Gets all running FoeiProcess'es
|
||||
* @return
|
||||
*/
|
||||
public Collection<FoeiProcess> getFoeiProcesses();
|
||||
}
|
68
src/com/idcanet/foei/core/ObjectBindingsManager.java
Normal file
68
src/com/idcanet/foei/core/ObjectBindingsManager.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Manages all the Foei EventPort bindings.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 1/05/2005
|
||||
*/
|
||||
public interface ObjectBindingsManager
|
||||
{
|
||||
/**
|
||||
* Adds an binding from the input to the output EventPort.
|
||||
* @param outputPort The output EventPort
|
||||
* @param inputPort The input EventPort
|
||||
*/
|
||||
public void addBinding(EventPort outputPort,EventPort inputPort);
|
||||
|
||||
/**
|
||||
* Removes an binding.
|
||||
* @param inputPort The input EventPort.
|
||||
* @param outputPort The output EventPort.
|
||||
*/
|
||||
public void removeBinding(EventPort inputPort,EventPort outputPort);
|
||||
|
||||
/**
|
||||
* Gets the bindings of an EventPort
|
||||
* @param eventPort The EventPort to retreive the bindings.
|
||||
* @return Returns an List of the binded EventPorts
|
||||
*/
|
||||
public List<EventPort> getBindings(EventPort eventPort);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bindings in an xml format to render with dotty.
|
||||
* @return
|
||||
*/
|
||||
public String getBindingsAsXML();
|
||||
}
|
56
src/com/idcanet/foei/core/ObjectContextManager.java
Normal file
56
src/com/idcanet/foei/core/ObjectContextManager.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
/**
|
||||
* ObjectContextManager makes it possible to get and set objects
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 19, 2005
|
||||
*/
|
||||
public interface ObjectContextManager {
|
||||
|
||||
/**
|
||||
* Adds an EventObject to the Context
|
||||
* @param eventObject
|
||||
*/
|
||||
public void addEventObject(Object eventObject,String id);
|
||||
|
||||
/**
|
||||
* removes an EventObject from the Context
|
||||
* @param eventObject
|
||||
*/
|
||||
public void removeEventObject(String id);
|
||||
|
||||
/**
|
||||
* Gets an EventObject by its id.
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public Object getEventObject(String id);
|
||||
}
|
74
src/com/idcanet/foei/core/X2OExecutor.java
Normal file
74
src/com/idcanet/foei/core/X2OExecutor.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Executes an X2O script.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 24, 2006
|
||||
*/
|
||||
public interface X2OExecutor extends Runnable {
|
||||
|
||||
/**
|
||||
* Sets the fileName to parse.
|
||||
* @param fileName
|
||||
*/
|
||||
public void setFileName(String fileName);
|
||||
|
||||
/**
|
||||
* Sets the inputStream to parse.
|
||||
* @param inputStream
|
||||
*/
|
||||
public void setInputStream(InputStream inputStream);
|
||||
|
||||
/**
|
||||
* Sets the xml to parse.
|
||||
* @param xml
|
||||
*/
|
||||
public void setXml(String xml);
|
||||
|
||||
/**
|
||||
* Sets the debug state of the X2O Parser.
|
||||
* @param debug The debug state to set.
|
||||
*/
|
||||
public void setDebug(boolean debug);
|
||||
|
||||
/**
|
||||
* Gets the debug state.
|
||||
* @return Returns the debug state.
|
||||
*/
|
||||
public boolean getDebug();
|
||||
|
||||
/**
|
||||
* Returns true when this X2OExecutor is ready
|
||||
* @return
|
||||
*/
|
||||
public boolean isReady();
|
||||
}
|
59
src/com/idcanet/foei/core/package.html
Normal file
59
src/com/idcanet/foei/core/package.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!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">
|
||||
Defines the Foei Event Core interfaces, exceptions and 1 class.<br/>
|
||||
|
||||
<h2>Package Specification</h2>
|
||||
|
||||
The Foei Core objects are fully interfaced so you<br/>
|
||||
can hook into every core process.<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>
|
101
src/com/idcanet/foei/event/AbstractEventInput.java
Normal file
101
src/com/idcanet/foei/event/AbstractEventInput.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import com.idcanet.foei.event.EventInput;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Defines an AbstractEventInput which implements most<br/>
|
||||
* methods needed for an Foei EventInput bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 20, 2005
|
||||
*/
|
||||
abstract public class AbstractEventInput implements EventInput {
|
||||
|
||||
/** The input EventPorts */
|
||||
private Map<String,EventPort> inputs = null;
|
||||
|
||||
/**
|
||||
* The constuctor
|
||||
*/
|
||||
public AbstractEventInput() {
|
||||
inputs = new HashMap<String,EventPort>(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an input EventPort
|
||||
* @param inputName The inputName of the EventPort
|
||||
*/
|
||||
protected void addInputPort(String inputName) {
|
||||
addInputPort(inputName,Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an input EventPort
|
||||
* @param inputName The inputName of the EventPort
|
||||
* @param inputType The inputClass of the EventPort
|
||||
*/
|
||||
protected void addInputPort(String inputName,Class inputClass) {
|
||||
if(inputName==null) {
|
||||
throw new NullPointerException("inputName may not be null.");
|
||||
}
|
||||
if(inputClass==null) {
|
||||
throw new NullPointerException("inputClass may not be null.");
|
||||
}
|
||||
inputs.put(inputName,new EventPort(inputName,inputClass,EventPortType.input,this));
|
||||
}
|
||||
|
||||
// ---------------- EventInput
|
||||
|
||||
/**
|
||||
* Gets all input EventPorts
|
||||
* @see EventInput#getInputPorts()
|
||||
* @return Returns an List of input EventPorts
|
||||
*/
|
||||
public Collection<EventPort> getInputPorts() {
|
||||
return inputs.values();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public EventPort getInputPort(String name) {
|
||||
return inputs.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EventInput#doEvent(EventPort, Object)
|
||||
*/
|
||||
abstract public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException;
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 25, 2006
|
||||
*/
|
||||
abstract public class AbstractEventInputStepController extends AbstractEventInput implements EventStepController
|
||||
{
|
||||
/** The EventStep List */
|
||||
private List<EventStep> eventSteps = null;
|
||||
/** The Logger to log to. */
|
||||
private Logger logger = null;
|
||||
|
||||
/**
|
||||
* Creates the EventStep list and the logger.
|
||||
*/
|
||||
public AbstractEventInputStepController() {
|
||||
eventSteps = new ArrayList<EventStep>();
|
||||
logger = Logger.getLogger(AbstractEventStepController.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an EventStep
|
||||
* @see EventStepController#addEventStep(EventStep)
|
||||
*/
|
||||
public void addEventStep(EventStep eventStep) {
|
||||
logger.finer("Adding EventStep to: "+this);
|
||||
eventSteps.add(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an EventStep
|
||||
* @see EventStepController#removeEventStep(EventStep)
|
||||
*/
|
||||
public void removeEventStep(EventStep eventStep) {
|
||||
logger.finer("Removing EventStep to: "+this);
|
||||
eventSteps.remove(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all EventSteps.
|
||||
* @see EventStepController#getEventSteps()
|
||||
* @returns Returns all EventSteps.
|
||||
*/
|
||||
public List<EventStep> getEventSteps() {
|
||||
return eventSteps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all EventSteps of the EventStepController
|
||||
* Override for other behavior
|
||||
* @see EventStepController#processEventSteps(Object)
|
||||
* @param object The object to pass to the EventSteps
|
||||
* @return The object or null.
|
||||
*/
|
||||
public Object processEventSteps(Object object) {
|
||||
for(EventStep e:getEventSteps()) {
|
||||
if(object==null) {
|
||||
return null;
|
||||
}
|
||||
object = e.processObject(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
98
src/com/idcanet/foei/event/AbstractEventObject.java
Normal file
98
src/com/idcanet/foei/event/AbstractEventObject.java
Normal 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.event;
|
||||
|
||||
import com.idcanet.foei.event.EventInput;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Defines an AbstractEventInput which implements most<br/>
|
||||
* methods needed for an Foei EventInput and EventOutput bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2005
|
||||
*/
|
||||
abstract public class AbstractEventObject extends AbstractEventOutput implements EventInput
|
||||
{
|
||||
/** The input EventPorts */
|
||||
private Map<String,EventPort> inputs = null;
|
||||
|
||||
public AbstractEventObject() {
|
||||
inputs = new HashMap<String,EventPort>(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an input EventPort
|
||||
* @param inputName The inputName of the EventPort
|
||||
*/
|
||||
protected void addInputPort(String inputName) {
|
||||
addInputPort(inputName,Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an input EventPort
|
||||
* @param inputName The inputName of the EventPort
|
||||
* @param inputType The inputType of the EventPort
|
||||
*/
|
||||
protected void addInputPort(String inputName,Class inputType) {
|
||||
if(inputName==null) {
|
||||
throw new NullPointerException("inputName may not be null.");
|
||||
}
|
||||
if(inputType==null) {
|
||||
throw new NullPointerException("inputType may not be null.");
|
||||
}
|
||||
inputs.put(inputName,new EventPort(inputName,inputType,EventPortType.input,this));
|
||||
}
|
||||
|
||||
// ---------------- EventInput
|
||||
|
||||
/**
|
||||
* Gets all input EventPorts
|
||||
* @see EventInput#getInputPorts()
|
||||
* @return Returns an List of input EventPorts
|
||||
*/
|
||||
public Collection<EventPort> getInputPorts() {
|
||||
return inputs.values();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public EventPort getInputPort(String name) {
|
||||
return inputs.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EventInput#doEvent(EventPort, Object)
|
||||
*/
|
||||
abstract public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException;
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 25, 2006
|
||||
*/
|
||||
abstract public class AbstractEventObjectStepController extends AbstractEventObject implements EventStepController
|
||||
{
|
||||
/** The EventStep List */
|
||||
private List<EventStep> eventSteps = null;
|
||||
/** The Logger to log to. */
|
||||
private Logger logger = null;
|
||||
|
||||
/**
|
||||
* Creates the EventStep list and the logger.
|
||||
*/
|
||||
public AbstractEventObjectStepController() {
|
||||
eventSteps = new ArrayList<EventStep>();
|
||||
logger = Logger.getLogger(AbstractEventStepController.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an EventStep
|
||||
* @see EventStepController#addEventStep(EventStep)
|
||||
*/
|
||||
public void addEventStep(EventStep eventStep) {
|
||||
logger.finer("Adding EventStep to: "+this);
|
||||
eventSteps.add(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an EventStep
|
||||
* @see EventStepController#removeEventStep(EventStep)
|
||||
*/
|
||||
public void removeEventStep(EventStep eventStep) {
|
||||
logger.finer("Removing EventStep to: "+this);
|
||||
eventSteps.remove(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all EventSteps.
|
||||
* @see EventStepController#getEventSteps()
|
||||
* @returns Returns all EventSteps.
|
||||
*/
|
||||
public List<EventStep> getEventSteps() {
|
||||
return eventSteps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all EventSteps of the EventStepController
|
||||
* Override for other behavior
|
||||
* @see EventStepController#processEventSteps(Object)
|
||||
* @param object The object to pass to the EventSteps
|
||||
* @return The object or null.
|
||||
*/
|
||||
public Object processEventSteps(Object object) {
|
||||
for(EventStep e:getEventSteps()) {
|
||||
if(object==null) {
|
||||
return null;
|
||||
}
|
||||
object = e.processObject(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
98
src/com/idcanet/foei/event/AbstractEventOutput.java
Normal file
98
src/com/idcanet/foei/event/AbstractEventOutput.java
Normal 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.event;
|
||||
|
||||
import com.idcanet.foei.event.EventOutput;
|
||||
import com.idcanet.foei.event.EventPort;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Defines an AbstractEventInput which implements most<br/>
|
||||
* methods needed for an Foei EventOutput bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2005
|
||||
*/
|
||||
abstract public class AbstractEventOutput implements EventOutput {
|
||||
|
||||
/** The output EventPorts */
|
||||
private Map<String,EventPort> outputs = null;
|
||||
|
||||
/**
|
||||
* Creates an AbstractEventOutput
|
||||
*/
|
||||
public AbstractEventOutput() {
|
||||
outputs = new HashMap<String,EventPort>(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an OutputPort to this bean.
|
||||
* @param outputName The outputName of the EventPort.
|
||||
*/
|
||||
protected void addOutputPort(String outputName) {
|
||||
addOutputPort(outputName,Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an Output to this bean which an certain class type.
|
||||
* @param outputName The outputName of the EventPort.
|
||||
* @param outputType The output Class type of the EventPort.
|
||||
*/
|
||||
protected void addOutputPort(String outputName,Class outputType) {
|
||||
if(outputName==null) {
|
||||
throw new NullPointerException("outputName may not be null.");
|
||||
}
|
||||
if(outputType==null) {
|
||||
throw new NullPointerException("outputType may not be null.");
|
||||
}
|
||||
outputs.put(outputName,new EventPort(outputName,outputType,EventPortType.output,this));
|
||||
}
|
||||
|
||||
// ---------------- EventOutput
|
||||
|
||||
/**
|
||||
* Returns an List of OutputPorts
|
||||
* @returns Returns an List of OutputPorts
|
||||
* @see EventOutput#getOutputPorts()
|
||||
*/
|
||||
public Collection<EventPort> getOutputPorts() {
|
||||
return outputs.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an output EventPort by its name.
|
||||
* @param name The name of the outputPort
|
||||
* @returns Returns the EventPort
|
||||
* @see EventOutput#getOutputPort(String)
|
||||
*/
|
||||
public EventPort getOutputPort(String name) {
|
||||
return outputs.get(name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 25, 2006
|
||||
*/
|
||||
abstract public class AbstractEventOutputStepController extends AbstractEventOutput implements EventStepController
|
||||
{
|
||||
/** The EventStep List */
|
||||
private List<EventStep> eventSteps = null;
|
||||
/** The Logger to log to. */
|
||||
private Logger logger = null;
|
||||
|
||||
/**
|
||||
* Creates the EventStep list and the logger.
|
||||
*/
|
||||
public AbstractEventOutputStepController() {
|
||||
eventSteps = new ArrayList<EventStep>();
|
||||
logger = Logger.getLogger(AbstractEventStepController.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an EventStep
|
||||
* @see EventStepController#addEventStep(EventStep)
|
||||
*/
|
||||
public void addEventStep(EventStep eventStep) {
|
||||
logger.finer("Adding EventStep to: "+this);
|
||||
eventSteps.add(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an EventStep
|
||||
* @see EventStepController#removeEventStep(EventStep)
|
||||
*/
|
||||
public void removeEventStep(EventStep eventStep) {
|
||||
logger.finer("Removing EventStep to: "+this);
|
||||
eventSteps.remove(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all EventSteps.
|
||||
* @see EventStepController#getEventSteps()
|
||||
* @returns Returns all EventSteps.
|
||||
*/
|
||||
public List<EventStep> getEventSteps() {
|
||||
return eventSteps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all EventSteps of the EventStepController
|
||||
* Override for other behavior
|
||||
* @see EventStepController#processEventSteps(Object)
|
||||
* @param object The object to pass to the EventSteps
|
||||
* @return The object or null.
|
||||
*/
|
||||
public Object processEventSteps(Object object) {
|
||||
for(EventStep e:getEventSteps()) {
|
||||
if(object==null) {
|
||||
return null;
|
||||
}
|
||||
object = e.processObject(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
37
src/com/idcanet/foei/event/AbstractEventStep.java
Normal file
37
src/com/idcanet/foei/event/AbstractEventStep.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
/**
|
||||
* Defines an abstract EventStep
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 25, 2006
|
||||
*/
|
||||
abstract public class AbstractEventStep implements EventStep {
|
||||
|
||||
}
|
97
src/com/idcanet/foei/event/AbstractEventStepController.java
Normal file
97
src/com/idcanet/foei/event/AbstractEventStepController.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 25, 2006
|
||||
*/
|
||||
abstract public class AbstractEventStepController extends AbstractEventStep implements EventStepController
|
||||
{
|
||||
/** The EventStep List */
|
||||
private List<EventStep> eventSteps = null;
|
||||
/** The Logger to log to. */
|
||||
private Logger logger = null;
|
||||
|
||||
/**
|
||||
* Should be implemented by the overriding class.
|
||||
*/
|
||||
abstract public Object processObject(Object object) throws ClassCastException;
|
||||
|
||||
/**
|
||||
* Creates the list and the logger.
|
||||
*/
|
||||
public AbstractEventStepController() {
|
||||
eventSteps = new ArrayList<EventStep>();
|
||||
logger = Logger.getLogger(AbstractEventStepController.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void addEventStep(EventStep eventStep) {
|
||||
logger.finer("Adding EventStep to: "+this);
|
||||
eventSteps.add(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void removeEventStep(EventStep eventStep) {
|
||||
logger.finer("Removing EventStep to: "+this);
|
||||
eventSteps.remove(eventStep);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public List<EventStep> getEventSteps() {
|
||||
return eventSteps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls all EventSteps the processObject method
|
||||
* until one returns null.
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public Object processEventSteps(Object object) {
|
||||
for(EventStep e:getEventSteps()) {
|
||||
if(object==null) {
|
||||
return null;
|
||||
}
|
||||
object = e.processObject(object);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
61
src/com/idcanet/foei/event/EventInput.java
Normal file
61
src/com/idcanet/foei/event/EventInput.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* An Object that implments thius interface can receive events.<br>
|
||||
* Which can be directed at different inputs of the object.<br>
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 01/02/2005
|
||||
*/
|
||||
public interface EventInput extends Serializable {
|
||||
|
||||
/**
|
||||
* Gets the all input EventPorts.<br>
|
||||
*
|
||||
* @return An List with the current EventPort's.
|
||||
*/
|
||||
public Collection<EventPort> getInputPorts();
|
||||
|
||||
/**
|
||||
* Gets an input EventPort by its name
|
||||
* @param name The name of the eventPort
|
||||
* @return Returns an input EventPort by its name
|
||||
*/
|
||||
public EventPort getInputPort(String name);
|
||||
|
||||
/**
|
||||
* Process an Object.<br>
|
||||
* @param inputPort The input channel name of this object.
|
||||
* @param object The object this input needs to process.
|
||||
*/
|
||||
public void doEvent(EventPort eventPort,Object object) throws IllegalEventPortNameException;
|
||||
}
|
54
src/com/idcanet/foei/event/EventOutput.java
Normal file
54
src/com/idcanet/foei/event/EventOutput.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* An Object that implments thius interface can send events to<br>
|
||||
* inputsEvent objects.<br>
|
||||
* <br>
|
||||
* So send en event it most use the defined methods in EventBinding class.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 01/02/2005
|
||||
*/
|
||||
public interface EventOutput extends Serializable {
|
||||
/**
|
||||
* Gets the current list of valid outputs.
|
||||
* @return A List with the current EventPort's.
|
||||
*/
|
||||
public Collection<EventPort> getOutputPorts();
|
||||
|
||||
/**
|
||||
* Gets an OutputPort by its name.
|
||||
* @param name The name of the output port.
|
||||
* @return Returns the outputPort
|
||||
*/
|
||||
public EventPort getOutputPort(String name);
|
||||
}
|
161
src/com/idcanet/foei/event/EventPort.java
Normal file
161
src/com/idcanet/foei/event/EventPort.java
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
/**
|
||||
* Defines an EventPort which can be an input or output for
|
||||
* traveling object.<br/>
|
||||
* <br/>
|
||||
* All the public final are for progroming
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 18/04/2005
|
||||
*/
|
||||
public class EventPort {
|
||||
|
||||
static final public String TRUE = "true";
|
||||
static final public String FALSE = "false";
|
||||
static final public String INPUT = "input";
|
||||
static final public String OUTPUT = "output";
|
||||
static final public String PASS = "pass";
|
||||
static final public String DROP = "drop";
|
||||
|
||||
/** The name of the port */
|
||||
private String name = null;
|
||||
/** The type of Object class which can be handled by the port.*/
|
||||
private Class objectType = null;
|
||||
/** The total number of events this port has had. */
|
||||
private long eventsPassed = 0;
|
||||
/** The type of event port */
|
||||
private EventPortType eventPortType = null;
|
||||
/**The EventObject of this port */
|
||||
private Object eventObject = null;
|
||||
/** The immediate if true i*/
|
||||
private boolean immediate = false;
|
||||
|
||||
/**
|
||||
* Contructs an EventPort with an name and a certain type.
|
||||
* <br/>
|
||||
* immediate has 2 defaults depending on the EventPortType of the EventPort.<br/>
|
||||
* input=true<br/>
|
||||
* output=false<br/>
|
||||
* This defines the default behouvier of the foei events and newexecutors<br/>
|
||||
*
|
||||
* @param name The name of the EventPort.
|
||||
* @param objectType The class type which it accepts.
|
||||
*/
|
||||
public EventPort(String name,Class objectType,EventPortType eventPortType,Object eventObject) {
|
||||
if(name==null) {
|
||||
throw new NullPointerException("name may not be null.");
|
||||
}
|
||||
if(objectType==null) {
|
||||
throw new NullPointerException("eventPortType may not be null.");
|
||||
}
|
||||
if(eventPortType==null) {
|
||||
throw new NullPointerException("eventPortType may not be null.");
|
||||
}
|
||||
if(eventObject==null) {
|
||||
throw new NullPointerException("eventObject may not be null.");
|
||||
}
|
||||
this.name=name;
|
||||
this.objectType=objectType;
|
||||
this.eventPortType=eventPortType;
|
||||
this.eventObject=eventObject;
|
||||
|
||||
if(eventPortType==EventPortType.input) {
|
||||
immediate=true;
|
||||
}
|
||||
if(eventPortType==EventPortType.output) {
|
||||
immediate=false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the EventPort.
|
||||
* @return The name of the EventPort.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the object this EventPort handleds.
|
||||
* @return the class of the transfering object.
|
||||
*/
|
||||
public Class getObjectClass() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the event to the eventsPassed value.
|
||||
*/
|
||||
public void addEventsPassed() {
|
||||
eventsPassed++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The number of events that this port has done.
|
||||
* @return Returns the number of events of this port.
|
||||
*/
|
||||
public long getEventsPassed() {
|
||||
return eventsPassed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the EventPortType
|
||||
* @return Returns the EventPortType.
|
||||
*/
|
||||
public EventPortType getEventPortType() {
|
||||
return eventPortType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the EventObject.
|
||||
* @return Returns the EventObject.
|
||||
*/
|
||||
public Object getEventObject() {
|
||||
return eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the immediate
|
||||
* @return Returns immediate
|
||||
*/
|
||||
public boolean isImmediate() {
|
||||
return immediate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the immediate state of this event port
|
||||
* @param immediate
|
||||
*/
|
||||
public void setImmediate(boolean immediate) {
|
||||
this.immediate=immediate;
|
||||
}
|
||||
}
|
39
src/com/idcanet/foei/event/EventPortType.java
Normal file
39
src/com/idcanet/foei/event/EventPortType.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
/**
|
||||
* EventPortType of an EventPort
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 3, 2006
|
||||
*/
|
||||
public enum EventPortType {
|
||||
|
||||
input,
|
||||
output;
|
||||
}
|
46
src/com/idcanet/foei/event/EventStep.java
Normal file
46
src/com/idcanet/foei/event/EventStep.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Process an object an gives an object back.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 27/02/2005
|
||||
*/
|
||||
public interface EventStep extends Serializable {
|
||||
|
||||
/**
|
||||
* Process an object and gives it back.
|
||||
*
|
||||
* @param object The Object which need to be processed.
|
||||
* @returns An object or null if not succesfull.
|
||||
*/
|
||||
public Object processObject(Object object) throws ClassCastException;
|
||||
}
|
67
src/com/idcanet/foei/event/EventStepController.java
Normal file
67
src/com/idcanet/foei/event/EventStepController.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
import com.idcanet.foei.event.EventStep;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The implementing object of this interface.<br>
|
||||
* Gets the possibilty to add/remove EventSteps.<br>
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 28/02/2005
|
||||
*/
|
||||
public interface EventStepController extends Serializable {
|
||||
|
||||
/**
|
||||
* Adds an EventStep to the object.
|
||||
* @param eventStep The EventStep to be added.
|
||||
*/
|
||||
public void addEventStep(EventStep eventStep);
|
||||
|
||||
/**
|
||||
* Removes an EventStep of the object.
|
||||
* @param eventStep The EventStep to be removed.
|
||||
*/
|
||||
public void removeEventStep(EventStep eventStep);
|
||||
|
||||
/**
|
||||
* Gets an List of the EventSteps which are registrated to this object.
|
||||
* @return The List of EventSteps.
|
||||
*/
|
||||
public List<EventStep> getEventSteps();
|
||||
|
||||
/**
|
||||
* Executes all EventSteps until there is null or we are done.
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public Object processEventSteps(Object object);
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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.event;
|
||||
|
||||
/**
|
||||
* May be throw when we try to send to in EventPort that doen't excists.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 4, 2006
|
||||
*/
|
||||
public class IllegalEventPortNameException extends Exception
|
||||
{
|
||||
/** Version 1.0 */
|
||||
final static long serialVersionUID = 10l;
|
||||
|
||||
/**
|
||||
* Constructs an IllegalEventPortNameException without a detail message.
|
||||
*/
|
||||
public IllegalEventPortNameException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an IllegalEventPortNameException with a detail message.
|
||||
* @param message The message of this Exception
|
||||
*/
|
||||
public IllegalEventPortNameException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an IllegalEventPortNameException from a parent exception.
|
||||
* @param e The parent Exception
|
||||
*/
|
||||
public IllegalEventPortNameException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an IllegalEventPortNameException from a parent exception and a detail message
|
||||
* @param message The message of this Exception
|
||||
* @param e The parent Exception
|
||||
*/
|
||||
public IllegalEventPortNameException(String message,Exception e) {
|
||||
super(message,e);
|
||||
}
|
||||
}
|
61
src/com/idcanet/foei/event/package.html
Normal file
61
src/com/idcanet/foei/event/package.html
Normal 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">
|
||||
Provides abstract classes and interfaces to send/receive events.<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>
|
112
src/com/idcanet/foei/server/FoeiContextManager.java
Normal file
112
src/com/idcanet/foei/server/FoeiContextManager.java
Normal 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.server;
|
||||
|
||||
import com.idcanet.foei.core.FoeiConfigurator;
|
||||
import com.idcanet.foei.core.FoeiContext;
|
||||
import com.idcanet.foei.core.impl.FoeiConfiguratorImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Manages the different FoeiContext.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 6, 2006
|
||||
*/
|
||||
public class FoeiContextManager
|
||||
{
|
||||
/** The logger to log to. */
|
||||
private Logger logger = null;
|
||||
/** All FoeiContext */
|
||||
private Map<String,FoeiContext> contexts = null;
|
||||
|
||||
/**
|
||||
* Inits the logger and the FoeiContext storage.
|
||||
*/
|
||||
public FoeiContextManager() {
|
||||
logger = Logger.getLogger(FoeiContextManager.class.getName());
|
||||
contexts = new HashMap<String,FoeiContext>(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an FoeiContext.
|
||||
* @param properties The properties of the FoeiContext.
|
||||
*/
|
||||
public void createFoeiContext(Map properties) {
|
||||
FoeiConfigurator config = null;
|
||||
try {
|
||||
config = (FoeiConfigurator) FoeiConfigurator.DEFAULT_FOEI_CONFIGURATOR.newInstance();
|
||||
logger.info("Building FoeiContext: "+FoeiConfiguratorImpl.getContextName(properties));
|
||||
FoeiContext context = config.buildFoeiContext(properties);
|
||||
addFoeiContext(context);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error while starting FoeiContext: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an FoeiContext
|
||||
* @param foeiContext The FoeiContext to add.
|
||||
*/
|
||||
public void addFoeiContext(FoeiContext foeiContext) {
|
||||
if(foeiContext==null) {
|
||||
throw new NullPointerException("FoeiContext may not be null.");
|
||||
}
|
||||
contexts.put(foeiContext.getName(),foeiContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* USE AS LESS AS POSIBLE, MOSTLY NOT !!<br/>
|
||||
*
|
||||
* Be aware that a lot of functions in Foei depent on the
|
||||
* thread locale being injected in the current thread.
|
||||
*
|
||||
* For sake of OO dividing layers its not recommened to do Foei Logic
|
||||
* in the request/event/etc thread.
|
||||
*
|
||||
* Gets an FoeiContext by its name.
|
||||
* @param name The name of the FoeiContext
|
||||
* @return Returns the FoeiContext or null if none was found by its name.
|
||||
*/
|
||||
public FoeiContext getFoeiContext(String name) {
|
||||
return contexts.get(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroys all FoeiContexts.
|
||||
*/
|
||||
public void destroyAll() {
|
||||
for(FoeiContext context:contexts.values()) {
|
||||
context.destroy();
|
||||
}
|
||||
}
|
||||
}
|
67
src/com/idcanet/foei/server/FoeiContextManagerFactory.java
Normal file
67
src/com/idcanet/foei/server/FoeiContextManagerFactory.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.server;
|
||||
|
||||
/**
|
||||
* Provides the method to get the FoeiContextManager
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Feb 6, 2006
|
||||
*/
|
||||
public class FoeiContextManagerFactory
|
||||
{
|
||||
/** */
|
||||
static private FoeiContextManager foeiContextManager = null;
|
||||
|
||||
/**
|
||||
* Gets the FoeiContextManager
|
||||
* @return Returns the FoeiContextManager
|
||||
*/
|
||||
static public FoeiContextManager getFoeiContextManager() {
|
||||
if(foeiContextManager==null) {
|
||||
throw new IllegalStateException("no FoeiContextManager has been set.");
|
||||
}
|
||||
return foeiContextManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an FoeiContextManager.<br/>
|
||||
* note:
|
||||
* May only be set once !.
|
||||
*
|
||||
* @param foeiContextManager
|
||||
*/
|
||||
static public void setFoeiContextManager(FoeiContextManager foeiContextManager) {
|
||||
if(foeiContextManager==null) {
|
||||
throw new NullPointerException("foeiContextManager may not be null.");
|
||||
}
|
||||
if(FoeiContextManagerFactory.foeiContextManager!=null) {
|
||||
throw new IllegalStateException("foeiContextManager may only be set once.");
|
||||
}
|
||||
FoeiContextManagerFactory.foeiContextManager=foeiContextManager;
|
||||
}
|
||||
}
|
55
src/com/idcanet/foei/server/package.html
Normal file
55
src/com/idcanet/foei/server/package.html
Normal 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">
|
||||
Foei server objects<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>
|
Loading…
Reference in a new issue