Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelPartnerLinksState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelPartnerLinksState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelPartnerLinksState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelPartnerLinksState.java Thu Sep 14 16:28:01 2006 @@ -18,59 +18,64 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.PartnerLink; +import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.fsa.ParseContext; import org.apache.ode.sax.fsa.ParseException; import org.apache.ode.sax.fsa.State; import org.apache.ode.sax.fsa.StateFactory; -import org.apache.ode.sax.evt.StartElement; import java.util.ArrayList; import java.util.Iterator; class BpelPartnerLinksState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private ArrayList<PartnerLink> _plinks; - - private BpelPartnerLinksState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - _plinks = new ArrayList<PartnerLink>(); - } - - public Iterator<PartnerLink> getPartnerLinks() { - return _plinks.iterator(); - } - - /** - * @see org.apache.ode.sax.fsa.State#handleChildCompleted(org.apache.ode.sax.fsa.State) - */ - public void handleChildCompleted(State pn) throws ParseException { - if (pn.getType() == BPEL_PARTNERLINK) { - _plinks.add(((BpelPartnerLinkState)pn).getPartnerLink()); - } else { - super.handleChildCompleted(pn); - } - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_PARTNERLINKS; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelPartnerLinksState(se,pc); + private static final StateFactory _factory = new Factory(); + private ArrayList<PartnerLink> _plinks; + + private BpelPartnerLinksState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + _plinks = new ArrayList<PartnerLink>(); + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + return null; + } + + public Iterator<PartnerLink> getPartnerLinks() { + return _plinks.iterator(); + } + + /** + * @see org.apache.ode.sax.fsa.State#handleChildCompleted(org.apache.ode.sax.fsa.State) + */ + public void handleChildCompleted(State pn) throws ParseException { + if (pn.getType() == BPEL_PARTNERLINK) { + _plinks.add(((BpelPartnerLinkState)pn).getPartnerLink()); + } else { + super.handleChildCompleted(pn); + } + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_PARTNERLINKS; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelPartnerLinksState(se,pc); + } } - } }
Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelProcessState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelProcessState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelProcessState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelProcessState.java Thu Sep 14 16:28:01 2006 @@ -18,6 +18,7 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.CorrelationSet; import org.apache.ode.bom.api.OnAlarm; import org.apache.ode.bom.api.OnEvent; @@ -52,7 +53,26 @@ private Process _process; BpelProcessState(StartElement se, ParseContext pc) throws ParseException { - super(pc); + super(se, pc); + XmlAttributes atts = se.getAttributes(); + /* + * NOTE: Xerces automatically fills in the default value of the attribute for us, + * in this case "no" for enableInstanceCompensation and abstractProcess. Thus, + * we can't warn if it's present because we don't know if the user or the parser + * put it in... + */ + if (atts.hasAtt("enableInstanceCompensation") && checkYesNo(atts.getValue("enableInstanceCompensation"))) { + pc.parseError(ParseError.WARNING,se, + "","Instance compensation is not well-defined; it will not be used at runtime."); + } + if (atts.hasAtt("abstractProcess") && checkYesNo(atts.getValue("abstractProcess"))) { + pc.parseError(ParseError.FATAL,se, + "","ODE does not support the parsing or compilation of abstract processes."); + // TODO: Get a real error key. + } + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { XmlAttributes atts = se.getAttributes(); String name = atts.getValue("name"); String tns = atts.getValue("targetNamespace"); @@ -74,21 +94,7 @@ if (atts.hasAtt("expressionLanguage")) { _process.setExpressionLanguage(atts.getValue("expressionLanguage")); } - /* - * NOTE: Xerces automatically fills in the default value of the attribute for us, - * in this case "no" for enableInstanceCompensation and abstractProcess. Thus, - * we can't warn if it's present because we don't know if the user or the parser - * put it in... - */ - if (atts.hasAtt("enableInstanceCompensation") && checkYesNo(atts.getValue("enableInstanceCompensation"))) { - pc.parseError(ParseError.WARNING,se, - "","Instance compensation is not well-defined; it will not be used at runtime."); - } - if (atts.hasAtt("abstractProcess") && checkYesNo(atts.getValue("abstractProcess"))) { - pc.parseError(ParseError.FATAL,se, - "","ODE does not support the parsing or compilation of abstract processes."); - // TODO: Get a real error key. - } + return _process; } /** Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelQueryState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelQueryState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelQueryState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelQueryState.java Thu Sep 14 16:28:01 2006 @@ -18,67 +18,75 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.Query; import org.apache.ode.bom.impl.nodes.ExpressionImpl; -import org.apache.ode.sax.fsa.*; import org.apache.ode.sax.evt.SaxEvent; import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.evt.XmlAttributes; +import org.apache.ode.sax.fsa.DOMGenerator; +import org.apache.ode.sax.fsa.ParseContext; +import org.apache.ode.sax.fsa.ParseException; +import org.apache.ode.sax.fsa.State; +import org.apache.ode.sax.fsa.StateFactory; class BpelQueryState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private ExpressionImpl _expr; - private DOMGenerator _domGenerator; - - BpelQueryState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - - XmlAttributes attr = se.getAttributes(); - if(attr.hasAtt("queryLanguage")){ - _expr = new ExpressionImpl(attr.getValue("queryLanguage")); - }else{ - _expr = new ExpressionImpl(); - } - _expr.setNamespaceContext(se.getNamespaceContext()); - _domGenerator = new DOMGenerator(); - } - - Query getQuery(){ - return _expr; - } - - /** - * @see org.apache.ode.sax.fsa.State#handleSaxEvent(org.apache.ode.sax.evt.SaxEvent) - */ - public void handleSaxEvent(SaxEvent se) throws ParseException { - _domGenerator.handleSaxEvent(se); - } - /** - * @see org.apache.ode.sax.fsa.State#done() - */ - public void done(){ - _expr.setNode(_domGenerator.getRoot()); - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_QUERY; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelQueryState(se,pc); + private static final StateFactory _factory = new Factory(); + private ExpressionImpl _expr; + private DOMGenerator _domGenerator; + + BpelQueryState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + XmlAttributes attr = se.getAttributes(); + if(attr.hasAtt("queryLanguage")){ + _expr = new ExpressionImpl(attr.getValue("queryLanguage")); + }else{ + _expr = new ExpressionImpl(); + } + _expr.setNamespaceContext(se.getNamespaceContext()); + _domGenerator = new DOMGenerator(); + return _expr; + } + + Query getQuery(){ + return _expr; + } + + /** + * @see org.apache.ode.sax.fsa.State#handleSaxEvent(org.apache.ode.sax.evt.SaxEvent) + */ + public void handleSaxEvent(SaxEvent se) throws ParseException { + _domGenerator.handleSaxEvent(se); + } + /** + * @see org.apache.ode.sax.fsa.State#done() + */ + public void done(){ + _expr.setNode(_domGenerator.getRoot()); + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_QUERY; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelQueryState(se,pc); + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelSwitchActivityState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelSwitchActivityState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelSwitchActivityState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelSwitchActivityState.java Thu Sep 14 16:28:01 2006 @@ -19,147 +19,152 @@ package org.apache.ode.sax.fsa.bpel_2_0; import org.apache.ode.bom.api.Activity; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.Expression; import org.apache.ode.bom.impl.nodes.SwitchActivityImpl; +import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.fsa.ParseContext; import org.apache.ode.sax.fsa.ParseException; import org.apache.ode.sax.fsa.State; import org.apache.ode.sax.fsa.StateFactory; -import org.apache.ode.sax.evt.StartElement; class BpelSwitchActivityState extends BpelBaseActivityState { - private static final StateFactory _factory = new Factory(); - - BpelSwitchActivityState(StartElement se, ParseContext pc) throws ParseException { - super(se,pc); - } - - protected Activity createActivity(StartElement se) { - return new SwitchActivityImpl(); - } - - public void handleChildCompleted(State pn) throws ParseException { - if (pn.getType() == BPEL_CASE) { - CaseState c = (CaseState)pn; - ((SwitchActivityImpl)getActivity()).addCase(c.getExpression(),c.getActivity()); - } else if (pn.getType() == BPEL_OTHERWISE){ - ((SwitchActivityImpl)getActivity()).addCase( - null,((OtherwiseState)pn).getActivity()); - } else { - super.handleChildCompleted(pn); - } - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_SWITCH; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelSwitchActivityState(se,pc); - } - } - - static class CaseState extends OtherwiseState { - private static final StateFactory _factory = new Factory(); - - private Expression _e; - - CaseState(StartElement se, ParseContext pc) throws ParseException { - super(se,pc); - } - - public void handleChildCompleted(State pn) throws ParseException { - switch (pn.getType()) { - case BPEL_EXPRESSION: - _e = ((BpelExpressionState)pn).getExpression(); - break; - default: - super.handleChildCompleted(pn); - } - } - - public Expression getExpression() { - return _e; - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_CASE; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new CaseState(se,pc); - } + BpelSwitchActivityState(StartElement se, ParseContext pc) throws ParseException { + super(se,pc); } - } - - static class OtherwiseState extends BaseBpelState { - - private static final StateFactory _factory = new Factory(); - private Activity _a; - - OtherwiseState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - // Do nothing in this case. + protected Activity createActivity(StartElement se) { + return new SwitchActivityImpl(); } - + public void handleChildCompleted(State pn) throws ParseException { - if (pn instanceof ActivityStateI) { - _a = ((ActivityStateI)pn).getActivity(); - } else { - super.handleChildCompleted(pn); - } - } - - public Activity getActivity() { - return _a; + if (pn.getType() == BPEL_CASE) { + CaseState c = (CaseState)pn; + ((SwitchActivityImpl)getActivity()).addCase(c.getExpression(),c.getActivity()); + } else if (pn.getType() == BPEL_OTHERWISE){ + ((SwitchActivityImpl)getActivity()).addCase( + null,((OtherwiseState)pn).getActivity()); + } else { + super.handleChildCompleted(pn); + } } /** * @see org.apache.ode.sax.fsa.State#getFactory() */ public StateFactory getFactory() { - return _factory; + return _factory; } /** * @see org.apache.ode.sax.fsa.State#getType() */ public int getType() { - return BPEL_OTHERWISE; + return BPEL_SWITCH; } - + static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new OtherwiseState(se,pc); - } + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelSwitchActivityState(se,pc); + } + } + + static class CaseState extends OtherwiseState { + + private static final StateFactory _factory = new Factory(); + + private Expression _e; + + CaseState(StartElement se, ParseContext pc) throws ParseException { + super(se,pc); + } + + public void handleChildCompleted(State pn) throws ParseException { + switch (pn.getType()) { + case BPEL_EXPRESSION: + _e = ((BpelExpressionState)pn).getExpression(); + break; + default: + super.handleChildCompleted(pn); + } + } + + public Expression getExpression() { + return _e; + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_CASE; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new CaseState(se,pc); + } + } + + } + + static class OtherwiseState extends BaseBpelState { + + private static final StateFactory _factory = new Factory(); + private Activity _a; + + OtherwiseState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + // Do nothing in this case. + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + return null; + } + + public void handleChildCompleted(State pn) throws ParseException { + if (pn instanceof ActivityStateI) { + _a = ((ActivityStateI)pn).getActivity(); + } else { + super.handleChildCompleted(pn); + } + } + + public Activity getActivity() { + return _a; + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_OTHERWISE; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new OtherwiseState(se,pc); + } + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelTerminationHandlerState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelTerminationHandlerState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelTerminationHandlerState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelTerminationHandlerState.java Thu Sep 14 16:28:01 2006 @@ -18,55 +18,60 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.TerminationHandler; import org.apache.ode.bom.impl.nodes.TerminationHandlerImpl; +import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.fsa.ParseContext; import org.apache.ode.sax.fsa.ParseException; import org.apache.ode.sax.fsa.State; import org.apache.ode.sax.fsa.StateFactory; -import org.apache.ode.sax.evt.StartElement; class BpelTerminationHandlerState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private TerminationHandlerImpl _th; - - BpelTerminationHandlerState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - _th = new TerminationHandlerImpl(se.getNamespaceContext()); - _th.setLineNo(se.getLocation().getLineNumber()); - } - - public void handleChildCompleted(State pn) throws ParseException { - if (pn instanceof ActivityStateI) { - _th.setActivity(((ActivityStateI)pn).getActivity()); - } else { - super.handleChildCompleted(pn); - } - } - - public TerminationHandler getTerminationHandler() { - return _th; - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_TERMINATIONHANDLER; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelTerminationHandlerState(se,pc); + private static final StateFactory _factory = new Factory(); + private TerminationHandlerImpl _th; + + BpelTerminationHandlerState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + _th = new TerminationHandlerImpl(se.getNamespaceContext()); + _th.setLineNo(se.getLocation().getLineNumber()); + return _th; + } + + public void handleChildCompleted(State pn) throws ParseException { + if (pn instanceof ActivityStateI) { + _th.setActivity(((ActivityStateI)pn).getActivity()); + } else { + super.handleChildCompleted(pn); + } + } + + public TerminationHandler getTerminationHandler() { + return _th; + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_TERMINATIONHANDLER; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelTerminationHandlerState(se,pc); + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelToState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelToState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelToState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelToState.java Thu Sep 14 16:28:01 2006 @@ -18,117 +18,126 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.To; -import org.apache.ode.bom.impl.nodes.*; -import org.apache.ode.sax.fsa.*; +import org.apache.ode.bom.impl.nodes.ExpressionImpl; +import org.apache.ode.bom.impl.nodes.ExpressionValImpl; +import org.apache.ode.bom.impl.nodes.PartnerLinkValImpl; +import org.apache.ode.bom.impl.nodes.PropertyValImpl; +import org.apache.ode.bom.impl.nodes.VariableValImpl; import org.apache.ode.sax.evt.SaxEvent; import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.evt.XmlAttributes; import org.apache.ode.sax.evt.attspec.FilterSpec; import org.apache.ode.sax.evt.attspec.XmlAttributeSpec; +import org.apache.ode.sax.fsa.DOMGenerator; +import org.apache.ode.sax.fsa.ParseContext; +import org.apache.ode.sax.fsa.ParseError; +import org.apache.ode.sax.fsa.ParseException; +import org.apache.ode.sax.fsa.State; +import org.apache.ode.sax.fsa.StateFactory; class BpelToState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private To _t; - - private XmlAttributeSpec PLINK = new FilterSpec( - new String[] {"partnerLink"},new String[] {}); - - private XmlAttributeSpec VAR = new FilterSpec( - new String[] {"variable"}, - new String[] {"part"}); - - private XmlAttributeSpec VAR_PROP = new FilterSpec( - new String[] {"variable","property"},new String[] {}); - - private StartElement _se; - private String _queryLanguage; - private DOMGenerator _domBuilder; - private ExpressionImpl _expr; - - BpelToState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - _se = se; - XmlAttributes atts = se.getAttributes(); - - _queryLanguage = atts.getValue("queryLanguage"); - - if (VAR_PROP.matches(atts)) { - PropertyValImpl pvi = new PropertyValImpl(se.getNamespaceContext()); - pvi.setLineNo(se.getLocation().getLineNumber()); - pvi.setVariable(atts.getValue("variable")); - pvi.setProperty(se.getNamespaceContext().derefQName(atts.getValue("property"))); - _t = pvi; - } if (VAR.matches(atts)) { - VariableValImpl vvi = new VariableValImpl(); - vvi.setLineNo(se.getLocation().getLineNumber()); - vvi.setVariable(atts.getValue("variable")); - vvi.setPart(atts.getValue("part")); - _t = vvi; - } else if (PLINK.matches(atts)) { - PartnerLinkValImpl pvi = new PartnerLinkValImpl(); - pvi.setLineNo(se.getLocation().getLineNumber()); - pvi.setPartnerLink(atts.getValue("partnerLink")); - _t = pvi; - } else { - if (_queryLanguage != null) - _expr = new ExpressionImpl(_queryLanguage); - else - _expr = new ExpressionImpl(); - - _expr.setNamespaceContext(_se.getNamespaceContext()); - _expr.setLineNo(_se.getLocation().getLineNumber()); - _domBuilder = new DOMGenerator(); - } - } - - /** - * @see org.apache.ode.sax.fsa.State#handleSaxEvent(org.apache.ode.sax.evt.SaxEvent) - */ - public void handleSaxEvent(SaxEvent se) throws ParseException { - if (_domBuilder == null) { - getParseContext().parseError(ParseError.ERROR,se,"","Unexpected content in the <to> element."); - assert false; - } - _domBuilder.handleSaxEvent(se); - } - - /** - * @see org.apache.ode.sax.fsa.State#done() - */ - public void done(){ - if(_domBuilder != null && _t == null){ - _expr.setNode(_domBuilder.getRoot()); - ExpressionValImpl evi = new ExpressionValImpl(_expr.getNamespaceContext()); - evi.setExpression(_expr); - _t = evi; - } - } - - - public To getTo() { - return _t; - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_TO; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelToState(se,pc); + private static final StateFactory _factory = new Factory(); + private To _t; + + private StartElement _se; + private String _queryLanguage; + private DOMGenerator _domBuilder; + private ExpressionImpl _expr; + + BpelToState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + XmlAttributeSpec PLINK = new FilterSpec(new String[] {"partnerLink"},new String[] {}); + XmlAttributeSpec VAR = new FilterSpec(new String[] {"variable"}, new String[] {"part"}); + XmlAttributeSpec VAR_PROP = new FilterSpec(new String[] {"variable","property"},new String[] {}); + + _se = se; + XmlAttributes atts = se.getAttributes(); + + _queryLanguage = atts.getValue("queryLanguage"); + + if (VAR_PROP.matches(atts)) { + PropertyValImpl pvi = new PropertyValImpl(se.getNamespaceContext()); + pvi.setLineNo(se.getLocation().getLineNumber()); + pvi.setVariable(atts.getValue("variable")); + pvi.setProperty(se.getNamespaceContext().derefQName(atts.getValue("property"))); + _t = pvi; + } + if (VAR.matches(atts)) { + VariableValImpl vvi = new VariableValImpl(); + vvi.setLineNo(se.getLocation().getLineNumber()); + vvi.setVariable(atts.getValue("variable")); + vvi.setPart(atts.getValue("part")); + _t = vvi; + } else if (PLINK.matches(atts)) { + PartnerLinkValImpl pvi = new PartnerLinkValImpl(); + pvi.setLineNo(se.getLocation().getLineNumber()); + pvi.setPartnerLink(atts.getValue("partnerLink")); + _t = pvi; + } else { + if (_queryLanguage != null) + _expr = new ExpressionImpl(_queryLanguage); + else + _expr = new ExpressionImpl(); + + _expr.setNamespaceContext(_se.getNamespaceContext()); + _expr.setLineNo(_se.getLocation().getLineNumber()); + _domBuilder = new DOMGenerator(); + } + return _t; + } + + /** + * @see org.apache.ode.sax.fsa.State#handleSaxEvent(org.apache.ode.sax.evt.SaxEvent) + */ + public void handleSaxEvent(SaxEvent se) throws ParseException { + if (_domBuilder == null) { + getParseContext().parseError(ParseError.ERROR,se,"","Unexpected content in the <to> element."); + assert false; + } + _domBuilder.handleSaxEvent(se); + } + + /** + * @see org.apache.ode.sax.fsa.State#done() + */ + public void done(){ + if(_domBuilder != null && _t == null){ + _expr.setNode(_domBuilder.getRoot()); + ExpressionValImpl evi = new ExpressionValImpl(_expr.getNamespaceContext()); + evi.setExpression(_expr); + _t = evi; + } + } + + + public To getTo() { + return _t; + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_TO; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelToState(se,pc); + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariableState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariableState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariableState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariableState.java Thu Sep 14 16:28:01 2006 @@ -18,76 +18,86 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.Variable; import org.apache.ode.bom.impl.nodes.VariableImpl; -import org.apache.ode.sax.fsa.*; import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.evt.XmlAttributes; import org.apache.ode.sax.evt.attspec.FilterSpec; import org.apache.ode.sax.evt.attspec.OrSpec; import org.apache.ode.sax.evt.attspec.XmlAttributeSpec; +import org.apache.ode.sax.fsa.ParseContext; +import org.apache.ode.sax.fsa.ParseError; +import org.apache.ode.sax.fsa.ParseException; +import org.apache.ode.sax.fsa.State; +import org.apache.ode.sax.fsa.StateFactory; class BpelVariableState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private VariableImpl _v; - - private static final XmlAttributeSpec MESSAGETYPE = new FilterSpec( - new String[] {"name","messageType"}, - new String[] {}); - private static final XmlAttributeSpec ELEMENTTYPE = new FilterSpec( - new String[] {"name","element"}, - new String[] {}); - private static final XmlAttributeSpec TYPE = new FilterSpec( - new String[] {"name","type"}, - new String[] {}); - - private static final XmlAttributeSpec VALID = new OrSpec(MESSAGETYPE, - new OrSpec(TYPE,ELEMENTTYPE)); - - BpelVariableState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - XmlAttributes atts = se.getAttributes(); - if (!VALID.matches(atts)){ - getParseContext().parseError(ParseError.ERROR,se,"", - "Invalid attributes on variable declaration."); - } - _v = new VariableImpl(); - _v.setNamespaceContext(se.getNamespaceContext()); - _v.setLineNo(se.getLocation().getLineNumber()); - _v.setName(atts.getValue("name")); - if (MESSAGETYPE.matches(atts)) { - _v.setMessageType(se.getNamespaceContext().derefQName(atts.getValue("messageType"))); - } else if (TYPE.matches(atts)) { - _v.setSchemaType(se.getNamespaceContext().derefQName(atts.getValue("type"))); - } else if (ELEMENTTYPE.matches(atts)) { - _v.setElementType(se.getNamespaceContext().derefQName(atts.getValue("element"))); - } - } - - public Variable getVariable() { - return _v; - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_VARIABLE; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelVariableState(se,pc); + private static final StateFactory _factory = new Factory(); + private VariableImpl _v; + + private static final XmlAttributeSpec MESSAGETYPE = new FilterSpec( + new String[] {"name","messageType"}, + new String[] {}); + private static final XmlAttributeSpec ELEMENTTYPE = new FilterSpec( + new String[] {"name","element"}, + new String[] {}); + private static final XmlAttributeSpec TYPE = new FilterSpec( + new String[] {"name","type"}, + new String[] {}); + + private static final XmlAttributeSpec VALID = new OrSpec(MESSAGETYPE, + new OrSpec(TYPE,ELEMENTTYPE)); + + BpelVariableState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + XmlAttributes atts = se.getAttributes(); + if (!VALID.matches(atts)){ + getParseContext().parseError(ParseError.ERROR,se,"", + "Invalid attributes on variable declaration."); + } + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + XmlAttributes atts = se.getAttributes(); + _v = new VariableImpl(); + _v.setNamespaceContext(se.getNamespaceContext()); + _v.setLineNo(se.getLocation().getLineNumber()); + _v.setName(atts.getValue("name")); + if (MESSAGETYPE.matches(atts)) { + _v.setMessageType(se.getNamespaceContext().derefQName(atts.getValue("messageType"))); + } else if (TYPE.matches(atts)) { + _v.setSchemaType(se.getNamespaceContext().derefQName(atts.getValue("type"))); + } else if (ELEMENTTYPE.matches(atts)) { + _v.setElementType(se.getNamespaceContext().derefQName(atts.getValue("element"))); + } + return _v; + } + + public Variable getVariable() { + return _v; + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_VARIABLE; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelVariableState(se,pc); + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariablesState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariablesState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariablesState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/BpelVariablesState.java Thu Sep 14 16:28:01 2006 @@ -18,59 +18,64 @@ */ package org.apache.ode.sax.fsa.bpel_2_0; +import org.apache.ode.bom.api.BpelObject; import org.apache.ode.bom.api.Variable; +import org.apache.ode.sax.evt.StartElement; import org.apache.ode.sax.fsa.ParseContext; import org.apache.ode.sax.fsa.ParseException; import org.apache.ode.sax.fsa.State; import org.apache.ode.sax.fsa.StateFactory; -import org.apache.ode.sax.evt.StartElement; import java.util.ArrayList; import java.util.Iterator; class BpelVariablesState extends BaseBpelState { - private static final StateFactory _factory = new Factory(); - private ArrayList<Variable> _vars; - - private BpelVariablesState(StartElement se, ParseContext pc) throws ParseException { - super(pc); - _vars = new ArrayList<Variable>(); - } - - public Iterator<Variable> getVariables() { - return _vars.iterator(); - } - - /** - * @see org.apache.ode.sax.fsa.State#handleChildCompleted(org.apache.ode.sax.fsa.State) - */ - public void handleChildCompleted(State pn) throws ParseException { - if (pn.getType() == BPEL_VARIABLE) { - _vars.add(((BpelVariableState)pn).getVariable()); - } else { - super.handleChildCompleted(pn); - } - } - - /** - * @see org.apache.ode.sax.fsa.State#getFactory() - */ - public StateFactory getFactory() { - return _factory; - } - - /** - * @see org.apache.ode.sax.fsa.State#getType() - */ - public int getType() { - return BPEL_VARIABLES; - } - - static class Factory implements StateFactory { - - public State newInstance(StartElement se, ParseContext pc) throws ParseException { - return new BpelVariablesState(se,pc); + private static final StateFactory _factory = new Factory(); + private ArrayList<Variable> _vars; + + private BpelVariablesState(StartElement se, ParseContext pc) throws ParseException { + super(se, pc); + _vars = new ArrayList<Variable>(); + } + + protected BpelObject createBpelObject(StartElement se) throws ParseException { + return null; + } + + public Iterator<Variable> getVariables() { + return _vars.iterator(); + } + + /** + * @see org.apache.ode.sax.fsa.State#handleChildCompleted(org.apache.ode.sax.fsa.State) + */ + public void handleChildCompleted(State pn) throws ParseException { + if (pn.getType() == BPEL_VARIABLE) { + _vars.add(((BpelVariableState)pn).getVariable()); + } else { + super.handleChildCompleted(pn); + } + } + + /** + * @see org.apache.ode.sax.fsa.State#getFactory() + */ + public StateFactory getFactory() { + return _factory; + } + + /** + * @see org.apache.ode.sax.fsa.State#getType() + */ + public int getType() { + return BPEL_VARIABLES; + } + + static class Factory implements StateFactory { + + public State newInstance(StartElement se, ParseContext pc) throws ParseException { + return new BpelVariablesState(se,pc); + } } - } } Modified: incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/ExtensibilityBucketState.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/ExtensibilityBucketState.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/ExtensibilityBucketState.java (original) +++ incubator/ode/trunk/bpel-parser/src/main/java/org/apache/ode/sax/fsa/bpel_2_0/ExtensibilityBucketState.java Thu Sep 14 16:28:01 2006 @@ -20,17 +20,14 @@ import org.apache.ode.sax.evt.SaxEvent; import org.apache.ode.sax.evt.StartElement; -import org.apache.ode.sax.evt.EndElement; import org.apache.ode.sax.fsa.AbstractState; import org.apache.ode.sax.fsa.DOMGenerator; import org.apache.ode.sax.fsa.ParseContext; import org.apache.ode.sax.fsa.ParseException; import org.apache.ode.sax.fsa.State; import org.apache.ode.sax.fsa.StateFactory; -import org.apache.ode.utils.DOMUtils; -import org.w3c.dom.Node; -import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import javax.xml.namespace.QName; @@ -77,15 +74,6 @@ Node root = _domGenerator.getRoot(); if (root instanceof Element) _extensibility = (Element) _domGenerator.getRoot(); -/* -- - if (_domGenerator.getRoot() != null) { - Document doc = DOMUtils.newDocument(); - Element root = doc.createElementNS(_elementQName.getNamespaceURI(), _elementQName.getLocalPart()); - root.appendChild(doc.importNode(_domGenerator.getRoot(), true)); - doc.appendChild(root); - _extensibility = root; - } -*/ } public StateFactory getFactory() { Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?view=diff&rev=443516&r1=443515&r2=443516 ============================================================================== --- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java (original) +++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java Thu Sep 14 16:28:01 2006 @@ -385,10 +385,19 @@ for (int aid : aids) { OBase obase = oprocess.getChild(aid); if (obase != null && obase.debugInfo != null && obase.debugInfo.extensibilityElements != null) { - for (Map.Entry<QName, Element> entry : obase.debugInfo.extensibilityElements.entrySet()) { + for (Map.Entry<QName, Object> entry : obase.debugInfo.extensibilityElements.entrySet()) { TActivityExtInfo taei = taeil.addNewActivityExtInfo(); taei.setAiid(""+aid); - taei.getDomNode().appendChild(taei.getDomNode().getOwnerDocument().importNode(entry.getValue(), true)); + Object extValue = entry.getValue(); + if (extValue instanceof Element) + taei.getDomNode().appendChild(taei.getDomNode() + .getOwnerDocument().importNode((Element) extValue, true)); + else if (extValue instanceof String) { + Element valueElmt = taei.getDomNode().getOwnerDocument().createElementNS( + entry.getKey().getNamespaceURI(), entry.getKey().getLocalPart()); + valueElmt.appendChild(taei.getDomNode().getOwnerDocument().createTextNode((String) extValue)); + taei.getDomNode().appendChild(valueElmt); + } } } }
