From d271edb1ee5653ded3838f5497d57f9c6646de29 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sat, 27 Apr 2013 20:10:47 +0200 Subject: [PATCH] Started with moving write to phases. Changed eld attribute name to id, Changed runBeanFill to runBeanValue. --- .../src/main/java/org/x4o/xml/X4ODriver.java | 32 ++- .../java/org/x4o/xml/X4ODriverManager.java | 3 +- .../org/x4o/xml/conv/text/package-info.java | 2 +- .../java/org/x4o/xml/el/package-info.java | 2 +- .../org/x4o/xml/eld/EldModuleLoaderCore.java | 3 +- .../org/x4o/xml/eld/lang/package-info.java | 2 +- .../java/org/x4o/xml/eld/package-info.java | 2 +- .../org/x4o/xml/eld/xsd/EldXsdXmlWriter.java | 4 +- .../AbstractElementClassAttribute.java | 29 ++- .../xml/element/AbstractElementClassBase.java | 2 +- .../DefaultElementAttributeValueParser.java | 2 +- .../xml/element/ElementClassAttribute.java | 30 ++- .../org/x4o/xml/element/package-info.java | 2 +- .../java/org/x4o/xml/io/DefaultX4OWriter.java | 107 ++++----- .../org/x4o/xml/io/sax/X4ODebugWriter.java | 6 +- .../java/org/x4o/xml/io/sax/package-info.java | 2 +- .../x4o/xml/lang/X4OLanguageModuleLoader.java | 7 +- .../lang/phase/DefaultX4OPhaseManager.java | 12 +- .../xml/lang/phase/X4OPhaseLanguageInit.java | 26 +-- .../xml/lang/phase/X4OPhaseLanguageRead.java | 128 +++++------ .../xml/lang/phase/X4OPhaseLanguageWrite.java | 215 ++++++++++++++++++ .../x4o/xml/lang/phase/X4OPhaseManager.java | 2 + .../main/java/org/x4o/xml/package-info.java | 2 +- .../resources/META-INF/cel/cel-core-1.0.xsd | 102 +++++++-- .../resources/META-INF/cel/cel-root-1.0.xsd | 10 +- .../resources/META-INF/eld/eld-conv-1.0.xsd | 2 +- .../resources/META-INF/eld/eld-lang-1.0.xsd | 23 +- .../main/resources/META-INF/eld/eld-lang.eld | 82 +++---- .../resources/META-INF/eld/eld-root-1.0.xsd | 4 +- .../java/org/x4o/xml/io/X4OWriterTest.java | 13 +- .../java/org/x4o/xml/test/TestDriver.java | 8 - .../META-INF/junit-defd/defd-lang.eld | 2 +- .../META-INF/swixml/swixml-lang-2.0.eld | 41 ++-- .../META-INF/swixml/swixml-lang-3.0.eld | 25 +- .../resources/META-INF/test/test-lang.eld | 2 +- .../org/x4o/xml/eld/doc/EldDocHtmlWriter.java | 2 +- .../org/x4o/xml/lang/meta/package-info.java | 2 +- .../org/x4o/xml/lang/meta/MTestDriver.java | 10 - x4o-plugin/x4o-plugin-ant/pom.xml | 2 +- 39 files changed, 615 insertions(+), 337 deletions(-) create mode 100644 x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageWrite.java diff --git a/x4o-driver/src/main/java/org/x4o/xml/X4ODriver.java b/x4o-driver/src/main/java/org/x4o/xml/X4ODriver.java index f55337a..afc4d69 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/X4ODriver.java +++ b/x4o-driver/src/main/java/org/x4o/xml/X4ODriver.java @@ -29,8 +29,10 @@ import org.x4o.xml.io.DefaultX4OReader; import org.x4o.xml.io.DefaultX4OSchemaWriter; import org.x4o.xml.io.DefaultX4OWriter; import org.x4o.xml.io.X4OReader; +import org.x4o.xml.io.X4OReaderContext; import org.x4o.xml.io.X4OSchemaWriter; import org.x4o.xml.io.X4OWriter; +import org.x4o.xml.io.X4OWriterContext; import org.x4o.xml.lang.X4OLanguageConfiguration; import org.x4o.xml.lang.X4OLanguageContext; @@ -66,6 +68,7 @@ public abstract class X4ODriver { abstract public String[] getLanguageVersions(); + protected X4OLanguage buildLanguage(String version) { return X4ODriverManager.getDefaultBuildLanguage(this, version); } @@ -79,6 +82,7 @@ public abstract class X4ODriver { } + public X4OSchemaWriter createSchemaWriter() { return createSchemaWriter(getLanguageVersionDefault()); } @@ -87,22 +91,42 @@ public abstract class X4ODriver { return new DefaultX4OSchemaWriter(createLanguageContext(version)); } + + public X4OReader createReader() { - return createReader(getLanguageVersionDefault()); + return createReaderContext(); } public X4OReader createReader(String version) { - return new DefaultX4OReader(createLanguageContext(version)); + return createReaderContext(version); } public X4OWriter createWriter() { - return createWriter(getLanguageVersionDefault()); + return createWriterContext(); } public X4OWriter createWriter(String version) { + return createWriterContext(version); + } + + public X4OReaderContext createReaderContext() { + return createReaderContext(getLanguageVersionDefault()); + } + + public X4OReaderContext createReaderContext(String version) { + return new DefaultX4OReader(createLanguageContext(version)); + } + + public X4OWriterContext createWriterContext() { + return createWriterContext(getLanguageVersionDefault()); + } + + public X4OWriterContext createWriterContext(String version) { return new DefaultX4OWriter(createLanguageContext(version)); } - + + + public String getLanguageVersionDefault() { return X4ODriverManager.getDefaultLanguageVersion(getLanguageVersions()); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/X4ODriverManager.java b/x4o-driver/src/main/java/org/x4o/xml/X4ODriverManager.java index 4b60acb..4bfbe93 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/X4ODriverManager.java +++ b/x4o-driver/src/main/java/org/x4o/xml/X4ODriverManager.java @@ -43,6 +43,7 @@ import org.x4o.xml.lang.X4OLanguageConfiguration; import org.x4o.xml.lang.phase.DefaultX4OPhaseManager; import org.x4o.xml.lang.phase.X4OPhaseLanguageInit; import org.x4o.xml.lang.phase.X4OPhaseLanguageRead; +import org.x4o.xml.lang.phase.X4OPhaseLanguageWrite; import org.x4o.xml.lang.phase.X4OPhaseManager; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -92,7 +93,7 @@ public final class X4ODriverManager { DefaultX4OPhaseManager manager = new DefaultX4OPhaseManager(); new X4OPhaseLanguageInit().createPhases(manager); new X4OPhaseLanguageRead().createPhases(manager); - //new X4OPhaseLanguageWrite().createPhases(manager); + new X4OPhaseLanguageWrite().createPhases(manager); return manager; } diff --git a/x4o-driver/src/main/java/org/x4o/xml/conv/text/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/conv/text/package-info.java index 0478443..fc3be69 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/conv/text/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/conv/text/package-info.java @@ -22,7 +22,7 @@ */ /** - * Provides default java text converters. + * Provides implementations of object to text converters. * * * @since 1.0 diff --git a/x4o-driver/src/main/java/org/x4o/xml/el/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/el/package-info.java index 70f88e2..6ac16b9 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/el/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/el/package-info.java @@ -22,7 +22,7 @@ */ /** - * The X4O EL Support classes. + * The Expression Language classes. * * * @since 1.0 diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java b/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java index 7e45a5c..2382947 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/EldModuleLoaderCore.java @@ -254,8 +254,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader { private ElementClassAttribute createElementClassAttribute(X4OLanguage language,String name,boolean required,ObjectConverter converter) throws X4OLanguageModuleLoaderException { try { ElementClassAttribute result = (ElementClassAttribute)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementClassAttribute()); - result.setId(name); // ?? - result.setName(name); + result.setId(name); if (required) { result.setRequired(required); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/lang/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/eld/lang/package-info.java index 5f6f767..c961ba2 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/lang/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/lang/package-info.java @@ -22,7 +22,7 @@ */ /** - * The X4O ELD Language x4o classes. + * The Element Language Definition language elements. * * * @since 1.0 diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/eld/package-info.java index f8a4b5e..d76c2b8 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/package-info.java @@ -22,7 +22,7 @@ */ /** - * The X4O Element Language Definition parser. + * The Element Language Definition drivers. * * * @since 1.0 diff --git a/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdXmlWriter.java b/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdXmlWriter.java index e925698..d444f94 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdXmlWriter.java +++ b/x4o-driver/src/main/java/org/x4o/xml/eld/xsd/EldXsdXmlWriter.java @@ -282,9 +282,9 @@ public class EldXsdXmlWriter { List attrNames = new ArrayList(30); for (ElementClassAttribute eca:ec.getElementClassAttributes()) { - attrNames.add(eca.getName()); + attrNames.add(eca.getId()); atts = new AttributesImpl(); - atts.addAttribute ("", "name", "", "", eca.getName()); + atts.addAttribute ("", "name", "", "", eca.getId()); atts.addAttribute ("", "type", "", "", "string"); if (eca.getRequired()!=null && eca.getRequired()) { atts.addAttribute ("", "use", "", "", "required"); diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassAttribute.java b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassAttribute.java index 3febe09..091febc 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassAttribute.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassAttribute.java @@ -44,7 +44,8 @@ public abstract class AbstractElementClassAttribute extends AbstractElementMetaB private Boolean runResolveEL = null; //private Boolean runInterfaces = null; private Boolean runConverters = null; - private Boolean runBeanFill = null; + private Boolean runBeanValue = null; + private Integer writeOrder = null; public AbstractElementClassAttribute() { attributeAliases = new ArrayList(3); @@ -156,16 +157,30 @@ public abstract class AbstractElementClassAttribute extends AbstractElementMetaB } /** - * @return the runBeanFill + * @return the runBeanValue */ - public Boolean getRunBeanFill() { - return runBeanFill; + public Boolean getRunBeanValue() { + return runBeanValue; } /** - * @param runBeanFill the runBeanFill to set + * @param runBeanValue the runBeanValue to set */ - public void setRunBeanFill(Boolean runBeanFill) { - this.runBeanFill = runBeanFill; + public void setRunBeanValue(Boolean runBeanValue) { + this.runBeanValue = runBeanValue; + } + + /** + * @return the writeOrder + */ + public Integer getWriteOrder() { + return writeOrder; + } + + /** + * @param writeOrder the writeOrder to set + */ + public void setWriteOrder(Integer writeOrder) { + this.writeOrder = writeOrder; } } diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassBase.java b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassBase.java index 672f317..d5790b0 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassBase.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/AbstractElementClassBase.java @@ -66,7 +66,7 @@ public abstract class AbstractElementClassBase extends AbstractElementMetaBase i * @param elementClassAttribute The ElementClassAttribute to add. */ public void addElementClassAttribute(ElementClassAttribute elementClassAttribute) { - elementClassAttributes.put(elementClassAttribute.getName(),elementClassAttribute); + elementClassAttributes.put(elementClassAttribute.getId(),elementClassAttribute); } /** diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/DefaultElementAttributeValueParser.java b/x4o-driver/src/main/java/org/x4o/xml/element/DefaultElementAttributeValueParser.java index bacb195..8c8df5f 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/DefaultElementAttributeValueParser.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/DefaultElementAttributeValueParser.java @@ -86,7 +86,7 @@ public class DefaultElementAttributeValueParser implements ElementAttributeValue for (ElementInterface ei:element.getLanguageContext().getLanguage().findElementInterfaces(element.getElementObject())) { logger.finer("Found interface match executing converter."); for (ElementClassAttribute attrClass:ei.getElementClassAttributes()) { - if (name.equals(attrClass.getName())==false) { + if (name.equals(attrClass.getId())==false) { continue; } if (attrClass.getObjectConverter()==null) { diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/ElementClassAttribute.java b/x4o-driver/src/main/java/org/x4o/xml/element/ElementClassAttribute.java index 20d82cc..a24331a 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/ElementClassAttribute.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/ElementClassAttribute.java @@ -35,18 +35,6 @@ import org.x4o.xml.conv.ObjectConverter; * @version 1.0 Aug 11, 2005 */ public interface ElementClassAttribute extends ElementMetaBase { - - /** - * Gets the attribute name of the ElementClass. - * @return The name. - */ - String getName(); - - /** - * Sets the attribute name of the ElementClass. - * @param name The name of the attribute. - */ - void setName(String name); /** * Gets the ObjectConverter. @@ -123,12 +111,22 @@ public interface ElementClassAttribute extends ElementMetaBase { void setRunConverters(Boolean runConverters); /** - * @return the runBeanFill. + * @return the runBeanValue. */ - Boolean getRunBeanFill(); + Boolean getRunBeanValue(); /** - * @param runBeanFill the runBeanFill to set. + * @param runBeanValue the runBeanValue to set. */ - void setRunBeanFill(Boolean runBeanFill); + void setRunBeanValue(Boolean runBeanValue); + + /** + * @return the writeOrder + */ + Integer getWriteOrder(); + + /** + * @param writeOrder the writeOrder to set + */ + void setWriteOrder(Integer writeOrder); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/element/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/element/package-info.java index 6938d9d..2235e8a 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/element/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/element/package-info.java @@ -22,7 +22,7 @@ */ /** - * The X4O XML Element interfaces. + * The XML Element definitions. * * * @since 1.0 diff --git a/x4o-driver/src/main/java/org/x4o/xml/io/DefaultX4OWriter.java b/x4o-driver/src/main/java/org/x4o/xml/io/DefaultX4OWriter.java index 7486ebb..b6c3d83 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/io/DefaultX4OWriter.java +++ b/x4o-driver/src/main/java/org/x4o/xml/io/DefaultX4OWriter.java @@ -36,16 +36,16 @@ import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import org.x4o.xml.element.Element; -import org.x4o.xml.element.ElementBindingHandler; -import org.x4o.xml.element.ElementBindingHandlerException; import org.x4o.xml.element.ElementClass; import org.x4o.xml.element.ElementClassAttribute; +import org.x4o.xml.element.ElementInterface; import org.x4o.xml.element.ElementNamespaceContext; -import org.x4o.xml.element.ElementNamespaceInstanceProviderException; import org.x4o.xml.element.ElementObjectPropertyValueException; import org.x4o.xml.io.sax.XMLWriter; import org.x4o.xml.lang.X4OLanguageContext; import org.x4o.xml.lang.X4OLanguageModule; +import org.x4o.xml.lang.phase.X4OPhaseException; +import org.x4o.xml.lang.phase.X4OPhaseType; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; @@ -57,24 +57,20 @@ import org.xml.sax.helpers.AttributesImpl; */ public class DefaultX4OWriter extends AbstractX4OWriter { - public DefaultX4OWriter(X4OLanguageContext elementLanguage) { - super(elementLanguage); + public DefaultX4OWriter(X4OLanguageContext languageContext) { + super(languageContext); } - public void writeContext(X4OLanguageContext context,OutputStream out) throws ParserConfigurationException, + public void writeContext(X4OLanguageContext languageContext,OutputStream out) throws ParserConfigurationException, FileNotFoundException, SecurityException, NullPointerException, SAXException, IOException { - Element root = getLanguageContext().getRootElement(); - if (root.getElementClass()==null) { - try { - root = fillElementTree(root.getElementObject()); - } catch (ElementNamespaceInstanceProviderException e) { - throw new SAXException(e); - } catch (ElementBindingHandlerException e) { - throw new SAXException(e); - } + try { + languageContext.getLanguage().getPhaseManager().runPhases(languageContext, X4OPhaseType.XML_WRITE); + } catch (X4OPhaseException e1) { + throw new SAXException(e1); } + Element root = languageContext.getRootElement(); XMLWriter writer = new XMLWriter(out); writer.startDocument(); @@ -120,9 +116,6 @@ public class DefaultX4OWriter extends AbstractX4OWriter { if (m.getName().startsWith("get")==false) { continue; } - if(m.getName().startsWith("getLocationOnScreen")) { - continue; // TODO: rm this - } String name = m.getName().substring(3,4).toLowerCase()+m.getName().substring(4); result.add(name); @@ -135,15 +128,37 @@ public class DefaultX4OWriter extends AbstractX4OWriter { if (element.getElementClass().getAutoAttributes()!=null && element.getElementClass().getAutoAttributes()==false) { for (ElementClassAttribute eca:element.getElementClass().getElementClassAttributes()) { - Object value = element.getLanguageContext().getElementObjectPropertyValue().getProperty(element.getElementObject(),eca.getName()); + if (eca.getRunBeanValue()!=null && eca.getRunBeanValue()==false) { + continue; + } + + Object value = element.getLanguageContext().getElementObjectPropertyValue().getProperty(element.getElementObject(),eca.getId()); if (value==null) { continue; } - atts.addAttribute ("", eca.getName(), "", "", ""+value); + atts.addAttribute ("", eca.getId(), "", "", ""+value); } } else { for (String p:getProperties(element.getElementObject().getClass())) { + + ElementClassAttribute eca = element.getElementClass().getElementClassAttributeByName(p); + if (eca!=null && eca.getRunBeanValue()!=null && eca.getRunBeanValue()) { + continue; + } + boolean writeValue = true; + for (ElementInterface ei:element.getLanguageContext().getLanguage().findElementInterfaces(element.getElementObject().getClass())) { + eca = ei.getElementClassAttributeByName(p); + if (eca!=null && eca.getRunBeanValue()!=null && eca.getRunBeanValue()==false) { + writeValue = false; + break; + } + } + if (writeValue==false) { + continue; + } + + // TODO: check attr see reader Object value = element.getLanguageContext().getElementObjectPropertyValue().getProperty(element.getElementObject(),p); if (value==null) { continue; @@ -164,7 +179,7 @@ public class DefaultX4OWriter extends AbstractX4OWriter { } private String findElementUri(Element e) { - for (X4OLanguageModule mod:e.getLanguageContext().getLanguage().getLanguageModules()) { + for (X4OLanguageModule mod:getLanguageContext().getLanguage().getLanguageModules()) { for (ElementNamespaceContext c:mod.getElementNamespaceContexts()) { ElementClass ec = c.getElementClass(e.getElementClass().getTag()); if (ec!=null) { @@ -176,57 +191,11 @@ public class DefaultX4OWriter extends AbstractX4OWriter { } private String findNamespacePrefix(Element e,String uri) { - ElementNamespaceContext ns = e.getLanguageContext().getLanguage().findElementNamespaceContext(uri); + ElementNamespaceContext ns = getLanguageContext().getLanguage().findElementNamespaceContext(uri); if (ns.getPrefixMapping()!=null) { return ns.getPrefixMapping(); } return ns.getId(); } - - private Element fillElementTree(Object object) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException { - Element element = findRootElement(object.getClass()); - element.setElementObject(object); - - for (ElementBindingHandler bind:getLanguageContext().getLanguage().findElementBindingHandlers(object)) { - bind.createChilderen(element); - fillTree(element); - } - return element; - } - - private void fillTree(Element element) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException { - for (Element e:element.getChilderen()) { - Object object = e.getElementObject(); - for (ElementBindingHandler bind:getLanguageContext().getLanguage().findElementBindingHandlers(object)) { - bind.createChilderen(e); - fillTree(e); - } - } - } - - - private Element findRootElement(Class objectClass) throws ElementNamespaceInstanceProviderException { - // redo this mess, add nice find for root - for (X4OLanguageModule modContext:getLanguageContext().getLanguage().getLanguageModules()) { - for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) { - if (nsContext.getLanguageRoot()!=null && nsContext.getLanguageRoot()) { - for (ElementClass ec:nsContext.getElementClasses()) { - if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) { - return nsContext.getElementNamespaceInstanceProvider().createElementInstance(getLanguageContext(), ec.getTag()); - } - } - } - } - } - for (X4OLanguageModule modContext:getLanguageContext().getLanguage().getLanguageModules()) { - for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) { - for (ElementClass ec:nsContext.getElementClasses()) { - if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) { - return nsContext.getElementNamespaceInstanceProvider().createElementInstance(getLanguageContext(), ec.getTag()); - } - } - } - } - throw new IllegalArgumentException("Could not find ElementClass for: "+objectClass.getName()); - } + } diff --git a/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java b/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java index 71977e0..2dded38 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java +++ b/x4o-driver/src/main/java/org/x4o/xml/io/sax/X4ODebugWriter.java @@ -422,7 +422,7 @@ public class X4ODebugWriter { } } - public void debugElementLanguage(X4OLanguageContext elementLanguage) throws SAXException { + public void debugLanguageContext(X4OLanguageContext elementLanguage) throws SAXException { AttributesImpl atts = new AttributesImpl(); //atts.addAttribute ("", key, "", "", value); atts.addAttribute ("", "language", "", "", elementLanguage.getLanguage().getLanguageName()); @@ -484,11 +484,11 @@ public class X4ODebugWriter { private void debugElementClassAttributes(Collection elementClassAttributes) throws SAXException { for (ElementClassAttribute elementClassAttribute:elementClassAttributes) { AttributesImpl atts = new AttributesImpl(); - atts.addAttribute ("", "attributeName", "", "", elementClassAttribute.getName()); + atts.addAttribute ("", "id", "", "", elementClassAttribute.getId()); atts.addAttribute ("", "description", "", "", elementClassAttribute.getDescription()); atts.addAttribute ("", "className", "", "", elementClassAttribute.getClass().getName()); atts.addAttribute ("", "defaultValue", "", "", ""+elementClassAttribute.getDefaultValue()); - atts.addAttribute ("", "runBeanFill", "", "", ""+elementClassAttribute.getRunBeanFill()); + atts.addAttribute ("", "runBeanValue", "", "", ""+elementClassAttribute.getRunBeanValue()); atts.addAttribute ("", "runConverters", "", "", ""+elementClassAttribute.getRunConverters()); //atts.addAttribute ("", "runInterfaces", "", "", ""+elementClassAttribute.getRunInterfaces()); atts.addAttribute ("", "runResolveEL", "", "", ""+elementClassAttribute.getRunResolveEL()); diff --git a/x4o-driver/src/main/java/org/x4o/xml/io/sax/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/io/sax/package-info.java index 473e52b..58f0279 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/io/sax/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/io/sax/package-info.java @@ -22,7 +22,7 @@ */ /** - * Sax interface based classes. + * The Sax based classes and interfaces. * * @since 1.0 */ diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/X4OLanguageModuleLoader.java b/x4o-driver/src/main/java/org/x4o/xml/lang/X4OLanguageModuleLoader.java index bb19dfb..50ca97c 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/X4OLanguageModuleLoader.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/X4OLanguageModuleLoader.java @@ -23,12 +23,9 @@ package org.x4o.xml.lang; - - /** - * Provides elements from tag.
- * And ElementClass from a tag.
- * + * X4OLanguageModuleLoader Loads all elements and other options + * into the X4OLanguageModule for the X4OLanguageLocal language. * * @author Willem Cazander * @version 1.0 Jul 8, 2006 diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/DefaultX4OPhaseManager.java b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/DefaultX4OPhaseManager.java index e46c9c2..c19ac57 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/DefaultX4OPhaseManager.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/DefaultX4OPhaseManager.java @@ -68,6 +68,16 @@ PHASE_ORDER = { *startupX4OPhase, * = runOnce */ + + public X4OPhase getPhase(String phaseName) { + for (X4OPhase phase:x4oPhases) { + if (phase.getId().equals(phaseName)) { + return phase; + } + } + return null; + } + /** * Adds an X4OPhaseHandler. * @param phase The X4OPhaseHandler to add. @@ -333,7 +343,7 @@ PHASE_ORDER = { *startupX4OPhase, * @throws X4OPhaseException */ private void executePhaseTree(Element element,X4OPhase phase) throws X4OPhaseException { - if (element.getElementClass().getSkipPhases().contains(phase.getId())==false) { + if (element.getElementClass()!=null && element.getElementClass().getSkipPhases().contains(phase.getId())==false) { phase.runElementPhase(element); } for (Element e:element.getChilderen()) { diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageInit.java b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageInit.java index fce3488..3f85337 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageInit.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageInit.java @@ -74,7 +74,7 @@ public class X4OPhaseLanguageInit { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { logger.finest("Run init start phase"); } }; @@ -98,14 +98,14 @@ public class X4OPhaseLanguageInit { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { try { //debugPhaseMessage("Loading main language: "+elementLanguage.getLanguage(),this,elementLanguage); - X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader()); - loader.loadLanguage((X4OLanguageLocal)elementLanguage.getLanguage(),elementLanguage.getLanguage().getLanguageName(),elementLanguage.getLanguage().getLanguageVersion()); + X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(languageContext.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader()); + loader.loadLanguage((X4OLanguageLocal)languageContext.getLanguage(),languageContext.getLanguage().getLanguageName(),languageContext.getLanguage().getLanguageVersion()); - if (elementLanguage.hasX4ODebugWriter()) { - elementLanguage.getX4ODebugWriter().debugElementLanguageModules(elementLanguage); + if (languageContext.hasX4ODebugWriter()) { + languageContext.getX4ODebugWriter().debugElementLanguageModules(languageContext); } } catch (Exception e) { throw new X4OPhaseException(this,e); @@ -131,22 +131,22 @@ public class X4OPhaseLanguageInit { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { try { List siblingLoaders = new ArrayList(3); - for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) { + for (X4OLanguageModule module:languageContext.getLanguage().getLanguageModules()) { if (module.getLanguageModuleLoader() instanceof X4OLanguageModuleLoaderSibling) { siblingLoaders.add((X4OLanguageModuleLoaderSibling)module.getLanguageModuleLoader()); } } if (siblingLoaders.isEmpty()==false) { - X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader()); + X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(languageContext.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader()); for (X4OLanguageModuleLoaderSibling siblingLoader:siblingLoaders) { //debugPhaseMessage("Loading sibling langauge loader: "+siblingLoader,this,elementLanguage); - siblingLoader.loadLanguageSibling((X4OLanguageLocal)elementLanguage.getLanguage(), loader); + siblingLoader.loadLanguageSibling((X4OLanguageLocal)languageContext.getLanguage(), loader); } - if (elementLanguage.hasX4ODebugWriter()) { - elementLanguage.getX4ODebugWriter().debugElementLanguageModules(elementLanguage); + if (languageContext.hasX4ODebugWriter()) { + languageContext.getX4ODebugWriter().debugElementLanguageModules(languageContext); } } } catch (Exception e) { @@ -173,7 +173,7 @@ public class X4OPhaseLanguageInit { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { logger.finest("Run init end phase"); } }; diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageRead.java b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageRead.java index 5d10063..e70e29f 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageRead.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageRead.java @@ -82,11 +82,11 @@ public class X4OPhaseLanguageRead { manager.addX4OPhase(new X4OPhaseReadXml()); manager.addX4OPhase(new X4OPhaseReadConfigELBeans()); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} // meta start point // manager.addX4OPhase(factory.startX4OPhase()); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} // config X4OPhaseReadRunConfigurator runConf = new X4OPhaseReadRunConfigurator(); @@ -97,27 +97,27 @@ public class X4OPhaseLanguageRead { // run all attribute events manager.addX4OPhase(new X4OPhaseReadRunAttribute()); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} // templating manager.addX4OPhase(new X4OPhaseReadFillTemplate()); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} // transforming manager.addX4OPhase(new X4OPhaseReadTransform()); manager.addX4OPhase(new X4OPhaseReadRunDirty(manager)); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} // binding elements manager.addX4OPhase(new X4OPhaseReadBindElement()); // runing and releasing manager.addX4OPhase(new X4OPhaseReadRun()); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} manager.addX4OPhase(runConf); manager.addX4OPhase(new X4OPhaseReadRunDirtyLast(manager)); -// if (elementLanguage.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} +// if (languageContext.hasX4ODebugWriter()) {manager.addX4OPhaseHandler(factory.debugPhase());} manager.addX4OPhase(new X4OPhaseReadEnd()); @@ -126,9 +126,9 @@ public class X4OPhaseLanguageRead { manager.addX4OPhase(releasePhase()); // Add debug phase listener to all phases -// if (elementLanguage.hasX4ODebugWriter()) { +// if (languageContext.hasX4ODebugWriter()) { //for (X4OPhase h:manager.getOrderedPhases()) { -// h.addPhaseListener(elementLanguage.getX4ODebugWriter().createDebugX4OPhaseListener()); +// h.addPhaseListener(languageContext.getX4ODebugWriter().createDebugX4OPhaseListener()); //} //} @@ -166,12 +166,12 @@ public class X4OPhaseLanguageRead { public void runElementPhase(Element element) throws X4OPhaseException { // not used. } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { // print the properties and classes for this language/config - if (elementLanguage.hasX4ODebugWriter()) { + if (languageContext.hasX4ODebugWriter()) { try { - elementLanguage.getX4ODebugWriter().debugLanguageProperties(elementLanguage); - elementLanguage.getX4ODebugWriter().debugLanguageDefaultClasses(elementLanguage); + languageContext.getX4ODebugWriter().debugLanguageProperties(languageContext); + languageContext.getX4ODebugWriter().debugLanguageDefaultClasses(languageContext); } catch (ElementException e) { throw new X4OPhaseException(this,e); } @@ -197,63 +197,63 @@ public class X4OPhaseLanguageRead { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { try { //XMLParserConfiguration config = new XIncludeAwareParserConfiguration(); //config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",myFullGrammarPool); //SAXParser parser = new SAXParser(config); // Create Sax parser with x4o tag handler - X4OTagHandler xth = new X4OTagHandler(elementLanguage); + X4OTagHandler xth = new X4OTagHandler(languageContext); XMLReader saxParser = XMLReaderFactory.createXMLReader(); - saxParser.setErrorHandler(new X4OErrorHandler(elementLanguage)); - saxParser.setEntityResolver(new X4OEntityResolver(elementLanguage)); + saxParser.setErrorHandler(new X4OErrorHandler(languageContext)); + saxParser.setEntityResolver(new X4OEntityResolver(languageContext)); saxParser.setContentHandler(xth); saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", xth); saxParser.setProperty("http://xml.org/sax/properties/declaration-handler",xth); // Set properties and optional - Map saxParserProperties = elementLanguage.getLanguage().getLanguageConfiguration().getSAXParserProperties(elementLanguage); + Map saxParserProperties = languageContext.getLanguage().getLanguageConfiguration().getSAXParserProperties(languageContext); for (Map.Entry entry:saxParserProperties.entrySet()) { String name = entry.getKey(); Object value= entry.getValue(); saxParser.setProperty(name, value); - debugPhaseMessage("Set SAX property: "+name+" to: "+value,this,elementLanguage); + debugPhaseMessage("Set SAX property: "+name+" to: "+value,this,languageContext); } - Map saxParserPropertiesOptional = elementLanguage.getLanguage().getLanguageConfiguration().getSAXParserPropertiesOptional(elementLanguage); + Map saxParserPropertiesOptional = languageContext.getLanguage().getLanguageConfiguration().getSAXParserPropertiesOptional(languageContext); for (Map.Entry entry:saxParserPropertiesOptional.entrySet()) { String name = entry.getKey(); Object value= entry.getValue(); try { saxParser.setProperty(name, value); - debugPhaseMessage("Set SAX optional property: "+name+" to: "+value,this,elementLanguage); + debugPhaseMessage("Set SAX optional property: "+name+" to: "+value,this,languageContext); } catch (SAXException e) { - debugPhaseMessage("Could not set optional SAX property: "+name+" to: "+value+" error: "+e.getMessage(),this,elementLanguage); + debugPhaseMessage("Could not set optional SAX property: "+name+" to: "+value+" error: "+e.getMessage(),this,languageContext); } } // Set sax features and optional - Map features = elementLanguage.getLanguage().getLanguageConfiguration().getSAXParserFeatures(elementLanguage); + Map features = languageContext.getLanguage().getLanguageConfiguration().getSAXParserFeatures(languageContext); for (String key:features.keySet()) { Boolean value=features.get(key); saxParser.setFeature(key, value); - debugPhaseMessage("Set SAX feature: "+key+" to: "+value,this,elementLanguage); + debugPhaseMessage("Set SAX feature: "+key+" to: "+value,this,languageContext); } - Map featuresOptional = elementLanguage.getLanguage().getLanguageConfiguration().getSAXParserFeaturesOptional(elementLanguage); + Map featuresOptional = languageContext.getLanguage().getLanguageConfiguration().getSAXParserFeaturesOptional(languageContext); for (String key:featuresOptional.keySet()) { Boolean value=featuresOptional.get(key); try { saxParser.setFeature(key, value); - debugPhaseMessage("Set SAX optional feature: "+key+" to: "+value,this,elementLanguage); + debugPhaseMessage("Set SAX optional feature: "+key+" to: "+value,this,languageContext); } catch (SAXException e) { - debugPhaseMessage("Could not set optional SAX feature: "+key+" to: "+value+" error: "+e.getMessage(),this,elementLanguage); + debugPhaseMessage("Could not set optional SAX feature: "+key+" to: "+value+" error: "+e.getMessage(),this,languageContext); } } // check for required features - List requiredFeatures = elementLanguage.getLanguage().getLanguageConfiguration().getSAXParserFeaturesRequired(elementLanguage); + List requiredFeatures = languageContext.getLanguage().getLanguageConfiguration().getSAXParserFeaturesRequired(languageContext); for (String requiredFeature:requiredFeatures) { - debugPhaseMessage("Checking required SAX feature: "+requiredFeature,this,elementLanguage); + debugPhaseMessage("Checking required SAX feature: "+requiredFeature,this,languageContext); if (saxParser.getFeature(requiredFeature)==false) { Exception e = new IllegalStateException("Missing required feature: "+requiredFeature); throw new X4OPhaseException(this,e); @@ -261,21 +261,21 @@ public class X4OPhaseLanguageRead { } // Finally start parsing the xml input stream - Object requestInputSource = elementLanguage.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_OBJECT); + Object requestInputSource = languageContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_OBJECT); InputSource input = null; InputStream inputStream = null; if (requestInputSource instanceof InputSource) { input = (InputSource)requestInputSource; } else { - inputStream = (InputStream)elementLanguage.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_STREAM); + inputStream = (InputStream)languageContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_STREAM); input = new InputSource(inputStream); } - Object requestInputEncoding = elementLanguage.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_ENCODING); + Object requestInputEncoding = languageContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_ENCODING); if (requestInputEncoding!=null && requestInputEncoding instanceof String) { input.setEncoding(requestInputEncoding.toString()); } - Object requestSystemId = elementLanguage.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_SYSTEM_ID); + Object requestSystemId = languageContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_SYSTEM_ID); if (requestSystemId!=null && requestSystemId instanceof String) { input.setSystemId(requestSystemId.toString()); } @@ -313,17 +313,17 @@ public class X4OPhaseLanguageRead { // not used. } @SuppressWarnings("rawtypes") - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { try { - Map beanMap = (Map)elementLanguage.getLanguageProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP); + Map beanMap = (Map)languageContext.getLanguageProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP); if (beanMap==null) { return; } for (Object elName:beanMap.keySet()) { Object o = beanMap.get(elName); - ValueExpression ve = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+elName+"}", o.getClass()); - ve.setValue(elementLanguage.getExpressionLanguageContext(), o); - debugPhaseMessage("Setting el bean: ${"+elName+"} to: "+o.getClass().getName(),this,elementLanguage); + ValueExpression ve = languageContext.getExpressionLanguageFactory().createValueExpression(languageContext.getExpressionLanguageContext(),"${"+elName+"}", o.getClass()); + ve.setValue(languageContext.getExpressionLanguageContext(), o); + debugPhaseMessage("Setting el bean: ${"+elName+"} to: "+o.getClass().getName(),this,languageContext); } } catch (Exception e) { throw new X4OPhaseException(this,e); @@ -359,7 +359,7 @@ public class X4OPhaseLanguageRead { for (String alias:aliases) { if (element.getAttributes().containsKey(alias)) { String attributeValue = element.getAttributes().get(alias); - element.getAttributes().put(eca.getName(), attributeValue); + element.getAttributes().put(eca.getId(), attributeValue); element.getAttributes().remove(alias); } } @@ -520,7 +520,7 @@ public class X4OPhaseLanguageRead { if (attrClass.getRunConverters()==null || attrClass.getRunConverters()) { value = attrParser.getConvertedParameterValue(name, value, element); } - if (attrClass.getRunBeanFill()==null || attrClass.getRunBeanFill()) { + if (attrClass.getRunBeanValue()==null || attrClass.getRunBeanValue()) { element.getLanguageContext().getElementObjectPropertyValue().setProperty(element.getElementObject(), name, value); } } else if (autoAttributes) { @@ -534,15 +534,15 @@ public class X4OPhaseLanguageRead { } // check for defaults for (ElementClassAttribute attrClass:element.getElementClass().getElementClassAttributes()) { - if (attrClass.getDefaultValue()!=null && attr.containsKey(attrClass.getName())==false) { + if (attrClass.getDefaultValue()!=null && attr.containsKey(attrClass.getId())==false) { Object value = null; if (attrClass.getDefaultValue() instanceof String) { - value = attrParser.getParameterValue(attrClass.getName(),(String)attrClass.getDefaultValue(),element); + value = attrParser.getParameterValue(attrClass.getId(),(String)attrClass.getDefaultValue(),element); } else { value = attrClass.getDefaultValue(); } - if (attrClass.getRunBeanFill()==null || attrClass.getRunBeanFill()) { - element.getLanguageContext().getElementObjectPropertyValue().setProperty(element.getElementObject(), attrClass.getName(), value); + if (attrClass.getRunBeanValue()==null || attrClass.getRunBeanValue()) { + element.getLanguageContext().getElementObjectPropertyValue().setProperty(element.getElementObject(), attrClass.getId(), value); } } } @@ -752,11 +752,11 @@ public class X4OPhaseLanguageRead { public boolean isElementPhase() { return false; } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { for (RunConfigurator conf:runConf) { try { - if (elementLanguage.hasX4ODebugWriter()) { - elementLanguage.getX4ODebugWriter().debugElementConfigurator(conf.elementConfigurator,conf.element); + if (languageContext.hasX4ODebugWriter()) { + languageContext.getX4ODebugWriter().debugElementConfigurator(conf.elementConfigurator,conf.element); } conf.elementConfigurator.doConfigElement(conf.element); } catch (ElementException e) { @@ -815,12 +815,12 @@ public class X4OPhaseLanguageRead { public void runElementPhase(Element element) throws X4OPhaseException { // not used. } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { // print the properties and classes for this language/config - if (elementLanguage.hasX4ODebugWriter()) { + if (languageContext.hasX4ODebugWriter()) { try { - elementLanguage.getX4ODebugWriter().debugLanguageProperties(elementLanguage); - elementLanguage.getX4ODebugWriter().debugLanguageDefaultClasses(elementLanguage); + languageContext.getX4ODebugWriter().debugLanguageProperties(languageContext); + languageContext.getX4ODebugWriter().debugLanguageDefaultClasses(languageContext); } catch (ElementException e) { throw new X4OPhaseException(this,e); } @@ -840,21 +840,21 @@ public class X4OPhaseLanguageRead { /** * @see org.x4o.xml.lang.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext) */ - public void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void preRunPhase(X4OPhase phase,X4OLanguageContext languageContext) throws X4OPhaseException { elementsReleased=0; } /** * @see org.x4o.xml.lang.phase.X4OPhaseListener#endRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext) */ - public void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException { - if (elementLanguage.hasX4ODebugWriter()==false) { + public void endRunPhase(X4OPhase phase,X4OLanguageContext languageContext) throws X4OPhaseException { + if (languageContext.hasX4ODebugWriter()==false) { return; } try { AttributesImpl atts = new AttributesImpl(); atts.addAttribute ("", "elements", "", "", elementsReleased+""); - elementLanguage.getX4ODebugWriter().getDebugWriter().startElement (X4ODebugWriter.DEBUG_URI, "executeReleases", "", atts); - elementLanguage.getX4ODebugWriter().getDebugWriter().endElement (X4ODebugWriter.DEBUG_URI, "executeReleases" , ""); + languageContext.getX4ODebugWriter().getDebugWriter().startElement (X4ODebugWriter.DEBUG_URI, "executeReleases", "", atts); + languageContext.getX4ODebugWriter().getDebugWriter().endElement (X4ODebugWriter.DEBUG_URI, "executeReleases" , ""); } catch (SAXException e) { throw new X4OPhaseException(phase,e); } @@ -876,7 +876,7 @@ public class X4OPhaseLanguageRead { public String[] getPhaseDependencies() { return new String[] {"READ_END"}; } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { } public void runElementPhase(Element element) throws X4OPhaseException { try { @@ -912,23 +912,23 @@ public class X4OPhaseLanguageRead { } public void runElementPhase(Element element) throws X4OPhaseException { } - public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { // safety check - if (elementLanguage.hasX4ODebugWriter()==false) { + if (languageContext.hasX4ODebugWriter()==false) { throw new X4OPhaseException(this,"Use debugPhase only when X4OParser.debugWriter is filled."); } try { AttributesImpl atts = new AttributesImpl(); //atts.addAttribute ("", key, "", "", value); //atts.addAttribute ("", "verbose", "", "", "true"); - elementLanguage.getX4ODebugWriter().getDebugWriter().startElement (X4ODebugWriter.DEBUG_URI, "printElementTree", "", atts); + languageContext.getX4ODebugWriter().getDebugWriter().startElement (X4ODebugWriter.DEBUG_URI, "printElementTree", "", atts); startedPrefix.clear(); - printXML(elementLanguage.getRootElement()); + printXML(languageContext.getRootElement()); for (String prefix:startedPrefix) { - elementLanguage.getX4ODebugWriter().getDebugWriter().endPrefixMapping(prefix); + languageContext.getX4ODebugWriter().getDebugWriter().endPrefixMapping(prefix); } - elementLanguage.getX4ODebugWriter().getDebugWriter().endElement(X4ODebugWriter.DEBUG_URI, "printElementTree", ""); - elementLanguage.getX4ODebugWriter().debugElementLanguage(elementLanguage); + languageContext.getX4ODebugWriter().getDebugWriter().endElement(X4ODebugWriter.DEBUG_URI, "printElementTree", ""); + languageContext.getX4ODebugWriter().debugLanguageContext(languageContext); } catch (SAXException e) { throw new X4OPhaseException(this,e); } diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageWrite.java b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageWrite.java new file mode 100644 index 0000000..ac621e8 --- /dev/null +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseLanguageWrite.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2004-2012, Willem Cazander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * 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 THE COPYRIGHT HOLDERS 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 + * THE COPYRIGHT HOLDER 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. + */ + +package org.x4o.xml.lang.phase; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +import org.x4o.xml.element.Element; +import org.x4o.xml.element.ElementBindingHandler; +import org.x4o.xml.element.ElementBindingHandlerException; +import org.x4o.xml.element.ElementClass; +import org.x4o.xml.element.ElementNamespaceContext; +import org.x4o.xml.element.ElementNamespaceInstanceProviderException; +import org.x4o.xml.lang.X4OLanguageModule; +import org.x4o.xml.lang.X4OLanguageContext; +import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling; +import org.x4o.xml.lang.X4OLanguageClassLoader; +import org.x4o.xml.lang.X4OLanguageLoader; +import org.x4o.xml.lang.X4OLanguageLocal; +import org.xml.sax.SAXException; + +/** + * X4OPhaseLanguageWrite defines all phases to write the language. + * + * @author Willem Cazander + * @version 1.0 Apr 7, 2013 + */ +public class X4OPhaseLanguageWrite { + + private Logger logger = null; + + public X4OPhaseLanguageWrite() { + logger = Logger.getLogger(X4OPhaseLanguageWrite.class.getName()); + } + + public void createPhases(DefaultX4OPhaseManager manager) { + manager.addX4OPhase(new X4OPhaseWriteStart()); + manager.addX4OPhase(new X4OPhaseWriteFillTree()); + //manager.addX4OPhase(new X4OPhaseInitLanguageSiblings()); + manager.addX4OPhase(new X4OPhaseWriteEnd()); + } + + /** + * Creates the X4OPhaseWriteStart which is a empty meta phase. + */ + class X4OPhaseWriteStart extends AbstractX4OPhase { + public X4OPhaseType getType() { + return X4OPhaseType.XML_WRITE; + } + public String getId() { + return "WRITE_START"; + } + public String[] getPhaseDependencies() { + return new String[]{}; + } + public boolean isElementPhase() { + return false; + } + public void runElementPhase(Element element) throws X4OPhaseException { + } + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { + logger.finest("Run init start phase"); + } + }; + + /** + * Fills the element tree + */ + class X4OPhaseWriteFillTree extends AbstractX4OPhase { + public X4OPhaseType getType() { + return X4OPhaseType.XML_WRITE; + } + public String getId() { + return "WRITE_FILL_TREE"; + } + public String[] getPhaseDependencies() { + return new String[]{"WRITE_START"}; + } + public boolean isElementPhase() { + return false; + } + public void runElementPhase(Element element) throws X4OPhaseException { + } + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { + try { + Element root = languageContext.getRootElement(); + // TODO: check for read tree then write support as ec is not null then .. + if (root.getElementClass()==null) { + root = fillElementTree(languageContext,root.getElementObject()); + } + } catch (Exception e) { + throw new X4OPhaseException(this,e); + } + } + + private Element fillElementTree(X4OLanguageContext languageContext,Object object) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException { + Element element = findRootElement(languageContext,object.getClass()); + element.setElementObject(object); + languageContext.setRootElement(element); + + for (ElementBindingHandler bind:languageContext.getLanguage().findElementBindingHandlers(object)) { + bind.createChilderen(element); + fillTree(languageContext,element); + } + return element; + } + + private void fillTree(X4OLanguageContext languageContext,Element element) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException { + for (Element e:element.getChilderen()) { + Object object = e.getElementObject(); + for (ElementBindingHandler bind:languageContext.getLanguage().findElementBindingHandlers(object)) { + bind.createChilderen(e); + fillTree(languageContext,e); + } + } + } + + private Element findRootElement(X4OLanguageContext languageContext,Class objectClass) throws ElementNamespaceInstanceProviderException { + // redo this mess, add nice find for root + for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) { + for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) { + if (nsContext.getLanguageRoot()!=null && nsContext.getLanguageRoot()) { + for (ElementClass ec:nsContext.getElementClasses()) { + if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) { + return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getTag()); + } + } + } + } + } + for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) { + for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) { + for (ElementClass ec:nsContext.getElementClasses()) { + if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) { + return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getTag()); + } + } + } + } + throw new IllegalArgumentException("Could not find ElementClass for: "+objectClass.getName()); + } + }; + + /** + * Loads all sibling languages. + */ + class X4OPhaseInitLanguageSiblings extends AbstractX4OPhase { + public X4OPhaseType getType() { + return X4OPhaseType.XML_WRITE; + } + public String getId() { + return "WRITE_TREE_VALUES"; + } + public String[] getPhaseDependencies() { + return new String[] {"INIT_LANG"}; + } + public boolean isElementPhase() { + return false; + } + public void runElementPhase(Element element) throws X4OPhaseException { + } + public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException { + try { + + } catch (Exception e) { + throw new X4OPhaseException(this,e); + } + } + }; + + /** + * Creates the X4OPhaseWriteEnd which is a empty meta phase. + */ + class X4OPhaseWriteEnd extends AbstractX4OPhase { + public X4OPhaseType getType() { + return X4OPhaseType.XML_WRITE; + } + public String getId() { + return "WRITE_END"; + } + public String[] getPhaseDependencies() { + return new String[]{"WRITE_FILL_TREE"}; + } + public boolean isElementPhase() { + return false; + } + public void runElementPhase(Element element) throws X4OPhaseException { + } + public void runPhase(X4OLanguageContext languageContext) throws X4OPhaseException { + logger.finest("Run init end phase"); + } + }; +} diff --git a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseManager.java b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseManager.java index 7183502..ef03b07 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseManager.java +++ b/x4o-driver/src/main/java/org/x4o/xml/lang/phase/X4OPhaseManager.java @@ -39,6 +39,8 @@ import org.x4o.xml.lang.X4OLanguageContext; */ public interface X4OPhaseManager { + X4OPhase getPhase(String phaseName); + /** * Returns all the X4OPhaseHandlers. * @return Returns all X4OPhaseHandlers. diff --git a/x4o-driver/src/main/java/org/x4o/xml/package-info.java b/x4o-driver/src/main/java/org/x4o/xml/package-info.java index 8338b0d..b8144c3 100644 --- a/x4o-driver/src/main/java/org/x4o/xml/package-info.java +++ b/x4o-driver/src/main/java/org/x4o/xml/package-info.java @@ -22,7 +22,7 @@ */ /** - * Provides interfaces for two way object converters. + * The X4O XML Driver program interface. * * * @since 1.0 diff --git a/x4o-driver/src/main/resources/META-INF/cel/cel-core-1.0.xsd b/x4o-driver/src/main/resources/META-INF/cel/cel-core-1.0.xsd index 033c97e..312ca7b 100644 --- a/x4o-driver/src/main/resources/META-INF/cel/cel-core-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/cel/cel-core-1.0.xsd @@ -7,10 +7,10 @@ ModuleName: Core Element Languag Module Namespaces: 2 Namespace: http://cel.x4o.org/xml/ns/cel-core - Created on: Tue Jan 08 06:02:28 CET 2013 + Created on: Sat Apr 27 20:01:59 CEST 2013 --> - @@ -19,12 +19,12 @@ + + - - @@ -44,11 +44,11 @@ - - + - + + @@ -81,12 +81,13 @@ - - - - + + + + + @@ -119,15 +120,70 @@ - - - - - - - - - - - + + + Defines an xml namespace. + + + + + + Adds description as text on all eld elements. + + + + + + Defines xml element tag. + + + + + + Define generic global configuator for languge. + + + + + + Define generic configurator for language. + + + + + + Defines generic attribute handler for language. + + + + + + Defines xml element attribute. + + + + + + Converts string attribute to java class instance. + + + + + + Defines generic binding handler for languge. + + + + + + Defines element interface class. + + + + + + Added (meta) element parent. + + + \ No newline at end of file diff --git a/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd b/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd index 3d08e60..e1a3419 100644 --- a/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/cel/cel-root-1.0.xsd @@ -7,10 +7,10 @@ ModuleName: Core Element Languag Module Namespaces: 2 Namespace: http://cel.x4o.org/xml/ns/cel-root - Created on: Tue Jan 08 06:02:28 CET 2013 + Created on: Sat Apr 27 20:01:59 CEST 2013 --> - @@ -24,9 +24,9 @@ - - + + diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd b/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd index 8564ab7..0d47313 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-conv-1.0.xsd @@ -7,7 +7,7 @@ ModuleName: Element Language Definition Namespaces: 3 Namespace: http://eld.x4o.org/xml/ns/eld-conv - Created on: Mon Apr 08 02:26:14 CEST 2013 + Created on: Sat Apr 27 20:06:33 CEST 2013 --> + + + - - - @@ -55,10 +55,10 @@ - - - + + + @@ -126,13 +126,14 @@ - + + + + - - - + diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld b/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld index 4d83e69..a1dcfd1 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-lang.eld @@ -53,7 +53,7 @@ > Single root namespace so xsd schema generation works correct. - + The module id. The module root element. @@ -73,27 +73,27 @@ Defines an namespace for the language. - + The namespace id. The xml element. - + The class of the wrapped object. - + An custom element class to config object. Config element objects by java interface. - + The interface id. - + The interface class. @@ -106,10 +106,10 @@ Define an className in bean.class for an ElementBindingHandler interface. - + The binding handler id. - + The class of the binding handler. @@ -118,13 +118,13 @@ Define an className in bean.class for an ElementAttributeHandler. - + The atttribute handler id. - + The class of the attribute handler. - + The xml attribute name. @@ -132,13 +132,13 @@ Define an className in bean.class for an ElementConfiguratorGlobal. - + The global element configurator id. - + The class of the element configurator. - + If set to true then run in config phase. @@ -146,13 +146,13 @@ Define an className in bean.class for an ElementConfigurator. - + The element configurator id. - + The class of the global element configurator. - + If set to true then run in config phase. @@ -181,17 +181,17 @@ Adds an parent element tag for xsd - + The parent tag to have object for. - + The element namespace uri if non local parent. Adds an phase to skip to the parent element. - + The name of the phase to skip. @@ -199,7 +199,7 @@ Defines the parameter order. - + The attribute name to run after this attribute. @@ -208,7 +208,7 @@ Defines an alias for an attribute name. - + The alias name to add to the attribute. @@ -216,13 +216,13 @@ Defines an alias for an attribute name. - + The id for this configurator. - + The attribute name to fill the value. - + See org.x4o.xml.element.Element.ElementType for options defaults to 'characters'. @@ -231,21 +231,21 @@ autoAttributes="false" > Lets you dynamicly bind to object togecher. - + The id for this binding handler. - + The parent class. - + The child class. - + The method name of the method used to add the child to the parent. - + The method name of the method used to get the childeren of the parent. @@ -256,7 +256,7 @@ Loads bean into the Element - + The class name of the the class to load. @@ -278,7 +278,7 @@ Define an loadable in bean.class for an ObjectConverter. - + The class name of the converter to load. @@ -296,20 +296,20 @@ - + The class name to convert the string to. - - - - + + + + - - - - + + + + \ No newline at end of file diff --git a/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd b/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd index e0c7194..5c32da6 100644 --- a/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd +++ b/x4o-driver/src/main/resources/META-INF/eld/eld-root-1.0.xsd @@ -7,7 +7,7 @@ ModuleName: Element Language Definition Namespaces: 3 Namespace: http://eld.x4o.org/xml/ns/eld-root - Created on: Mon Apr 08 02:26:14 CEST 2013 + Created on: Sat Apr 27 20:06:33 CEST 2013 --> + - diff --git a/x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java b/x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java index 17803f3..ec070fb 100644 --- a/x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java +++ b/x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java @@ -62,10 +62,17 @@ public class X4OWriterTest extends TestCase { TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml"); writer.writeFile(root, outputFile); - assertTrue("Debug file does not exists.",outputFile.exists()); - String text = new Scanner( outputFile ).useDelimiter("\\A").next(); - System.out.println("Output: '\n"+text+"\n' end in "+outputFile.getAbsolutePath()); + + assertTrue(text.startsWith("")); + assertTrue(text.contains("http://test.x4o.org/xml/ns/test-root")); + assertTrue(text.contains("")); + assertTrue(text.contains(" { static public TestDriver getInstance() { return (TestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); } - - public X4OReaderContext createReaderContext() { - return (X4OReaderContext)super.createReader(); - } - - public X4OWriterContext createWriterContext() { - return (X4OWriterContext)super.createWriter(); - } } diff --git a/x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld b/x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld index 9b2da10..0b0a143 100644 --- a/x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld +++ b/x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld @@ -55,7 +55,7 @@ Configs the Component based objects. - + diff --git a/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-2.0.eld b/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-2.0.eld index eb0ec5a..bcf1ef4 100644 --- a/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-2.0.eld +++ b/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-2.0.eld @@ -46,7 +46,7 @@ - + @@ -54,36 +54,37 @@ - + - + - + - + + - + - + - - - + + + @@ -111,21 +112,21 @@ - + - - + + - + - + @@ -142,11 +143,11 @@ - - - - - + + + + + \ No newline at end of file diff --git a/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-3.0.eld b/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-3.0.eld index f858914..d84ecc5 100644 --- a/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-3.0.eld +++ b/x4o-driver/src/test/resources/META-INF/swixml/swixml-lang-3.0.eld @@ -46,7 +46,7 @@ - + @@ -54,31 +54,32 @@ - + - + - + - + + - + - + @@ -105,21 +106,21 @@ - + - - + + - + - + diff --git a/x4o-driver/src/test/resources/META-INF/test/test-lang.eld b/x4o-driver/src/test/resources/META-INF/test/test-lang.eld index 9b2da10..0b0a143 100644 --- a/x4o-driver/src/test/resources/META-INF/test/test-lang.eld +++ b/x4o-driver/src/test/resources/META-INF/test/test-lang.eld @@ -55,7 +55,7 @@ Configs the Component based objects. - + diff --git a/x4o-elddoc/src/main/java/org/x4o/xml/eld/doc/EldDocHtmlWriter.java b/x4o-elddoc/src/main/java/org/x4o/xml/eld/doc/EldDocHtmlWriter.java index cb3cbb7..a15a9f9 100644 --- a/x4o-elddoc/src/main/java/org/x4o/xml/eld/doc/EldDocHtmlWriter.java +++ b/x4o-elddoc/src/main/java/org/x4o/xml/eld/doc/EldDocHtmlWriter.java @@ -807,7 +807,7 @@ public class EldDocHtmlWriter { private void printElementAttributes(PrintWriter pw,Collection elementClassAttributes) { printTableStart(pw,"Element Attributes"); for (ElementClassAttribute attr:elementClassAttributes) { - printTableRowSummary(pw,attr.getName(),attr.getDescription()); + printTableRowSummary(pw,attr.getId(),attr.getDescription()); } printTableEnd(pw); } diff --git a/x4o-meta/src/main/java/org/x4o/xml/lang/meta/package-info.java b/x4o-meta/src/main/java/org/x4o/xml/lang/meta/package-info.java index 2d190fd..675aeb5 100644 --- a/x4o-meta/src/main/java/org/x4o/xml/lang/meta/package-info.java +++ b/x4o-meta/src/main/java/org/x4o/xml/lang/meta/package-info.java @@ -22,7 +22,7 @@ */ /** - * The X4O XML Meta Language. + * The XML Meta Language. * * * @since 1.0 diff --git a/x4o-meta/src/test/java/org/x4o/xml/lang/meta/MTestDriver.java b/x4o-meta/src/test/java/org/x4o/xml/lang/meta/MTestDriver.java index 0d0a31d..efa7365 100644 --- a/x4o-meta/src/test/java/org/x4o/xml/lang/meta/MTestDriver.java +++ b/x4o-meta/src/test/java/org/x4o/xml/lang/meta/MTestDriver.java @@ -25,8 +25,6 @@ package org.x4o.xml.lang.meta; import org.x4o.xml.X4ODriver; import org.x4o.xml.X4ODriverManager; -import org.x4o.xml.io.X4OReaderContext; -import org.x4o.xml.io.X4OWriterContext; public class MTestDriver extends X4ODriver { @@ -46,12 +44,4 @@ public class MTestDriver extends X4ODriver { static public MTestDriver getInstance() { return (MTestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); } - - public X4OReaderContext createReaderContext() { - return (X4OReaderContext)super.createReader(); - } - - public X4OWriterContext createWriterContext() { - return (X4OWriterContext)super.createWriter(); - } } diff --git a/x4o-plugin/x4o-plugin-ant/pom.xml b/x4o-plugin/x4o-plugin-ant/pom.xml index 6d5b2b6..c74316e 100644 --- a/x4o-plugin/x4o-plugin-ant/pom.xml +++ b/x4o-plugin/x4o-plugin-ant/pom.xml @@ -121,7 +121,7 @@ - +