diff --git a/doc/todo.txt b/doc/todo.txt index 457a1c9..971b78f 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -4,5 +4,6 @@ - (80% DONE) make J2EE compaitle - Add annotations for ports - Make asysc piping faster +- Auto immiate useage on bench of time of functions against piping - Start implementing JMS interfaces diff --git a/src/main/java/com/idcanet/foei/core/FoeiBindingException.java b/src/main/java/com/idcanet/foei/core/FoeiBindingException.java new file mode 100644 index 0000000..dccd73c --- /dev/null +++ b/src/main/java/com/idcanet/foei/core/FoeiBindingException.java @@ -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); + } +} \ No newline at end of file diff --git a/src/main/java/com/idcanet/foei/core/FoeiContextBuildingException.java b/src/main/java/com/idcanet/foei/core/FoeiContextBuildingException.java index 50edf8d..bff5d89 100644 --- a/src/main/java/com/idcanet/foei/core/FoeiContextBuildingException.java +++ b/src/main/java/com/idcanet/foei/core/FoeiContextBuildingException.java @@ -32,8 +32,8 @@ package com.idcanet.foei.core; * @author Willem Cazander * @version 1.0 Jan 24, 2006 */ -public class FoeiContextBuildingException extends Exception -{ +public class FoeiContextBuildingException extends Exception { + /** v1.0 */ static final long serialVersionUID = 10l; diff --git a/src/main/java/com/idcanet/foei/core/ObjectContextManager.java b/src/main/java/com/idcanet/foei/core/ObjectContextManager.java index 9c51969..a7037ff 100644 --- a/src/main/java/com/idcanet/foei/core/ObjectContextManager.java +++ b/src/main/java/com/idcanet/foei/core/ObjectContextManager.java @@ -39,13 +39,13 @@ public interface ObjectContextManager { * Adds an EventObject to the Context * @param eventObject */ - public void addEventObject(Object eventObject,String id); + public void addEventObject(Object eventObject,String id) throws FoeiBindingException; /** * removes an EventObject from the Context * @param eventObject */ - public void removeEventObject(String id); + public void removeEventObject(String id) throws FoeiBindingException; /** * Gets an EventObject by its id. diff --git a/src/main/java/com/idcanet/foei/core/impl/EventExecutorImpl.java b/src/main/java/com/idcanet/foei/core/impl/EventExecutorImpl.java index be1b041..6a301ff 100644 --- a/src/main/java/com/idcanet/foei/core/impl/EventExecutorImpl.java +++ b/src/main/java/com/idcanet/foei/core/impl/EventExecutorImpl.java @@ -114,7 +114,6 @@ public class EventExecutorImpl implements EventExecutor { ready = true; FoeiProcessFactory.unbindFoeiProcess(); foeiProcess.getExecutors().remove(this); - logger.info(Thread.currentThread().getName()+"--"+this.toString()+" executed: "+processed); } } @@ -122,13 +121,13 @@ public class EventExecutorImpl implements EventExecutor { EventPort eventPort = msg.getEventPort(); Object eventObject = msg.getEventObject(); - if(eventPort.getEventPortType()==EventPortType.input) { + 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) { + if (eventPort.getEventPortType()==EventPortType.output) { eventPort.addEventsPassed(); // inc output port List bindings = foeiProcess.getBindings(eventPort); diff --git a/src/main/java/com/idcanet/foei/core/impl/FoeiProcessImpl.java b/src/main/java/com/idcanet/foei/core/impl/FoeiProcessImpl.java index 35b71cd..1a8080a 100644 --- a/src/main/java/com/idcanet/foei/core/impl/FoeiProcessImpl.java +++ b/src/main/java/com/idcanet/foei/core/impl/FoeiProcessImpl.java @@ -27,6 +27,7 @@ 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; @@ -138,13 +139,13 @@ public class FoeiProcessImpl implements FoeiProcess { /** * @see com.idcanet.foei.core.ObjectContextManager#addEventObject(com.idcanet.foei.event.EventObject) */ - public void addEventObject(Object eventObject,String id) { + public void addEventObject(Object eventObject,String id) throws FoeiBindingException { try { getEventObjectContext().bind(id,eventObject); } catch (NameAlreadyBoundException nabe) { - logger.log(Level.WARNING,"NameAlreadyBoundException: "+nabe.getMessage(),nabe); + throw new FoeiBindingException(nabe); } catch (NamingException ne) { - logger.log(Level.WARNING,"NamingException: "+ne.getMessage(),ne); + throw new FoeiBindingException(ne); } } @@ -155,21 +156,20 @@ public class FoeiProcessImpl implements FoeiProcess { try { return getEventObjectContext().lookup(id); } catch (NamingException ne) { - logger.log(Level.WARNING,"NamingException: "+ne.getMessage(),ne); + return null; } - return null; } /** * @see com.idcanet.foei.core.ObjectContextManager#removeEventObject(com.idcanet.foei.event.EventObject) */ - public void removeEventObject(String id) { + public void removeEventObject(String id) throws FoeiBindingException { try { getEventObjectContext().unbind(id); } catch (NameNotFoundException nnfe) { - logger.log(Level.WARNING,"NamingNotFoundException: "+nnfe.getMessage(),nnfe); + throw new FoeiBindingException(nnfe); } catch (NamingException ne) { - logger.log(Level.WARNING,"NamingException: "+ne.getMessage(),ne); + throw new FoeiBindingException(ne); } } diff --git a/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java b/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java index f83e783..ccd03dc 100644 --- a/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java +++ b/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java @@ -29,15 +29,7 @@ package com.idcanet.foei.core.impl; import com.idcanet.foei.core.FoeiProcess; import com.idcanet.foei.core.FoeiProcessFactory; import com.idcanet.foei.core.X2OExecutor; -import com.idcanet.x4o.core.AbstractX4OPhaseHandler; import com.idcanet.x4o.core.X4OParser; -import com.idcanet.x4o.core.X4OPhaseException; -import com.idcanet.x4o.core.X4OPhaseHandler; -import com.idcanet.x4o.core.X4OPhaseHandlerFactory; -import com.idcanet.x4o.core.X4OPhase; -import com.idcanet.x4o.eld.EldX4OElementConfigurator; -import com.idcanet.x4o.element.Element; -import com.idcanet.x4o.element.ElementContext; import java.io.InputStream; import java.util.logging.Level; @@ -55,7 +47,7 @@ public class X2OExecutorImpl implements X2OExecutor { private String parseFileName = null; private InputStream parseInputStream = null; private String parseXml = null; - private boolean ready = false; + volatile private boolean ready = false; private Logger logger = null; /** diff --git a/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java b/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java index aad5df7..5d6eed9 100644 --- a/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java +++ b/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java @@ -26,6 +26,7 @@ package com.idcanet.foei.core.x4o; +import com.idcanet.foei.core.FoeiBindingException; import com.idcanet.foei.core.FoeiProcess; import com.idcanet.foei.core.FoeiProcessFactory; import com.idcanet.x4o.element.AbstractElementParameterHandler; @@ -52,6 +53,10 @@ public class IdAttributeHandler extends AbstractElementParameterHandler { //logger.finest("Generated auto id: "+parameterValue); } FoeiProcess process = FoeiProcessFactory.getFoeiProcess(); - process.addEventObject(element.getElementObject(),parameterValue); + try { + process.addEventObject(element.getElementObject(),parameterValue); + } catch (FoeiBindingException e) { + throw new ElementConfiguratorException(this,e.getMessage(),e); + } } } diff --git a/src/main/java/com/idcanet/foei/core/x4o/ObjectBindingElement.java b/src/main/java/com/idcanet/foei/core/x4o/ObjectBindingElement.java index b58544c..d5a819e 100644 --- a/src/main/java/com/idcanet/foei/core/x4o/ObjectBindingElement.java +++ b/src/main/java/com/idcanet/foei/core/x4o/ObjectBindingElement.java @@ -53,7 +53,7 @@ public class ObjectBindingElement extends AbstractElement { * Do the element */ @Override - public void doElementStart() throws ElementException { + public void doElementRun() throws ElementException { Map attributes = getAttributes(); diff --git a/src/main/java/com/idcanet/foei/ee/jca/cci/EJBFoeiProcessListener.java b/src/main/java/com/idcanet/foei/ee/jca/cci/EJBFoeiProcessListener.java index 1b48918..38c3fff 100644 --- a/src/main/java/com/idcanet/foei/ee/jca/cci/EJBFoeiProcessListener.java +++ b/src/main/java/com/idcanet/foei/ee/jca/cci/EJBFoeiProcessListener.java @@ -28,6 +28,7 @@ package com.idcanet.foei.ee.jca.cci; import javax.resource.spi.endpoint.MessageEndpointFactory; +import com.idcanet.foei.core.FoeiBindingException; import com.idcanet.foei.core.FoeiProcess; import com.idcanet.foei.core.FoeiProcessListener; import com.idcanet.foei.ee.jca.spi.FoeiActivationSpec; @@ -71,7 +72,12 @@ public class EJBFoeiProcessListener implements FoeiProcessListener { FoeiEventWrapper wrapper = new FoeiEventWrapper(endpointFactory,process); // inject bean - process.addEventObject(wrapper, foeiActivationSpec.getFoeiBeanName()); + try { + process.addEventObject(wrapper, foeiActivationSpec.getFoeiBeanName()); + } catch (FoeiBindingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } } diff --git a/src/main/resources/META-INF/foei-events.eld b/src/main/resources/META-INF/foei-events.eld index 4ffc61b..dc8c935 100644 --- a/src/main/resources/META-INF/foei-events.eld +++ b/src/main/resources/META-INF/foei-events.eld @@ -24,6 +24,6 @@ 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. --> - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/resources/META-INF/foei-filters.eld b/src/main/resources/META-INF/foei-filters.eld index 17acc49..7adb021 100644 --- a/src/main/resources/META-INF/foei-filters.eld +++ b/src/main/resources/META-INF/foei-filters.eld @@ -24,11 +24,11 @@ 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. --> - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/resources/META-INF/foei-io.eld b/src/main/resources/META-INF/foei-io.eld index 47f0cb0..1b1396f 100644 --- a/src/main/resources/META-INF/foei-io.eld +++ b/src/main/resources/META-INF/foei-io.eld @@ -24,10 +24,10 @@ 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. --> - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/resources/META-INF/foei-lang.eld b/src/main/resources/META-INF/foei-lang.eld index ab144aa..b407d3b 100644 --- a/src/main/resources/META-INF/foei-lang.eld +++ b/src/main/resources/META-INF/foei-lang.eld @@ -24,8 +24,12 @@ 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. --> - - + + + + Fake root tag + + @@ -41,4 +45,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/resources/META-INF/foei-logging.eld b/src/main/resources/META-INF/foei-logging.eld index 896ae95..80c8017 100644 --- a/src/main/resources/META-INF/foei-logging.eld +++ b/src/main/resources/META-INF/foei-logging.eld @@ -24,6 +24,6 @@ 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. --> - + - + diff --git a/src/main/resources/META-INF/foei-printers.eld b/src/main/resources/META-INF/foei-printers.eld index b2d541e..1d17261 100644 --- a/src/main/resources/META-INF/foei-printers.eld +++ b/src/main/resources/META-INF/foei-printers.eld @@ -24,9 +24,9 @@ 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. --> - + - \ No newline at end of file + \ No newline at end of file