Split abstract connection and debug code and fixed a couple of code

markers.
This commit is contained in:
Willem Cazander 2014-03-14 01:20:16 +01:00
parent e27949c874
commit 80ade0b3f4
13 changed files with 209 additions and 165 deletions

View file

@ -157,7 +157,7 @@ public class EldXsdWriterElement {
//xsdWriter.ignorableWhitespace(XMLConstants.CHAR_NEWLINE);
xsdWriter.comment(COMMENT_SEPERATOR);
String byValue = propertyConfig.getPropertyStringOrValue(EldXsdWriter.PROLOG_GENERATED_BY, EldXsdWriter.class.getSimpleName());
String byValue = propertyConfig.getPropertyString(EldXsdWriter.PROLOG_GENERATED_BY, EldXsdWriter.class.getSimpleName());
if (!byValue.endsWith(".")) {
byValue += '.';
}

View file

@ -22,28 +22,12 @@
*/
package org.x4o.xml.io;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.io.sax.ext.ContentWriter;
import org.x4o.xml.io.sax.ext.ContentWriterXml;
import org.x4o.xml.io.sax.ext.PropertyConfig;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageSessionLocal;
import org.x4o.xml.lang.phase.X4OPhase;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.x4o.xml.lang.phase.X4OPhaseLanguageRead;
import org.x4o.xml.lang.phase.X4OPhaseLanguageWrite;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
/**
* AbstractX4OConnection is the read/write interface for the classes.
@ -51,15 +35,11 @@ import org.xml.sax.helpers.AttributesImpl;
* @author Willem Cazander
* @version 1.0 Apr 6, 2013
*/
public abstract class AbstractX4OConnection implements X4OConnection {
public abstract class AbstractX4OConnection extends AbstractX4OConnectionDebug {
private final X4OLanguage language;
private boolean debugStarted = false;
private OutputStream debugCloseOutputStream = null;
protected String phaseStop = null;
protected List<String> phaseSkip = null;
protected final static String ABSTRACT_DEBUG_OUTPUT_HANDLER = "debug/output-handler";
protected final static String ABSTRACT_DEBUG_OUTPUT_STREAM = "debug/output-stream";
public AbstractX4OConnection(X4OLanguage language) {
this.language=language;
@ -96,105 +76,4 @@ public abstract class AbstractX4OConnection implements X4OConnection {
public void addPhaseSkip(String phaseId) {
phaseSkip.add( phaseId );
}
protected void debugStart(X4OLanguageSession languageSession,String debugHandlerKey,String debugStreamKey) throws UnsupportedEncodingException, SAXException {
Object debugOutputHandler = getProperty(debugHandlerKey);
Object debugOutputStream = getProperty(debugStreamKey);
if (languageSession.getX4ODebugWriter()==null) {
ContentWriter xmlDebugWriter = null;
if (debugOutputHandler instanceof ContentWriter) {
xmlDebugWriter = (ContentWriter)debugOutputHandler;
} else if (debugOutputStream instanceof OutputStream) {
debugCloseOutputStream = (OutputStream)debugOutputStream;
xmlDebugWriter = new ContentWriterXml(debugCloseOutputStream);
}
if (xmlDebugWriter!=null) {
xmlDebugWriter.startDocument();
xmlDebugWriter.startPrefixMapping("debug", X4ODebugWriter.DEBUG_URI);
X4ODebugWriter debugWriter = new X4ODebugWriter(xmlDebugWriter);
X4OLanguageSessionLocal local = (X4OLanguageSessionLocal)languageSession;
local.setX4ODebugWriter(debugWriter);
// We only close if we started it, this is for recursief debugging.
debugStarted = true;
}
}
// debug language
if (languageSession.hasX4ODebugWriter()) {
languageSession.getX4ODebugWriter().debugConnectionStart(languageSession, this);
// Add debug phases for all phases
for (String key:languageSession.getLanguage().getPhaseManager().getPhaseKeys()) {
X4OPhase p = languageSession.getLanguage().getPhaseManager().getPhase(key);
p.addPhaseListener(languageSession.getX4ODebugWriter().createDebugX4OPhaseListener());
if (shouldPrintTree(p)) {
p.addPhaseListener(languageSession.getX4ODebugWriter().createDebugPrintTreePhaseListener());
}
}
}
}
private boolean shouldPrintTree(X4OPhase p) {
String phase = p.getId();
if (X4OPhaseLanguageWrite.WRITE_END.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_END.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_RUN_ATTRIBUTE.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_TRANSFORM.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_BIND_ELEMENT.equals(phase)) {
return true;
}
return false;
}
protected void debugException(X4OLanguageSession languageSession,Exception e) {
if (languageSession.hasX4ODebugWriter()) {
try {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "message", "", "", e.getMessage());
if (e instanceof X4OPhaseException) {
atts.addAttribute ("", "phase", "", "", ((X4OPhaseException)e).getX4OPhaseHandler().getId());
}
languageSession.getX4ODebugWriter().getContentWriter().startElement(X4ODebugWriter.DEBUG_URI, "exceptionStackTrace", "", atts);
StringWriter writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer);
printer.append('\n');
if (e.getCause()==null) {
e.printStackTrace(printer);
} else {
e.getCause().printStackTrace(printer);
}
char[] stack = writer.getBuffer().toString().toCharArray();
languageSession.getX4ODebugWriter().getContentWriter().characters(stack, 0, stack.length);
languageSession.getX4ODebugWriter().getContentWriter().endElement(X4ODebugWriter.DEBUG_URI, "exceptionStackTrace", "");
} catch (Exception ee) {
// TODO print e;
//logger.warning(ee.getMessage());
}
}
}
protected void debugStop(X4OLanguageSession languageSession) throws SAXException, IOException {
if (languageSession.hasX4ODebugWriter()) {
languageSession.getX4ODebugWriter().debugConnectionEnd();
}
if (debugStarted && languageSession.hasX4ODebugWriter()) {
languageSession.getX4ODebugWriter().getContentWriter().endPrefixMapping("debug");
languageSession.getX4ODebugWriter().getContentWriter().endDocument();
if (debugCloseOutputStream!=null) {
debugCloseOutputStream.flush();
debugCloseOutputStream.close(); // need this here ?
}
}
}
}

View file

@ -0,0 +1,171 @@
/*
* Copyright (c) 2004-2013, 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.io;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.io.sax.ext.ContentWriter;
import org.x4o.xml.io.sax.ext.ContentWriterXml;
import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageSessionLocal;
import org.x4o.xml.lang.phase.X4OPhase;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.x4o.xml.lang.phase.X4OPhaseLanguageRead;
import org.x4o.xml.lang.phase.X4OPhaseLanguageWrite;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
/**
* AbstractX4OConnectionDebug has the abstract debug code of all connections.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2014
*/
public abstract class AbstractX4OConnectionDebug implements X4OConnection {
private boolean debugStarted = false;
private boolean debugAutoCloseOutputStream = true;
private OutputStream debugCloseOutputStream = null;
protected final static String ABSTRACT_DEBUG_OUTPUT_HANDLER = "debug/output-handler";
protected final static String ABSTRACT_DEBUG_OUTPUT_STREAM = "debug/output-stream";
protected final static String ABSTRACT_DEBUG_OUTPUT_STREAM_CLOSE = "debug/output-stream-close";
protected void debugStart(X4OLanguageSession languageSession,String debugHandlerKey,String debugStreamKey,String debugStreamCloseKey) throws UnsupportedEncodingException, SAXException {
debugAutoCloseOutputStream = (Boolean)getProperty(debugStreamCloseKey);
Object debugOutputHandler = getProperty(debugHandlerKey);
Object debugOutputStream = getProperty(debugStreamKey);
if (languageSession.getX4ODebugWriter()==null) {
ContentWriter xmlDebugWriter = null;
if (debugOutputHandler instanceof ContentWriter) {
xmlDebugWriter = (ContentWriter)debugOutputHandler;
} else if (debugOutputStream instanceof OutputStream) {
debugCloseOutputStream = (OutputStream)debugOutputStream;
xmlDebugWriter = new ContentWriterXml(debugCloseOutputStream);
}
if (xmlDebugWriter!=null) {
xmlDebugWriter.startDocument();
xmlDebugWriter.startPrefixMapping("debug", X4ODebugWriter.DEBUG_URI);
X4ODebugWriter debugWriter = new X4ODebugWriter(xmlDebugWriter);
X4OLanguageSessionLocal local = (X4OLanguageSessionLocal)languageSession;
local.setX4ODebugWriter(debugWriter);
// We only close if we started it, this is for recursief debugging.
debugStarted = true;
}
}
// debug language
if (languageSession.hasX4ODebugWriter()) {
languageSession.getX4ODebugWriter().debugConnectionStart(languageSession, this);
// Add debug phases for all phases
for (String key:languageSession.getLanguage().getPhaseManager().getPhaseKeys()) {
X4OPhase p = languageSession.getLanguage().getPhaseManager().getPhase(key);
p.addPhaseListener(languageSession.getX4ODebugWriter().createDebugX4OPhaseListener());
if (shouldPrintTree(p)) {
p.addPhaseListener(languageSession.getX4ODebugWriter().createDebugPrintTreePhaseListener());
}
}
}
}
private boolean shouldPrintTree(X4OPhase p) {
String phase = p.getId();
if (X4OPhaseLanguageWrite.WRITE_END.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_END.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_RUN_ATTRIBUTE.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_TRANSFORM.equals(phase)) {
return true;
}
if (X4OPhaseLanguageRead.READ_BIND_ELEMENT.equals(phase)) {
return true;
}
return false;
}
protected void debugException(X4OLanguageSession languageSession,Exception e) throws X4OConnectionException {
if (!languageSession.hasX4ODebugWriter()) {
return;
}
try {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "message", "", "", e.getMessage());
if (e instanceof X4OPhaseException) {
atts.addAttribute ("", "phase", "", "", ((X4OPhaseException)e).getX4OPhaseHandler().getId());
}
languageSession.getX4ODebugWriter().getContentWriter().startElement(X4ODebugWriter.DEBUG_URI, "exceptionStackTrace", "", atts);
StringWriter writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer);
printer.append('\n');
if (e.getCause()==null) {
e.printStackTrace(printer);
} else {
e.getCause().printStackTrace(printer);
}
char[] stack = writer.getBuffer().toString().toCharArray();
languageSession.getX4ODebugWriter().getContentWriter().characters(stack, 0, stack.length);
languageSession.getX4ODebugWriter().getContentWriter().endElement(X4ODebugWriter.DEBUG_URI, "exceptionStackTrace", "");
} catch (SAXException ee) {
throw new X4OConnectionException("Error while writing debug; "+ee.getMessage(),ee);
}
}
protected void debugStop(X4OLanguageSession languageSession) throws X4OConnectionException {
if (!languageSession.hasX4ODebugWriter()) {
return;
}
try {
languageSession.getX4ODebugWriter().debugConnectionEnd();
if (!debugStarted) {
return; // not in this instance started so no stopping then.
}
languageSession.getX4ODebugWriter().getContentWriter().endPrefixMapping("debug");
languageSession.getX4ODebugWriter().getContentWriter().endDocument();
if (debugCloseOutputStream==null) {
return; // we have handler
}
debugCloseOutputStream.flush();
if (!debugAutoCloseOutputStream) {
return; // no auto close
}
debugCloseOutputStream.close();
} catch (SAXException ee) {
throw new X4OConnectionException("Error while closing debug; "+ee.getMessage(),ee);
} catch (IOException ee) {
throw new X4OConnectionException("Error while closing debug; "+ee.getMessage(),ee);
}
}
}

View file

@ -75,6 +75,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
public final static String VALIDATION_INPUT_SCHEMA = PROPERTY_CONTEXT_PREFIX + "validation/input-schema";
public final static String DEBUG_OUTPUT_HANDLER = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_HANDLER;
public final static String DEBUG_OUTPUT_STREAM = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM;
public final static String DEBUG_OUTPUT_STREAM_CLOSE = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM_CLOSE;
static {
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
@ -92,7 +93,8 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
new PropertyConfigItem(VALIDATION_INPUT_DOC,Boolean.class,false),
new PropertyConfigItem(VALIDATION_INPUT_SCHEMA,Boolean.class,false),
new PropertyConfigItem(DEBUG_OUTPUT_HANDLER,ContentWriter.class),
new PropertyConfigItem(DEBUG_OUTPUT_STREAM,OutputStream.class)
new PropertyConfigItem(DEBUG_OUTPUT_STREAM,OutputStream.class),
new PropertyConfigItem(DEBUG_OUTPUT_STREAM_CLOSE,Boolean.class,true)
);
}
@ -150,7 +152,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
}
// init debug
debugStart(languageSession, DEBUG_OUTPUT_HANDLER, DEBUG_OUTPUT_STREAM);
debugStart(languageSession, DEBUG_OUTPUT_HANDLER, DEBUG_OUTPUT_STREAM, DEBUG_OUTPUT_STREAM_CLOSE);
try {
// Run document parsing

View file

@ -71,6 +71,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
public final static String SCHEMA_ROOT_URI = PROPERTY_CONTEXT_PREFIX+"schema/root-uri";
public final static String DEBUG_OUTPUT_HANDLER = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_HANDLER;
public final static String DEBUG_OUTPUT_STREAM = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM;
public final static String DEBUG_OUTPUT_STREAM_CLOSE = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM_CLOSE;
static {
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,ContentWriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
@ -78,7 +79,8 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
new PropertyConfigItem(SCHEMA_PRINT,Boolean.class,true),
new PropertyConfigItem(SCHEMA_ROOT_URI,String.class),
new PropertyConfigItem(DEBUG_OUTPUT_HANDLER,ContentWriter.class),
new PropertyConfigItem(DEBUG_OUTPUT_STREAM,OutputStream.class)
new PropertyConfigItem(DEBUG_OUTPUT_STREAM,OutputStream.class),
new PropertyConfigItem(DEBUG_OUTPUT_STREAM_CLOSE,Boolean.class,true)
);
}
@ -108,7 +110,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
public void writeSession(X4OLanguageSession languageSession,OutputStream output) throws X4OConnectionException,SAXException,IOException {
setProperty(OUTPUT_STREAM, output);
addPhaseSkip(X4OPhaseLanguageWrite.WRITE_RELEASE);
debugStart(languageSession, DEBUG_OUTPUT_HANDLER, DEBUG_OUTPUT_STREAM);
debugStart(languageSession, DEBUG_OUTPUT_HANDLER, DEBUG_OUTPUT_STREAM, DEBUG_OUTPUT_STREAM_CLOSE);
try {
languageSession.getLanguage().getPhaseManager().runPhases(languageSession, X4OPhaseType.XML_WRITE);
} catch (X4OPhaseException e) {
@ -161,11 +163,6 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
debugException(languageSession, e);
throw new X4OConnectionException(e);
} finally {
try {
debugStop(languageSession);
} catch (Exception e1) {
// FIXME
}
if (out!=null) {
try {
out.close();
@ -173,6 +170,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
//logger.warning(e.getMessage());
}
}
debugStop(languageSession);
}
}

View file

@ -41,7 +41,7 @@ import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementNamespace;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.io.AbstractX4OConnection;
import org.x4o.xml.io.X4OConnection;
import org.x4o.xml.io.sax.ext.ContentWriter;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLoaderResult;
@ -130,7 +130,7 @@ public class X4ODebugWriter {
return buf.toString();
}
public void debugConnectionStart(X4OLanguageSession languageSession,AbstractX4OConnection ec) throws SAXException {
public void debugConnectionStart(X4OLanguageSession languageSession,X4OConnection ec) throws SAXException {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "language", "", "", languageSession.getLanguage().getLanguageName());
atts.addAttribute ("", "languageVersion", "", "", languageSession.getLanguage().getLanguageVersion());

View file

@ -299,7 +299,7 @@ public final class PropertyConfig implements Cloneable {
}
throw new IllegalStateException("Wrong value type: "+value.getClass()+" for key: "+key);
}
@SuppressWarnings("unchecked")
public final List<String> getPropertyList(String key) {
Object value = getProperty(key);
@ -335,11 +335,10 @@ public final class PropertyConfig implements Cloneable {
throw new IllegalStateException("Wrong value type: "+value.getClass()+" for key: "+key);
}
// TODO: better name this
public final String getPropertyStringOrValue(String key,String value) {
public final String getPropertyString(String key,String defaultValue) {
String propertyValue = getPropertyString(key);
if (propertyValue==null) {
return value;
return defaultValue;
} else {
return propertyValue;
}
@ -403,9 +402,7 @@ public final class PropertyConfig implements Cloneable {
setProperty(key, result);
}
if (listValues.length!=2) {
System.err.println("Could not parse map value: "+value);
System.exit(1);
return;
throw new IllegalArgumentException("Coult not parse map value: '"+value+"' parsed length: "+listValues.length+" needs to be 2.");
}
String mKey = listValues[0];
String mValue = listValues[1];

View file

@ -23,7 +23,10 @@
package org.x4o.xml.lang;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.x4o.xml.el.X4OExpressionFactory;
@ -52,6 +55,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
private String languageName = null;
private String languageVersion = null;
private X4OPhaseManager phaseManager = null;
private Map<String,ElementNamespace> keyedNamespaceLookup = null;
public DefaultX4OLanguage(X4OLanguageConfiguration languageConfiguration,X4OPhaseManager phaseManager,String languageName,String languageVersion) {
if (languageName==null) {
@ -62,6 +66,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
logger = Logger.getLogger(DefaultX4OLanguage.class.getName());
elementLanguageModules = new ArrayList<X4OLanguageModule>(20);
keyedNamespaceLookup = new HashMap<String,ElementNamespace>(20);
this.languageConfiguration=languageConfiguration;
this.languageName=languageName;
this.languageVersion=languageVersion;
@ -109,12 +114,16 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
}
elementLanguageModules.add(elementLanguageModule);
for (ElementNamespace ns:elementLanguageModule.getElementNamespaces()) {
keyedNamespaceLookup.put(ns.getUri(), ns);
}
}
/**
* @see org.x4o.xml.lang.X4OLanguage#getLanguageModules()
*/
public List<X4OLanguageModule> getLanguageModules() {
public Collection<X4OLanguageModule> getLanguageModules() {
return elementLanguageModules;
}
@ -255,16 +264,6 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
* @see org.x4o.xml.lang.X4OLanguage#findElementNamespace(java.lang.String)
*/
public ElementNamespace findElementNamespace(String namespaceUri) {
// TODO: refactor so no search for every tag !!
ElementNamespace result = null;
for (int i=0;i<elementLanguageModules.size();i++) {
X4OLanguageModule module = elementLanguageModules.get(i);
result = module.getElementNamespace(namespaceUri);
if (result!=null) {
return result;
}
}
return result;
return keyedNamespaceLookup.get(namespaceUri);
}
}

View file

@ -22,6 +22,7 @@
*/
package org.x4o.xml.lang;
import java.util.Collection;
import java.util.List;
import org.x4o.xml.element.Element;
@ -103,7 +104,7 @@ public interface X4OLanguage {
ElementNamespace findElementNamespace(String namespaceUri);
/**
* @return Returns a list of element language modules in this defined and loaded language.
* @return Returns a collection of element language modules in this defined and loaded language.
*/
List<X4OLanguageModule> getLanguageModules();
Collection<X4OLanguageModule> getLanguageModules();
}

View file

@ -29,7 +29,6 @@ import org.x4o.xml.io.X4OReader;
import org.x4o.xml.io.X4OWriter;
import org.x4o.xml.lang.DefaultX4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.lang.X4OLanguageModule;
import junit.framework.TestCase;

View file

@ -63,7 +63,7 @@ public class EldXsdLanguageTaskTest extends TestCase {
File outputPath = createOutputPath(outputPostfix);
config.setProperty(EldXsdWriter.OUTPUT_PATH,outputPath);
config.setProperty(EldXsdWriter.OUTPUT_DOCUMENTATION,false);
config.setProperty(ContentWriterXml.PROLOG_LICENCE_FILE,new File("../license.txt")); // TODO: s or c ?
config.setProperty(ContentWriterXml.PROLOG_LICENCE_FILE,new File("../license.txt"));
config.setProperty(ContentWriterXml.PROLOG_USER_COMMENT,"Generated by junit-test-run in class: "+this.getClass().getSimpleName());
if (props!=null) {
for (String key:props.keySet()) {

View file

@ -24,8 +24,6 @@ package org.x4o.xml.test;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.io.X4OReaderSession;
import org.x4o.xml.io.X4OWriterSession;
import org.x4o.xml.test.models.TestObjectRoot;
public class TestDriver extends X4ODriver<TestObjectRoot> {

View file

@ -160,11 +160,11 @@ public class EldDocWriter {
// Generic config
ApiDoc doc = new ApiDoc();
doc.setName( propertyConfig.getPropertyStringOrValue(DOC_NAME, DEFAULT_NAME));
doc.setDescription( propertyConfig.getPropertyStringOrValue(DOC_DESCRIPTION, DEFAULT_DESCRIPTION));
doc.setDocAbout( propertyConfig.getPropertyStringOrValue(DOC_ABOUT, createLanguageAbout()));
doc.setDocCopyright( propertyConfig.getPropertyStringOrValue(DOC_COPYRIGHT, createLanguageCopyright()));
doc.setDocPageSubTitle( propertyConfig.getPropertyStringOrValue(DOC_PAGE_SUB_TITLE, createPageSubTitle()));
doc.setName( propertyConfig.getPropertyString(DOC_NAME, DEFAULT_NAME));
doc.setDescription( propertyConfig.getPropertyString(DOC_DESCRIPTION, DEFAULT_DESCRIPTION));
doc.setDocAbout( propertyConfig.getPropertyString(DOC_ABOUT, createLanguageAbout()));
doc.setDocCopyright( propertyConfig.getPropertyString(DOC_COPYRIGHT, createLanguageCopyright()));
doc.setDocPageSubTitle( propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, createPageSubTitle()));
doc.setMetaStyleSheetThema( propertyConfig.getPropertyString(META_STYLESHEET_THEMA));
doc.setMetaStyleSheet( propertyConfig.getPropertyFile(META_STYLESHEET));
List<String> keywords = propertyConfig.getPropertyList(META_KEYWORDS);