finisched x4o maven plugin and fixed javadoc errors.

This commit is contained in:
Willem Cazander 2013-04-14 21:59:26 +02:00
parent 6f45317753
commit 897fe80357
45 changed files with 656 additions and 239 deletions

View file

@ -32,11 +32,12 @@ mvn clean install;
-- Update schemas in src -- -- Update schemas in src --
-- note; rm after auto schema creation
cd project-root/; cd project-root/;
mvn clean install; mvn clean install;
mvn -Pupdate-schema-cel package; mvn -Pant-update-schema-cel package;
mvn -Pupdate-schema-eld package; mvn -Pant-update-schema-eld package;
- Add the license as manual step in xsd files. (todo in ant task) - Add the license as manual step in xsd files. (todo in ant task)
note: the do 'install' is because of circle plugins. note: the do 'install' is because of circle plugins.
@ -54,7 +55,7 @@ src/main/build/gnu-up.sh <scm_username> <version>
-- Make site -- -- Make site --
cd project-root/; cd project-root/;
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Psite-elddoc clean package site site:stage MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Pbuild-site-x4o-support clean package site site:stage
-- Check for code style -- -- Check for code style --
@ -81,4 +82,5 @@ mvn versions:display-dependency-updates;
cd project-root/; cd project-root/;
mvn clean install; mvn clean install;
mvn org.x4o.plugin:x4o-plugin-maven:help mvn org.x4o.plugin:x4o-plugin-maven:help
mvn org.x4o.plugin:x4o-plugin-maven:write-language-doc -Dlanguages=cel -DoutputDirectory=/tmp/dd -Dverbose=true mvn org.x4o.plugin:x4o-plugin-maven:write-language-doc -DoutputDirectory=/tmp/doc1
mvn org.x4o.plugin:x4o-plugin-maven:write-language-doc -DoutputDirectory=/tmp/doc2 -Dlanguages={eld=ALL,swixml=1.0-2.0} -Dverbose=true

View file

@ -51,13 +51,19 @@
<item name="Sample swixml" href="examples/sample-swixml.html"/> <item name="Sample swixml" href="examples/sample-swixml.html"/>
<item name="Sample jr4o" href="examples/sample-jr4o.html"/> <item name="Sample jr4o" href="examples/sample-jr4o.html"/>
</menu> </menu>
<menu name="EldDoc"> <menu name="Support Doc">
<item name="cel" href="elddocs/cel-1.0/index.html"/> <item name="cel" href="x4o-support/doc-cel-1.0/index.html"/>
<item name="eld" href="elddocs/eld-1.0/index.html"/> <item name="eld" href="x4o-support/doc-eld-1.0/index.html"/>
<item name="junit-test" href="elddocs/test-1.0/index.html"/> <item name="junit-test" href="x4o-support/doc-test-1.0/index.html"/>
<item name="junit-swixml2" href="elddocs/swixml-2.0/index.html"/> <item name="junit-swixml2" href="x4o-support/doc-swixml-2.0/index.html"/>
<item name="junit-swixml3" href="elddocs/swixml-3.0/index.html"/> <item name="junit-swixml3" href="x4o-support/doc-swixml-3.0/index.html"/>
</menu>
<menu name="Support Schema">
<item name="cel" href="x4o-support/xsd-cel-1.0/"/>
<item name="eld" href="x4o-support/xsd-eld-1.0/"/>
<item name="junit-test" href="x4o-support/xsd-test-1.0/"/>
<item name="junit-swixml2" href="x4o-support/xsd-swixml-2.0/"/>
<item name="junit-swixml3" href="x4o-support/xsd-swixml-3.0/"/>
</menu> </menu>
<menu ref="parent"/> <menu ref="parent"/>
<menu ref="modules"/> <menu ref="modules"/>

View file

@ -146,16 +146,31 @@ public final class X4ODriverManager {
} }
static public void registerX4ODriver(X4ODriver<?> driver) { static public void registerX4ODriver(X4ODriver<?> driver) {
if (driver==null) {
throw new NullPointerException("Can't register null driver.");
}
if (driver.getLanguageName()==null) { if (driver.getLanguageName()==null) {
throw new NullPointerException("Error in driver impl languageName is null in: "+driver.getClass()); throw new NullPointerException("Error in driver impl languageName is null in: "+driver.getClass());
} }
if (driver.getLanguageName().length()==0) {
throw new IllegalArgumentException("Error in driver impl languageName is empty in: "+driver.getClass());
}
if (driver.getLanguageVersions()==null) { if (driver.getLanguageVersions()==null) {
throw new NullPointerException("Error in driver impl languageVersions is null in: "+driver.getClass()); throw new NullPointerException("Error in driver impl languageVersions is null in: "+driver.getClass());
} }
if (driver.getLanguageVersions().length==0) {
throw new IllegalArgumentException("Error in driver impl languageVersions is empty in: "+driver.getClass());
}
instance.drivers.put(driver.getLanguageName(), driver); instance.drivers.put(driver.getLanguageName(), driver);
} }
static public void deregisterX4ODriver(X4ODriver<?> driver) { static public void deregisterX4ODriver(X4ODriver<?> driver) {
if (driver==null) {
throw new NullPointerException("Can't deregister null driver.");
}
if (driver.getLanguageName()==null) {
throw new NullPointerException("Error in driver impl languageName is null in: "+driver.getClass());
}
instance.drivers.remove(driver.getLanguageName()); instance.drivers.remove(driver.getLanguageName());
} }
@ -166,6 +181,9 @@ public final class X4ODriverManager {
if (language.isEmpty()) { if (language.isEmpty()) {
throw new IllegalArgumentException("Can't provider driver for empty language."); throw new IllegalArgumentException("Can't provider driver for empty language.");
} }
if (instance.drivers.containsKey(language)) {
return instance.drivers.get(language);
}
try { try {
instance.lazyInit(); instance.lazyInit();
} catch (IOException e) { } catch (IOException e) {

View file

@ -136,7 +136,7 @@ public class StringSplitConverter extends AbstractStringObjectConverter {
* Converts object into string. * Converts object into string.
* *
* @see org.x4o.xml.conv.AbstractStringObjectConverter#convertStringBack(java.lang.Object, java.util.Locale) * @see org.x4o.xml.conv.AbstractStringObjectConverter#convertStringBack(java.lang.Object, java.util.Locale)
* @param obj The object to convert to string. * @param object The object to convert to string.
* @param locale The locale to convert the object from. * @param locale The locale to convert the object from.
* @return The string converted from the object. * @return The string converted from the object.
* @throws ObjectConverterException When conversion fails. * @throws ObjectConverterException When conversion fails.

View file

@ -61,8 +61,6 @@ public class EldModuleLoader implements X4OLanguageModuleLoader {
/** The EL key to access the parent language element langauge. */ /** The EL key to access the parent language element langauge. */
public static final String EL_PARENT_LANGUAGE = "parentLanguage"; public static final String EL_PARENT_LANGUAGE = "parentLanguage";
/** /**
* Creates an ELD/CEL module loader. * Creates an ELD/CEL module loader.
* @param eldResource The resource to load. * @param eldResource The resource to load.
@ -79,10 +77,10 @@ public class EldModuleLoader implements X4OLanguageModuleLoader {
/** /**
* Loads the ELD language into the module. * Loads the ELD language into the module.
* @param elementLanguage The langauge to load for. * @param language The langauge to load for.
* @param elementLanguageModule The module to load it in. * @param elementLanguageModule The module to load it in.
* @throws X4OLanguageModuleLoaderException When eld language could not be loaded. * @throws X4OLanguageModuleLoaderException When eld language could not be loaded.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageContext, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
logger.fine("Loading name eld file from resource: "+eldResource); logger.fine("Loading name eld file from resource: "+eldResource);

View file

@ -82,9 +82,9 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
/** /**
* Loads the CEL language into the module. * Loads the CEL language into the module.
* @param elementLanguage The langauge to load for. * @param language The langauge to load for.
* @param elementLanguageModule The module to load it in. * @param languageModule The module to load it in.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException {
@ -113,8 +113,8 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
/** /**
* Adds only Element class beans which need extra meta info for schema. * Adds only Element class beans which need extra meta info for schema.
* * @param namespace The namespace to config.
* @param elementClassList The list to fill. * @param language The language to config for.
* @throws X4OLanguageModuleLoaderException * @throws X4OLanguageModuleLoaderException
*/ */
private void configElementClasses(X4OLanguage language,ElementNamespaceContext namespace) throws X4OLanguageModuleLoaderException { private void configElementClasses(X4OLanguage language,ElementNamespaceContext namespace) throws X4OLanguageModuleLoaderException {
@ -243,8 +243,11 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
} }
/** /**
* Creates new ElementClassAttribute instance. * Creates new configed ElementClassAttribute instance.
* @param elementLanguage The ElementLanguage to create from. * @param language The X4OLanguage to create from.
* @param name The name of the attribute.
* @param required Is the attribute required.
* @param converter The converter for the attribute.
* @return The new ElementClassAttribute instance. * @return The new ElementClassAttribute instance.
* @throws X4OLanguageModuleLoaderException When class could not be created. * @throws X4OLanguageModuleLoaderException When class could not be created.
*/ */
@ -269,9 +272,10 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
/** /**
* Adds binding handler to module. * Adds binding handler to module.
* @param id The id to set on the handler. * @param languageModule The language module.
* @param handler The handler to add the the module. * @param handler The handler to add the the module.
* @param languageModule The module to add the handler to. * @param id The handler id.
* @param description The handler descripion.
*/ */
private void addBindingHandler(X4OLanguageModule languageModule,ElementBindingHandler handler,String id,String description) { private void addBindingHandler(X4OLanguageModule languageModule,ElementBindingHandler handler,String id,String description) {
handler.setId(id); handler.setId(id);

View file

@ -56,12 +56,18 @@ public class ElementClassAttributeBindingHandler extends AbstractElementBindingH
return CLASSES_CHILD; return CLASSES_CHILD;
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/
public void bindChild(Element childElement,ElementClassAttribute parentObject,Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,ElementClassAttribute parentObject,Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ObjectConverter) { if (childObject instanceof ObjectConverter) {
parentObject.setObjectConverter((ObjectConverter)childObject); parentObject.setObjectConverter((ObjectConverter)childObject);
} }
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
public void createChilderen(Element parentElement,ElementClassAttribute parentObject) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,ElementClassAttribute parentObject) throws ElementBindingHandlerException {
createChild(parentElement, parentObject.getObjectConverter()); createChild(parentElement, parentObject.getObjectConverter());
} }

View file

@ -59,7 +59,7 @@ public class ElementClassBindingHandler extends AbstractElementBindingHandler<El
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element,java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,ElementClass parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,ElementClass parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ElementClassAttribute) { if (childObject instanceof ElementClassAttribute) {
@ -70,6 +70,9 @@ public class ElementClassBindingHandler extends AbstractElementBindingHandler<El
} }
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
public void createChilderen(Element parentElement,ElementClass parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,ElementClass parent) throws ElementBindingHandlerException {
for (ElementClassAttribute child:parent.getElementClassAttributes()) { for (ElementClassAttribute child:parent.getElementClassAttributes()) {
createChild(parentElement, child); createChild(parentElement, child);

View file

@ -60,7 +60,7 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,ElementInterface parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,ElementInterface parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ElementBindingHandler) { if (childObject instanceof ElementBindingHandler) {
@ -74,6 +74,9 @@ public class ElementInterfaceBindingHandler extends AbstractElementBindingHandle
} }
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
public void createChilderen(Element parentElement,ElementInterface parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,ElementInterface parent) throws ElementBindingHandlerException {
for (ElementBindingHandler child:parent.getElementBindingHandlers()) { for (ElementBindingHandler child:parent.getElementBindingHandlers()) {
createChild(parentElement, child); createChild(parentElement, child);

View file

@ -75,7 +75,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,X4OLanguageModule languageModule, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,X4OLanguageModule languageModule, Object childObject) throws ElementBindingHandlerException {
@ -131,6 +131,9 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
} }
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
public void createChilderen(Element parentElement,X4OLanguageModule parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,X4OLanguageModule parent) throws ElementBindingHandlerException {
for (ElementInterface child:parent.getElementInterfaces()) { for (ElementInterface child:parent.getElementInterfaces()) {
createChild(parentElement, child); createChild(parentElement, child);

View file

@ -56,7 +56,7 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,ElementNamespaceContext parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,ElementNamespaceContext parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ElementClass) { if (childObject instanceof ElementClass) {
@ -64,6 +64,9 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
} }
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
public void createChilderen(Element parentElement,ElementNamespaceContext parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,ElementNamespaceContext parent) throws ElementBindingHandlerException {
for (ElementClass child:parent.getElementClasses()) { for (ElementClass child:parent.getElementClasses()) {
createChild(parentElement, child); createChild(parentElement, child);

View file

@ -60,7 +60,7 @@ public class ElementRefectionBindingHandler extends AbstractElementBindingHandle
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element,java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement, Object parentObject, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement, Object parentObject, Object childObject) throws ElementBindingHandlerException {
@ -91,6 +91,9 @@ public class ElementRefectionBindingHandler extends AbstractElementBindingHandle
throw new ElementBindingHandlerException("Could not find method: "+addMethod+" on: "+childClass+" id:"+getId()); throw new ElementBindingHandlerException("Could not find method: "+addMethod+" on: "+childClass+" id:"+getId());
} }
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public void createChilderen(Element parentElement,Object parentObject) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,Object parentObject) throws ElementBindingHandlerException {
if (parentClass==null | childClass==null | getMethod==null) { if (parentClass==null | childClass==null | getMethod==null) {

View file

@ -57,7 +57,7 @@ public class StringSplitConverterBindingHandler extends AbstractElementBindingHa
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,StringSplitConverter parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,StringSplitConverter parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof StringSplitConverterStep) { if (childObject instanceof StringSplitConverterStep) {

View file

@ -57,7 +57,7 @@ public class StringSplitConverterStepBindingHandler extends AbstractElementBindi
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,StringSplitConverterStep parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,StringSplitConverterStep parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ObjectConverter) { if (childObject instanceof ObjectConverter) {

View file

@ -50,7 +50,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
/** /**
* @param language The elementLanguage of this provider. * @param language The elementLanguage of this provider.
* @param elementNamespaceContext The elementNamespaceContext for this provider. * @param elementNamespaceContext The elementNamespaceContext for this provider.
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguageContext, org.x4o.xml.element.ElementNamespaceContext) * @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguage, org.x4o.xml.element.ElementNamespaceContext)
*/ */
public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) { public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) {
this.elementNamespaceContext=elementNamespaceContext; this.elementNamespaceContext=elementNamespaceContext;
@ -58,12 +58,13 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
} }
/** /**
* @param languageContext The language context for which we create the Element instance.
* @param tag The xml tag to create an Element instance for. * @param tag The xml tag to create an Element instance for.
* @return The Element to handle the given tag. * @return The Element to handle the given tag.
* @throws ElementNamespaceInstanceProviderException * @throws ElementNamespaceInstanceProviderException
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(java.lang.String) * @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(org.x4o.xml.lang.X4OLanguageContext,java.lang.String)
*/ */
public Element createElementInstance(X4OLanguageContext elementLanguage,String tag) throws ElementNamespaceInstanceProviderException { public Element createElementInstance(X4OLanguageContext languageContext,String tag) throws ElementNamespaceInstanceProviderException {
ElementClass elementClass = elementNamespaceContext.getElementClass(tag); ElementClass elementClass = elementNamespaceContext.getElementClass(tag);
Element element = null; Element element = null;
@ -79,7 +80,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
} }
element = (Element) obj; element = (Element) obj;
} else { } else {
element = (Element)X4OLanguageClassLoader.newInstance((elementLanguage.getLanguage().getLanguageConfiguration().getDefaultElement())); element = (Element)X4OLanguageClassLoader.newInstance((languageContext.getLanguage().getLanguageConfiguration().getDefaultElement()));
} }
if (elementClass.getObjectClass()!=null) { if (elementClass.getObjectClass()!=null) {
@ -93,7 +94,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
throw new ElementNamespaceInstanceProviderException(this,"Error while providing Element: "+e.getMessage(),e); throw new ElementNamespaceInstanceProviderException(this,"Error while providing Element: "+e.getMessage(),e);
} */ } */
element.setElementClass(elementClass); element.setElementClass(elementClass);
element.setLanguageContext(elementLanguage); element.setLanguageContext(languageContext);
return element; return element;
} }
} }

View file

@ -49,12 +49,15 @@ public interface ElementBindingHandler extends ElementMetaBase {
/** /**
* Do the binding of this child to the parent object. * Do the binding of this child to the parent object.
* @param parentObject The parentObject of this childElement.
* @param childObject The childObject of this childElement.
* @param childElement The child element to bind to the parent.' * @param childElement The child element to bind to the parent.'
* @throws ElementBindingHandlerException When binding could not happen. * @throws ElementBindingHandlerException When binding could not happen.
*/ */
void bindChild(Element childElement) throws ElementBindingHandlerException; void bindChild(Element childElement) throws ElementBindingHandlerException;
/**
* Creates the childeren of the parent object.
* @param parentElement The parent element to create the childeren from.'
* @throws ElementBindingHandlerException When binding could not happen.
*/
void createChilderen(Element parentElement) throws ElementBindingHandlerException; void createChilderen(Element parentElement) throws ElementBindingHandlerException;
} }

View file

@ -72,7 +72,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public T readFile(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public T readFile(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (fileName==null) { if (fileName==null) {
@ -90,7 +90,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public T readFile(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public T readFile(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (file==null) { if (file==null) {
@ -122,6 +122,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public T readResource(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public T readResource(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (resourceName==null) { if (resourceName==null) {
@ -156,7 +157,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public T readString(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException { public T readString(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (xmlString==null) { if (xmlString==null) {
@ -173,7 +174,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public T readUrl(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException { public T readUrl(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (url==null) { if (url==null) {

View file

@ -57,7 +57,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (fileName==null) { if (fileName==null) {
@ -75,7 +75,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (file==null) { if (file==null) {
@ -107,6 +107,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException { public X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (resourceName==null) { if (resourceName==null) {
@ -141,7 +142,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException { public X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (xmlString==null) { if (xmlString==null) {
@ -158,7 +159,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
public X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException { public X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (url==null) { if (url==null) {

View file

@ -61,7 +61,7 @@ public interface X4OReader<T> extends X4OConnection {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
T readFile(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; T readFile(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -74,7 +74,7 @@ public interface X4OReader<T> extends X4OConnection {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
T readFile(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; T readFile(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -87,6 +87,7 @@ public interface X4OReader<T> extends X4OConnection {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
T readResource(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; T readResource(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -97,7 +98,7 @@ public interface X4OReader<T> extends X4OConnection {
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
T readString(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException; T readString(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
@ -108,7 +109,7 @@ public interface X4OReader<T> extends X4OConnection {
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
T readUrl(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException; T readUrl(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
} }

View file

@ -63,7 +63,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -76,7 +76,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -89,6 +89,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws NullPointerException * @throws NullPointerException
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException; X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
@ -99,7 +100,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException; X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
@ -110,7 +111,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws SAXException * @throws SAXException
* @throws IOException * @throws IOException
* @throws NullPointerException * @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL) * @see org.x4o.xml.io.X4OReaderContext#readContext(java.io.InputStream,java.lang.String,java.net.URL)
*/ */
X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException; X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
} }

View file

@ -38,31 +38,31 @@ import org.xml.sax.SAXParseException;
*/ */
public class X4OErrorHandler implements ErrorHandler { public class X4OErrorHandler implements ErrorHandler {
private X4OLanguageContext elementContext = null; private X4OLanguageContext languageContext = null;
private ErrorHandler errorHandler = null; private ErrorHandler errorHandler = null;
/** /**
* Construct a new SAXErrorPrinter * Construct a new SAXErrorPrinter
* @param language The language to get errors to. * @param languageContext The language to get errors to.
*/ */
public X4OErrorHandler(X4OLanguageContext elementContext) { public X4OErrorHandler(X4OLanguageContext languageContext) {
if (elementContext==null) { if (languageContext==null) {
throw new NullPointerException("Can't debug and proxy errors with null elementContext."); throw new NullPointerException("Can't debug and proxy errors with null languageContext.");
} }
this.elementContext=elementContext; this.languageContext=languageContext;
this.errorHandler=(ErrorHandler)elementContext.getLanguageProperty(X4OLanguageProperty.CONFIG_ERROR_HANDLER); this.errorHandler=(ErrorHandler)languageContext.getLanguageProperty(X4OLanguageProperty.CONFIG_ERROR_HANDLER);
} }
/** /**
* Prints the error message to debug output. * Prints the error message to debug output.
*/ */
private void printError(boolean isError, SAXParseException exception) throws SAXException { private void printError(boolean isError, SAXParseException exception) throws SAXException {
if (elementContext.hasX4ODebugWriter()==false) { if (languageContext.hasX4ODebugWriter()==false) {
return; return;
} }
String message = printErrorString(isError,exception); String message = printErrorString(isError,exception);
try { try {
elementContext.getX4ODebugWriter().debugPhaseMessage(message, X4OErrorHandler.class); languageContext.getX4ODebugWriter().debugPhaseMessage(message, X4OErrorHandler.class);
} catch (ElementException e) { } catch (ElementException e) {
throw new SAXException(e); throw new SAXException(e);
} }

View file

@ -260,7 +260,7 @@ public class XMLWriter extends DefaultHandler2 {
public void endElement(String uri, String localName, String name) throws SAXException { public void endElement(String uri, String localName, String name) throws SAXException {
if (startElement!=null) { if (startElement!=null) {
String tag = startElement.toString(); String tag = startElement.toString();
write(tag.substring(0,tag.length()-1)); write(tag.substring(0,tag.length()-1));// rm normal close
write(XMLConstants.TAG_CLOSE_EMPTY); write(XMLConstants.TAG_CLOSE_EMPTY);
startElement=null; startElement=null;
indent--; indent--;

View file

@ -152,7 +152,7 @@ public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLo
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#setCurrentPhase(org.x4o.xml.lang.phase.X4OPhase) * @see org.x4o.xml.lang.X4OLanguageContextLocal#setCurrentPhase(org.x4o.xml.lang.phase.X4OPhase)
*/ */
public void setCurrentPhase(X4OPhase currentX4OPhase) { public void setCurrentPhase(X4OPhase currentX4OPhase) {
this.currentX4OPhase = currentX4OPhase; this.currentX4OPhase = currentX4OPhase;
@ -205,14 +205,14 @@ public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLo
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty) *
*/ */
public Object getLanguageProperty(X4OLanguageProperty property) { public Object getLanguageProperty(X4OLanguageProperty property) {
return getLanguageProperty(property.toUri()); return getLanguageProperty(property.toUri());
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty, java.lang.Object) *
*/ */
public void setLanguageProperty(X4OLanguageProperty property, Object value) { public void setLanguageProperty(X4OLanguageProperty property, Object value) {
if (property.isValueValid(value)==false) { if (property.isValueValid(value)==false) {
@ -222,7 +222,7 @@ public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLo
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyBoolean(org.x4o.xml.lang.X4OLanguageProperty) *
*/ */
public boolean getLanguagePropertyBoolean(X4OLanguageProperty property) { public boolean getLanguagePropertyBoolean(X4OLanguageProperty property) {
Object value = getLanguageProperty(property); Object value = getLanguageProperty(property);
@ -233,7 +233,7 @@ public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLo
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyInteger(org.x4o.xml.lang.X4OLanguageProperty) *
*/ */
public int getLanguagePropertyInteger(X4OLanguageProperty property) { public int getLanguagePropertyInteger(X4OLanguageProperty property) {
Object value = getLanguageProperty(property); Object value = getLanguageProperty(property);
@ -252,21 +252,21 @@ public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLo
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getX4ODebugWriter() * @see org.x4o.xml.lang.X4OLanguageContext#getX4ODebugWriter()
*/ */
public X4ODebugWriter getX4ODebugWriter() { public X4ODebugWriter getX4ODebugWriter() {
return debugWriter; return debugWriter;
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#hasX4ODebugWriter() * @see org.x4o.xml.lang.X4OLanguageContext#hasX4ODebugWriter()
*/ */
public boolean hasX4ODebugWriter() { public boolean hasX4ODebugWriter() {
return debugWriter!=null; return debugWriter!=null;
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setX4ODebugWriter(org.x4o.xml.io.sax.X4ODebugWriter) * @see org.x4o.xml.lang.X4OLanguageContextLocal#setX4ODebugWriter(org.x4o.xml.io.sax.X4ODebugWriter)
*/ */
public void setX4ODebugWriter(X4ODebugWriter debugWriter) { public void setX4ODebugWriter(X4ODebugWriter debugWriter) {
this.debugWriter=debugWriter; this.debugWriter=debugWriter;

View file

@ -73,7 +73,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#addLanguageModule(org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageLocal#addLanguageModule(org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void addLanguageModule(X4OLanguageModule elementLanguageModule) { public void addLanguageModule(X4OLanguageModule elementLanguageModule) {
if (elementLanguageModule.getId()==null) { if (elementLanguageModule.getId()==null) {
@ -83,7 +83,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#getLanguageModules() * @see org.x4o.xml.lang.X4OLanguage#getLanguageModules()
*/ */
public List<X4OLanguageModule> getLanguageModules() { public List<X4OLanguageModule> getLanguageModules() {
return elementLanguageModules; return elementLanguageModules;
@ -132,7 +132,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguage#createElementInstance(java.lang.Class) * @see org.x4o.xml.lang.X4OLanguage#createElementInstance(org.x4o.xml.lang.X4OLanguageContext,java.lang.Class)
*/ */
public Element createElementInstance(X4OLanguageContext context,Class<?> objectClass) { public Element createElementInstance(X4OLanguageContext context,Class<?> objectClass) {
for (X4OLanguageModule modContext:getLanguageModules()) { for (X4OLanguageModule modContext:getLanguageModules()) {
@ -152,7 +152,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#findElementBindingHandlers(java.lang.Object) * @see org.x4o.xml.lang.X4OLanguage#findElementBindingHandlers(java.lang.Object)
*/ */
public List<ElementBindingHandler> findElementBindingHandlers(Object parent) { public List<ElementBindingHandler> findElementBindingHandlers(Object parent) {
List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50); List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50);
@ -167,7 +167,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#findElementBindingHandlers(java.lang.Object,java.lang.Object) * @see org.x4o.xml.lang.X4OLanguage#findElementBindingHandlers(java.lang.Object,java.lang.Object)
*/ */
public List<ElementBindingHandler> findElementBindingHandlers(Object parent,Object child) { public List<ElementBindingHandler> findElementBindingHandlers(Object parent,Object child) {
List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50); List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50);
@ -213,7 +213,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#findElementInterfaces(java.lang.Object) * @see org.x4o.xml.lang.X4OLanguage#findElementInterfaces(java.lang.Object)
*/ */
public List<ElementInterface> findElementInterfaces(Object elementObject) { public List<ElementInterface> findElementInterfaces(Object elementObject) {
if (elementObject==null) { if (elementObject==null) {
@ -238,7 +238,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageContext#findElementNamespaceContext(java.lang.String) * @see org.x4o.xml.lang.X4OLanguage#findElementNamespaceContext(java.lang.String)
*/ */
public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) { public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) {

View file

@ -160,14 +160,14 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageVersionFilter() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultLanguageVersionFilter()
*/ */
public Class<?> getDefaultLanguageVersionFilter() { public Class<?> getDefaultLanguageVersionFilter() {
return DefaultX4OLanguageVersionFilter.class; return DefaultX4OLanguageVersionFilter.class;
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageLoader() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultLanguageLoader()
*/ */
public Class<?> getDefaultLanguageLoader() { public Class<?> getDefaultLanguageLoader() {
return DefaultX4OLanguageLoader.class; return DefaultX4OLanguageLoader.class;
@ -181,7 +181,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserProperties() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserProperties(org.x4o.xml.lang.X4OLanguageContext)
*/ */
public Map<String, Object> getSAXParserProperties(X4OLanguageContext elementContext) { public Map<String, Object> getSAXParserProperties(X4OLanguageContext elementContext) {
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1); Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
@ -189,7 +189,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserPropertiesOptional() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserPropertiesOptional(org.x4o.xml.lang.X4OLanguageContext)
*/ */
public Map<String, Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext) { public Map<String, Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext) {
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1); Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
@ -198,7 +198,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeatures() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeatures(org.x4o.xml.lang.X4OLanguageContext)
*/ */
public Map<String, Boolean> getSAXParserFeatures(X4OLanguageContext elementContext) { public Map<String, Boolean> getSAXParserFeatures(X4OLanguageContext elementContext) {
@ -247,7 +247,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesOptional() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesOptional(org.x4o.xml.lang.X4OLanguageContext)
*/ */
public Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext) { public Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext) {
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20); Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
@ -271,7 +271,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesRequired() * @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesRequired(org.x4o.xml.lang.X4OLanguageContext)
*/ */
public List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext) { public List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext) {
List<String> result = new ArrayList<String>(5); List<String> result = new ArrayList<String>(5);

View file

@ -80,7 +80,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
} }
/** /**
* @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.element.ElementLanguage, java.lang.String, java.lang.String) * @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.lang.X4OLanguageLocal, java.lang.String, java.lang.String)
*/ */
public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException { public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException {
try { try {
@ -156,7 +156,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
/** /**
* Loads all modules of an language. * Loads all modules of an language.
* @param elementLanguage The ElementLanguage to load for. * @param languageLocal The ElementLanguage to load for.
* @param language The language to load. * @param language The language to load.
*/ */
protected void loadLanguageModules(X4OLanguageLocal languageLocal,String language) throws IOException, SAXException { protected void loadLanguageModules(X4OLanguageLocal languageLocal,String language) throws IOException, SAXException {

View file

@ -62,15 +62,16 @@ public interface X4OLanguage {
X4OLanguageConfiguration getLanguageConfiguration(); X4OLanguageConfiguration getLanguageConfiguration();
/** /**
* Creates and filles the inital element language used to store the language. * Creates and fills the initial element language used to store the language.
* @return The newly created ElementLanguage. * @return The newly created ElementLanguage.
*/ */
X4OLanguageContext createLanguageContext(X4ODriver<?> driver); X4OLanguageContext createLanguageContext(X4ODriver<?> driver);
/** /**
* Search language for object and create elememt for it. * Search language for object and create element for it.
* @param object The object to search for. * @param context The X4O language context to create for.
* @return Returns an new Elememt instance for the object. * @param objectClass The object to search for.
* @return Returns an new Element instance for the object.
*/ */
Element createElementInstance(X4OLanguageContext context,Class<?> objectClass); Element createElementInstance(X4OLanguageContext context,Class<?> objectClass);

View file

@ -33,10 +33,10 @@ public interface X4OLanguageLoader {
/** /**
* Loads the language modules. * Loads the language modules.
* @param elementLanguage The elementLanguage to load the module in. * @param languageLocal The elementLanguage to load the module in.
* @param language The language to load. * @param languageName The language name to load.
* @param languageVersion The language version to load. * @param languageVersion The language version to load.
* @throws X4OLanguageLoaderException When there is an error. * @throws X4OLanguageLoaderException When there is an error.
*/ */
void loadLanguage(X4OLanguageLocal languageLocal,String language,String languageVersion) throws X4OLanguageLoaderException; void loadLanguage(X4OLanguageLocal languageLocal,String languageName,String languageVersion) throws X4OLanguageLoaderException;
} }

View file

@ -37,8 +37,8 @@ public interface X4OLanguageModuleLoaderSibling extends X4OLanguageModuleLoader
/** /**
* Loads in the sibling language. * Loads in the sibling language.
* @param languageLocal The ElementLanguage for which we load an sibling. * @param languageLocal The ElementLanguage for which we load an sibling.
* @param loader The loader to use to load the x4o languages. * @param languageLoader The loader to use to load the x4o languages.
* @throws X4OLanguageLoaderException Gets thrown when there is an error loading the sibling language. * @throws X4OLanguageLoaderException Gets thrown when there is an error loading the sibling language.
*/ */
void loadLanguageSibling(X4OLanguageLocal languageLocal,X4OLanguageLoader loader) throws X4OLanguageLoaderException; void loadLanguageSibling(X4OLanguageLocal languageLocal,X4OLanguageLoader languageLoader) throws X4OLanguageLoaderException;
} }

View file

@ -46,8 +46,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
private List<X4OPhase> x4oPhases = null; private List<X4OPhase> x4oPhases = null;
/** /**
* Local package constructor. * Constructor.
* @param elementLanguage The ElementLanguage to run the phases on.
*/ */
public DefaultX4OPhaseManager() { public DefaultX4OPhaseManager() {
x4oPhases = new ArrayList<X4OPhase>(25); x4oPhases = new ArrayList<X4OPhase>(25);

View file

@ -109,4 +109,127 @@ public class X4ODriverManagerTest extends TestCase {
long loopTime = System.currentTimeMillis() - startTime; long loopTime = System.currentTimeMillis() - startTime;
assertEquals("Language list loop is slow;"+loopTime,true, loopTime<500); assertEquals("Language list loop is slow;"+loopTime,true, loopTime<500);
} }
public void testRegisterDriverNull() throws Exception {
Exception e = null;
try {
X4ODriverManager.registerX4ODriver(null);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("null"));
}
public void testRegisterDriverNameNull() throws Exception {
Exception e = null;
try {
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
@Override public String getLanguageName() { return null; }
});
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("null"));
}
public void testRegisterDriverNameEmpty() throws Exception {
Exception e = null;
try {
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
@Override public String getLanguageName() { return ""; }
});
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",IllegalArgumentException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("empty"));
}
public void testRegisterDriverVersionNull() throws Exception {
Exception e = null;
try {
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return null; }
@Override public String getLanguageName() { return "junit-driver-test"; }
});
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("null"));
}
public void testRegisterDriverVersionEmpty() throws Exception {
Exception e = null;
try {
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return new String[]{}; }
@Override public String getLanguageName() { return "junit-driver-test"; }
});
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",IllegalArgumentException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("empty"));
}
public void testDeregisterDriverNull() throws Exception {
Exception e = null;
try {
X4ODriverManager.deregisterX4ODriver(null);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("null"));
}
public void testDeregisterDriverNameNull() throws Exception {
Exception e = null;
try {
X4ODriverManager.deregisterX4ODriver(new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
@Override public String getLanguageName() { return null; }
});
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("null"));
}
public void testDeregisterDriverInstance() throws Exception {
Exception e = null;
try {
X4ODriver<?> driver = new X4ODriver<Object>() {
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
@Override public String getLanguageName() { return "junit-driver-test"; }
};
X4ODriverManager.registerX4ODriver(driver);
assertEquals(driver.hashCode(), X4ODriverManager.getX4ODriver("junit-driver-test").hashCode());
X4ODriverManager.deregisterX4ODriver(driver);
X4ODriverManager.getX4ODriver("junit-driver-test");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull("No exception",e);
assertEquals("Wrong exception class",IllegalArgumentException.class, e.getClass());
assertTrue("Wrong exception message",e.getMessage().contains("junit-driver-test"));
}
} }

View file

@ -109,7 +109,7 @@ public class EldParserTest extends TestCase {
assertTrue("No elementConfigurator tag found in core eld.", resultTags.contains("elementConfigurator")); assertTrue("No elementConfigurator tag found in core eld.", resultTags.contains("elementConfigurator"));
*/ */
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); //e.printStackTrace();
} finally { } finally {
// parser.doReleasePhaseManual(); // parser.doReleasePhaseManual();
} }

View file

@ -53,13 +53,13 @@ public class X4OWriteLanguageDocExecutor {
String arg = arguIterator.next(); String arg = arguIterator.next();
if ("-path".equals(arg) || "-p".equals(arg)) { if ("-path".equals(arg) || "-p".equals(arg)) {
if (arguIterator.hasNext()==false) { if (arguIterator.hasNext()==false) {
System.out.println("No argument for "+arg+" given."); System.err.println("No argument for "+arg+" given.");
System.exit(1); System.exit(1);
return; return;
} }
File schemaBasePath = new File(arguIterator.next()); File schemaBasePath = new File(arguIterator.next());
if (schemaBasePath.exists()==false) { if (schemaBasePath.exists()==false) {
System.out.println("path does not exists; "+schemaBasePath); System.err.println("path does not exists; "+schemaBasePath);
System.exit(1); System.exit(1);
return; return;
} }
@ -68,7 +68,7 @@ public class X4OWriteLanguageDocExecutor {
} }
if ("-language".equals(arg) || "-l".equals(arg)) { if ("-language".equals(arg) || "-l".equals(arg)) {
if (arguIterator.hasNext()==false) { if (arguIterator.hasNext()==false) {
System.out.println("No argument for "+arg+" given."); System.err.println("No argument for "+arg+" given.");
System.exit(1); System.exit(1);
return; return;
} }
@ -80,7 +80,7 @@ public class X4OWriteLanguageDocExecutor {
try { try {
languageSchema.execute(); languageSchema.execute();
} catch (ElementException e) { } catch (ElementException e) {
System.out.println("Error while schema writing: "+e.getMessage()); System.err.println("Error while schema writing: "+e.getMessage());
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
return; return;

View file

@ -47,27 +47,27 @@ public class MetaLanguageSiblingLoader implements X4OLanguageModuleLoaderSibling
/** /**
* Loads an ElementLanguageModule. * Loads an ElementLanguageModule.
* @param language The ElementLanguage to load for. * @param language The ElementLanguage to load for.
* @param elementLanguageModule The ElementLanguageModule to load into. * @param languageModule The ElementLanguageModule to load into.
* @throws X4OLanguageModuleLoaderException Is thrown when meta language could not be loaded. * @throws X4OLanguageModuleLoaderException Is thrown when meta language could not be loaded.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal languageLocal,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException {
elementLanguageModule.setId(META_LANGUAGE); languageModule.setId(META_LANGUAGE);
elementLanguageModule.setName(META_LANGUAGE); languageModule.setName(META_LANGUAGE);
elementLanguageModule.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName()); languageModule.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName());
elementLanguageModule.setDescription("X4O Meta Language"); languageModule.setDescription("X4O Meta Language");
} }
/** /**
* Loads an sibling language. * Loads an sibling language.
* @param elementLanguage The ElementLanguage to load for. * @param language The ElementLanguage to load for.
* @param loader The x4o language loader. * @param languageLoader The x4o language loader.
* @throws X4OLanguageLoaderException * @throws X4OLanguageLoaderException
* @see org.x4o.xml.lang.X4OLanguageModuleLoaderSibling#loadLanguageSibling(org.x4o.xml.element.ElementLanguage, org.x4o.xml.lang.X4OLanguageLoader) * @see org.x4o.xml.lang.X4OLanguageModuleLoaderSibling#loadLanguageSibling(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageLoader)
*/ */
public void loadLanguageSibling(X4OLanguageLocal languageLocal,X4OLanguageLoader loader) throws X4OLanguageLoaderException { public void loadLanguageSibling(X4OLanguageLocal language,X4OLanguageLoader languageLoader) throws X4OLanguageLoaderException {
// Load the meta language. // Load the meta language.
loader.loadLanguage(languageLocal, META_LANGUAGE, META_LANGUAGE_VERSION); languageLoader.loadLanguage(language, META_LANGUAGE, META_LANGUAGE_VERSION);
} }
} }

View file

@ -71,7 +71,7 @@
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>update-schema-cel</id> <id>ant-update-schema-cel</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -106,7 +106,7 @@
</build> </build>
</profile> </profile>
<profile> <profile>
<id>update-schema-eld</id> <id>ant-update-schema-eld</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -141,7 +141,7 @@
</build> </build>
</profile> </profile>
<profile> <profile>
<id>site-elddoc2</id> <id>ant-site-elddoc</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View file

@ -69,7 +69,7 @@
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>site-elddoc</id> <id>build-site-x4o-support</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -78,10 +78,10 @@
<version>${project.version}</version> <version>${project.version}</version>
<executions> <executions>
<execution> <execution>
<id>site-elddoc-maven</id> <id>build-site-x4o-support</id>
<phase>pre-site</phase> <phase>pre-site</phase>
<configuration> <configuration>
<outputDirectory>${basedir}/../../target/site/elddocs</outputDirectory> <outputDirectory>${basedir}/../../target/site/x4o-support</outputDirectory>
<languages> <languages>
<cel>ALL</cel> <cel>ALL</cel>
<eld>ALL</eld> <eld>ALL</eld>
@ -91,6 +91,7 @@
</configuration> </configuration>
<goals> <goals>
<goal>write-language-doc</goal> <goal>write-language-doc</goal>
<goal>write-language-schema</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>

View file

@ -24,8 +24,7 @@
package org.x4o.plugin.maven; package org.x4o.plugin.maven;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
@ -35,49 +34,77 @@ import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager; import org.x4o.xml.X4ODriverManager;
/** /**
* X4OWriteLanguageDocMojo creates docs for language. * AbstractX4OLanguageMojo can perform a task on languages and versions.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 9, 2013 * @version 1.0 Apr 9, 2013
*/ */
public abstract class AbstractX4OLanguageMojo extends AbstractMojo { public abstract class AbstractX4OLanguageMojo extends AbstractMojo {
@Parameter(property="outputDirectory") private final static String DEFAULT_OUTPUT_DIRECTORY = "target/x4o";
@Parameter(property="outputDirectory",defaultValue=DEFAULT_OUTPUT_DIRECTORY)
private File outputDirectory; private File outputDirectory;
@Parameter(required=true,property="languages") @Parameter
private Map<String,String> languages; private Map<String,String> languages;
@Parameter(property="languages")
private String languageCommandLineString;
@Parameter(defaultValue="false",property="verbose") @Parameter(defaultValue="false",property="verbose")
private boolean verbose = false; private boolean verbose = false;
@Parameter(defaultValue="true",property="failOnError") @Parameter(defaultValue="true",property="failOnError")
private boolean failOnError = true; private boolean failOnError = true;
abstract String getLanguageTaskDirectoryLabel();
abstract String getLanguageTaskName(); abstract String getLanguageTaskName();
abstract void executeLanguageTask(String languageName,String languageVersion,File outputDirectory) throws MojoExecutionException; abstract void executeLanguageTask(String languageName,String languageVersion,File outputDirectory) throws MojoExecutionException;
private void executeLanguageTask() throws MojoExecutionException { private void executeLanguageTask() throws MojoExecutionException {
if (outputDirectory==null) {
throw new MojoExecutionException("outputDirectory attribute is not set.");
}
if (languages==null) { if (languages==null) {
throw new MojoExecutionException("languages attribute is not set."); languages = new HashMap<String,String>(10); // maven does not support setting map on cmd line ?
} }
if (languages.size()==0) { if (outputDirectory==null) {
throw new MojoExecutionException("languages attribute is empty."); outputDirectory = new File(DEFAULT_OUTPUT_DIRECTORY);
} }
long startTime = System.currentTimeMillis();
if (verbose) { if (verbose) {
getLog().info("Starting "+getLanguageTaskName()); getLog().info("Output directory: "+outputDirectory);
getLog().info("Verbose: "+verbose);
getLog().info("Fail on error: "+failOnError);
} }
if (outputDirectory.exists()==false) { if (outputDirectory.exists()==false) {
outputDirectory.mkdir(); outputDirectory.mkdirs(); // incl parents
if (verbose) { if (verbose) {
getLog().info("Created directory: "+outputDirectory); getLog().info("Created directory: "+outputDirectory);
} }
} }
if (languageCommandLineString!=null && languageCommandLineString.startsWith("{") && languageCommandLineString.endsWith("}")) {
languages.clear();
String langString = languageCommandLineString.substring(1,languageCommandLineString.length()-1);
String[] lang = langString.split(",");
for (String l:lang) {
String[] ll = l.split("=");
if (ll.length!=2) {
getLog().warn("Wrong langauge key split: '"+l+"' of languageString: '"+languageCommandLineString+"'");
continue;
}
String langName = ll[0];
String langVersion = ll[1];
languages.put(langName,langVersion);
}
}
if (languages.size()==0) {
if (verbose) {
getLog().info("Defaulting to all languages in classpath.");
}
for (String lang:X4ODriverManager.getX4OLanguages()) {
languages.put(lang, "ALL");
}
}
for (String languageName:languages.keySet()) { for (String languageName:languages.keySet()) {
String languageVersions = languages.get(languageName); String languageVersions = languages.get(languageName);
if (languageVersions.contains("*") || languageVersions.contains("ALL")) { if (languageVersions.contains("*") || languageVersions.contains("ALL")) {
@ -96,12 +123,22 @@ public abstract class AbstractX4OLanguageMojo extends AbstractMojo {
executeLanguageTask(languageName,languageVersions); // only one version executeLanguageTask(languageName,languageVersions); // only one version
} }
} }
long stopTime = System.currentTimeMillis();
getLog().info("Done "+getLanguageTaskName()+" in "+(stopTime-startTime)+" ms.");
} }
private void executeLanguageTask(String languageName,String languageVersion) throws MojoExecutionException { private void executeLanguageTask(String languageName,String languageVersion) throws MojoExecutionException {
File outputLanguagPath = new File(outputDirectory.getAbsolutePath()+File.separatorChar+languageName+"-"+languageVersion); long startTime = System.currentTimeMillis();
if (verbose) {
getLog().info("Starting "+getLanguageTaskName()+" for "+languageName+":"+languageVersion);
}
StringBuffer buf = new StringBuffer(100);
buf.append(outputDirectory.getAbsolutePath());
buf.append(File.separatorChar);
buf.append(getLanguageTaskDirectoryLabel());
buf.append("-");
buf.append(languageName);
buf.append("-");
buf.append(languageVersion);
File outputLanguagPath = new File(buf.toString());
if (outputLanguagPath.exists()==false) { if (outputLanguagPath.exists()==false) {
outputLanguagPath.mkdir(); outputLanguagPath.mkdir();
if (verbose) { if (verbose) {
@ -109,18 +146,12 @@ public abstract class AbstractX4OLanguageMojo extends AbstractMojo {
} }
} }
executeLanguageTask(languageName,languageVersion,outputLanguagPath); executeLanguageTask(languageName,languageVersion,outputLanguagPath);
long stopTime = System.currentTimeMillis();
getLog().info("Done "+getLanguageTaskName()+" for "+languageName+":"+languageVersion+" in "+(stopTime-startTime)+" ms.");
} }
public void execute() throws MojoExecutionException { public void execute() throws MojoExecutionException {
try { try {
if (verbose) {
if (languages!=null) {
getLog().info("X4O Languages: "+languages.size());
}
getLog().info("Output directory: "+outputDirectory);
getLog().info("Verbose: "+verbose);
getLog().info("Fail on error: "+failOnError);
}
executeLanguageTask(); executeLanguageTask();
} catch (MojoExecutionException e) { } catch (MojoExecutionException e) {
if (failOnError) { if (failOnError) {
@ -153,7 +184,9 @@ public abstract class AbstractX4OLanguageMojo extends AbstractMojo {
} }
/** /**
* @param languages the languages to set * Adds an language with version.
* @param languageName the languageName to set
* @param languageVersion the languageVersion to set
*/ */
public void addLanguage(String languageName,String languageVersion) { public void addLanguage(String languageName,String languageVersion) {
languages.put(languageName,languageVersion); languages.put(languageName,languageVersion);

View file

@ -43,6 +43,10 @@ public class X4OWriteLanguageDocMojo extends AbstractX4OLanguageMojo {
static public final String GOAL = "write-language-doc"; static public final String GOAL = "write-language-doc";
String getLanguageTaskDirectoryLabel() {
return "doc";
}
String getLanguageTaskName() { String getLanguageTaskName() {
return "X4O Write language documentation"; return "X4O Write language documentation";
} }

View file

@ -43,6 +43,10 @@ public class X4OWriteLanguageSchemaMojo extends AbstractX4OLanguageMojo {
static public final String GOAL = "write-language-schema"; static public final String GOAL = "write-language-schema";
String getLanguageTaskDirectoryLabel() {
return "xsd";
}
String getLanguageTaskName() { String getLanguageTaskName() {
return "X4O Write language schema"; return "X4O Write language schema";
} }

View file

@ -45,51 +45,38 @@ public class X4OWriteLanguageDocMojoTest extends AbstractMojoTestCase {
super.tearDown(); // required super.tearDown(); // required
} }
private void executeGoal() throws Exception { private void executeGoal(String goal,String testFile) throws Exception {
File pom = getTestFile( "src/test/resources/junit/test-write-language-doc.pom" ); File pom = getTestFile(testFile);
assertNotNull(pom); assertNotNull(pom);
assertTrue(pom.exists()); assertTrue(pom.exists());
X4OWriteLanguageDocMojo mojo = (X4OWriteLanguageDocMojo) lookupMojo(goal,pom);
X4OWriteLanguageDocMojo mojo = (X4OWriteLanguageDocMojo) lookupMojo( X4OWriteLanguageDocMojo.GOAL, pom );
//mojo.s
assertNotNull(mojo); assertNotNull(mojo);
mojo.execute(); mojo.execute();
} }
public void testEldDocCel() throws Exception { public void testConfAllWriteDoc() throws Exception {
executeGoal(); //"test-elddoc-cel" executeGoal(X4OWriteLanguageDocMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom");
File testDir = new File("target/test-elddoc/cel"); File outputDir = new File("target/jtest/test-plugin-conf-all/doc-eld-1.0");
//int files = testDir.listFiles().length; assertTrue(outputDir.exists());
//assertEquals("Should created more then two files", true, files>2); int files = outputDir.listFiles().length;
}
/*
public void testEldDocEld() {
executeTarget("test-elddoc-eld");
File testDir = new File("target/test-elddoc/eld");
int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2); assertEquals("Should created more then two files", true, files>2);
} }
public void testEldDocEldVerbose() {
executeTarget("test-elddoc-cel-verbose"); public void testConfLangWriteDoc() throws Exception {
assertLogContaining("Verbose:"); executeGoal(X4OWriteLanguageDocMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/doc-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
} }
public void testFailAllMissing() { public void testConfDefaultsWriteDoc() throws Exception {
expectBuildException("test-fail-all", "Should get exception with no attributes."); executeGoal(X4OWriteLanguageDocMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/doc-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
outputDir = new File("target/x4o/doc-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
} }
public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
}
public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
}
public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set.");
}
public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
}
*/
} }

View file

@ -0,0 +1,72 @@
/*
* 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.plugin.maven;
import java.io.File;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
/**
* X4OWriteLanguageSchemaMojoTest.
*
* @author Willem Cazander
* @version 1.0 Apr 14, 2013
*/
public class X4OWriteLanguageSchemaMojoTest extends AbstractMojoTestCase {
private void executeGoal(String goal,String testFile) throws Exception {
File pom = getTestFile(testFile);
assertNotNull(pom);
assertTrue(pom.exists());
X4OWriteLanguageSchemaMojo mojo = (X4OWriteLanguageSchemaMojo) lookupMojo(goal,pom);
assertNotNull(mojo);
mojo.execute();
}
public void testConfAllWriteSchema() throws Exception {
executeGoal(X4OWriteLanguageSchemaMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom");
File outputDir = new File("target/jtest/test-plugin-conf-all/xsd-eld-1.0");
assertTrue(outputDir.exists());
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testConfLangWriteSchema() throws Exception {
executeGoal(X4OWriteLanguageSchemaMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
}
public void testConfDefaultsWriteSchema() throws Exception {
executeGoal(X4OWriteLanguageSchemaMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
outputDir = new File("target/x4o/xsd-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
}

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-plugin-maven</artifactId>
<configuration>
<outputDirectory>target/jtest/test-plugin-conf-all</outputDirectory>
<languages>
<eld>1.0</eld>
</languages>
<verbose>false</verbose>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-plugin-maven</artifactId>
<configuration>
<outputDirectory>target/jtest/test-plugin-conf-lang</outputDirectory>
<languages>
<cel>1.0</cel>
</languages>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-plugin-maven</artifactId>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,33 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x4o.plugin.junit</groupId>
<artifactId>x4o-plugin-maven-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>x4o-plugin-maven-test</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>x4o-plugin-maven</artifactId>
<configuration>
<outputDirectory>target/jtest/write-language-doc</outputDirectory>
<languages>
<cel>ALL</cel>
<eld>ALL</eld>
</languages>
</configuration>
</plugin>
</plugins>
</build>
</project>