3
0
Fork 0

[svn r190] updated x4o

This commit is contained in:
willemc 2007-02-16 02:42:36 +01:00
parent 1fbd48d7c2
commit ca0b06add3
8 changed files with 6 additions and 294 deletions

Binary file not shown.

View file

@ -67,7 +67,7 @@ public class X2OExecutorImpl implements X2OExecutor {
// config parser // config parser
FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess(); FoeiProcess foeiProcess = FoeiProcessFactory.getFoeiProcess();
X4OParser parser = new X4OParser("foei"); X4OParser parser = new X4OParser("foei");
parser.getParsingContext().getProperties().putAll(foeiProcess.getFoeiContext().getStartProperties()); parser.getElementContext().getProperties().putAll(foeiProcess.getFoeiContext().getStartProperties());
logger.info("Executing X2O Parsing."); logger.info("Executing X2O Parsing.");

View file

@ -47,7 +47,8 @@ public class BindAttributeHandler extends AbstractElementParameterHandler {
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String) * @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String)
*/ */
@Override @Override
public void doParameterStartTag(Element element,String parameterValue) throws Exception { public void doParameterStartTag(Element element) throws Exception {
String parameterValue = element.getAttributes().get(getParameterName());
String[] port = parameterValue.split(":"); String[] port = parameterValue.split(":");
if(port.length!=2) { if(port.length!=2) {
return; return;

View file

@ -43,8 +43,9 @@ public class IdAttributeHandler extends AbstractElementParameterHandler {
* @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String) * @see com.idca.foei.xml.x2o.eld.GlobalParameterHandler#doParameter(java.lang.Object, java.lang.String)
*/ */
@Override @Override
public void doParameterStartTag(Element element,String parameterValue) throws Exception { public void doParameterStartTag(Element element) throws Exception {
// add to objext context // add to objext context
String parameterValue = element.getAttributes().get(getParameterName());
if(element.getElementObject()==null | "".equals(parameterValue)) { if(element.getElementObject()==null | "".equals(parameterValue)) {
parameterValue= "auto."+Integer.toHexString(element.getElementObject().hashCode()); parameterValue= "auto."+Integer.toHexString(element.getElementObject().hashCode());
//logger.finest("Generated auto id: "+parameterValue); //logger.finest("Generated auto id: "+parameterValue);

View file

@ -44,10 +44,6 @@ import org.xml.sax.Attributes;
*/ */
public class ObjectBindingElement extends AbstractElement { public class ObjectBindingElement extends AbstractElement {
/** The Object which is configed */
//private Object parentObject = null;
//private Object childObject = null;
private String outputID = null; private String outputID = null;
private String outputPort = null; private String outputPort = null;
private String inputID = null; private String inputID = null;
@ -82,69 +78,5 @@ public class ObjectBindingElement extends AbstractElement {
throw new ElementException("Could not find EventPort from outputPort"); throw new ElementException("Could not find EventPort from outputPort");
} }
foei.addBinding(outputEventPort,inputEventPort); foei.addBinding(outputEventPort,inputEventPort);
/*
if(outputID==null) {
//outputID = foei.getObjectConfigurator().getParameter(parentObject,"id").toString();
}
if(outputPort==null) {
if(parentObject instanceof EventOutput) {
EventOutput eventOutput = (EventOutput)parentObject;
if(eventOutput.getOutputPorts().size()>0) {
EventPort port = (EventPort)eventOutput.getOutputPorts().get(0);
outputPort = port.getName();
} else {
// no output ports
throw new ElementException("parentObject(EventOutput) is no output ports defined");
}
} else {
// np EventOutput ..
throw new ElementException("parentObject: "+parentObject+" is not an EventOutput");
} }
} }
*/
}
// HACK routines
/*
public String getOutputID() {
return outputID;
}
public String getOutputPort() {
return outputPort;
}
*/
public void doElementEnd() {
/*
FoeiProcess foei = FoeiProcessFactory.getFoeiProcess();
if(inputID!=null & inputPort!=null & outputID!=null & outputPort!=null) {
// Add binding
foei.addBinding()
foeiInstance.getObjectBindingsManager().addBinding(outputID,outputPort,inputID,inputPort);
} else {
System.err.println("Coudn't addbinding: inID="+inputID+" inPort="+inputPort+" outID="+outputID+" outPort="+outputPort);
}
*/
}
//------------------ ElementObject
/**
* Get the object this elements configs.
* @return The object this Element controlles
*/
/*
public Object getElementObject() {
return parentObject;
//return object;
}
public void setElementObject(Object object) {
// TODO: this is an quich hack see FoeiTagHandler
//this.object=object;
}
*/
}

View file

@ -1,88 +0,0 @@
/*
* 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 org.xml.sax.Attributes;
import com.idcanet.x4o.element.AbstractElement;
import com.idcanet.x4o.element.ElementException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Mar 2, 2006
*/
public class SetParameterElement extends AbstractElement {
/** The Object which is configed */
private Object object = null;
private Object eventObject = null;
private String parameterName = null;
private Object parameterValue = null;
public SetParameterElement() {
}
/**
* Do the element
*/
public void doElementStart(Attributes attributes) throws ElementException
{
// the EventObject for the parent element is also this its elementObject.
Object o = getParent().getElementObject();
/*
if(!(o instanceof EventObject)) {
throw new ElementException("parent ElementObject is not EventObject");
}
eventObject = (EventObject)o;
*/
parameterName = attributes.getValue("name");
parameterValue = attributes.getValue("value");
}
public void doElementEnd()
{
}
//------------------ ElementObject
/**
* Get the object this elements configs.
* @return The object this Element controlles
*/
public Object getElementObject() {
return object;
}
public void setElementObject(Object object) {
this.object=object;
}
}

View file

@ -1,68 +0,0 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.server.config;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import com.idcanet.x4o.xml.AbstractXMLParser;
import com.idcanet.x4o.xml.XMLHandler;
/**
* Parses the foei-config.xml file
*
*
* @author Willem Cazander
* @version 1.0 Jun 23, 2006
*/
public class FoeiConfigParser extends AbstractXMLParser {
/**
* Parsesn the input stream as a X2O document
*/
public void parse(InputStream inputStream) throws ParserConfigurationException,SAXException,IOException {
XMLHandler handler = new XMLHandler();
/*
X2OTagHandler xth = new X2OTagHandler(rootTag,parsingContext);
xth.setDebug(debug);
handler.addXMLTagHandler(xth);
*/
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(inputStream,handler);
}
}

View file

@ -1,66 +0,0 @@
/*
* Copyright 2004-2006 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.foei.server.config;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import com.idcanet.x4o.xml.AbstractXMLTagHandler;
/**
*
*
*
* @author Willem Cazander
* @version 1.0 Jun 23, 2006
*/
public class FoeiContextXMLTagHandler extends AbstractXMLTagHandler {
@Override
public void startElement(String nameSpace,String tag,String qName,Attributes attributes) throws SAXException {
}
@Override
public void endElement(String nameSpace,String tag,String qName) throws SAXException {
}
/**
* @see AbstractXMLTagHandler#characters(String)
*/
@Override
public void characters(String text) {/*
if(this.text==null) {
this.text=text;
} else {
this.text+=text;
} */
}
}