3
0
Fork 0

simple split to multi module project

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

10
foei-core/.classpath Normal file
View file

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

23
foei-core/.project Normal file
View file

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

View file

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

View file

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

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

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

View file

@ -0,0 +1,50 @@
/*
* 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;
/**
* Reuables EventExecutor wich are executed
* in the EcentExecutorManager
*
* @author Willem Cazander
* @version 1.0 Jan 19, 2006
*/
public interface EventExecutor extends Runnable {
/**
* Sets the foei process
* @param object
*/
public void setFoeiProcess(FoeiProcess foeiProcess);
/**
* Returns true when this EventExecutor is ready
* @return
*/
public boolean isReady();
}

View 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;
}

View 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);
}

View 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);
}

View 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;
/**
* Binding exception
*
* @author Willem Cazander
* @version 1.0 Jan 24, 2006
*/
public class FoeiBindingException extends Exception {
/** v1.0 */
static final long serialVersionUID = 10l;
/**
* Constructs an FoeiContextBuildingException without a detail message.
*/
public FoeiBindingException() {
super();
}
/**
* Constructs an FoeiContextBuildingException with a detail message.
* @param message The message of this Exception
*/
public FoeiBindingException(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 FoeiBindingException(String message,Exception e) {
super(message,e);
}
/**
* Creates an FoeiContextBuildingException from a parent exception.
* @param e The parant exception
*/
public FoeiBindingException(Exception e) {
super(e);
}
}

View file

@ -0,0 +1,83 @@
/*
* 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 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;
}

View file

@ -0,0 +1,75 @@
/*
* 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 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();
}

View 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);
}
}

View file

@ -0,0 +1,85 @@
/*
* 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;
/**
* Message block used in work queue to store non-immatiate port events.
*
* @author Willem Cazander
* @version 1.0 Apr 9, 2008
*/
public class FoeiPortMessage {
/** The event obect. */
private Object eventObject = null;
/** The eventport */
private EventPort eventPort = null;
public FoeiPortMessage() {
}
public FoeiPortMessage(Object eventObject,EventPort eventPort) {
setEventObject(eventObject);
setEventPort(eventPort);
}
/**
* @return the eventObject
*/
public Object getEventObject() {
return eventObject;
}
/**
* @param eventObject the eventObject to set
*/
public void setEventObject(Object eventObject) {
if (eventObject==null) {
throw new NullPointerException("May not set null eventObject");
}
this.eventObject = eventObject;
}
/**
* @return the eventPort
*/
public EventPort getEventPort() {
return eventPort;
}
/**
* @param eventPort the eventPort to set
*/
public void setEventPort(EventPort eventPort) {
if (eventPort==null) {
throw new NullPointerException("May not set null eventPort");
}
this.eventPort = eventPort;
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.Queue;
import java.util.Set;
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();
/**
* Returns the work queue for this foei process
* @return
*/
public Queue<FoeiPortMessage> getWorkQueue();
public Set<EventExecutor> getExecutors();
}

View file

@ -0,0 +1,72 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.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);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2004-2008 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;
/**
* Gets called when process is created or destroyed.<br/>
*
*
* @author Willem Cazander
* @version 1.0 Apr 26, 2008
*/
public interface FoeiProcessListener {
public void foeiProcessCreated(FoeiProcess process);
public void foeiProcessDestroyed(FoeiProcess process);
}

View file

@ -0,0 +1,70 @@
/*
* 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();
public void addFoeiProcessListener(FoeiProcessListener foeiProcessListener);
public void removeFoeiProcessListener(FoeiProcessListener foeiProcessListener);
}

View 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.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();
}

View 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) throws FoeiBindingException;
/**
* removes an EventObject from the Context
* @param eventObject
*/
public void removeEventObject(String id) throws FoeiBindingException;
/**
* Gets an EventObject by its id.
* @param id
* @return
*/
public Object getEventObject(String id);
}

View file

@ -0,0 +1,62 @@
/*
* 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);
/**
* Returns true when this X2OExecutor is ready
* @return
*/
public boolean isReady();
}

View file

@ -0,0 +1,147 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventExecutor;
import com.idcanet.foei.core.FoeiPortMessage;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
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.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Reuable EventExecutors
*
* @author Willem Cazander
* @version 1.0 Jan 19, 2006
*/
public class EventExecutorImpl implements EventExecutor {
/** The logger to log to. */
private Logger logger = null;
/** The foei process to execute for */
private FoeiProcess foeiProcess = null;
/** True when ready */
private volatile boolean ready = false;
/**
* Creates an EventExecutor
*/
public EventExecutorImpl() {
logger = Logger.getLogger(EventExecutorImpl.class.getName());
}
/**
* @see EventExecutor#setEventObject(Object)
*/
public void setFoeiProcess(FoeiProcess foeiProcess) {
this.foeiProcess=foeiProcess;
}
/**
* @see EventExecutor#isReady()
*/
public boolean isReady() {
return ready;
}
/**
* @see Runnable#run()
*/
public void run() {
if(foeiProcess==null) {
logger.warning("Can't execute event on null foeiProcess.");
return;
}
ready = false;
int processed = 0;
try {
FoeiProcessFactory.bindFoeiProcess(foeiProcess);
FoeiPortMessage msg = foeiProcess.getWorkQueue().poll();
while (msg!=null) {
process(msg);
processed++;
msg = foeiProcess.getWorkQueue().poll();
// try 3 times to get new work, if not found then exit, EventExecutorManagerImpl work auto create new EventExecutor on new work.
if (msg==null) {
Thread.sleep(200);
msg = foeiProcess.getWorkQueue().poll();
}
if (msg==null) {
Thread.sleep(200);
msg = foeiProcess.getWorkQueue().poll();
}
if (msg==null) {
Thread.sleep(200);
msg = foeiProcess.getWorkQueue().poll();
}
}
} catch (Exception e) {
logger.log(Level.WARNING,"Error while Executing Event",e);
} finally {
ready = true;
FoeiProcessFactory.unbindFoeiProcess();
foeiProcess.getExecutors().remove(this);
}
}
private void process(FoeiPortMessage msg) throws IllegalEventPortNameException {
EventPort eventPort = msg.getEventPort();
Object eventObject = msg.getEventObject();
if (eventPort.getEventPortType()==EventPortType.input) {
EventInput eventInput = (EventInput)eventPort.getEventObject();
eventPort.addEventsPassed(); // inc input port
eventInput.doEvent(eventPort,eventObject);
return;
}
if (eventPort.getEventPortType()==EventPortType.output) {
eventPort.addEventsPassed(); // inc output port
List<EventPort> bindings = foeiProcess.getBindings(eventPort);
for (int i=0;i<bindings.size();i++) {
EventPort port = bindings.get(i); // faster then using iterator (auto)
EventInput eventInput = (EventInput)port.getEventObject();
if(port.isImmediate()) {
port.addEventsPassed(); // inc Immediate import port
eventInput.doEvent(port,eventObject);
} else {
foeiProcess.executeEvent(eventPort, eventObject);
}
}
return;
}
}
}

View file

@ -0,0 +1,207 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventExecutor;
import com.idcanet.foei.core.EventExecutorManager;
import com.idcanet.foei.core.EventThreadListener;
import com.idcanet.foei.core.FoeiContext;
import com.idcanet.foei.core.FoeiPortMessage;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.EventPort;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Defines the EventExecutorManager implementation
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2006
*/
public class EventExecutorManagerImpl implements EventExecutorManager {
/** The logger to log to. */
private Logger logger = null;
/** The thread pool */
private ThreadPoolExecutor threadPoolExecutor = null;
/** The EventThreadListeners */
private List<EventThreadListener> eventThreadListeners = null;
/** The class for the EventExecutor */
private Class<?> eventExecutorClass = null;
/**
* Creates an EventExecutorManagerImpl ans inits the logger.
*/
public EventExecutorManagerImpl() {
logger = Logger.getLogger(EventExecutorManagerImpl.class.getName());
eventThreadListeners = new ArrayList<EventThreadListener>(1);
}
// ============= EventExecutorManager
/**
* Executes an Event mostly send from an EventObject.
* @see EventExecutorManager#executeEvent(Object, EventPort)
*/
public void executeEvent(EventPort eventPort,Object eventObject) {
executeEvent(eventPort,eventObject,FoeiProcessFactory.getFoeiProcess());
}
/**
* Executes an EventPort with object in an FoeiProcess.
* @param eventPort
* @param eventObject
* @param foeiProcess
*/
public void executeEvent(EventPort eventPort,Object eventObject,FoeiProcess foeiProcess) {
FoeiPortMessage msg = new FoeiPortMessage();
msg.setEventObject(eventObject);
msg.setEventPort(eventPort);
foeiProcess.getWorkQueue().add(msg);
if (foeiProcess.getExecutors().size()>3) {
return;
}
EventExecutor e = null;
try {
e = (EventExecutor)eventExecutorClass.newInstance();
} catch (Exception ee) {
logger.log(Level.WARNING,"Error Creating EventExecutor: "+ee.getMessage(),ee);
return;
}
e.setFoeiProcess(foeiProcess);
foeiProcess.getExecutors().add(e); // else to much will be created on 1st X objects.
threadPoolExecutor.execute(e);
}
/**
* Executes an event.
* @see EventExecutorManager#execute(Runnable)
*/
public void execute(Runnable runnable,FoeiProcess foeiProcess) {
if(threadPoolExecutor==null) {
throw new IllegalStateException("EventExecutorManager has not been started.");
}
threadPoolExecutor.execute(new FoeiProcessRunnableWrapper(runnable,foeiProcess));
}
/**
* Starts the ThreadPool
* @see EventExecutorManager#start()
*/
public void start(FoeiContext foeiContext) {
if(foeiContext==null) {
throw new NullPointerException("FoeiContext may not be null.");
}
logger.info("Starting EventExecutorManagerImpl");
try {
eventExecutorClass = FoeiConfiguratorImpl.newEventExecutorClass(foeiContext.getStartProperties());
} catch (ClassNotFoundException cce) {
logger.log(Level.WARNING,"Error getting eventExecutor class: "+cce.getMessage(),cce);
throw new RuntimeException("Could not get EventExecutor class: "+cce.getMessage(),cce);
}
EventExecutorThreadFactory tf = new EventExecutorThreadFactory(foeiContext);
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor (
FoeiConfiguratorImpl.getEventExecutorPoolCoreSize(foeiContext.getStartProperties()),
FoeiConfiguratorImpl.getEventExecutorPoolMaxSize(foeiContext.getStartProperties()),
FoeiConfiguratorImpl.getEventExecutorPoolKeepAlive(foeiContext.getStartProperties()),
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
tf
);
threadPoolExecutor.prestartAllCoreThreads();
setThreadPoolExecutor(threadPoolExecutor);
}
/**
* Stops the ThreadPool
* @see EventExecutorManager#stop()
*/
public void stop(FoeiContext foeiContext) {
if(threadPoolExecutor==null) {
throw new IllegalStateException("EventExecutorManager has not been started.");
}
logger.info("Stoping EventExecutorManagerImpl");
threadPoolExecutor.shutdown();
threadPoolExecutor=null;
}
/**
* @see EventExecutorManager#getEventThreadListeners()
*/
public List<EventThreadListener> getEventThreadListeners() {
return eventThreadListeners;
}
/**
* @see EventExecutorManager#addEventThreadListener(EventThreadListener)
*/
public void addEventThreadListener(EventThreadListener eventThreadListener) throws IllegalStateException {
if(eventThreadListener==null) {
throw new NullPointerException("eventThreadListener may not be null.");
}
if(threadPoolExecutor!=null) {
throw new IllegalStateException("threadPoolExecutor is already started.");
}
eventThreadListeners.add(eventThreadListener);
}
// ========== other methods:
/**
* Can be used when override from this class.
* note:
* This method is not an interface method.
* @param threadPoolExecutor
*/
public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor) {
if(this.threadPoolExecutor!=null) {
throw new IllegalStateException("ThreadPoolExecutor may only be set once");
}
this.threadPoolExecutor=threadPoolExecutor;
}
/**
* Returns the ThreadPoolExecutor
*/
public ThreadPoolExecutor getThreadPoolExecutor() {
if(threadPoolExecutor==null) {
throw new IllegalStateException("EventExecutorManager has not been started.");
}
return threadPoolExecutor;
}
}

View file

@ -0,0 +1,91 @@
/*
* 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.impl;
import com.idcanet.foei.core.FoeiContext;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
/**
* Creates Thread for the threadpool and injects the threadpool runnable object with the
* FoeiContext.
*
* @author Willem Cazander
* @version 1.0 Feb 7, 2006
*/
public class EventExecutorThreadFactory implements ThreadFactory {
/** The pool number. */
static private final AtomicInteger poolNumber = new AtomicInteger(1);
/** The thread group. */
private final ThreadGroup group;
/** The thread number. */
private final AtomicInteger threadNumber = new AtomicInteger(1);
/** The name prefix. */
private String namePrefix = null;
/** The FoeiContext to wrap in the thread. */
private FoeiContext foeiContext = null;
/** The logger to log to. */
private Logger logger = null;
/**
* Creates an EventExecutorThreadFactory
* @param foeiContext
*/
public EventExecutorThreadFactory(FoeiContext foeiContext) {
if(foeiContext==null) {
throw new NullPointerException("FoeiContext may not be null.");
}
logger = Logger.getLogger(EventExecutorThreadFactory.class.getName());
this.foeiContext=foeiContext;
SecurityManager s = System.getSecurityManager();
group = (s != null)? s.getThreadGroup():Thread.currentThread().getThreadGroup();
namePrefix = "foei"+poolNumber.getAndIncrement()+"-"+foeiContext.getName()+"-";
}
/**
* Creates an new Thread and wrappes the Runnable with the FoeiContextRunnableWrapper
*/
public Thread newThread(Runnable r) {
Runnable runnable = new EventThreadListenersRunnableWrapper(r,foeiContext);
Thread t = new Thread(group,runnable,namePrefix+threadNumber.getAndIncrement(),0);
logger.info("Created new Executor Thread: "+t.getName());
if (t.isDaemon()) {
t.setDaemon(false);
}
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
}
}

View file

@ -0,0 +1,75 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventThreadListener;
import com.idcanet.foei.core.FoeiContext;
/**
* Call all EventTheadListeners of an FoeiContext
*
* @author Willem Cazander
* @version 1.0 Feb 8, 2006
*/
public class EventThreadListenersRunnableWrapper implements Runnable {
/** The wrapped runnable object. */
private Runnable runnable = null;
/** The FoeiContext for this thread. */
private FoeiContext foeiContext = null;
/**
* creates an EventThreadListenersRunnableWrapper
* @param runnable
* @param foeiContext
*/
public EventThreadListenersRunnableWrapper(Runnable runnable,FoeiContext foeiContext) {
if(runnable==null) {
throw new NullPointerException("runnable may not be null.");
}
if(foeiContext==null) {
throw new NullPointerException("FoeiContext may not be null.");
}
this.runnable=runnable;
this.foeiContext=foeiContext;
}
/**
* Call all EventThreadListeners
*/
public void run() {
for(EventThreadListener eth:foeiContext.getEventExecutorManager().getEventThreadListeners()) {
eth.startThread(foeiContext);
}
// Executer the runnable object we wrapped.
// this is the runnable executor of the default thread pool in java 1.5
runnable.run();
for(EventThreadListener eth:foeiContext.getEventExecutorManager().getEventThreadListeners()) {
eth.stopThread(foeiContext);
}
}
}

View file

@ -0,0 +1,263 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventExecutorManager;
import com.idcanet.foei.core.EventThreadListener;
import com.idcanet.foei.core.FoeiConfigurator;
import com.idcanet.foei.core.FoeiContext;
import com.idcanet.foei.core.FoeiContextBuildingException;
import com.idcanet.foei.core.FoeiProcessManager;
import com.idcanet.foei.core.ObjectBindingsManager;
import com.idcanet.foei.utils.jndi.MemoryContextFactory;
import java.util.Hashtable;
import java.util.Map;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
/**
* Creates an default implemention an of FoeiContext.
* Which is config with the objects.
*
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2006
*/
public class FoeiConfiguratorImpl implements FoeiConfigurator {
static private Logger logger = Logger.getLogger(FoeiConfiguratorImpl.class.getName());
/**
* Creates an FoeiContext
*/
public FoeiContext buildFoeiContext(Map<String,String> properties) throws FoeiContextBuildingException {
if(properties==null) {
throw new NullPointerException("properties may not be null.");
}
String name = getContextName(properties);
Context objectContext = null;
EventExecutorManager eventExecutorManager = null;
FoeiProcessManager foeiProcessManager = null;
try {
objectContext = newContext(properties);
eventExecutorManager = newEventExecutorManager(properties);
foeiProcessManager = newFoeiProcessManager(properties);
loadEventThreadListeners(properties,eventExecutorManager);
} catch (Exception e) {
throw new FoeiContextBuildingException("Error while building childs objects:",e);
}
return new FoeiContextImpl(name,objectContext,eventExecutorManager,properties,foeiProcessManager);
}
/**
* Gets the contextName from the properties map.
* @param properties The properties map.
* @return Returns the contextName from the properties map.
*/
static public String getContextName(Map<String,String> properties) {
String contextName = properties.get(FoeiConfigurator.CONTEXT_NAME);
if(contextName==null) {
throw new NullPointerException("contextName needs to be set in properties as: "+FoeiConfigurator.CONTEXT_NAME);
}
return contextName;
}
/**
*
* @param properties
* @return
* @throws ClassNotFoundException
* @throws InstantiationException
* @throws IllegalAccessException
*/
static public ObjectBindingsManager newObjectBindingsManager(Map<String,String> properties) throws ClassNotFoundException,InstantiationException, IllegalAccessException {
String className = properties.get(FoeiConfigurator.OBJECT_BINDINGS_MANAGER);
if(className==null) {
return new ObjectBindingsManagerImpl();
}
return (ObjectBindingsManager)loadClass(className).newInstance();
}
/**
*
* @param properties
* @return
* @throws ClassNotFoundException
* @throws InstantiationException
* @throws IllegalAccessException
* @throws NamingException
*/
static public Context newContext(Map<String,String> properties) throws ClassNotFoundException,InstantiationException, IllegalAccessException,NamingException {
String className = properties.get(FoeiConfigurator.OBJECT_CONTEXT_FACTORY);
if(className==null) {
return new MemoryContextFactory().getInitialContext(new Hashtable<String,String>(properties));
}
return ((InitialContextFactory)loadClass(className).newInstance()).getInitialContext(new Hashtable<String,String>(properties));
}
/**
*
* @param properties
* @return
* @throws ClassNotFoundException
* @throws InstantiationException
* @throws IllegalAccessException
*/
static public EventExecutorManager newEventExecutorManager(Map<String,String> properties) throws ClassNotFoundException,InstantiationException, IllegalAccessException {
String className = properties.get(FoeiConfigurator.EVENT_EXECUTOR_MANAGER);
if(className==null) {
return new EventExecutorManagerImpl();
}
return (EventExecutorManager)loadClass(className).newInstance();
}
/**
* Loads and adds all the EventThreadListener.
* @param properties
* @param eventExecutorManager
* @throws Exception
*/
static public void loadEventThreadListeners(Map<String,String> properties,EventExecutorManager eventExecutorManager) throws Exception {
String classNames = properties.get(FoeiConfigurator.EVENT_THREAD_LISTENERS);
if(classNames==null) {
logger.finer("No EventThreadListeners loading");
return;
}
for(String className:classNames.split(",")) {
logger.finest("Loading class: "+className);
EventThreadListener eventThreadListener = (EventThreadListener)loadClass(className).newInstance();
eventExecutorManager.addEventThreadListener(eventThreadListener);
}
}
/**
* Gets the Pool Core Size for the EventExecutor
* @param properties
* @return
* @throws NumberFormatException
*/
static public Integer getEventExecutorPoolCoreSize(Map<String,String> properties) throws NumberFormatException {
String size = properties.get(FoeiConfigurator.EVENT_EXECUTOR_POOL_CORE_SIZE);
if(size==null) {
return 3;
}
return new Integer(size);
}
/**
* Gets the Pool Max Size for the EventExecutor
* @param properties
* @return
* @throws NumberFormatException
*/
static public Integer getEventExecutorPoolMaxSize(Map<String,String> properties) throws NumberFormatException {
String size = properties.get(FoeiConfigurator.EVENT_EXECUTOR_POOL_MAX_SIZE);
if(size==null) {
return 5;
}
return new Integer(size);
}
/**
* Gets the Pool Keep Alive Time in second for the EventExecutor
* @param properties
* @return
* @throws NumberFormatException
*/
static public Integer getEventExecutorPoolKeepAlive(Map<String,String> properties) throws NumberFormatException {
String size = properties.get(FoeiConfigurator.EVENT_EXECUTOR_POOL_KEEP_ALIVE);
if(size==null) {
return 180;
}
return new Integer(size);
}
/**
* Creates an new EventExecutor class
* @param properties
* @return
* @throws ClassNotFoundException
*/
static public Class<?> newEventExecutorClass(Map<String,String> properties) throws ClassNotFoundException {
String className = properties.get(FoeiConfigurator.EVENT_EXECUTOR);
if(className==null) {
return EventExecutorImpl.class;
}
return loadClass(className);
}
/**
* Gets the X2O root tag
* @param properties
* @return The X2ORootTag
*/
static public String getX2ORootTag(Map<String,String> properties) {
String rootTag = properties.get(FoeiConfigurator.X2O_ROOT_TAG);
if(rootTag==null) {
return "foei";
}
return rootTag;
}
/**
*
* @param properties
* @return
* @throws ClassNotFoundException
* @throws InstantiationException
* @throws IllegalAccessException
*/
static public FoeiProcessManager newFoeiProcessManager(Map<String,String> properties) throws ClassNotFoundException,InstantiationException, IllegalAccessException {
String className = properties.get(FoeiConfigurator.FOEI_PROCESS_MANAGER);
if(className==null) {
return new FoeiProcessManagerImpl();
}
return (FoeiProcessManager)loadClass(className).newInstance();
}
/**
* Loads a Class from the ContextClassLoader and if that is not set, then
* uses the class of the String parameters
* @param className The class name to load
* @return The loaded class
* @throws Exception throws exception if class not loaded.
*/
static public Class<?> loadClass(String className) throws ClassNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = className.getClass().getClassLoader(); // fallback
}
return cl.loadClass(className);
}
}

View file

@ -0,0 +1,135 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventExecutorManager;
import com.idcanet.foei.core.FoeiContext;
import com.idcanet.foei.core.FoeiProcessManager;
import java.util.Map;
import javax.naming.Context;
/**
* Defines the FoeiContext implemention.
*
* @see FoeiContext
* @author Willem Cazander
* @version 1.0 Jan 19, 2006
*/
public class FoeiContextImpl implements FoeiContext {
/** The name of this Instance **/
private String name = null;
/** The FoeiContext where all objects are stored. **/
private Context objectContext = null;
/** The EventExecutorManager */
private EventExecutorManager eventExecutorManager = null;
/** The start properties */
private Map<String,String> startProperties = null;
/** The FoeiProcessManager */
private FoeiProcessManager foeiProcessManager = null;
/**
* Creates an new FoeiContextImpl
*
* @param name
* @param rootPath
* @param objectBindingsManager
* @param objectContext
* @param eventExecutorManager
* @param startProperties
*/
public FoeiContextImpl(String name,Context objectContext,EventExecutorManager eventExecutorManager,Map<String,String> startProperties,FoeiProcessManager foeiProcessManager) {
if(name==null) {
throw new NullPointerException("name may not be null.");
}
if(objectContext==null) {
throw new NullPointerException("objectContext may not be null.");
}
if(eventExecutorManager==null) {
throw new NullPointerException("eventExecutorManager may not be null.");
}
if(foeiProcessManager==null) {
throw new NullPointerException("foeiProcessManager may not be null.");
}
this.name=name;
this.objectContext=objectContext;
this.eventExecutorManager=eventExecutorManager;
this.startProperties=startProperties;
this.foeiProcessManager=foeiProcessManager;
eventExecutorManager.start(this);
}
/**
* @see FoeiContext#getName()
*/
public String getName() {
return name;
}
/**
* @see FoeiContext#getEventExecutorManager()
*/
public EventExecutorManager getEventExecutorManager() {
return eventExecutorManager;
}
/**
* @see FoeiContext#getEventObjectContext()
*/
public Context getEventObjectContext() {
return objectContext;
}
/**
* @see FoeiContext#getStartProperties()
*/
public Map<String,String> getStartProperties() {
return startProperties;
}
/**
* @see FoeiContext#destroy()
*/
public void destroy() {
getEventExecutorManager().stop(this);
}
/**
* Gets the FoeiProcessManager
* @return Returns the FoeiProcessManager
*/
public FoeiProcessManager getFoeiProcessManager() {
return foeiProcessManager;
}
}

View file

@ -0,0 +1,79 @@
package com.idcanet.foei.core.impl;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventOutput;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.EventStepController;
import com.idcanet.x4o.element.AbstractElementBindingHandler;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementBindingHandlerException;
/**
*
* MM maybe move this class
*
* @author Willem Cazander
* @version 1.0 Feb 24, 2006
*/
public class FoeiEventBindingRuleHandler extends AbstractElementBindingHandler {
/**
*
* @param object1
* @param object2
* @return
*/
public boolean canBind(Element element) {
Object parent = element.getParent().getElementObject();
Object child = element.getElementObject();
Object object1 = parent;
Object object2 = child; // is correct ??
if(object1==null) {
throw new NullPointerException("object1 may not be null.");
}
if(object2==null) {
throw new NullPointerException("object2 may not be null.");
}
if(object1 instanceof EventInput) {
if(object2 instanceof EventOutput) {
return true;
}
}
if(object1 instanceof EventOutput) {
if(object2 instanceof EventInput) {
return true;
}
}
if(object1 instanceof EventStep) {
if(object2 instanceof EventStepController) {
return true;
}
}
if(object1 instanceof EventStepController) {
if(object2 instanceof EventStep) {
return true;
}
}
return false;
}
/**
*
* @param object1
* @param object2
* @throws ClassCastException
*/
public void doBind(Element element) throws ElementBindingHandlerException {
Object parent = element.getParent().getElementObject();
Object child = element.getElementObject();
if(parent==null) {
throw new NullPointerException("object1 may not be null.");
}
if(child==null) {
throw new NullPointerException("object2 may not be null.");
}
}
}

View file

@ -0,0 +1,205 @@
/*
* 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.impl;
import com.idcanet.foei.core.EventExecutor;
import com.idcanet.foei.core.FoeiBindingException;
import com.idcanet.foei.core.FoeiContext;
import com.idcanet.foei.core.FoeiPortMessage;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.ObjectBindingsManager;
import com.idcanet.foei.event.EventPort;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
/**
* Defines the default FoeiProcess implementation
*
* @author Willem Cazander
* @version 1.0 Mar 2, 2006
*/
public class FoeiProcessImpl implements FoeiProcess {
/** The FoeiContext */
private FoeiContext foeiContext = null;
/** The Logger */
private Logger logger = null;
/** The name */
private String name = null;
/** The eventObjectContext */
private Context eventObjectContext = null;
/** The ObjectBindingsManager */
private ObjectBindingsManager objectBindingsManager = null;
private Queue<FoeiPortMessage> foeiPortMessages = new LinkedBlockingQueue<FoeiPortMessage>();
private Set<EventExecutor> eventExecutors = Collections.synchronizedSet(new HashSet<EventExecutor>(10));
public FoeiProcessImpl(String name,FoeiContext foeiContext,Context eventObjectContext,ObjectBindingsManager objectBindingsManager) {
logger = Logger.getLogger(FoeiProcessImpl.class.getName());
this.name=name;
this.foeiContext=foeiContext;
this.eventObjectContext=eventObjectContext;
this.objectBindingsManager=objectBindingsManager;
logger.info("Creating FoeiProcess: "+getName());
}
// ========= FoeiProcess
/**
* @see com.idcanet.foei.core.FoeiProcess#getName()
*/
public String getName() {
return name;
}
/**
* @see com.idcanet.foei.core.FoeiProcess#getEventObjectContext()
*/
public Context getEventObjectContext() {
return eventObjectContext;
}
/**
* @see com.idcanet.foei.core.FoeiProcess#getObjectBindingsManager()
*/
public ObjectBindingsManager getObjectBindingsManager() {
return objectBindingsManager;
}
/**
* @see com.idcanet.foei.core.FoeiProcess#destroy()
*/
public void destroy() {
logger.info("Destroying FoeiProcess: "+getName());
}
/**
* @see com.idcanet.foei.core.FoeiProcess#getFoeiContext()
*/
public FoeiContext getFoeiContext() {
return foeiContext;
}
public Queue<FoeiPortMessage> getWorkQueue() {
return foeiPortMessages;
}
public Set<EventExecutor> getExecutors() {
return eventExecutors;
}
// ================== EventPortExecutor
/**
* @see com.idcanet.foei.core.EventPortExecutor#executeEvent(com.idcanet.foei.event.EventPort, java.lang.Object)
*/
public void executeEvent(EventPort eventPort, Object eventObject) {
getFoeiContext().getEventExecutorManager().executeEvent(eventPort,eventObject);
}
// ============= ObjectContextManager
/**
* @see com.idcanet.foei.core.ObjectContextManager#addEventObject(com.idcanet.foei.event.EventObject)
*/
public void addEventObject(Object eventObject,String id) throws FoeiBindingException {
try {
getEventObjectContext().bind(id,eventObject);
} catch (NameAlreadyBoundException nabe) {
throw new FoeiBindingException(nabe);
} catch (NamingException ne) {
throw new FoeiBindingException(ne);
}
}
/**
* @see com.idcanet.foei.core.ObjectContextManager#getEventObject(java.lang.String)
*/
public Object getEventObject(String id) {
try {
return getEventObjectContext().lookup(id);
} catch (NamingException ne) {
return null;
}
}
/**
* @see com.idcanet.foei.core.ObjectContextManager#removeEventObject(com.idcanet.foei.event.EventObject)
*/
public void removeEventObject(String id) throws FoeiBindingException {
try {
getEventObjectContext().unbind(id);
} catch (NameNotFoundException nnfe) {
throw new FoeiBindingException(nnfe);
} catch (NamingException ne) {
throw new FoeiBindingException(ne);
}
}
// ============ ObjectBindingsManager
/**
* @see com.idcanet.foei.core.ObjectBindingsManager#addBinding(com.idcanet.foei.event.EventPort, com.idcanet.foei.event.EventPort)
*/
public void addBinding(EventPort outputPort, EventPort inputPort) {
getObjectBindingsManager().addBinding(outputPort,inputPort);
}
/**
* @see com.idcanet.foei.core.ObjectBindingsManager#getBindings(com.idcanet.foei.event.EventPort)
*/
public List<EventPort> getBindings(EventPort eventPort) {
return getObjectBindingsManager().getBindings(eventPort);
}
/**
* @see com.idcanet.foei.core.ObjectBindingsManager#getBindingsAsXML()
*/
public String getBindingsAsXML() {
return getObjectBindingsManager().getBindingsAsXML();
}
/**
* @see com.idcanet.foei.core.ObjectBindingsManager#removeBinding(com.idcanet.foei.event.EventPort, com.idcanet.foei.event.EventPort)
*/
public void removeBinding(EventPort inputPort, EventPort outputPort) {
getObjectBindingsManager().removeBinding(inputPort,outputPort);
}
}

View file

@ -0,0 +1,152 @@
/*
* 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.impl;
import com.idcanet.foei.core.FoeiContext;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessListener;
import com.idcanet.foei.core.FoeiProcessManager;
import com.idcanet.foei.core.ObjectBindingsManager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
/**
* Defines the default FoeiProcessManager implementation
*
* @author Willem Cazander
* @version 1.0 Mar 2, 2006
*/
public class FoeiProcessManagerImpl implements FoeiProcessManager {
/** Stores all foeiProcesses */
private Map<String,FoeiProcess> foeiProcesses = null;
/** The logger to log to. */
private Logger logger = null;
private List<FoeiProcessListener> foeiProcessListeners = null;
/**
* Creates an FoeiProcessManagerImpl
*/
public FoeiProcessManagerImpl() {
logger = Logger.getLogger(FoeiProcessManagerImpl.class.getName());
foeiProcesses = new HashMap<String,FoeiProcess>(5);
foeiProcessListeners = new ArrayList<FoeiProcessListener>(5);
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#createFoeiProcess(java.lang.String, FoeiContext)
*/
public FoeiProcess createFoeiProcess(String name,FoeiContext foeiContext) {
if(name==null) {
throw new NullPointerException("name may not be null.");
}
if(foeiContext==null) {
throw new NullPointerException("foeiContext may not be null.");
}
try {
Context c = foeiContext.getEventObjectContext().createSubcontext(name);
ObjectBindingsManager objectBindingsManager = FoeiConfiguratorImpl.newObjectBindingsManager(foeiContext.getStartProperties());
FoeiProcess fp = new FoeiProcessImpl(name,foeiContext,c,objectBindingsManager);
synchronized (foeiProcesses) {
foeiProcesses.put(fp.getName(),fp);
}
for (FoeiProcessListener l:foeiProcessListeners) {
l.foeiProcessCreated(fp);
}
logger.finer("FoeiProcess created and added total processes: "+foeiProcesses.size());
return fp;
} catch (Exception e) {
logger.log(Level.WARNING,"Error whiile creating FoeiProcess: "+e.getMessage(),e);
return null;
}
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#destroyFoeiProcess(java.lang.String)
*/
public void destroyFoeiProcess(String name) {
FoeiProcess p = getFoeiProcess(name);
if(p==null) {
throw new NullPointerException("No FoeiProcess found with id: "+name);
}
p.destroy();
synchronized (foeiProcesses) {
foeiProcesses.remove(p.getName());
}
for (FoeiProcessListener l:foeiProcessListeners) {
l.foeiProcessDestroyed(p);
}
logger.finer("FoeiProcess destroyed total processes: "+foeiProcesses.size());
try {
p.getFoeiContext().getEventObjectContext().destroySubcontext(p.getName());
} catch (Exception e) {
logger.log(Level.WARNING,"Error while removing process context from foei context; "+e.getMessage(),e);
}
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#getFoeiProcess(java.lang.String)
*/
public FoeiProcess getFoeiProcess(String name) {
if(name==null) {
throw new NullPointerException("name may not be null.");
}
return foeiProcesses.get(name);
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#getFoeiProcesses()
*/
public Collection<FoeiProcess> getFoeiProcesses() {
return foeiProcesses.values();
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#addFoeiProcessListener(com.idcanet.foei.core.FoeiProcessListener)
*/
public void addFoeiProcessListener(FoeiProcessListener foeiProcessListener) {
foeiProcessListeners.add(foeiProcessListener);
}
/**
* @see com.idcanet.foei.core.FoeiProcessManager#removeFoeiProcessListener(com.idcanet.foei.core.FoeiProcessListener)
*/
public void removeFoeiProcessListener(FoeiProcessListener foeiProcessListener) {
foeiProcessListeners.remove(foeiProcessListener);
}
}

View file

@ -0,0 +1,73 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.core.impl;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
/**
* Wraps an Runnable object so it binds the FoeiProcess before running
* and unbinds it also.
*
* @author Willem Cazander
* @version 1.0 Mar 3, 2006
*/
public class FoeiProcessRunnableWrapper implements Runnable {
/** The wrapped runnable object. */
private Runnable runnable = null;
/** The FoeiProcess for this Runnable. */
private FoeiProcess foeiProcess = null;
/**
* creates an FoeiProcessRunnableWrapper
* @param runnable
* @param foeiProcess
*/
public FoeiProcessRunnableWrapper(Runnable runnable,FoeiProcess foeiProcess) {
if(runnable==null) {
throw new NullPointerException("runnable may not be null.");
}
if(foeiProcess==null) {
throw new NullPointerException("FoeiProcess may not be null.");
}
this.runnable=runnable;
this.foeiProcess=foeiProcess;
}
/**
* Binds and unbinds the FoeiProcess and call the runnalbe run method.
*/
public void run() {
FoeiProcessFactory.bindFoeiProcess(foeiProcess);
try {
runnable.run();
} finally {
FoeiProcessFactory.unbindFoeiProcess();
}
}
}

View file

@ -0,0 +1,197 @@
/*
* 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.impl;
import com.idcanet.foei.core.ObjectBindingsManager;
import com.idcanet.foei.event.EventPort;
import com.idcanet.foei.event.EventPortType;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.EventStepController;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
/**
* Defines the ObjectBindingsManager implamentation.
*
* @author Willem Cazander
* @version 1.0 20/04/2005
*/
public class ObjectBindingsManagerImpl implements ObjectBindingsManager {
/** */
private Map<EventPort,List<EventPort>> bindingsOutput = null;
/** Works like: eventPort(input) -> List (EventPorts(output) */
private Map<EventPort,List<EventPort>> bindingsInput = null;
/** The logger to log to. */
private Logger logger = null;
/**
* Creates the defaults implementation of the ObjectBindingsManager.<br/>
* inits the logger and de input and output Map mappings.
*/
public ObjectBindingsManagerImpl() {
logger = Logger.getLogger(ObjectBindingsManagerImpl.class.getName());
bindingsOutput = new HashMap<EventPort,List<EventPort>>(50);
bindingsInput = new HashMap<EventPort,List<EventPort>>(50);
logger.finer("BindingsManager Created");
}
/**
*
* @see ObjectBindingsManager#addBinding(EventPort, EventPort)
*/
public void addBinding(EventPort outputPort,EventPort inputPort) {
if(inputPort==null) {
throw new NullPointerException("inputPort may not be null.");
}
if(inputPort.getEventPortType()!=EventPortType.input) {
throw new IllegalArgumentException("inputPort needs to be input type.");
}
if(outputPort==null) {
throw new NullPointerException("outputPort may not be null.");
}
if(outputPort.getEventPortType()!=EventPortType.output) {
throw new IllegalArgumentException("inputPort needs to be ouput type.");
}
List<EventPort> inputPorts = bindingsInput.get(inputPort);
List<EventPort> outputPorts = bindingsOutput.get(outputPort);
if(inputPorts==null) {
inputPorts = new ArrayList<EventPort>(5);
bindingsInput.put(inputPort,inputPorts);
}
if(outputPorts==null) {
outputPorts = new ArrayList<EventPort>(5);
bindingsOutput.put(outputPort,outputPorts);
}
// disables to bind twice
if(inputPorts.contains(outputPort) || outputPorts.contains(inputPort) ) {
throw new IllegalArgumentException("inputPort is already bind to outputPort");
}
inputPorts.add(outputPort);
outputPorts.add(inputPort);
logger.fine("Bind completed: "+inputPort.getEventObject()+":"+inputPort.getName()+" to "+outputPort.getEventObject()+":"+outputPort.getName());
}
/**
*
* @see ObjectBindingsManager#removeBinding(EventPort, EventPort)
*/
public void removeBinding(EventPort inputPort,EventPort outputPort) {
if(inputPort==null) {
throw new NullPointerException("inputPort may not be null.");
}
if(inputPort.getEventPortType()!=EventPortType.input) {
throw new IllegalArgumentException("inputPort needs to be input type.");
}
if(outputPort==null) {
throw new NullPointerException("outputPort may not be null.");
}
if(outputPort.getEventPortType()!=EventPortType.output) {
throw new IllegalArgumentException("inputPort needs to be ouput type.");
}
List<EventPort> inputPorts = bindingsInput.get(inputPort);
List<EventPort> outputPorts = bindingsOutput.get(outputPort);
if(inputPorts==null || outputPorts==null) {
throw new IllegalArgumentException("Can not remove not binded ports.");
}
inputPorts.remove(outputPort);
outputPorts.remove(inputPort);
if(inputPorts.isEmpty()) {
bindingsInput.remove(inputPort);
}
if(outputPorts.isEmpty()) {
bindingsOutput.remove(outputPort);
}
logger.fine("Bind removed: "+inputPort.getEventObject()+":"+inputPort.getName()+" to "+outputPort.getEventObject()+":"+outputPort.getName());
}
/**
* 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) {
if(eventPort==null) {
throw new NullPointerException("eventPort may not be null.");
}
if (EventPortType.output.equals(eventPort.getEventPortType())) {
List<EventPort> inputPorts = bindingsOutput.get(eventPort);
if(inputPorts!=null) {
return inputPorts;
}
List<EventPort> result = new ArrayList<EventPort>(0);
return result;
} else {
List<EventPort> outputPorts = bindingsInput.get(eventPort);
if(outputPorts!=null) {
return outputPorts;
}
List<EventPort> result = new ArrayList<EventPort>(0);
return result;
}
}
/**
* Returns the dotty xml bindings
*/
public String getBindingsAsXML() {
StringBuffer result = new StringBuffer();
result.append("<?xml version=\"1.0\"?>\n");
result.append("<bindings>\n");
//FoeiProcess process = FoeiProcessFactory.getFoeiProcess();
// todo: ID nameing should go automatic, and be reverse lookup'ale
for(EventPort port:bindingsOutput.keySet()) {
for(EventPort b:getBindings(port)) {
result.append("\t<binding outputClass=\""+port.getEventObject()+"\" outputPortName=\""+port.getName());
result.append("\" inputClass=\""+b.getEventObject()+"\" inputPortName=\""+b.getName()+"\" inputPortPassed=\""+b.getEventsPassed());
Object o = port.getEventObject();
if (o instanceof EventStepController) {
result.append("\">\n");
EventStepController e = (EventStepController)o;
for(EventStep es:e.getEventSteps()) {
result.append("\t\t<step stepClass=\""+es+"\"/>\n");
}
result.append("\t</binding>\n");
} else {
result.append("\"/>\n");
}
}
}
result.append("</bindings>");
return result.toString();
}
}

View file

@ -0,0 +1,131 @@
/*
* 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.impl;
import com.idcanet.foei.core.X2OExecutor;
import com.idcanet.x4o.core.X4OParser;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* The default X2OExecutor implemention
*
* @author Willem Cazander
* @version 1.0 Feb 24, 2006
*
*/
public class X2OExecutorImpl implements X2OExecutor {
private String parseFileName = null;
private InputStream parseInputStream = null;
private String parseXml = null;
volatile private boolean ready = false;
private Logger logger = null;
/**
* Constructs an X2OExecutorImpl
*/
public X2OExecutorImpl() {
logger = Logger.getLogger(X2OExecutorImpl.class.getName());
}
/**
* @see java.lang.Runnable#run()
*/
public void run() {
try {
// config parser
//FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess();
X4OParser parser = new X4OParser("foei");
logger.info("Executing X2O Parsing.");
if(parseFileName!=null) {
try {
logger.finer("Parsing File: "+parseFileName);
parser.parseFile(parseFileName);
} catch (Exception e) {
logger.log(Level.SEVERE,"Error while loading config file:"+e.getMessage(),e);
}
}
if(parseInputStream!=null) {
try {
logger.finer("Parsing InputStream");
parser.parse(parseInputStream);
} catch (Exception e) {
logger.log(Level.SEVERE,"Error while loading inputStream:"+e.getMessage(),e);
}
}
if(parseXml!=null) {
try {
logger.finer("Parsing XML");
parser.parseXml(parseXml);
} catch (Exception e) {
logger.log(Level.SEVERE,"Error while loading xml:"+e.getMessage(),e);
}
}
} catch (Throwable t) {
logger.log(Level.WARNING,"Error in X2O thread: "+t.getMessage(),t);
} finally {
ready = true;
}
}
/**
* @see com.idcanet.foei.core.X2OExecutor#isReady()
*/
public boolean isReady() {
return ready;
}
/**
* @see com.idcanet.foei.core.X2OExecutor#setFileName(java.lang.String)
*/
public void setFileName(String fileName) {
parseFileName=fileName;
}
/**
* @see com.idcanet.foei.core.X2OExecutor#setInputStream(java.io.InputStream)
*/
public void setInputStream(InputStream inputStream) {
parseInputStream=inputStream;
}
/**
* @see com.idcanet.foei.core.X2OExecutor#setXml(java.lang.String)
*/
public void setXml(String xml) {
parseXml=xml;
}
}

View file

@ -0,0 +1,58 @@
<!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 Implemention.<br/>
Some classes are build to be used for overriding classes so<br/>
they have method to make live easer.<br/>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,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>

View file

@ -0,0 +1,83 @@
/*
* 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.x4o;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventOutput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.x4o.element.AbstractElementAttributeHandler;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementConfiguratorException;
import com.idcanet.x4o.element.ElementException;
/**
* Handlers the "bind" attribute
*
* @author Willem Cazander
* @version 1.0 Apr 15, 2006
*/
public class BindAttributeHandler extends AbstractElementAttributeHandler {
/**
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doConfigElement(java.lang.Object, java.lang.String)
*/
public void doConfigElement(Element element) throws ElementConfiguratorException {
String parameterValue = element.getAttributes().get(getAttributeName());
String[] port = parameterValue.split(":");
if(port.length!=2) {
return;
}
try {
EventInput in = (EventInput)element.getElementObject();
if(in==null) {
throw new ElementException("Could not find EventObject from inputID");
}
EventOutput out = (EventOutput)element.getParent().getElementObject();
if(out==null) {
throw new ElementException("Could not find EventObject from outputID");
}
EventPort inputEventPort = in.getInputPort(port[1]);
EventPort outputEventPort = out.getOutputPort(port[0]);
FoeiProcess foei = FoeiProcessFactory.getFoeiProcess();
if(inputEventPort==null) {
throw new ElementException("Could not find EventPort from inputPort");
}
if(outputEventPort==null) {
throw new ElementException("Could not find EventPort from outputPort");
}
foei.addBinding(outputEventPort,inputEventPort);
} catch (Exception e) {
throw new ElementConfiguratorException(this,e.getMessage(),e);
}
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.core.x4o;
import com.idcanet.foei.event.EventStep;
import com.idcanet.foei.event.EventStepController;
import com.idcanet.x4o.element.AbstractElementBindingHandler;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementBindingHandlerException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Apr 16, 2006
*/
public class EventStepBindRuleHandler extends AbstractElementBindingHandler {
/**
* @see com.idca.foei.xml.x2o.eld.BindingRuleHandler#canBind(java.lang.Object, java.lang.Object)
*/
public boolean canBind(Element element) {
Object parent = element.getParent().getElementObject();
Object child = element.getElementObject();
if(!(parent instanceof EventStepController)) {
return false;
}
if(!(child instanceof EventStep)) {
return false;
}
return true;
}
/**
* @see com.idca.foei.xml.x2o.eld.BindingRuleHandler#doBind(java.lang.Object, java.lang.Object)
*/
public void doBind(Element element) throws ElementBindingHandlerException {
Object parent = element.getParent().getElementObject();
Object child = element.getElementObject();
((EventStepController)parent).addEventStep((EventStep)child);
}
}

View 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.core.x4o;
import com.idcanet.foei.core.FoeiBindingException;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.x4o.element.AbstractElementAttributeHandler;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementConfiguratorException;
/**
* Handles the id
*
* @author Willem Cazander
* @version 1.0 Jul 8, 2006
*/
public class IdAttributeHandler extends AbstractElementAttributeHandler {
/**
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doConfigElement(java.lang.Object, java.lang.String)
*/
public void doConfigElement(Element element) throws ElementConfiguratorException {
// add to objext context
String parameterValue = element.getAttributes().get(getAttributeName());
if(element.getElementObject()==null | "".equals(parameterValue)) {
parameterValue= "auto."+Integer.toHexString(element.getElementObject().hashCode());
//logger.finest("Generated auto id: "+parameterValue);
}
FoeiProcess process = FoeiProcessFactory.getFoeiProcess();
try {
process.addEventObject(element.getElementObject(),parameterValue);
} catch (FoeiBindingException e) {
throw new ElementConfiguratorException(this,e.getMessage(),e);
}
}
}

View file

@ -0,0 +1,85 @@
/*
* 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.x4o;
import java.util.Map;
import com.idcanet.foei.core.FoeiProcess;
import com.idcanet.foei.core.FoeiProcessFactory;
import com.idcanet.foei.event.EventInput;
import com.idcanet.foei.event.EventOutput;
import com.idcanet.foei.event.EventPort;
import com.idcanet.x4o.element.AbstractElement;
import com.idcanet.x4o.element.ElementException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Mar 2, 2006
*/
public class ObjectBindingElement extends AbstractElement {
private String outputID = null;
private String outputPort = null;
private String inputID = null;
private String inputPort = null;
/**
* Do the element
*/
@Override
public void doElementRun() throws ElementException {
Map<String,String> attributes = getAttributes();
outputID = attributes.get("outputID");
outputPort = attributes.get("outputPort");
inputID = attributes.get("inputID");
inputPort = attributes.get("inputPort");
FoeiProcess foei = FoeiProcessFactory.getFoeiProcess();
Object in = foei.getEventObject(inputID);
if(in==null) {
throw new ElementException("Could not find EventObject from inputID");
}
Object out = foei.getEventObject(outputID);
if(out==null) {
throw new ElementException("Could not find EventObject from outputID");
}
EventPort inputEventPort = ((EventInput)in).getInputPort(inputPort);
EventPort outputEventPort = ((EventOutput)out).getOutputPort(outputPort);
if(inputEventPort==null) {
throw new ElementException("Could not find EventPort from inputPort");
}
if(outputEventPort==null) {
throw new ElementException("Could not find EventPort from outputPort");
}
foei.addBinding(outputEventPort,inputEventPort);
}
}

View file

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
Copyright 2004-2006 IDCA. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and
should not be interpreted as representing official policies, either expressed or implied, of IDCA.
-->
</head>
<body bgcolor="white">
Special Element object for foei xml.<br/>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,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;
}

View 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 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;
}
}

View file

@ -0,0 +1,98 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.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;
}

View 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 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;
}
}

View file

@ -0,0 +1,98 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.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);
}
}

View 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 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;
}
}

View file

@ -0,0 +1,52 @@
/*
* 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 {
private EventStepOperand eventStepOperand = null;
/**
* @return the eventStepOperand
*/
public EventStepOperand getEventStepOperand() {
return eventStepOperand;
}
/**
* @param eventStepOperand the eventStepOperand to set
*/
public void setEventStepOperand(EventStepOperand eventStepOperand) {
this.eventStepOperand = eventStepOperand;
}
}

View 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;
}
}

View 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;
}

View 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);
}

View file

@ -0,0 +1,167 @@
/*
* 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 {
/** public type for defining TRUE */
static final public String TRUE = "true";
/** public type for defining FALSE */
static final public String FALSE = "false";
/** public type for defining INPUT */
static final public String INPUT = "input";
/** public type for defining OUTPUT */
static final public String OUTPUT = "output";
/** public type for defining PASS */
static final public String PASS = "pass";
/** public type for defining DROP */
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;
}
}

View 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;
/**
* EventPortType of an EventPort
*
* @author Willem Cazander
* @version 1.0 Mar 3, 2006
*/
public enum EventPortType {
/**
* Type for input ports
*/
input,
/**
* Type for output ports
*/
output;
}

View 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.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 {
public enum EventStepOperand {
AND,NAND,
OR,NOR,XOR;
public boolean execute(boolean A,boolean B) {
if (this==AND) {
return A&B;
}
if (this==NAND) {
return !A&!B;
}
if (this==OR) {
return A|B;
}
if (this==NOR) {
return !A|!B;
}
if (this==XOR) {
return A^B;
}
throw new IllegalStateException("Can execute unknow EventStepOperand: "+this.name());
}
}
/**
* Process an object and gives it back.
*
* @param object The Object which need to be processed.
* @returns An object or null if not succesfull.
*/
public Object processObject(Object object) throws ClassCastException;
public void setEventStepOperand(EventStepOperand operand);
public EventStepOperand getEventStepOperand();
}

View 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);
}

View 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.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);
}
}

View file

@ -0,0 +1,70 @@
/*
* 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.annotations;
import com.idcanet.foei.event.EventPortType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Defines an input EventPort
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2006
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SetEventPort {
/**
*
* @return
*/
EventPortType type();
/**
* Gets the name of the input EventPort
* @return Returns the name of the input EventPort
*/
String name();
/**
* Gets the objectType of the input EventPort
* it defaults to Object.class but is lookuped in the annotated method.
* @return Returns the objectType of the input EventPort
*/
Class objectType() default Object.class;
/**
*
* @return
*/
String immediate() default "null";
}

View 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.event.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Defines an output EventPort
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2006
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SetEventPorts {
/**
* An array of SetEventPort annotations
* @return Returns an array of SetEventPort annotations
*/
SetEventPort[] ports();
}

View file

@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
Copyright 2004-2006 IDCA. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and
should not be interpreted as representing official policies, either expressed or implied, of IDCA.
-->
</head>
<body bgcolor="white">
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>

View file

@ -0,0 +1,70 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.utils.jndi;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import java.io.PrintStream;
/**
* A util recursive method which prints the jndi tree.
*
* @author Willem Cazander
* @version 1.0 Jan 18, 2006
*/
public class ContextListWriter {
/**
* writes an context tree to the printstream out.
* @param out The printstream to which the text line are printed.
* @param ctx The context to list.
* @param indent The intext text for sub contexts.
*/
public static void writeContextTree(PrintStream out,Context ctx, String indent) {
if(out==null | ctx==null | indent==null) {
return;
}
try {
NamingEnumeration<Binding> list = ctx.listBindings("");
while (list.hasMore()) {
Binding item = (Binding)list.next();
String className = item.getClassName();
String name = item.getName();
out.println(indent+" class: "+className+" name="+name);
Object o = item.getObject();
if (o instanceof javax.naming.Context) {
writeContextTree(out,(Context)o,indent+indent);
}
}
} catch (NamingException ne) {
out.println("Nameing Exception: "+ne.getMessage());
}
}
}

View file

@ -0,0 +1,670 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.utils.jndi;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import javax.naming.Binding;
import javax.naming.CompositeName;
import javax.naming.Context;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameClassPair;
import javax.naming.NameNotFoundException;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NotContextException;
import javax.naming.OperationNotSupportedException;
import javax.naming.spi.NamingManager;
/**
* A sample service provider that implements a hierarchical namespace in memory.
*
* @author Willem Cazander
* @version 1.0 Jan 18, 2006
*/
@SuppressWarnings("unchecked")
public class MemoryContext implements Context {
protected Hashtable myEnv;
protected Hashtable bindings = new Hashtable(11);
protected final static NameParser myParser = new MemoryContextNameParser();
protected MemoryContext parent = null;
protected String myAtomicName = null;
/**
* Creates an new FoeiContext without an everment
* note:
* This should be done via an Factrory
* but then the server loader can not easaly load this class
*/
public MemoryContext()
{
//super()FoeiContext(null);
}
MemoryContext(Hashtable inEnv)
{
myEnv = (inEnv != null)
? (Hashtable)(inEnv.clone())
: null;
}
protected MemoryContext(MemoryContext parent, String name, Hashtable inEnv,Hashtable bindings)
{
this(inEnv);
this.parent = parent;
myAtomicName = name;
this.bindings = (Hashtable)bindings.clone();
}
protected Context createFoeiContext(MemoryContext parent, String name, Hashtable inEnv)
{
return new MemoryContext(parent, name, inEnv, new Hashtable(11));
}
protected Context cloneCtx()
{
return new MemoryContext(parent, myAtomicName, myEnv, bindings);
}
/**
* Utility method for processing composite/compound name.
* @param name The non-null composite or compound name to process.
* @return The non-null string name in this namespace to be processed.
*/
protected Name getMyComponents(Name name) throws NamingException
{
if (name instanceof CompositeName)
{
if (name.size() > 1)
{
throw new InvalidNameException(name.toString()+" has more components than namespace can handle");
}
// Turn component that belongs to us into compound name
return myParser.parse(name.get(0));
}
// Already parsed
return name;
}
public Object lookup(String name) throws NamingException
{
return lookup(new CompositeName(name));
}
public Object lookup(Name name) throws NamingException
{
if (name.isEmpty())
{
return cloneCtx();
}
// Extract components that belong to this namespace
Name nm = getMyComponents(name);
String atom = nm.get(0);
Object inter = bindings.get(atom);
if (nm.size() == 1)
{
// Atomic name: Find object in internal data structure
if (inter == null)
{
throw new NameNotFoundException(name + " not found");
}
// Call getObjectInstance for using any object factories
try
{
return NamingManager.getObjectInstance(inter,new CompositeName().add(atom),this, myEnv);
}
catch (Exception e)
{
NamingException ne = new NamingException("getObjectInstance failed");
ne.setRootCause(e);
throw ne;
}
}
// else
// {
// Intermediate name: Consume name in this context and continue
if (!(inter instanceof Context))
{
throw new NotContextException(atom+" does not name a context");
}
return ((Context)inter).lookup(nm.getSuffix(1));
// }
}
public void bind(String name, Object obj) throws NamingException
{
bind(new CompositeName(name), obj);
}
public void bind(Name name, Object obj) throws NamingException
{
if (name.isEmpty())
{
throw new InvalidNameException("Cannot bind empty name");
}
Name nm = getMyComponents(name);
String atom = nm.get(0);
Object inter = bindings.get(atom);
if (nm.size() == 1)
{
// Atomic name: Find object in internal data structure
if (inter != null)
{
throw new NameAlreadyBoundException("Use rebind to override");
}
// Call getStateToBind for using any state factories
obj = NamingManager.getStateToBind(obj,new CompositeName().add(atom),this, myEnv);
// Add object to internal data structure
bindings.put(atom, obj);
}
else
{
// Intermediate name: Consume name in this context and continue
if(inter==null)
{
// auto create sub context.
inter = createSubcontext(atom);
}
if (!(inter instanceof Context))
{
throw new NotContextException(atom+" does not name a context");
}
((Context)inter).bind(nm.getSuffix(1), obj);
}
}
public void rebind(String name, Object obj) throws NamingException
{
rebind(new CompositeName(name), obj);
}
public void rebind(Name name, Object obj) throws NamingException
{
if (name.isEmpty())
{
throw new InvalidNameException("Cannot bind empty name");
}
// Extract components that belong to this namespace
Name nm = getMyComponents(name);
String atom = nm.get(0);
if (nm.size() == 1)
{
// Atomic name
// Call getStateToBind for using any state factories
obj = NamingManager.getStateToBind(obj,new CompositeName().add(atom),this, myEnv);
// Add object to internal data structure
bindings.put(atom, obj);
}
else
{
// Intermediate name: Consume name in this context and continue
Object inter = bindings.get(atom);
if(inter==null)
{
// auto create sub context.
inter = createSubcontext(atom);
}
if (!(inter instanceof Context))
{
throw new NotContextException(atom+" does not name a context");
}
((Context)inter).rebind(nm.getSuffix(1), obj);
}
}
public void unbind(String name) throws NamingException
{
unbind(new CompositeName(name));
}
public void unbind(Name name) throws NamingException
{
if (name.isEmpty())
{
throw new InvalidNameException("Cannot unbind empty name");
}
// Extract components that belong to this namespace
Name nm = getMyComponents(name);
String atom = nm.get(0);
// Remove object from internal data structure
if (nm.size() == 1)
{
// Atomic name: Find object in internal data structure
bindings.remove(atom);
}
else
{
// Intermediate name: Consume name in this context and continue
Object inter = bindings.get(atom);
if (!(inter instanceof Context))
{
throw new NotContextException(atom+" does not name a context");
}
((Context)inter).unbind(nm.getSuffix(1));
}
}
public void rename(String oldName, String newName) throws NamingException
{
rename(new CompositeName(oldName), new CompositeName(newName));
}
public void rename(Name oldname, Name newname) throws NamingException
{
if (oldname.isEmpty() || newname.isEmpty())
{
throw new InvalidNameException("Cannot rename empty name");
}
Name oldnm = getMyComponents(oldname);
Name newnm = getMyComponents(newname);
// Simplistic implementation: support only rename within same context
if (oldnm.size() != newnm.size())
{
throw new OperationNotSupportedException("Do not support rename across different contexts");
}
String oldatom = oldnm.get(0);
String newatom = newnm.get(0);
if (oldnm.size() == 1)
{
if (bindings.get(newatom) != null)
{
throw new NameAlreadyBoundException(newname.toString()+" is already bound");
}
// Check if old name is bound
Object oldBinding = bindings.remove(oldatom);
if (oldBinding == null)
{
throw new NameNotFoundException(oldname.toString() + " not bound");
}
bindings.put(newatom, oldBinding);
}
else
{
if (!oldatom.equals(newatom))
{
throw new OperationNotSupportedException("Do not support rename across different contexts");
}
// Intermediate name: Consume name in this context and continue
Object inter = bindings.get(oldatom);
if (!(inter instanceof Context))
{
throw new NotContextException(oldatom+" does not name a context");
}
((Context)inter).rename(oldnm.getSuffix(1), newnm.getSuffix(1));
}
}
public NamingEnumeration list(String name) throws NamingException
{
return list(new CompositeName(name));
}
public NamingEnumeration list(Name name) throws NamingException
{
if (name.isEmpty())
{
// listing this context
return new ListOfNames(bindings.keys());
}
// Perhaps 'name' names a context
Object target = lookup(name);
if (target instanceof Context)
{
return ((Context)target).list("");
}
throw new NotContextException(name + " cannot be listed");
}
public NamingEnumeration listBindings(String name) throws NamingException
{
return listBindings(new CompositeName(name));
}
public NamingEnumeration listBindings(Name name) throws NamingException
{
//System.err.println("FoeiContext list bindings is called "+this+" map size:"+bindings.size());
if (name.isEmpty()) {
// listing this context
return new ListOfBindings(bindings.keys());
}
// Perhaps 'name' names a context
Object target = lookup(name);
if (target instanceof Context) {
return ((Context)target).listBindings("");
}
throw new NotContextException(name + " cannot be listed");
}
public void destroySubcontext(String name) throws NamingException {
destroySubcontext(new CompositeName(name));
}
public void destroySubcontext(Name name) throws NamingException
{
if (name.isEmpty())
{
throw new InvalidNameException("Cannot destroy context using empty name");
}
// Simplistic implementation: not checking for nonempty context first
// Use same implementation as unbind
unbind(name);
}
public Context createSubcontext(String name) throws NamingException
{
return createSubcontext(new CompositeName(name));
}
public Context createSubcontext(Name name) throws NamingException
{
if (name.isEmpty())
{
throw new InvalidNameException("Cannot bind empty name");
}
// Extract components that belong to this namespace
Name nm = getMyComponents(name);
String atom = nm.get(0);
Object inter = bindings.get(atom);
if (nm.size() == 1)
{
// Atomic name: Find object in internal data structure
if (inter != null)
{
throw new NameAlreadyBoundException("Use rebind to override");
}
// Create child
Context child = createFoeiContext(this, atom, myEnv);
// Add child to internal data structure
bindings.put(atom, child);
return child;
}
else
{
// Intermediate name: Consume name in this context and continue
if (!(inter instanceof Context))
{
throw new NotContextException(atom+" does not name a context");
}
return ((Context)inter).createSubcontext(nm.getSuffix(1));
}
}
public Object lookupLink(String name) throws NamingException
{
return lookupLink(new CompositeName(name));
}
public Object lookupLink(Name name) throws NamingException
{
return lookup(name);
}
public NameParser getNameParser(String name) throws NamingException
{
return getNameParser(new CompositeName(name));
}
public NameParser getNameParser(Name name) throws NamingException
{
// Do lookup to verify name exists
Object obj = lookup(name);
if (obj instanceof Context)
{
((Context)obj).close();
}
return myParser;
}
public String composeName(String name, String prefix) throws NamingException
{
Name result = composeName(new CompositeName(name),new CompositeName(prefix));
return result.toString();
}
public Name composeName(Name name, Name prefix) throws NamingException
{
Name result;
// Both are compound names, compose using compound name rules
if (!(name instanceof CompositeName) && !(prefix instanceof CompositeName))
{
result = (Name)(prefix.clone());
result.addAll(name);
return new CompositeName().add(result.toString());
}
// Simplistic implementation: do not support federation
throw new OperationNotSupportedException("Do not support composing composite names");
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException
{
if (myEnv == null)
{
myEnv = new Hashtable(5, 0.75f);
}
return myEnv.put(propName, propVal);
}
public Object removeFromEnvironment(String propName) throws NamingException
{
if (myEnv == null)
{
return null;
}
return myEnv.remove(propName);
}
public Hashtable getEnvironment() throws NamingException
{
if (myEnv == null)
{
return new Hashtable(3, 0.75f);
}
else
{
return (Hashtable)myEnv.clone();
}
}
public String getNameInNamespace() throws NamingException
{
MemoryContext ancestor = parent;
// No ancestor
if (ancestor == null)
{
return "";
}
Name name = myParser.parse("");
name.add(myAtomicName);
// Get parent's names
while (ancestor != null && ancestor.myAtomicName != null)
{
name.add(0, ancestor.myAtomicName);
ancestor = ancestor.parent;
}
return name.toString();
}
public String toString()
{
if (myAtomicName != null)
{
return myAtomicName;
}
else
{
return "ROOT CONTEXT";
}
}
public void close() throws NamingException
{
}
// Class for enumerating name/class pairs
class ListOfNames implements NamingEnumeration {
protected Enumeration names;
ListOfNames (Enumeration names) {
this.names = names;
}
public boolean hasMoreElements() {
try {
return hasMore();
} catch (NamingException e) {
return false;
}
}
public boolean hasMore() throws NamingException {
return names.hasMoreElements();
}
public Object next() throws NamingException {
String name = (String)names.nextElement();
String className = bindings.get(name).getClass().getName();
return new NameClassPair(name, className);
}
public Object nextElement() {
try {
return next();
} catch (NamingException e) {
throw new NoSuchElementException(e.toString());
}
}
public void close() {
}
}
// Class for enumerating bindings
class ListOfBindings extends ListOfNames {
ListOfBindings(Enumeration names) {
super(names);
}
public Object next() throws NamingException {
String name = (String)names.nextElement();
Object obj = bindings.get(name);
try {
obj = NamingManager.getObjectInstance(obj,
new CompositeName().add(name), MemoryContext.this,
MemoryContext.this.myEnv);
} catch (Exception e) {
NamingException ne = new NamingException(
"getObjectInstance failed");
ne.setRootCause(e);
throw ne;
}
return new Binding(name, obj);
}
}
/*
static FoeiContext testRoot;
static {
try {
testRoot = new FoeiContext(null);
Context a = testRoot.createSubcontext("a");
Context b = a.createSubcontext("b");
Context c = b.createSubcontext("c");
testRoot.createSubcontext("x");
testRoot.createSubcontext("y");
} catch (NamingException e) {
}
}
public static Context getStaticNamespace(Hashtable env) {
return testRoot;
}
public static void main(String[] args) {
try {
Context ctx = new FoeiContext(null);
Context a = ctx.createSubcontext("a");
Context b = a.createSubcontext("b");
Context c = b.createSubcontext("c");
System.out.println(c.getNameInNamespace());
System.out.println(ctx.lookup(""));
System.out.println(ctx.lookup("a"));
System.out.println(ctx.lookup("b.a"));
System.out.println(a.lookup("c.b"));
} catch (NamingException e) {
e.printStackTrace();
}
}
*/
}

View 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.utils.jndi;
import java.util.Hashtable;
import javax.naming.spi.InitialContextFactory;
import javax.naming.Context;
import javax.naming.NamingException;
/**
* Creates an new MemoryContext
*
* @author Willem Cazander
* @version 1.0 Jan 18, 2006
*
*/
public class MemoryContextFactory implements InitialContextFactory {
/** Stores the jvm wide instance of the FoeiContext */
static private Context context = null;
/**
* Returns the FoeiContext
* @param environment
* @return
* @throws NamingException
*/
@SuppressWarnings("unchecked")
public Context getInitialContext(Hashtable environment) throws NamingException {
if (context!=null) {
return context;
}
context = new MemoryContext(environment);
return context;
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.utils.jndi;
import java.util.Properties;
import javax.naming.NameParser;
import javax.naming.Name;
import javax.naming.CompoundName;
import javax.naming.NamingException;
/**
* A jndi name parser
*
* @author Willem Cazander
* @version 1.0 Jan 18, 2006
*/
class MemoryContextNameParser implements NameParser {
/** The syntax to use. */
private static Properties syntax = null;
static {
try {
syntax = new Properties();
syntax.put("jndi.syntax.direction", "left_to_right");
syntax.put("jndi.syntax.separator", ".");
syntax.put("jndi.syntax.ignorecase", "false");
syntax.put("jndi.syntax.escape", "\\");
syntax.put("jndi.syntax.beginquote", "'");
} catch (Exception e) {
throw new RuntimeException("Error while creating FoeiNameParser",e);
}
}
/**
* Parses the String name into an Jndi name.
* @see NameParser#parse(java.lang.String)
*/
public Name parse(String name) throws NamingException {
return new CompoundName(name, syntax);
}
}

View file

@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.00
Copyright 2004-2006 IDCA. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and
should not be interpreted as representing official policies, either expressed or implied, of IDCA.
-->
</head>
<body bgcolor="white">
Defines an MemoryContext for storing object in a jndi tree.<br/>
<h2>Package Specification</h2>
<ul>
<li>Full J2SE 5 compatible</li>
<li>Small package</li>
</ul>
<!--
<ul>
<li><a href="">hgj</a>
</ul>
-->
<h2>Related Documentation</h2>
None.
<!--
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="http://foei.idca.nl/docs/jmx/example1">Example 1</a>
</ul>
-->
<!-- Put @see and @since tags down here. -->
</body>
</html>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<!-- THE FOEI PROPERTIES DEFAULTS -->
<!--
#foei.object_bindings_manager=com.idca.foei.core.impl.ObjectBindingsManagerImpl
#foei.event_executor=com.idca.foei.core.impl.EventExecutorImpl
#foei.event_executor_manager=com.idca.foei.core.impl.EventExecutorManagerImpl
#foei.event_executor_manager.pool_core_size=3
#foei.event_executor_manager.pool_max_size=5
#foei.event_executor_manager.pool_keep_alive=180
#foei.initial_object_context_factory=com.idca.foei.utils.jndi.MemoryContextFactory
#foei.event_thread_listeners=<empty>
#foei.x2o_root_tag=foei
#foei.x2o_default_element_configurator=com.idca.foei.xml.x2o.DefaultX2OElementConfigurator
-->
<entry key="foei.object_bindings_manager">com.idcanet.foei.core.impl.ObjectBindingsManagerImpl</entry>
</properties>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
</eld:root>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
<eld:elementClass tag="filter" objectClassName="com.idcanet.foei.components.lang.Filter"/>
<eld:elementClass tag="stringFilter" objectClassName="com.idcanet.foei.components.steps.filters.StringFilter"/>
<eld:elementClass tag="classFilter" objectClassName="com.idcanet.foei.components.steps.filters.ClassFilter"/>
<eld:elementClass tag="dateFilter" objectClassName="com.idcanet.foei.components.steps.filters.DateFilter"/>
</eld:root>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
<eld:elementClass tag="standardOutput" objectClassName="com.idcanet.foei.components.io.StandardOutput"/>
<eld:elementClass tag="errorOutput" objectClassName="com.idcanet.foei.components.io.ErrorOutput"/>
<eld:elementClass tag="fileOutput" objectClassName="com.idcanet.foei.components.io.FileOutput"/>
</eld:root>

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
<eld:elementClass tag="root" objectClassName="java.lang.Object">
<eld:elementDescription>Fake root tag</eld:elementDescription>
</eld:elementClass>
<eld:elementParameterHandler parameterName="bind" bean.class="com.idcanet.foei.core.x4o.BindAttributeHandler" />
<eld:elementParameterHandler parameterName="foei.id" bean.class="com.idcanet.foei.core.x4o.IdAttributeHandler"/>
<eld:elementBindingHandler bean.class="com.idcanet.foei.core.x4o.EventStepBindRuleHandler"/>
<eld:elementClass tag="bind" elementClassName="com.idcanet.foei.core.x4o.ObjectBindingElement"/>
<eld:elementClass tag="dummyOutputPort" objectClassName="com.idcanet.foei.components.lang.DummyOutputPort"/>
<eld:elementClass tag="objectChangedBuffer" objectClassName="com.idcanet.foei.components.lang.ObjectChangedBuffer"/>
<eld:elementClass tag="destroyFoeiProcess" objectClassName="com.idcanet.foei.components.lang.DestroyFoeiProcess"/>
<eld:elementClass tag="setBeanProperty" objectClassName="com.idcanet.foei.components.lang.SetBeanProperty"/>
<eld:elementClass tag="getBeanProperty" objectClassName="com.idcanet.foei.components.lang.GetBeanProperty"/>
<eld:elementClass tag="getBeanPropertyStep" objectClassName="com.idcanet.foei.components.steps.lang.GetBeanPropertyStep"/>
<eld:elementClass tag="mapValue" objectClassName="com.idcanet.foei.components.steps.lang.MapValue"/>
<eld:elementClass tag="listValue" objectClassName="com.idcanet.foei.components.steps.lang.ListValue"/>
</eld:root>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
<eld:elementClass tag="loggerInput" objectClassName="com.idcanet.foei.components.logging.LoggerInput"/>
</eld:root>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>
Foei namespace
</comment>
<entry key="eld.http://foei.idcanet.com/eld/foei-events.eld" >/META-INF/foei-events.eld</entry>
<entry key="eld.http://foei.idcanet.com/eld/foei-filters.eld" >/META-INF/foei-filters.eld</entry>
<entry key="eld.http://foei.idcanet.com/eld/foei-io.eld" >/META-INF/foei-io.eld</entry>
<entry key="eld.http://foei.idcanet.com/eld/foei-lang.eld" >/META-INF/foei-lang.eld</entry>
<entry key="eld.http://foei.idcanet.com/eld/foei-logging.eld" >/META-INF/foei-logging.eld</entry>
<entry key="eld.http://foei.idcanet.com/eld/foei-printers.eld" >/META-INF/foei-printers.eld</entry>
</properties>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<eld:root xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
<eld:elementClass tag="defaultPrinter" objectClassName="com.idcanet.foei.components.steps.printers.DefaultPrinter"/>
<eld:elementClass tag="datePrinter" objectClassName="com.idcanet.foei.components.steps.printers.DatePrinter"/>
</eld:root>

View file

View file