From 2ed987361cde39110207523ffc05d6a79ba028df Mon Sep 17 00:00:00 2001 From: willemc Date: Mon, 13 Apr 2009 19:17:55 +0200 Subject: [PATCH] [svn r378] updated x4o --- .../core/impl/FoeiEventBindingRuleHandler.java | 4 ++-- .../idcanet/foei/core/impl/X2OExecutorImpl.java | 16 ++++++++++++++-- .../foei/core/x4o/BindAttributeHandler.java | 5 +++-- .../foei/core/x4o/EventStepBindRuleHandler.java | 4 ++-- .../foei/core/x4o/IdAttributeHandler.java | 4 ++-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/idcanet/foei/core/impl/FoeiEventBindingRuleHandler.java b/src/main/java/com/idcanet/foei/core/impl/FoeiEventBindingRuleHandler.java index 29a8daf..4971889 100644 --- a/src/main/java/com/idcanet/foei/core/impl/FoeiEventBindingRuleHandler.java +++ b/src/main/java/com/idcanet/foei/core/impl/FoeiEventBindingRuleHandler.java @@ -6,9 +6,9 @@ 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.ElementBindingException; -import com.idcanet.x4o.element.ElementBindingHandler; /** * @@ -17,7 +17,7 @@ import com.idcanet.x4o.element.ElementBindingHandler; * @author Willem Cazander * @version 1.0 Feb 24, 2006 */ -public class FoeiEventBindingRuleHandler implements ElementBindingHandler { +public class FoeiEventBindingRuleHandler extends AbstractElementBindingHandler { /** * 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 322367b..f83e783 100644 --- a/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java +++ b/src/main/java/com/idcanet/foei/core/impl/X2OExecutorImpl.java @@ -29,7 +29,15 @@ 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; @@ -67,8 +75,12 @@ public class X2OExecutorImpl implements X2OExecutor { // config parser FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess(); X4OParser parser = new X4OParser("foei"); - parser.preStart(); - parser.getElementContext().getProperties().putAll(foeiProcess.getFoeiContext().getStartProperties()); + + for (String key:foeiProcess.getFoeiContext().getStartProperties().keySet()) { + String value = foeiProcess.getFoeiContext().getStartProperties().get(key); + parser.setProperty(key, value); + } + logger.info("Executing X2O Parsing."); diff --git a/src/main/java/com/idcanet/foei/core/x4o/BindAttributeHandler.java b/src/main/java/com/idcanet/foei/core/x4o/BindAttributeHandler.java index 1cfd52b..e954d38 100644 --- a/src/main/java/com/idcanet/foei/core/x4o/BindAttributeHandler.java +++ b/src/main/java/com/idcanet/foei/core/x4o/BindAttributeHandler.java @@ -33,6 +33,7 @@ import com.idcanet.foei.event.EventOutput; import com.idcanet.foei.event.EventPort; import com.idcanet.x4o.element.AbstractElementParameterHandler; import com.idcanet.x4o.element.Element; +import com.idcanet.x4o.element.ElementConfiguratorException; import com.idcanet.x4o.element.ElementException; /** @@ -47,7 +48,7 @@ public class BindAttributeHandler extends AbstractElementParameterHandler { * @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String) */ @Override - public void doParameterStartTag(Element element) throws ElementException { + public void doConfigElement(Element element) throws ElementConfiguratorException { String parameterValue = element.getAttributes().get(getParameterName()); String[] port = parameterValue.split(":"); if(port.length!=2) { @@ -77,7 +78,7 @@ public class BindAttributeHandler extends AbstractElementParameterHandler { foei.addBinding(outputEventPort,inputEventPort); } catch (Exception e) { - e.printStackTrace(); + throw new ElementConfiguratorException(this,e.getMessage(),e); } } } diff --git a/src/main/java/com/idcanet/foei/core/x4o/EventStepBindRuleHandler.java b/src/main/java/com/idcanet/foei/core/x4o/EventStepBindRuleHandler.java index 8c74253..f4a690f 100644 --- a/src/main/java/com/idcanet/foei/core/x4o/EventStepBindRuleHandler.java +++ b/src/main/java/com/idcanet/foei/core/x4o/EventStepBindRuleHandler.java @@ -28,9 +28,9 @@ 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.ElementBindingException; -import com.idcanet.x4o.element.ElementBindingHandler; /** * @@ -38,7 +38,7 @@ import com.idcanet.x4o.element.ElementBindingHandler; * @author Willem Cazander * @version 1.0 Apr 16, 2006 */ -public class EventStepBindRuleHandler implements ElementBindingHandler { +public class EventStepBindRuleHandler extends AbstractElementBindingHandler { /** * @see com.idca.foei.xml.x2o.eld.BindingRuleHandler#canBind(java.lang.Object, java.lang.Object) 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 0339532..aad5df7 100644 --- a/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java +++ b/src/main/java/com/idcanet/foei/core/x4o/IdAttributeHandler.java @@ -30,7 +30,7 @@ import com.idcanet.foei.core.FoeiProcess; import com.idcanet.foei.core.FoeiProcessFactory; import com.idcanet.x4o.element.AbstractElementParameterHandler; import com.idcanet.x4o.element.Element; -import com.idcanet.x4o.element.ElementException; +import com.idcanet.x4o.element.ElementConfiguratorException; /** * Handles the id @@ -44,7 +44,7 @@ public class IdAttributeHandler extends AbstractElementParameterHandler { * @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String) */ @Override - public void doParameterStartTag(Element element) throws ElementException { + public void doConfigElement(Element element) throws ElementConfiguratorException { // add to objext context String parameterValue = element.getAttributes().get(getParameterName()); if(element.getElementObject()==null | "".equals(parameterValue)) {