Removed core and impl package.

This commit is contained in:
Willem Cazander 2013-04-07 01:14:45 +02:00
parent f2844c61f2
commit b4225f6b0c
107 changed files with 612 additions and 753 deletions

View file

@ -25,17 +25,17 @@ package org.x4o.xml;
import java.util.Collection;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.core.phase.X4OPhaseException;
import org.x4o.xml.core.phase.X4OPhaseType;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.io.DefaultX4OReader;
import org.x4o.xml.io.DefaultX4OSchemaWriter;
import org.x4o.xml.io.DefaultX4OWriter;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.io.X4OSchemaWriter;
import org.x4o.xml.io.X4OWriter;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.x4o.xml.lang.phase.X4OPhaseType;
/**
* This is the starting point of the XML X4O Language Driver.
@ -69,13 +69,13 @@ public abstract class X4ODriver<T> {
return result;
}
public ElementLanguage createLanguageContext() {
public X4OLanguageContext createLanguageContext() {
return createLanguageContext(getLanguageVersionDefault());
}
public ElementLanguage createLanguageContext(String version) {
public X4OLanguageContext createLanguageContext(String version) {
X4OLanguage language = createLanguage(version);
ElementLanguage result = language.getLanguageConfiguration().createElementLanguage(this);
X4OLanguageContext result = language.getLanguageConfiguration().createElementLanguage(this);
try {
result.getLanguage().getPhaseManager().runPhases(result, X4OPhaseType.INIT);

View file

@ -35,7 +35,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

View file

@ -28,7 +28,7 @@ import java.util.Locale;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* Converts a String of an className into the the Class object.

View file

@ -28,7 +28,7 @@ import java.util.Locale;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* Converts Sring of an Enum into the enum value.

View file

@ -33,7 +33,7 @@ import java.util.Locale;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* StringSplitConverter.

View file

@ -1,30 +0,0 @@
/*
* 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.
*/
/**
* The core classes which startup the language.
*
* @since 1.0
*/
package org.x4o.xml.core;

View file

@ -24,11 +24,11 @@
package org.x4o.xml.eld;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.DefaultX4OLanguage;
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.lang.DefaultX4OLanguage;
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
/**
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementLanguageModule;
* @author Willem Cazander
* @version 1.0 Aug 20, 2005
*/
public class CelDriver extends X4ODriver<ElementLanguageModule> {
public class CelDriver extends X4ODriver<X4OLanguageModule> {
/** Defines the identifier of the 'Core Element Language' language. */
public static final String LANGUAGE_NAME = "cel";

View file

@ -24,11 +24,11 @@
package org.x4o.xml.eld;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.DefaultX4OLanguage;
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.lang.DefaultX4OLanguage;
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
/**
@ -38,7 +38,7 @@ import org.x4o.xml.element.ElementLanguageModule;
* @author Willem Cazander
* @version 1.0 Aug 20, 2005
*/
public class EldDriver extends X4ODriver<ElementLanguageModule> {
public class EldDriver extends X4ODriver<X4OLanguageModule> {
/** Defines the identifier of the 'Element Language Description' language. */
public static final String LANGUAGE_NAME = "eld";

View file

@ -31,13 +31,13 @@ import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementLanguageModuleLoader;
import org.x4o.xml.element.ElementLanguageModuleLoaderException;
import org.x4o.xml.io.DefaultX4OReader;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageModuleLoader;
import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
import org.x4o.xml.lang.X4OLanguageLocal;
import org.xml.sax.SAXException;
/**
@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
* @author Willem Cazander
* @version 1.0 Aug 17, 2005
*/
public class EldModuleLoader implements ElementLanguageModuleLoader {
public class EldModuleLoader implements X4OLanguageModuleLoader {
private Logger logger = null;
private String eldResource = null;
@ -81,46 +81,45 @@ public class EldModuleLoader implements ElementLanguageModuleLoader {
* Loads the ELD language into the module.
* @param elementLanguage The langauge to load for.
* @param elementLanguageModule The module to load it in.
* @throws ElementLanguageModuleLoaderException When eld language could not be loaded.
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
* @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)
*/
public void loadLanguageModule(X4OLanguageLocal language,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
logger.fine("Loading name eld file from resource: "+eldResource);
try {
//EldDriver parser = new EldDriver(elementLanguage,elementLanguageModule,isEldCore);
X4ODriver driver = null;
X4ODriver<?> driver = null;
if (isEldCore) {
driver = X4ODriverManager.getX4ODriver(CelDriver.LANGUAGE_NAME);
} else {
driver = X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
}
ElementLanguage eldLang = driver.createLanguageContext(driver.getLanguageVersionDefault());
X4OReader reader = new DefaultX4OReader(eldLang); //driver.createReader();
X4OLanguageContext eldLang = driver.createLanguageContext(driver.getLanguageVersionDefault());
X4OReader<?> reader = new DefaultX4OReader<Object>(eldLang);
reader.addELBeanInstance(EL_PARENT_LANGUAGE_CONFIGURATION, language.getLanguageConfiguration());
reader.addELBeanInstance(EL_PARENT_LANGUAGE, language);
reader.addELBeanInstance(EL_PARENT_ELEMENT_LANGUAGE_MODULE, elementLanguageModule);
// TODO: if (language.getLanguageConfiguration().getLanguagePropertyBoolean(X4OLanguageProperty.DEBUG_OUTPUT_ELD_PARSER)) {
//TODO: if (language.getLanguageConfiguration().getLanguagePropertyBoolean(X4OLanguageProperty.DEBUG_OUTPUT_ELD_PARSER)) {
// eldLang.setX4ODebugWriter(elementLanguage.getLanguageConfiguration().getX4ODebugWriter());
// }
reader.readResource(eldResource);
} catch (FileNotFoundException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
} catch (SecurityException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
} catch (NullPointerException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
} catch (ParserConfigurationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
} catch (SAXException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
} catch (IOException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
}
}
}

View file

@ -28,9 +28,6 @@ import java.util.List;
import java.util.logging.Logger;
import org.x4o.xml.conv.text.ClassConverter;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.eld.lang.BeanElement;
import org.x4o.xml.eld.lang.DescriptionElement;
import org.x4o.xml.eld.lang.ElementClassAddParentElement;
@ -40,16 +37,19 @@ import org.x4o.xml.eld.lang.ElementInterfaceBindingHandler;
import org.x4o.xml.eld.lang.ElementModuleBindingHandler;
import org.x4o.xml.eld.lang.ElementNamespaceContextBindingHandler;
import org.x4o.xml.eld.lang.ModuleElement;
import org.x4o.xml.element.DefaultElementClass;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementLanguageModuleLoader;
import org.x4o.xml.element.ElementLanguageModuleLoaderException;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
import org.x4o.xml.impl.DefaultElementClass;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLoader;
import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageLocal;
/**
* EldModuleLoaderCore provides a few basic elements for the core eld x4o language.
@ -57,7 +57,7 @@ import org.x4o.xml.impl.DefaultElementClass;
* @author Willem Cazander
* @version 1.0 Jan 11, 2009
*/
public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
private Logger logger = null;
private static final String PP_CEL_PROVIDER = "cel.x4o.org";
@ -83,9 +83,9 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
* Loads the CEL language into the module.
* @param elementLanguage The langauge to load for.
* @param elementLanguageModule The module to load it in.
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.lang.X4OLanguageModule)
*/
public void loadLanguageModule(X4OLanguageLocal language,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
elementLanguageModule.setId("cel-module");
elementLanguageModule.setName("Core Element Languag Module");
@ -130,18 +130,18 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
try {
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
} catch (InstantiationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
} catch (IllegalAccessException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
}
try {
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
);
} catch (InstantiationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
} catch (IllegalAccessException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
}
namespace.setId(CEL_CORE);
@ -164,7 +164,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
try {
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
} catch (ElementNamespaceInstanceProviderException e) {
throw new ElementLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
}
elementLanguageModule.addElementNamespaceContext(namespace);
@ -174,18 +174,18 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
try {
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
} catch (InstantiationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
} catch (IllegalAccessException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
}
try {
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
);
} catch (InstantiationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
} catch (IllegalAccessException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
}
namespace.setId(CEL_ROOT);
@ -198,7 +198,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
try {
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
} catch (ElementNamespaceInstanceProviderException e) {
throw new ElementLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
}
elementLanguageModule.addElementNamespaceContext(namespace);
}
@ -207,9 +207,9 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
* Adds only Element class beans which need extra meta info for schema.
*
* @param elementClassList The list to fill.
* @throws ElementLanguageModuleLoaderException
* @throws X4OLanguageModuleLoaderException
*/
private void createElementClasses(List<ElementClass> elementClassList,X4OLanguage language) throws ElementLanguageModuleLoaderException {
private void createElementClasses(List<ElementClass> elementClassList,X4OLanguage language) throws X4OLanguageModuleLoaderException {
ElementClass ec = null;
ElementClassAttribute attr = null;
@ -287,15 +287,15 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
* Creates new ElementClassAttribute instance.
* @param elementLanguage The ElementLanguage to create from.
* @return The new ElementClassAttribute instance.
* @throws ElementLanguageModuleLoaderException When class could not be created.
* @throws X4OLanguageModuleLoaderException When class could not be created.
*/
private ElementClassAttribute newElementClassAttribute(X4OLanguage language) throws ElementLanguageModuleLoaderException {
private ElementClassAttribute newElementClassAttribute(X4OLanguage language) throws X4OLanguageModuleLoaderException {
try {
return (ElementClassAttribute)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementClassAttribute());
} catch (InstantiationException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
} catch (IllegalAccessException e) {
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
}
}
@ -305,7 +305,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
* @param handler The handler to add the the module.
* @param elementLanguageModule The module to add the handler to.
*/
private void addBindingHandler(String id,ElementBindingHandler handler,ElementLanguageModule elementLanguageModule) {
private void addBindingHandler(String id,ElementBindingHandler handler,X4OLanguageModule elementLanguageModule) {
handler.setId(id);
elementLanguageModule.addElementBindingHandler(handler);
}

View file

@ -28,9 +28,9 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* BeanElement fills it elementObject from source with the bean.class attribute.

View file

@ -25,9 +25,6 @@ package org.x4o.xml.eld.lang;
import java.util.Map;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.eld.EldModuleLoader;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
@ -35,12 +32,14 @@ import org.x4o.xml.element.ElementAttributeHandler;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementBindingHandlerException;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageProperty;
/**
* An ParentLanguageElementConfigurator.
@ -65,7 +64,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/
public Class<?> getBindParentClass() {
return ElementLanguageModule.class;
return X4OLanguageModule.class;
}
/**
@ -87,7 +86,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler
}
X4OLanguage x4oParsingContext = (X4OLanguage)m.get(EldModuleLoader.EL_PARENT_LANGUAGE);
//ElementLanguageModule elementLanguageModule = (ElementLanguageModule)m.get(EldParser.PARENT_ELEMENT_LANGUAGE_MODULE);
ElementLanguageModule elementLanguageModule = (ElementLanguageModule)parentObject;
X4OLanguageModule elementLanguageModule = (X4OLanguageModule)parentObject;
if (x4oParsingContext==null) {
return;
}

View file

@ -25,11 +25,11 @@ package org.x4o.xml.eld.lang;
import java.util.Map;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.eld.EldModuleLoader;
import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageProperty;
/**
* ModuleElement put in an instance from parent language module.
@ -54,7 +54,7 @@ public class ModuleElement extends AbstractElement {
if (m==null) {
return;
}
ElementLanguageModule elementLanguageModule = (ElementLanguageModule)m.get(EldModuleLoader.EL_PARENT_ELEMENT_LANGUAGE_MODULE);
X4OLanguageModule elementLanguageModule = (X4OLanguageModule)m.get(EldModuleLoader.EL_PARENT_ELEMENT_LANGUAGE_MODULE);
setElementObject(elementLanguageModule);
}
}

View file

@ -26,12 +26,12 @@ package org.x4o.xml.eld.xsd;
import java.io.File;
import java.io.FileOutputStream;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.io.sax.XMLWriter;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.xml.sax.SAXException;
import org.xml.sax.ext.DefaultHandler2;
@ -76,7 +76,7 @@ public class EldXsdXmlGenerator {
}
return;
}
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
for (X4OLanguageModule mod:language.getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
checkNamespace(ns);
FileOutputStream fio = new FileOutputStream(new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource()));

View file

@ -33,14 +33,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.element.ElementAttributeHandler;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.xml.sax.SAXException;
import org.xml.sax.ext.DefaultHandler2;
import org.xml.sax.helpers.AttributesImpl;
@ -110,13 +110,13 @@ public class EldXsdXmlWriter {
this.namespaces.clear();
// redo this mess, add nice find for binding handlers
for (ElementLanguageModule modContext:language.getElementLanguageModules()) {
for (X4OLanguageModule modContext:language.getLanguageModules()) {
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
for (ElementClass ec:nsContext.getElementClasses()) {
Class<?> objectClass = null;
if (ec.getObjectClass()!=null) {
objectClass = ec.getObjectClass();
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
for (X4OLanguageModule mod:language.getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
for (ElementClass checkClass:ns.getElementClasses()) {
if (checkClass.getObjectClass()==null) {
@ -180,8 +180,8 @@ public class EldXsdXmlWriter {
msg = "\n".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
ElementLanguageModule module = null;
for (ElementLanguageModule elm:language.getElementLanguageModules()) {
X4OLanguageModule module = null;
for (X4OLanguageModule elm:language.getLanguageModules()) {
ElementNamespaceContext s = elm.getElementNamespaceContext(ns.getUri());
if (s!=null) {
module = elm;
@ -272,7 +272,7 @@ public class EldXsdXmlWriter {
atts.addAttribute ("", "maxOccurs", "", "", "unbounded");
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
for (X4OLanguageModule mod:language.getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
writeElementClassNamespaces(ec,nsWrite,ns);
}
@ -293,7 +293,7 @@ public class EldXsdXmlWriter {
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
}
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
for (X4OLanguageModule mod:language.getLanguageModules()) {
for (ElementAttributeHandler eah:mod.getElementAttributeHandlers()) {
attrNames.add(eah.getAttributeName());
atts = new AttributesImpl();

View file

@ -54,13 +54,13 @@ public class X4OSchemaWriterExecutor {
String arg = arguIterator.next();
if ("-path".equals(arg) || "-p".equals(arg)) {
if (arguIterator.hasNext()==false) {
System.out.println("No argument for "+arg+" given.");
System.err.println("No argument for "+arg+" given.");
System.exit(1);
return;
}
File schemaBasePath = new File(arguIterator.next());
if (schemaBasePath.exists()==false) {
System.out.println("path does not exists; "+schemaBasePath);
System.err.println("path does not exists; "+schemaBasePath);
System.exit(1);
return;
}
@ -69,7 +69,7 @@ public class X4OSchemaWriterExecutor {
}
if ("-language".equals(arg) || "-l".equals(arg)) {
if (arguIterator.hasNext()==false) {
System.out.println("No argument for "+arg+" given.");
System.err.println("No argument for "+arg+" given.");
System.exit(1);
return;
}
@ -91,7 +91,7 @@ public class X4OSchemaWriterExecutor {
e = e3;
}
if (e!=null) {
System.out.println("Error while schema writing: "+e.getMessage());
System.err.println("Error while schema writing: "+e.getMessage());
if (printStack) {
e.printStackTrace();
}

View file

@ -28,7 +28,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* An AbstractElement.
@ -43,7 +44,7 @@ public abstract class AbstractElement implements Element {
/** The config object */
private Object elementObject = null;
/** The language parsing context */
private ElementLanguage elementLanguage = null;
private X4OLanguageContext elementLanguage = null;
/** The ElementClass */
private ElementClass elementClass = null;
/** The attributes */
@ -93,7 +94,7 @@ public abstract class AbstractElement implements Element {
getAttributes().clear();
setElementClass(null);
setParent(null);
setElementLanguage(null);
setLanguageContext(null);
attributes.clear();
childeren.clear(); // we do not release childeren, x4o does that
allChilderen.clear();
@ -114,16 +115,16 @@ public abstract class AbstractElement implements Element {
}
/**
* @see Element#setElementLanguage(ElementLanguage)
* @see Element#setLanguageContext(X4OLanguageContext)
*/
public void setElementLanguage(ElementLanguage elementLanguage) {
public void setLanguageContext(X4OLanguageContext elementLanguage) {
this.elementLanguage=elementLanguage;
}
/**
* @see Element#getElementLanguage()
*/
public ElementLanguage getElementLanguage() {
public X4OLanguageContext getElementLanguage() {
return elementLanguage;
}

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElement;
/**
* The default element to handle the xml events.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.util.Locale;
import java.util.logging.Logger;
@ -29,11 +29,6 @@ import java.util.logging.Logger;
import javax.el.ValueExpression;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementAttributeValueParser;
import org.x4o.xml.element.ElementAttributeValueParserException;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementInterface;
/**
@ -112,8 +107,8 @@ public class DefaultElementAttributeValueParser implements ElementAttributeValue
* @see org.x4o.xml.element.ElementAttributeValueParser#getELParameterValue(java.lang.String, org.x4o.xml.element.Element)
*/
public Object getELParameterValue(String value, Element element) throws ElementAttributeValueParserException {
ValueExpression e = element.getElementLanguage().getExpressionFactory().createValueExpression(element.getElementLanguage().getELContext(), (String)value,Object.class);
return e.getValue(element.getElementLanguage().getELContext());
ValueExpression e = element.getElementLanguage().getExpressionLanguageFactory().createValueExpression(element.getElementLanguage().getExpressionLanguageContext(), (String)value,Object.class);
return e.getValue(element.getElementLanguage().getExpressionLanguageContext());
}
/**

View file

@ -21,17 +21,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.lang.X4OLanguageContext;
/**
@ -130,7 +127,7 @@ public class DefaultElementBodyCharacters implements Element {
/**
* @see org.x4o.xml.element.Element#getElementLanguage()
*/
public ElementLanguage getElementLanguage() {
public X4OLanguageContext getElementLanguage() {
return null;
}
@ -180,9 +177,9 @@ public class DefaultElementBodyCharacters implements Element {
}
/**
* @see org.x4o.xml.element.Element#setElementLanguage(org.x4o.xml.element.ElementLanguage)
* @see org.x4o.xml.element.Element#setLanguageContext(org.x4o.xml.lang.X4OLanguageContext)
*/
public void setElementLanguage(ElementLanguage elementLanguage) {
public void setLanguageContext(X4OLanguageContext elementLanguage) {
}
/**

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElement;
/**
* DefaultElementBodyComment the default comment element.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElement;
/**
* DefaultElementBodyWhitespace the default white space element.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElementClass;
/**
* The default ElementClass to store the Element information.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElementClassAttribute;
/**
* The default ElementClassAttribute.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElementInterface;
/**
* The default ElementInterface to store config based on class interface.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import org.x4o.xml.element.AbstractElementNamespaceContext;
/**
* The default namespace context.

View file

@ -21,18 +21,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.util.logging.Logger;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageClassLoader;
/**
* DefaultElementNamespaceInstanceProvider creates and configures an Element instance.
@ -55,7 +50,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
/**
* @param language The elementLanguage of this provider.
* @param elementNamespaceContext The elementNamespaceContext for this provider.
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementNamespaceContext)
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguageContext, org.x4o.xml.element.ElementNamespaceContext)
*/
public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) {
this.elementNamespaceContext=elementNamespaceContext;
@ -68,7 +63,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
* @throws ElementNamespaceInstanceProviderException
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(java.lang.String)
*/
public Element createElementInstance(ElementLanguage elementLanguage,String tag) throws ElementNamespaceInstanceProviderException {
public Element createElementInstance(X4OLanguageContext elementLanguage,String tag) throws ElementNamespaceInstanceProviderException {
ElementClass elementClass = elementNamespaceContext.getElementClass(tag);
Element element = null;
@ -98,7 +93,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
throw new ElementNamespaceInstanceProviderException(this,"Error while providing Element: "+e.getMessage(),e);
} */
element.setElementClass(elementClass);
element.setElementLanguage(elementLanguage);
element.setLanguageContext(elementLanguage);
return element;
}
}

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.io.Serializable;
import java.lang.reflect.Method;
@ -33,8 +33,6 @@ import java.util.logging.Logger;
import org.x4o.xml.conv.DefaultObjectConverterProvider;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.element.ElementObjectPropertyValue;
import org.x4o.xml.element.ElementObjectPropertyValueException;
/**
* An DefaultElementObjectPropertyValue which does does get/set operations on pojo beans.

View file

@ -21,11 +21,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.util.Comparator;
import org.x4o.xml.element.ElementAttributeHandler;
/**

View file

@ -27,6 +27,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.x4o.xml.lang.X4OLanguageContext;
/**
* Defines an XML element with an object.<br>
* <br>
@ -134,13 +136,13 @@ public interface Element {
* Sets the ElementLanguage.
* @param elementLanguage The ElementLanguage to set.
*/
void setElementLanguage(ElementLanguage elementLanguage);
void setLanguageContext(X4OLanguageContext elementLanguage);
/**
* Gets the ElementLanguage.
* @return Returns the ElementLanguage.
*/
ElementLanguage getElementLanguage();
X4OLanguageContext getElementLanguage();
/**
* Sets the body texts on an event based system.

View file

@ -23,7 +23,8 @@
package org.x4o.xml.element;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguage;
/**
* ElementNamespaceInstanceProvider is provider for creating new Element instances for an xml tag.<br>
@ -47,5 +48,5 @@ public interface ElementNamespaceInstanceProvider {
* @return An new Element instance.
* @throws ElementNamespaceInstanceProviderException Thrown when error happened in language.
*/
Element createElementInstance(ElementLanguage elementLanguage,String tag) throws ElementNamespaceInstanceProviderException;
Element createElementInstance(X4OLanguageContext elementLanguage,String tag) throws ElementNamespaceInstanceProviderException;
}

View file

@ -1,57 +0,0 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
import java.util.logging.Logger;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementLanguageModuleLoader;
/**
* ElementLanguageModuleLoaderDummy loads nothing.
*
* @author Willem Cazander
* @version 1.0 Aug 3, 2012
*/
public class DefaultElementLanguageModuleLoaderDummy implements ElementLanguageModuleLoader {
private Logger logger = null;
/**
* Creates new DefaultElementLanguageModuleLoaderDummy.
*/
public DefaultElementLanguageModuleLoaderDummy() {
logger = Logger.getLogger(DefaultElementLanguageModuleLoaderDummy.class.getName());
}
/**
* @param elementLanguage The elementLanguage to load for.
* @param elementLanguageModule The elementLanguageModule to load for.
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
*/
public void loadLanguageModule(X4OLanguageLocal elementLanguage,ElementLanguageModule elementLanguageModule) {
logger.fine("Dummy loader loads nothing.");
}
}

View file

@ -1,31 +0,0 @@
/*
* 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.
*/
/**
* The X4O Element and language implementation.The X4O XML Element interfaces.
*
*
* @since 1.0
*/
package org.x4o.xml.impl;

View file

@ -23,18 +23,18 @@
package org.x4o.xml.io;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
public abstract class AbstractX4OConnection implements X4OConnection {
private ElementLanguage languageContext = null;
private X4OLanguageContext languageContext = null;
public AbstractX4OConnection(ElementLanguage languageContext) {
public AbstractX4OConnection(X4OLanguageContext languageContext) {
this.languageContext=languageContext;
}
protected ElementLanguage getLanguageContext() {
protected X4OLanguageContext getLanguageContext() {
return languageContext;
}

View file

@ -31,8 +31,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
@ -46,7 +46,7 @@ import javax.xml.parsers.ParserConfigurationException;
*/
abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> implements X4OReader<T> {
public AbstractX4OReader(ElementLanguage elementLanguage) {
public AbstractX4OReader(X4OLanguageContext elementLanguage) {
super(elementLanguage);
}
@ -59,7 +59,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
@SuppressWarnings("unchecked")
public T read(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
ElementLanguage context = readContext(input, systemId, basePath);
X4OLanguageContext context = readContext(input, systemId, basePath);
return (T)context.getRootElement().getElementObject();
}

View file

@ -31,7 +31,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
@ -44,7 +44,7 @@ import javax.xml.parsers.ParserConfigurationException;
*/
abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection implements X4OReaderContext<T> {
public AbstractX4OReaderContext(ElementLanguage languageContext) {
public AbstractX4OReaderContext(X4OLanguageContext languageContext) {
super(languageContext);
}
@ -59,7 +59,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
*/
public ElementLanguage 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) {
throw new NullPointerException("Can't convert null fileName to file object.");
}
@ -77,7 +77,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws IOException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
*/
public ElementLanguage 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) {
throw new NullPointerException("Can't read null file.");
}
@ -108,7 +108,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws SAXException
* @throws IOException
*/
public ElementLanguage 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) {
throw new NullPointerException("Can't read null resourceName from classpath.");
}
@ -143,7 +143,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
*/
public ElementLanguage readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
public X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (xmlString==null) {
throw new NullPointerException("Can't read null xml string.");
}
@ -160,7 +160,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
* @throws NullPointerException
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
*/
public ElementLanguage readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
public X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
if (url==null) {
throw new NullPointerException("Can't read null url.");
}

View file

@ -31,13 +31,13 @@ import java.io.OutputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.xml.sax.SAXException;
public abstract class AbstractX4OWriter<T> extends AbstractX4OWriterContext<T> implements X4OWriter<T> {
public AbstractX4OWriter(ElementLanguage elementLanguage) {
public AbstractX4OWriter(X4OLanguageContext elementLanguage) {
super(elementLanguage);
}
@ -49,7 +49,7 @@ public abstract class AbstractX4OWriter<T> extends AbstractX4OWriterContext<T> i
}
public void write(T object,OutputStream output) throws ParserConfigurationException, SAXException, IOException {
ElementLanguage context = getLanguageContext();
X4OLanguageContext context = getLanguageContext();
context.getRootElement().setElementObject(object); //TODO: check ??
writeContext(context,output);
}

View file

@ -31,23 +31,23 @@ import java.io.OutputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.xml.sax.SAXException;
public abstract class AbstractX4OWriterContext<T> extends AbstractX4OConnection implements X4OWriterContext<T> {
public AbstractX4OWriterContext(ElementLanguage elementLanguage) {
public AbstractX4OWriterContext(X4OLanguageContext elementLanguage) {
super(elementLanguage);
}
public void writeFileContext(ElementLanguage context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
public void writeFileContext(X4OLanguageContext context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (fileName==null) {
throw new NullPointerException("Can't convert null fileName to file object.");
}
writeFileContext(context,new File(fileName));
}
public void writeFileContext(ElementLanguage context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
public void writeFileContext(X4OLanguageContext context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
if (file==null) {
throw new NullPointerException("Can't read null file.");
}

View file

@ -24,10 +24,10 @@
package org.x4o.xml.io;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.DefaultX4OLanguage;
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
import org.x4o.xml.lang.DefaultX4OLanguage;
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
public class DefaultX4ODriver<T> extends X4ODriver<T> {

View file

@ -35,14 +35,14 @@ import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.core.X4ODebugWriter;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.core.phase.X4OPhaseException;
import org.x4o.xml.core.phase.X4OPhaseType;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementLanguageLocal;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.io.sax.XMLWriter;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageContextLocal;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.x4o.xml.lang.phase.X4OPhaseType;
import org.xml.sax.SAXException;
import org.xml.sax.ext.DefaultHandler2;
import org.xml.sax.helpers.AttributesImpl;
@ -59,12 +59,12 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
/** The logger to log to. */
private Logger logger = null;
public DefaultX4OReader(ElementLanguage elementLanguage) {
public DefaultX4OReader(X4OLanguageContext elementLanguage) {
super(elementLanguage);
logger = Logger.getLogger(DefaultX4OReader.class.getName());
}
public ElementLanguage readContext(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
public X4OLanguageContext readContext(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_STREAM, input);
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_SYSTEM_ID, systemId);
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_BASE_PATH, basePath);
@ -96,7 +96,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
* Parses the input stream as a X4O document.
*/
protected void read() throws ParserConfigurationException,SAXException,IOException {
ElementLanguage elementLanguage = getLanguageContext();
X4OLanguageContext elementLanguage = getLanguageContext();
if (elementLanguage.getLanguage()==null) {
throw new ParserConfigurationException("parserConfig is broken getLanguage() returns null.");
}
@ -116,7 +116,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
xmlDebugWriter.startDocument();
xmlDebugWriter.startPrefixMapping("debug", X4ODebugWriter.DEBUG_URI);
X4ODebugWriter debugWriter = new X4ODebugWriter(xmlDebugWriter);
ElementLanguageLocal local = (ElementLanguageLocal)elementLanguage;
X4OLanguageContextLocal local = (X4OLanguageContextLocal)elementLanguage;
local.setX4ODebugWriter(debugWriter);
startedDebugWriter = true;
}
@ -195,7 +195,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
}
}
public void releaseContext(ElementLanguage context) throws X4OPhaseException {
public void releaseContext(X4OLanguageContext context) throws X4OPhaseException {
if (context==null) {
return;
}

View file

@ -25,14 +25,14 @@ package org.x4o.xml.io;
import java.io.File;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.eld.xsd.EldXsdXmlGenerator;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
public class DefaultX4OSchemaWriter extends AbstractX4OConnection implements X4OSchemaWriter {
public DefaultX4OSchemaWriter(ElementLanguage languageContext) {
public DefaultX4OSchemaWriter(X4OLanguageContext languageContext) {
super(languageContext);
}

View file

@ -29,16 +29,16 @@ import java.io.OutputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.xml.sax.SAXException;
public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
public DefaultX4OWriter(ElementLanguage elementLanguage) {
public DefaultX4OWriter(X4OLanguageContext elementLanguage) {
super(elementLanguage);
}
public void writeContext(ElementLanguage context,OutputStream out) throws ParserConfigurationException,
public void writeContext(X4OLanguageContext context,OutputStream out) throws ParserConfigurationException,
FileNotFoundException, SecurityException, NullPointerException,
SAXException, IOException {

View file

@ -31,13 +31,13 @@ import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.core.phase.X4OPhaseException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.xml.sax.SAXException;
public interface X4OReaderContext<T> extends X4OReader<T> {
void releaseContext(ElementLanguage context) throws X4OPhaseException;
void releaseContext(X4OLanguageContext context) throws X4OPhaseException;
/**
* Method to parse the xml data.
@ -46,7 +46,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws SAXException
* @throws IOException
*/
ElementLanguage readContext(InputStream input,String systemId,URL basePath) throws ParserConfigurationException,SAXException,IOException;
X4OLanguageContext readContext(InputStream input,String systemId,URL basePath) throws ParserConfigurationException,SAXException,IOException;
/**
* Reads the file fileName and parses it as an InputStream.
@ -59,7 +59,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
*/
ElementLanguage readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
/**
* Reads the file and parses it as an InputStream.
@ -72,7 +72,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws IOException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
*/
ElementLanguage readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
/**
* Parses an resource locaction.
@ -84,7 +84,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws SAXException
* @throws IOException
*/
ElementLanguage readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
/**
* Converts a String to a InputStream to is can me parsed by SAX.
@ -95,7 +95,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
*/
ElementLanguage readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
/**
* Fetched the data direct from remote url to a InputStream to is can me parsed by SAX.
@ -106,5 +106,5 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
* @throws NullPointerException
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
*/
ElementLanguage readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
}

View file

@ -30,14 +30,14 @@ import java.io.OutputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.xml.sax.SAXException;
public interface X4OWriterContext<T> extends X4OWriter<T> {
void writeContext(ElementLanguage context,OutputStream out) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
void writeContext(X4OLanguageContext context,OutputStream out) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
void writeFileContext(ElementLanguage context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
void writeFileContext(X4OLanguageContext context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
void writeFileContext(ElementLanguage context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
void writeFileContext(X4OLanguageContext context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
}

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
package org.x4o.xml.io.sax;
import java.lang.reflect.Method;
import java.util.Collection;
@ -29,11 +29,6 @@ import java.util.List;
import java.util.Map;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.core.config.X4OLanguageConfiguration;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.core.phase.X4OPhaseException;
import org.x4o.xml.core.phase.X4OPhase;
import org.x4o.xml.core.phase.X4OPhaseListener;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementAttributeHandler;
import org.x4o.xml.element.ElementBindingHandler;
@ -42,12 +37,17 @@ import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementClassBase;
import org.x4o.xml.element.ElementConfigurator;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.lang.phase.X4OPhase;
import org.x4o.xml.lang.phase.X4OPhaseException;
import org.x4o.xml.lang.phase.X4OPhaseListener;
import org.xml.sax.SAXException;
import org.xml.sax.ext.DefaultHandler2;
import org.xml.sax.helpers.AttributesImpl;
@ -83,9 +83,9 @@ public class X4ODebugWriter {
/**
* @throws X4OPhaseException
* @see org.x4o.xml.core.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.element.ElementLanguage)
* @see org.x4o.xml.lang.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.lang.X4OLanguageContext)
*/
public void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
public void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
startTime = System.currentTimeMillis();
try {
AttributesImpl atts = new AttributesImpl();
@ -99,7 +99,7 @@ public class X4ODebugWriter {
debugPhase(phase);
}
public void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
public void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
long stopTime = System.currentTimeMillis();
try {
AttributesImpl atts = new AttributesImpl();
@ -115,7 +115,7 @@ public class X4ODebugWriter {
}
}
public void debugLanguageProperties(ElementLanguage ec) throws ElementException {
public void debugLanguageProperties(X4OLanguageContext ec) throws ElementException {
try {
AttributesImpl atts = new AttributesImpl();
debugWriter.startElement (DEBUG_URI, "X4OLanguageProperties", "", atts);
@ -136,7 +136,7 @@ public class X4ODebugWriter {
}
}
public void debugLanguageDefaultClasses(ElementLanguage ec) throws ElementException {
public void debugLanguageDefaultClasses(X4OLanguageContext ec) throws ElementException {
try {
AttributesImpl atts = new AttributesImpl();
debugWriter.startElement (DEBUG_URI, "X4OLanguageDefaultClasses", "", atts);
@ -212,20 +212,20 @@ public class X4ODebugWriter {
}
}
public void debugElementLanguageModules(ElementLanguage elementLanguage) throws ElementException {
public void debugElementLanguageModules(X4OLanguageContext elementLanguage) throws ElementException {
try {
AttributesImpl attsEmpty = new AttributesImpl();
debugWriter.startElement (DEBUG_URI, "ElementLanguageModules", "", attsEmpty);
for (ElementLanguageModule module:elementLanguage.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "className", "", "", module.getClass().getName());
atts.addAttribute ("", "name", "", "", module.getName());
atts.addAttribute ("", "providerName", "", "", module.getProviderName());
if (module.getElementLanguageModuleLoader()==null) {
if (module.getLanguageModuleLoader()==null) {
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", "null");
} else {
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", module.getElementLanguageModuleLoader().getClass().getName());
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", module.getLanguageModuleLoader().getClass().getName());
}
debugWriter.startElement (DEBUG_URI, "ElementLanguageModule", "", atts);
@ -422,7 +422,7 @@ public class X4ODebugWriter {
}
}
public void debugElementLanguage(ElementLanguage elementLanguage) throws SAXException {
public void debugElementLanguage(X4OLanguageContext elementLanguage) throws SAXException {
AttributesImpl atts = new AttributesImpl();
//atts.addAttribute ("", key, "", "", value);
atts.addAttribute ("", "language", "", "", elementLanguage.getLanguage().getLanguageName());

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
package org.x4o.xml.io.sax;
import java.io.File;
import java.io.FileInputStream;
@ -31,11 +31,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -56,7 +56,7 @@ public class X4OEntityResolver implements EntityResolver {
private Logger logger = null;
private URL basePath = null;
private ElementLanguage elementContext = null;
private X4OLanguageContext elementContext = null;
private Map<String,String> schemaResources = null;
private Map<String,String> schemaPathResources = null;
@ -64,7 +64,7 @@ public class X4OEntityResolver implements EntityResolver {
* Creates an X4OEntityResolver for a language.
* @param elementContext The x4o language to resolve entities for.
*/
public X4OEntityResolver(ElementLanguage elementContext) {
public X4OEntityResolver(X4OLanguageContext elementContext) {
if (elementContext==null) {
throw new NullPointerException("Can't provide entities with null elementContext.");
}
@ -73,7 +73,7 @@ public class X4OEntityResolver implements EntityResolver {
this.basePath=(URL)elementContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_BASE_PATH);
this.schemaResources=new HashMap<String,String>(20);
this.schemaPathResources=new HashMap<String,String>(20);
for (ElementLanguageModule mod:elementContext.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:elementContext.getLanguage().getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
if (ns.getSchemaUri()==null) {
continue;

View file

@ -21,11 +21,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
package org.x4o.xml.io.sax;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@ -38,14 +38,14 @@ import org.xml.sax.SAXParseException;
*/
public class X4OErrorHandler implements ErrorHandler {
private ElementLanguage elementContext = null;
private X4OLanguageContext elementContext = null;
private ErrorHandler errorHandler = null;
/**
* Construct a new SAXErrorPrinter
* @param language The language to get errors to.
*/
public X4OErrorHandler(ElementLanguage elementContext) {
public X4OErrorHandler(X4OLanguageContext elementContext) {
if (elementContext==null) {
throw new NullPointerException("Can't debug and proxy errors with null elementContext.");
}

View file

@ -21,16 +21,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
package org.x4o.xml.io.sax;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.Element.ElementType;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.io.sax.AttributeMap;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
@ -61,7 +60,7 @@ public class X4OTagHandler extends DefaultHandler2 {
private Stack<Element> elementStack = null;
/** The elememtContext */
private ElementLanguage elementLanguage = null;
private X4OLanguageContext elementLanguage = null;
/** Store the override element */
private Element overrideSaxElement = null;
@ -73,7 +72,7 @@ public class X4OTagHandler extends DefaultHandler2 {
* Creates an X4OTagHandler
* which can receice sax xml events and converts them into the Element* interfaces events.
*/
public X4OTagHandler(ElementLanguage elementLanguage) {
public X4OTagHandler(X4OLanguageContext elementLanguage) {
logger = Logger.getLogger(X4OTagHandler.class.getName());
loggerFinest = logger.isLoggable(Level.FINEST);
elementStack = new Stack<Element>();

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import java.util.Map;
import java.util.HashMap;
@ -30,10 +30,11 @@ import java.util.logging.Logger;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import org.x4o.xml.core.X4ODebugWriter;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.core.phase.X4OPhase;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementAttributeValueParser;
import org.x4o.xml.element.ElementObjectPropertyValue;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.lang.phase.X4OPhase;
/**
* An AbstractElementLanguage.
@ -41,7 +42,7 @@ import org.x4o.xml.core.phase.X4OPhase;
* @author Willem Cazander
* @version 1.0 Aug 20, 2005
*/
public abstract class AbstractElementLanguage implements ElementLanguageLocal {
public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLocal {
private Logger logger = null;
private X4OLanguage language = null;
@ -58,7 +59,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
/**
* Creates a new empty ElementLanguage.
*/
public AbstractElementLanguage(X4OLanguage language,String languageVersion) {
public AbstractX4OLanguageContext(X4OLanguage language,String languageVersion) {
if (language==null) {
throw new NullPointerException("language may not be null");
}
@ -68,7 +69,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
if (languageVersion.length()==0) {
throw new IllegalArgumentException("languageVersion may not be empty");
}
logger = Logger.getLogger(AbstractElementLanguage.class.getName());
logger = Logger.getLogger(AbstractX4OLanguageContext.class.getName());
logger.finest("Creating new ParsingContext");
this.language=language;
dirtyElements = new HashMap<Element, X4OPhase>(40);
@ -82,16 +83,16 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#getELContext()
* @see org.x4o.xml.lang.X4OLanguageContext#getExpressionLanguageContext()
*/
public ELContext getELContext() {
public ELContext getExpressionLanguageContext() {
return eLContext;
}
/**
* @see org.x4o.xml.element.ElementLanguageLocal#setELContext(javax.el.ELContext)
* @see org.x4o.xml.lang.X4OLanguageContextLocal#setExpressionLanguageContext(javax.el.ELContext)
*/
public void setELContext(ELContext context) {
public void setExpressionLanguageContext(ELContext context) {
if (eLContext!=null) {
throw new IllegalStateException("Can only set elContext once.");
}
@ -99,16 +100,16 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#getExpressionFactory()
* @see org.x4o.xml.lang.X4OLanguageContext#getExpressionLanguageFactory()
*/
public ExpressionFactory getExpressionFactory() {
public ExpressionFactory getExpressionLanguageFactory() {
return expressionFactory;
}
/**
* @see org.x4o.xml.element.ElementLanguageLocal#setExpressionFactory(javax.el.ExpressionFactory)
* @see org.x4o.xml.lang.X4OLanguageContextLocal#setExpressionLanguageFactory(javax.el.ExpressionFactory)
*/
public void setExpressionFactory(ExpressionFactory expressionFactory) {
public void setExpressionLanguageFactory(ExpressionFactory expressionFactory) {
if (this.expressionFactory!=null) {
throw new IllegalStateException("Can only set expressionFactory once.");
}
@ -150,21 +151,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#getCurrentX4OPhase()
* @see org.x4o.xml.lang.X4OLanguageContext#getCurrentX4OPhase()
*/
public X4OPhase getCurrentX4OPhase() {
return currentX4OPhase;
}
/**
* @see org.x4o.xml.element.ElementLanguage#setCurrentX4OPhase(org.x4o.xml.core.phase.X4OPhase)
* @see org.x4o.xml.lang.X4OLanguageContext#setCurrentX4OPhase(org.x4o.xml.lang.phase.X4OPhase)
*/
public void setCurrentX4OPhase(X4OPhase currentX4OPhase) {
this.currentX4OPhase = currentX4OPhase;
}
/**
* @see org.x4o.xml.element.ElementLanguage#addDirtyElement(org.x4o.xml.element.Element, org.x4o.xml.core.phase.X4OPhase)
* @see org.x4o.xml.lang.X4OLanguageContext#addDirtyElement(org.x4o.xml.element.Element, org.x4o.xml.lang.phase.X4OPhase)
*/
public void addDirtyElement(Element element, X4OPhase phase) {
if (dirtyElements.containsKey(element)) {
@ -174,21 +175,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#getDirtyElements()
* @see org.x4o.xml.lang.X4OLanguageContext#getDirtyElements()
*/
public Map<Element, X4OPhase> getDirtyElements() {
return dirtyElements;
}
/**
* @see org.x4o.xml.element.ElementLanguage#getRootElement()
* @see org.x4o.xml.lang.X4OLanguageContext#getRootElement()
*/
public Element getRootElement() {
return rootElement;
}
/**
* @see org.x4o.xml.element.ElementLanguage#setRootElement(org.x4o.xml.element.Element)
* @see org.x4o.xml.lang.X4OLanguageContext#setRootElement(org.x4o.xml.element.Element)
*/
public void setRootElement(Element element) {
if (element==null) {
@ -210,14 +211,14 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageProperty(org.x4o.xml.core.config.X4OLanguageProperty)
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty)
*/
public Object getLanguageProperty(X4OLanguageProperty property) {
return getLanguageProperty(property.toUri());
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#setLanguageProperty(org.x4o.xml.core.config.X4OLanguageProperty, java.lang.Object)
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty, java.lang.Object)
*/
public void setLanguageProperty(X4OLanguageProperty property, Object value) {
if (property.isValueValid(value)==false) {
@ -227,7 +228,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguagePropertyBoolean(org.x4o.xml.core.config.X4OLanguageProperty)
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyBoolean(org.x4o.xml.lang.X4OLanguageProperty)
*/
public boolean getLanguagePropertyBoolean(X4OLanguageProperty property) {
Object value = getLanguageProperty(property);
@ -238,7 +239,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguagePropertyInteger(org.x4o.xml.core.config.X4OLanguageProperty)
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyInteger(org.x4o.xml.lang.X4OLanguageProperty)
*/
public int getLanguagePropertyInteger(X4OLanguageProperty property) {
Object value = getLanguageProperty(property);
@ -257,21 +258,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getX4ODebugWriter()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getX4ODebugWriter()
*/
public X4ODebugWriter getX4ODebugWriter() {
return debugWriter;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#hasX4ODebugWriter()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#hasX4ODebugWriter()
*/
public boolean hasX4ODebugWriter() {
return debugWriter!=null;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#setX4ODebugWriter(org.x4o.xml.core.X4ODebugWriter)
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setX4ODebugWriter(org.x4o.xml.io.sax.X4ODebugWriter)
*/
public void setX4ODebugWriter(X4ODebugWriter debugWriter) {
this.debugWriter=debugWriter;

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import java.util.List;
import java.util.Map;
@ -29,7 +29,12 @@ import java.util.HashMap;
import java.util.ArrayList;
import java.util.logging.Logger;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.element.AbstractElementMetaBase;
import org.x4o.xml.element.ElementAttributeHandler;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementNamespaceContext;
/**
* An AbstractElementLanguageModule.
@ -37,7 +42,7 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
* @author Willem Cazander
* @version 1.0 Aug 2, 2012
*/
public abstract class AbstractElementLanguageModule extends AbstractElementMetaBase implements ElementLanguageModule {
public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase implements X4OLanguageModule {
private Logger logger = null;
@ -57,13 +62,13 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
private Map<String,ElementNamespaceContext> elementNamespaceContexts = null;
private ElementLanguageModuleLoader elementLanguageModuleLoader = null;
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
/**
* Creates a new empty ElementLanguage.
*/
public AbstractElementLanguageModule() {
logger = Logger.getLogger(AbstractElementLanguage.class.getName());
public AbstractX4OLanguageModule() {
logger = Logger.getLogger(AbstractX4OLanguageContext.class.getName());
logger.finest("Creating new ParsingContext");
elementAttributeHandlers = new ArrayList<ElementAttributeHandler>(4);
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
@ -101,7 +106,7 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#addElementAttributeHandler(ElementAttributeHandler)
* @see org.x4o.xml.lang.X4OLanguageModule#addElementAttributeHandler(ElementAttributeHandler)
*/
public void addElementAttributeHandler(ElementAttributeHandler elementAttributeHandler) {
if (elementAttributeHandler==null) {
@ -115,14 +120,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementAttributeHandlers()
* @see org.x4o.xml.lang.X4OLanguageModule#getElementAttributeHandlers()
*/
public List<ElementAttributeHandler> getElementAttributeHandlers() {
return elementAttributeHandlers;
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#addElementBindingHandler(ElementBindingHandler)
* @see org.x4o.xml.lang.X4OLanguageModule#addElementBindingHandler(ElementBindingHandler)
*/
public void addElementBindingHandler(ElementBindingHandler elementBindingHandler) {
if (elementBindingHandler==null) {
@ -143,14 +148,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementBindingHandlers()
* @see org.x4o.xml.lang.X4OLanguageModule#getElementBindingHandlers()
*/
public List<ElementBindingHandler> getElementBindingHandlers() {
return elementBindingHandlers;
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#addElementConfiguratorGlobal(ElementConfiguratorGlobal)
* @see org.x4o.xml.lang.X4OLanguageModule#addElementConfiguratorGlobal(ElementConfiguratorGlobal)
*/
public void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator) {
if (elementConfigurator==null) {
@ -164,14 +169,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementConfiguratorGlobals()
* @see org.x4o.xml.lang.X4OLanguageModule#getElementConfiguratorGlobals()
*/
public List<ElementConfiguratorGlobal> getElementConfiguratorGlobals() {
return elementConfiguratorGlobals;
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#addElementInterface(org.x4o.xml.element.ElementInterface)
* @see org.x4o.xml.lang.X4OLanguageModule#addElementInterface(org.x4o.xml.element.ElementInterface)
*/
public void addElementInterface(ElementInterface elementInterface) {
if (elementInterface==null) {
@ -187,14 +192,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementInterfaces()
* @see org.x4o.xml.lang.X4OLanguageModule#getElementInterfaces()
*/
public List<ElementInterface> getElementInterfaces() {
return elementInterfaces;
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#addElementNamespaceContext(org.x4o.xml.element.ElementNamespaceContext)
* @see org.x4o.xml.lang.X4OLanguageModule#addElementNamespaceContext(org.x4o.xml.element.ElementNamespaceContext)
*/
public void addElementNamespaceContext(ElementNamespaceContext elementNamespaceContext) {
if (elementNamespaceContext==null) {
@ -222,14 +227,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementNamespaceContext(java.lang.String)
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContext(java.lang.String)
*/
public ElementNamespaceContext getElementNamespaceContext(String namespaceUri) {
return elementNamespaceContexts.get(namespaceUri);
}
/**
* @see org.x4o.xml.element.ElementLanguageModule#getElementNamespaceContexts()
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContexts()
*/
public List<ElementNamespaceContext> getElementNamespaceContexts() {
return new ArrayList<ElementNamespaceContext>(elementNamespaceContexts.values());
@ -238,14 +243,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
/**
* @return the elementLanguageModuleLoader
*/
public ElementLanguageModuleLoader getElementLanguageModuleLoader() {
public X4OLanguageModuleLoader getLanguageModuleLoader() {
return elementLanguageModuleLoader;
}
/**
* @param elementLanguageModuleLoader the elementLanguageModuleLoader to set
*/
public void setElementLanguageModuleLoader(ElementLanguageModuleLoader elementLanguageModuleLoader) {
public void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader) {
this.elementLanguageModuleLoader = elementLanguageModuleLoader;
}
@ -266,12 +271,12 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
/**
* Reloads the module, experiment !!
*/
public void reloadModule(X4OLanguageLocal elementLanguage,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
public void reloadModule(X4OLanguageLocal elementLanguage,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
elementAttributeHandlers.clear();
elementBindingHandlers.clear();
elementInterfaces.clear();
elementNamespaceContexts.clear();
getElementLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
getLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
}
}

View file

@ -1,27 +1,26 @@
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.x4o.xml.core.phase.X4OPhaseManager;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.phase.X4OPhaseManager;
public class DefaultX4OLanguage implements X4OLanguageLocal {
private Logger logger = null;
private X4OLanguageConfiguration languageConfiguration = null;
private List<ElementLanguageModule> elementLanguageModules = null;
private List<X4OLanguageModule> elementLanguageModules = null;
private String languageName = null;
private String languageVersion = null;
private X4OPhaseManager phaseManager = null;
public DefaultX4OLanguage(X4OLanguageConfiguration languageConfiguration,X4OPhaseManager phaseManager,String languageName,String languageVersion) {
logger = Logger.getLogger(DefaultX4OLanguage.class.getName());
elementLanguageModules = new ArrayList<ElementLanguageModule>(20);
elementLanguageModules = new ArrayList<X4OLanguageModule>(20);
this.languageConfiguration=languageConfiguration;
this.languageName=languageName;
this.languageVersion=languageVersion;
@ -29,21 +28,21 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
/**
* @see org.x4o.xml.core.config.X4OLanguage#getLanguageName()
* @see org.x4o.xml.lang.X4OLanguage#getLanguageName()
*/
public String getLanguageName() {
return languageName;
}
/**
* @see org.x4o.xml.core.config.X4OLanguage#getLanguageVersion()
* @see org.x4o.xml.lang.X4OLanguage#getLanguageVersion()
*/
public String getLanguageVersion() {
return languageVersion;
}
/**
* @see org.x4o.xml.core.config.X4OLanguage#getPhaseManager()
* @see org.x4o.xml.lang.X4OLanguage#getPhaseManager()
*/
public X4OPhaseManager getPhaseManager() {
return phaseManager;
@ -64,9 +63,9 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}*/
/**
* @see org.x4o.xml.element.ElementLanguage#addElementLanguageModule(org.x4o.xml.element.ElementLanguageModule)
* @see org.x4o.xml.lang.X4OLanguageContext#addLanguageModule(org.x4o.xml.lang.X4OLanguageModule)
*/
public void addElementLanguageModule(ElementLanguageModule elementLanguageModule) {
public void addLanguageModule(X4OLanguageModule elementLanguageModule) {
if (elementLanguageModule.getId()==null) {
throw new NullPointerException("Can't add module without id.");
}
@ -74,20 +73,20 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#getElementLanguageModules()
* @see org.x4o.xml.lang.X4OLanguageContext#getLanguageModules()
*/
public List<ElementLanguageModule> getElementLanguageModules() {
public List<X4OLanguageModule> getLanguageModules() {
return elementLanguageModules;
}
/**
* @see org.x4o.xml.element.ElementLanguage#findElementBindingHandlers(java.lang.Object,java.lang.Object)
* @see org.x4o.xml.lang.X4OLanguageContext#findElementBindingHandlers(java.lang.Object,java.lang.Object)
*/
public List<ElementBindingHandler> findElementBindingHandlers(Object parent,Object child) {
List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50);
for (int i=0;i<elementLanguageModules.size();i++) {
ElementLanguageModule module = elementLanguageModules.get(i);
X4OLanguageModule module = elementLanguageModules.get(i);
findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers());
}
for (ElementInterface ei:findElementInterfaces(parent)) {
@ -124,7 +123,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#findElementInterfaces(java.lang.Object)
* @see org.x4o.xml.lang.X4OLanguageContext#findElementInterfaces(java.lang.Object)
*/
public List<ElementInterface> findElementInterfaces(Object elementObject) {
if (elementObject==null) {
@ -132,7 +131,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
List<ElementInterface> result = new ArrayList<ElementInterface>(50);
for (int i=0;i<elementLanguageModules.size();i++) {
ElementLanguageModule module = elementLanguageModules.get(i);
X4OLanguageModule module = elementLanguageModules.get(i);
for (ElementInterface ei:module.getElementInterfaces()) {
Class<?> eClass = ei.getInterfaceClass();
logger.finest("Checking interface handler: "+ei+" for class: "+eClass);
@ -149,14 +148,14 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
}
/**
* @see org.x4o.xml.element.ElementLanguage#findElementNamespaceContext(java.lang.String)
* @see org.x4o.xml.lang.X4OLanguageContext#findElementNamespaceContext(java.lang.String)
*/
public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) {
// TODO: refactor so no search for every tag !!
ElementNamespaceContext result = null;
for (int i=0;i<elementLanguageModules.size();i++) {
ElementLanguageModule module = elementLanguageModules.get(i);
X4OLanguageModule module = elementLanguageModules.get(i);
result = module.getElementNamespaceContext(namespaceUri);
if (result!=null) {
return result;

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.ArrayList;
import java.util.HashMap;
@ -33,24 +33,20 @@ import javax.el.ExpressionFactory;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.el.X4OELContext;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.element.DefaultElement;
import org.x4o.xml.element.DefaultElementAttributeValueParser;
import org.x4o.xml.element.DefaultElementBodyCharacters;
import org.x4o.xml.element.DefaultElementBodyComment;
import org.x4o.xml.element.DefaultElementBodyWhitespace;
import org.x4o.xml.element.DefaultElementClass;
import org.x4o.xml.element.DefaultElementClassAttribute;
import org.x4o.xml.element.DefaultElementInterface;
import org.x4o.xml.element.DefaultElementNamespaceContext;
import org.x4o.xml.element.DefaultElementNamespaceInstanceProvider;
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
import org.x4o.xml.element.DefaultGlobalAttributeHandlerComparator;
import org.x4o.xml.element.ElementAttributeValueParser;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementLanguageLocal;
import org.x4o.xml.element.ElementObjectPropertyValue;
import org.x4o.xml.impl.DefaultElementBodyCharacters;
import org.x4o.xml.impl.DefaultElementBodyComment;
import org.x4o.xml.impl.DefaultElement;
import org.x4o.xml.impl.DefaultElementAttributeValueParser;
import org.x4o.xml.impl.DefaultElementClass;
import org.x4o.xml.impl.DefaultElementClassAttribute;
import org.x4o.xml.impl.DefaultElementLanguage;
import org.x4o.xml.impl.DefaultElementInterface;
import org.x4o.xml.impl.DefaultElementLanguageModule;
import org.x4o.xml.impl.DefaultElementNamespaceContext;
import org.x4o.xml.impl.DefaultElementNamespaceInstanceProvider;
import org.x4o.xml.impl.DefaultElementObjectPropertyValue;
import org.x4o.xml.impl.DefaultGlobalAttributeHandlerComparator;
import org.x4o.xml.impl.DefaultElementBodyWhitespace;
/**
@ -65,148 +61,148 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageResourcePathPrefix()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageResourcePathPrefix()
*/
public String getLanguageResourcePathPrefix() {
return X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageResourceModulesFileName()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageResourceModulesFileName()
*/
public String getLanguageResourceModulesFileName() {
return X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementNamespaceContext()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementNamespaceContext()
*/
public Class<?> getDefaultElementNamespaceContext() {
return DefaultElementNamespaceContext.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementInterface()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementInterface()
*/
public Class<?> getDefaultElementInterface() {
return DefaultElementInterface.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElement()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElement()
*/
public Class<?> getDefaultElement() {
return DefaultElement.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementClass()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementClass()
*/
public Class<?> getDefaultElementClass() {
return DefaultElementClass.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementClassAttribute()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementClassAttribute()
*/
public Class<?> getDefaultElementClassAttribute() {
return DefaultElementClassAttribute.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementLanguageModule()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementLanguageModule()
*/
public Class<?> getDefaultElementLanguageModule() {
return DefaultElementLanguageModule.class;
return DefaultX4OLanguageModule.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyComment()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyComment()
*/
public Class<?> getDefaultElementBodyComment() {
return DefaultElementBodyComment.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyCharacters()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyCharacters()
*/
public Class<?> getDefaultElementBodyCharacters() {
return DefaultElementBodyCharacters.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyWhitespace()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyWhitespace()
*/
public Class<?> getDefaultElementBodyWhitespace() {
return DefaultElementBodyWhitespace.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementNamespaceInstanceProvider()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementNamespaceInstanceProvider()
*/
public Class<?> getDefaultElementNamespaceInstanceProvider() {
return DefaultElementNamespaceInstanceProvider.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementAttributeValueParser()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementAttributeValueParser()
*/
public Class<?> getDefaultElementAttributeValueParser() {
return DefaultElementAttributeValueParser.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementObjectPropertyValue()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementObjectPropertyValue()
*/
public Class<?> getDefaultElementObjectPropertyValue() {
return DefaultElementObjectPropertyValue.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementAttributeHandlerComparator()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementAttributeHandlerComparator()
*/
public Class<?> getDefaultElementAttributeHandlerComparator() {
return DefaultGlobalAttributeHandlerComparator.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultX4OLanguageVersionFilter()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageVersionFilter()
*/
public Class<?> getDefaultX4OLanguageVersionFilter() {
return DefaultX4OLanguageVersionFilter.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultX4OLanguageLoader()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageLoader()
*/
public Class<?> getDefaultX4OLanguageLoader() {
return DefaultX4OLanguageLoader.class;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#createElementLanguage()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#createElementLanguage()
*/
public ElementLanguage createElementLanguage(X4ODriver<?> driver) {
String v = driver.DEFAULT_LANGUAGE_VERSION; // TODO:fixme
return configElementLanguage(new DefaultElementLanguage(driver.createLanguage(v),v),driver);
public X4OLanguageContext createElementLanguage(X4ODriver<?> driver) {
String v = X4ODriver.DEFAULT_LANGUAGE_VERSION; // TODO:fixme
return configElementLanguage(new DefaultX4OLanguageContext(driver.createLanguage(v),v),driver);
}
protected ElementLanguage configElementLanguage(ElementLanguage elementLanguage,X4ODriver<?> driver) {
if ((elementLanguage instanceof ElementLanguageLocal)==false) {
protected X4OLanguageContext configElementLanguage(X4OLanguageContext elementLanguage,X4ODriver<?> driver) {
if ((elementLanguage instanceof X4OLanguageContextLocal)==false) {
throw new RuntimeException("Can't init ElementLanguage which has not ElementLanguageLocal interface obj: "+elementLanguage);
}
ElementLanguageLocal contextInit = (ElementLanguageLocal)elementLanguage;
X4OLanguageContextLocal contextInit = (X4OLanguageContextLocal)elementLanguage;
//contextInit.setLanguageConfiguration(this);
for (String key:driver.getGlobalPropertyKeys()) {
Object value = driver.getGlobalProperty(key);
contextInit.setLanguageProperty(key, value);
}
if (contextInit.getExpressionFactory()==null) {
contextInit.setExpressionFactory(configExpressionFactory(contextInit));
if (contextInit.getExpressionLanguageFactory()==null) {
contextInit.setExpressionLanguageFactory(configExpressionFactory(contextInit));
}
if (contextInit.getELContext()==null) {
contextInit.setELContext(new X4OELContext());
if (contextInit.getExpressionLanguageContext()==null) {
contextInit.setExpressionLanguageContext(new X4OELContext());
}
try {
if (contextInit.getElementAttributeValueParser()==null) {
@ -221,7 +217,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
return elementLanguage;
}
protected ExpressionFactory configExpressionFactory(ElementLanguage elementContext) {
protected ExpressionFactory configExpressionFactory(X4OLanguageContext elementContext) {
ExpressionFactory factory = (ExpressionFactory)elementContext.getLanguageProperty(X4OLanguageProperty.EL_FACTORY_INSTANCE);
if (factory!=null) {
return factory;
@ -242,26 +238,26 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserProperties()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserProperties()
*/
public Map<String, Object> getSAXParserProperties(ElementLanguage elementContext) {
public Map<String, Object> getSAXParserProperties(X4OLanguageContext elementContext) {
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
return saxParserProperties;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserPropertiesOptional()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserPropertiesOptional()
*/
public Map<String, Object> getSAXParserPropertiesOptional(ElementLanguage elementContext) {
public Map<String, Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext) {
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
saxParserProperties.put("http://apache.org/xml/properties/input-buffer-size",elementContext.getLanguagePropertyInteger(X4OLanguageProperty.INPUT_BUFFER_SIZE)); // Increase buffer to 8KB
return saxParserProperties;
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeatures()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeatures()
*/
public Map<String, Boolean> getSAXParserFeatures(ElementLanguage elementContext) {
public Map<String, Boolean> getSAXParserFeatures(X4OLanguageContext elementContext) {
// see example: http://xerces.apache.org/xerces2-j/features.html
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
@ -308,9 +304,9 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeaturesOptional()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesOptional()
*/
public Map<String, Boolean> getSAXParserFeaturesOptional(ElementLanguage elementContext) {
public Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext) {
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
// Make Sax Impl more strict.
@ -332,9 +328,9 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
}
/**
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeaturesRequired()
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesRequired()
*/
public List<String> getSAXParserFeaturesRequired(ElementLanguage elementContext) {
public List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext) {
List<String> result = new ArrayList<String>(5);
result.add("http://xml.org/sax/features/use-attributes2"); // Attributes objects passed by the parser are ext.Attributes2 interface.
result.add("http://xml.org/sax/features/use-locator2"); // Locator objects passed by the parser are org.xml.sax.ext.Locator2 interface.

View file

@ -21,10 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.lang;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.element.AbstractElementLanguage;
/**
* An DefaultElementLanguage.
@ -32,9 +30,9 @@ import org.x4o.xml.element.AbstractElementLanguage;
* @author Willem Cazander
* @version 1.0 Feb 16, 2007
*/
public class DefaultElementLanguage extends AbstractElementLanguage {
public class DefaultX4OLanguageContext extends AbstractX4OLanguageContext {
public DefaultElementLanguage(X4OLanguage language, String languageVersion) {
public DefaultX4OLanguageContext(X4OLanguage language, String languageVersion) {
super(language, languageVersion);
}
}

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.io.IOException;
import java.io.InputStream;
@ -35,9 +35,6 @@ import java.util.logging.Logger;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.eld.EldModuleLoader;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementLanguageModuleLoader;
import org.x4o.xml.element.ElementLanguageModuleLoaderSibling;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -83,7 +80,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
}
/**
* @see org.x4o.xml.core.config.X4OLanguageLoader#loadLanguage(org.x4o.xml.element.ElementLanguage, java.lang.String, java.lang.String)
* @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.element.ElementLanguage, java.lang.String, java.lang.String)
*/
public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException {
try {
@ -106,14 +103,14 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
for (String key:modules.keySet()) {
String value = modules.get(key);
ElementLanguageModule module = (ElementLanguageModule)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
X4OLanguageModule module = (X4OLanguageModule)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
module.setSourceResource(value);
logMessage(languageLocal,"Parsing language config key: "+key+" value: "+value);
if ("module-loader".equals(key)) {
try {
module.setElementLanguageModuleLoader( (ElementLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance() );
module.setLanguageModuleLoader( (X4OLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance() );
} catch (Exception ee) {
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
}
@ -122,9 +119,9 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
String languagePrefix = languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix();
String resource = languagePrefix+"/"+language+"/"+value;
if (language.equals(EldDriver.LANGUAGE_NAME)) {
module.setElementLanguageModuleLoader(new EldModuleLoader(resource,true)); // load cel
module.setLanguageModuleLoader(new EldModuleLoader(resource,true)); // load cel
} else {
module.setElementLanguageModuleLoader(new EldModuleLoader(resource,false)); // load eld
module.setLanguageModuleLoader(new EldModuleLoader(resource,false)); // load eld
}
module.setSourceResource(resource);
} else if ("elb-resource".equals(key)) {
@ -134,22 +131,22 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
} else if ("sibling-loader".equals(key)) {
try {
module.setElementLanguageModuleLoader( (ElementLanguageModuleLoaderSibling)X4OLanguageClassLoader.loadClass(value).newInstance() );
module.setLanguageModuleLoader( (X4OLanguageModuleLoaderSibling)X4OLanguageClassLoader.loadClass(value).newInstance() );
} catch (Exception ee) {
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
}
}
if (module.getElementLanguageModuleLoader()==null) {
if (module.getLanguageModuleLoader()==null) {
logger.warning("module with null loader: "+module+" tag: "+key+" chars: "+value);
continue;
}
// mmm start in order ?
logMessage(languageLocal,"Starting modules: "+module+" for language: "+language);
module.getElementLanguageModuleLoader().loadLanguageModule(languageLocal, module);
module.getLanguageModuleLoader().loadLanguageModule(languageLocal, module);
languageLocal.addElementLanguageModule(module);
languageLocal.addLanguageModule(module);
}
}
} catch (Exception e1) {

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.lang;
import org.x4o.xml.element.AbstractElementLanguageModule;
/**
* An DefaultElementLanguageModule.
@ -31,6 +30,6 @@ import org.x4o.xml.element.AbstractElementLanguageModule;
* @author Willem Cazander
* @version 1.0 Aug 2, 2012
*/
public class DefaultElementLanguageModule extends AbstractElementLanguageModule {
public class DefaultX4OLanguageModule extends AbstractX4OLanguageModule {
}

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.List;
@ -36,7 +36,7 @@ public class DefaultX4OLanguageVersionFilter implements X4OLanguageVersionFilter
/**
* Filters to the best version.
* @see org.x4o.xml.core.config.X4OLanguageVersionFilter#filterVersion(java.lang.String, java.util.List)
* @see org.x4o.xml.lang.X4OLanguageVersionFilter#filterVersion(java.lang.String, java.util.List)
* @return The perfect or best match or null if no match for requested language.
* @param requestVersion The language version to search for.
* @param versions The list of version to search in.

View file

@ -21,15 +21,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.List;
import org.x4o.xml.core.phase.X4OPhaseManager;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.phase.X4OPhaseManager;
/**
* X4OLanguage hold the defined language.
@ -85,5 +84,5 @@ public interface X4OLanguage {
/**
* @return Returns a list of element language modules in this defined and loaded language.
*/
List<ElementLanguageModule> getElementLanguageModules();
List<X4OLanguageModule> getLanguageModules();
}

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
/**
* X4OLanguageClassLoader is short hand for safe class loading.

View file

@ -21,13 +21,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.List;
import java.util.Map;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.element.ElementLanguage;
/**
@ -85,30 +84,30 @@ public interface X4OLanguageConfiguration {
* Creates and filles the inital element language used to store the language.
* @return The newly created ElementLanguage.
*/
ElementLanguage createElementLanguage(X4ODriver<?> driver);
X4OLanguageContext createElementLanguage(X4ODriver<?> driver);
/**
* @return Returns Map of SAX properties which are set.
*/
Map<String,Object> getSAXParserProperties(ElementLanguage elementContext);
Map<String,Object> getSAXParserProperties(X4OLanguageContext elementContext);
/**
* @return Returns Map of SAX properties which are optional set.
*/
Map<String,Object> getSAXParserPropertiesOptional(ElementLanguage elementContext);
Map<String,Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext);
/**
* @return Returns Map of SAX features which are set on the xml parser.
*/
Map<String,Boolean> getSAXParserFeatures(ElementLanguage elementContext);
Map<String,Boolean> getSAXParserFeatures(X4OLanguageContext elementContext);
/**
* @return Returns Map of SAX features which are optional set.
*/
Map<String, Boolean> getSAXParserFeaturesOptional(ElementLanguage elementContext);
Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext);
/**
* @return Returns List of SAX features which are required for xml parsing.
*/
List<String> getSAXParserFeaturesRequired(ElementLanguage elementContext);
List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext);
}

View file

@ -21,17 +21,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import java.util.Map;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import org.x4o.xml.core.X4ODebugWriter;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.core.phase.X4OPhase;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementAttributeValueParser;
import org.x4o.xml.element.ElementObjectPropertyValue;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.lang.phase.X4OPhase;
/**
* ElementLanguage is the central store of the defined element language.
@ -39,7 +40,7 @@ import org.x4o.xml.core.phase.X4OPhase;
* @author Willem Cazander
* @version 1.0 Feb 14, 2007
*/
public interface ElementLanguage {
public interface X4OLanguageContext {
X4OLanguage getLanguage();
@ -47,13 +48,13 @@ public interface ElementLanguage {
* Gets the EL Context.
* @return Returns the ELContext.
*/
ELContext getELContext();
ELContext getExpressionLanguageContext();
/**
* Gets the ExpressionFactory.
* @return Returns the ExpressionFactory.
*/
ExpressionFactory getExpressionFactory();
ExpressionFactory getExpressionLanguageFactory();
/**
* @return Returns the ElementAttributeValueParser.

View file

@ -21,12 +21,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import org.x4o.xml.core.X4ODebugWriter;
import org.x4o.xml.element.ElementAttributeValueParser;
import org.x4o.xml.element.ElementObjectPropertyValue;
import org.x4o.xml.io.sax.X4ODebugWriter;
/**
* ElementLanguageLocal is the local set interface for ElementLanguage.
@ -34,19 +36,19 @@ import org.x4o.xml.core.X4ODebugWriter;
* @author Willem Cazander
* @version 1.0 Oct 28, 2009
*/
public interface ElementLanguageLocal extends ElementLanguage {
public interface X4OLanguageContextLocal extends X4OLanguageContext {
/**
* Sets the EL Context.
* @param context The ELContext to set.
*/
void setELContext(ELContext context);
void setExpressionLanguageContext(ELContext context);
/**
* Sets the ExpressionFactory.
* @param expressionFactory The ExpressionFactory to set.
*/
void setExpressionFactory(ExpressionFactory expressionFactory);
void setExpressionLanguageFactory(ExpressionFactory expressionFactory);
/**
* @param elementAttributeValueParser The elementAttributeValueParser to set.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
/**
* Loads the language into the contexts.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
/**
* Is throw when there is en Exception within an Element.

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import org.x4o.xml.element.ElementLanguageModule;
/**
* X4OLanguageLocal exposes the add method to load the language.
@ -40,8 +39,8 @@ public interface X4OLanguageLocal extends X4OLanguage {
*/
/**
* Adds an ElementLanguageModule to this language.
* @param elementLanguageModule The element language module to add.
* Adds an X4OLanguageModule to this language.
* @param languageModule The element language module to add.
*/
void addElementLanguageModule(ElementLanguageModule elementLanguageModule);
void addLanguageModule(X4OLanguageModule languageModule);
}

View file

@ -21,10 +21,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import java.util.List;
import org.x4o.xml.element.ElementAttributeHandler;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementMetaBase;
import org.x4o.xml.element.ElementNamespaceContext;
/**
* The ElementLanguageModule.<br>
* This is an central store to element interfaces from one language module
@ -32,7 +39,7 @@ import java.util.List;
* @author Willem Cazander
* @version 1.0 Aug 2, 2012
*/
public interface ElementLanguageModule extends ElementMetaBase {
public interface X4OLanguageModule extends ElementMetaBase {
/**
* @return the Name.
@ -123,12 +130,12 @@ public interface ElementLanguageModule extends ElementMetaBase {
/**
* @param elementLanguageModuleLoader Sets the loader of this module.
*/
void setElementLanguageModuleLoader(ElementLanguageModuleLoader elementLanguageModuleLoader);
void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader);
/**
* @return Returns the ElementLanguageModuleLoader of this module.
*/
ElementLanguageModuleLoader getElementLanguageModuleLoader();
X4OLanguageModuleLoader getLanguageModuleLoader();
/**
* @return the sourceResource

View file

@ -21,9 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import org.x4o.xml.core.config.X4OLanguageLocal;
/**
@ -34,13 +33,13 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
* @author Willem Cazander
* @version 1.0 Jul 8, 2006
*/
public interface ElementLanguageModuleLoader {
public interface X4OLanguageModuleLoader {
/**
* Starts the ElementProvider.
* @param languageLocal The ElementLanguage to load for.
* @param elementLanguageModule The ElementLanguageModule to load it into.
* @throws ElementLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded.
* @throws X4OLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded.
*/
void loadLanguageModule(X4OLanguageLocal languageLocal,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException;
void loadLanguageModule(X4OLanguageLocal languageLocal,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException;
}

View file

@ -21,7 +21,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import org.x4o.xml.element.ElementException;
/**
* ElementNamespaceLoaderException holds ElementLanguageModuleLoader which created the exception.<br>
@ -30,16 +32,16 @@ package org.x4o.xml.element;
* @version 1.0 Aug 29, 2008
*/
@SuppressWarnings("serial")
public class ElementLanguageModuleLoaderException extends ElementException {
public class X4OLanguageModuleLoaderException extends ElementException {
private ElementLanguageModuleLoader elementLanguageModuleLoader = null;
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
/**
* Creates module loader exception.
* @param elementLanguageModuleLoader The loader module which creates this exception.
* @param message The message of the exception.
*/
public ElementLanguageModuleLoaderException(ElementLanguageModuleLoader elementLanguageModuleLoader,String message) {
public X4OLanguageModuleLoaderException(X4OLanguageModuleLoader elementLanguageModuleLoader,String message) {
super(message);
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
}
@ -50,7 +52,7 @@ public class ElementLanguageModuleLoaderException extends ElementException {
* @param message The message of the exception.
* @param exception The root cause of the exception.
*/
public ElementLanguageModuleLoaderException(ElementLanguageModuleLoader elementLanguageModuleLoader,String message,Exception exception) {
public X4OLanguageModuleLoaderException(X4OLanguageModuleLoader elementLanguageModuleLoader,String message,Exception exception) {
super(message,exception);
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
}
@ -59,7 +61,7 @@ public class ElementLanguageModuleLoaderException extends ElementException {
* Returns the module loader which created the exception.
* @return Returns the module loader.
*/
public ElementLanguageModuleLoader getElementProvider() {
public X4OLanguageModuleLoader getElementProvider() {
return elementLanguageModuleLoader;
}
}

View file

@ -21,11 +21,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
package org.x4o.xml.lang;
import org.x4o.xml.core.config.X4OLanguageLoader;
import org.x4o.xml.core.config.X4OLanguageLoaderException;
import org.x4o.xml.core.config.X4OLanguageLocal;
/**
@ -35,7 +32,7 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
* @author Willem Cazander
* @version 1.0 Aug 7, 2012
*/
public interface ElementLanguageModuleLoaderSibling extends ElementLanguageModuleLoader {
public interface X4OLanguageModuleLoaderSibling extends X4OLanguageModuleLoader {
/**
* Loads in the sibling language.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.io.File;
import java.io.InputStream;

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
/**
* X4OLanguagePropertyKeys is shortcut to the the properties by uri.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import java.util.List;

View file

@ -28,4 +28,4 @@
* @since 1.0
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;

View file

@ -21,13 +21,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.util.ArrayList;
import java.util.List;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
/**
@ -98,6 +98,6 @@ public abstract class AbstractX4OPhase implements X4OPhase {
* @param elementLanguage The language to run phase for.
* @throws X4OPhaseException when phase has error.
*/
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
}
}

View file

@ -21,16 +21,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
/**
@ -124,7 +124,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
* Runs all the phases in the right order.
* @throws X4OPhaseException When a running handlers throws one.
*/
public void runPhases(ElementLanguage languageContext,X4OPhaseType type) throws X4OPhaseException {
public void runPhases(X4OLanguageContext languageContext,X4OPhaseType type) throws X4OPhaseException {
// sort for the order
List<X4OPhase> x4oPhasesOrder = getOrderedPhases(type);
@ -198,7 +198,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
* @throws X4OPhaseException When a running handlers throws one.
*/
public void runPhasesForElement(Element e,X4OPhaseType type,X4OPhase p) throws X4OPhaseException {
ElementLanguage languageContext = e.getElementLanguage();
X4OLanguageContext languageContext = e.getElementLanguage();
boolean skipRunPhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RUN);
String stopPhase = languageContext.getLanguagePropertyString(X4OLanguageProperty.PHASE_STOP_AFTER);
@ -235,7 +235,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
* Run release phase manual if auto release is disabled by config.
* @throws X4OPhaseException When a running handlers throws one.
*/
public void doReleasePhaseManual(ElementLanguage languageContext) throws X4OPhaseException {
public void doReleasePhaseManual(X4OLanguageContext languageContext) throws X4OPhaseException {
boolean skipReleasePhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RELEASE);
if (skipReleasePhase==false) {
throw new IllegalStateException("No manual release requested.");
@ -327,7 +327,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
* @param phase The phase to run.
* @throws X4OPhaseException When a running handlers throws one.
*/
private void executePhaseRoot(ElementLanguage elementLanguage,X4OPhase phase) throws X4OPhaseException {
private void executePhaseRoot(X4OLanguageContext elementLanguage,X4OPhase phase) throws X4OPhaseException {
if (elementLanguage.getRootElement()==null) {
return;
}

View file

@ -21,12 +21,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.util.List;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
/**
@ -58,7 +58,7 @@ public interface X4OPhase {
* @param elementLanguage The elementLanguage running this phase.
* @throws X4OPhaseException When error has happend.
*/
void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException;
void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException;
/**
* Returns all phase listeners which where added.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
/**
* Is throw when there is en Exception within an Element.

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.io.InputStream;
import java.util.ArrayList;
@ -34,14 +34,6 @@ import java.util.logging.Logger;
import javax.el.ValueExpression;
import org.x4o.xml.conv.ObjectConverterException;
import org.x4o.xml.core.X4ODebugWriter;
import org.x4o.xml.core.X4OEntityResolver;
import org.x4o.xml.core.X4OErrorHandler;
import org.x4o.xml.core.X4OTagHandler;
import org.x4o.xml.core.config.X4OLanguageClassLoader;
import org.x4o.xml.core.config.X4OLanguageLoader;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementAttributeHandler;
@ -51,12 +43,20 @@ import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementConfigurator;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementLanguageModuleLoaderSibling;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.io.sax.X4ODebugWriter;
import org.x4o.xml.io.sax.X4OEntityResolver;
import org.x4o.xml.io.sax.X4OErrorHandler;
import org.x4o.xml.io.sax.X4OTagHandler;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageLoader;
import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -79,7 +79,7 @@ public class X4OPhaseFactory {
logger = Logger.getLogger(X4OPhaseFactory.class.getName());
}
private void debugPhaseMessage(String message,X4OPhase phaseHandler,ElementLanguage languageContext) throws X4OPhaseException {
private void debugPhaseMessage(String message,X4OPhase phaseHandler,X4OLanguageContext languageContext) throws X4OPhaseException {
if (languageContext.hasX4ODebugWriter()) {
try {
languageContext.getX4ODebugWriter().debugPhaseMessage(message,phaseHandler.getClass());
@ -110,7 +110,7 @@ public class X4OPhaseFactory {
public void runElementPhase(Element element) throws X4OPhaseException {
// not used.
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
}
};
@ -139,7 +139,7 @@ public class X4OPhaseFactory {
}
public void runElementPhase(Element element) throws X4OPhaseException {
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
try {
debugPhaseMessage("Loading main language: "+elementLanguage.getLanguage(),this,elementLanguage);
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
@ -177,17 +177,17 @@ public class X4OPhaseFactory {
}
public void runElementPhase(Element element) throws X4OPhaseException {
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
try {
List<ElementLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<ElementLanguageModuleLoaderSibling>(3);
for (ElementLanguageModule module:elementLanguage.getLanguage().getElementLanguageModules()) {
if (module.getElementLanguageModuleLoader() instanceof ElementLanguageModuleLoaderSibling) {
siblingLoaders.add((ElementLanguageModuleLoaderSibling)module.getElementLanguageModuleLoader());
List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(3);
for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) {
if (module.getLanguageModuleLoader() instanceof X4OLanguageModuleLoaderSibling) {
siblingLoaders.add((X4OLanguageModuleLoaderSibling)module.getLanguageModuleLoader());
}
}
if (siblingLoaders.isEmpty()==false) {
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
for (ElementLanguageModuleLoaderSibling siblingLoader:siblingLoaders) {
for (X4OLanguageModuleLoaderSibling siblingLoader:siblingLoaders) {
debugPhaseMessage("Loading sibling langauge loader: "+siblingLoader,this,elementLanguage);
siblingLoader.loadLanguageSibling((X4OLanguageLocal)elementLanguage.getLanguage(), loader);
}
@ -225,7 +225,7 @@ public class X4OPhaseFactory {
public void runElementPhase(Element element) throws X4OPhaseException {
// not used.
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
// print the properties and classes for this language/config
if (elementLanguage.hasX4ODebugWriter()) {
try {
@ -262,7 +262,7 @@ public class X4OPhaseFactory {
}
public void runElementPhase(Element element) throws X4OPhaseException {
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
try {
//XMLParserConfiguration config = new XIncludeAwareParserConfiguration();
//config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",myFullGrammarPool);
@ -383,7 +383,7 @@ public class X4OPhaseFactory {
// not used.
}
@SuppressWarnings("rawtypes")
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
try {
Map beanMap = (Map)elementLanguage.getLanguageProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP);
if (beanMap==null) {
@ -391,8 +391,8 @@ public class X4OPhaseFactory {
}
for (Object elName:beanMap.keySet()) {
Object o = beanMap.get(elName);
ValueExpression ve = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${"+elName+"}", o.getClass());
ve.setValue(elementLanguage.getELContext(), o);
ValueExpression ve = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+elName+"}", o.getClass());
ve.setValue(elementLanguage.getExpressionLanguageContext(), o);
debugPhaseMessage("Setting el bean: ${"+elName+"} to: "+o.getClass().getName(),this,elementLanguage);
}
} catch (Exception e) {
@ -495,7 +495,7 @@ public class X4OPhaseFactory {
return new String[] {"READ_CONFIG_ELEMENT","READ_CONFIG_ELEMENT_INTERFACE"};
}
public void runElementPhase(Element element) throws X4OPhaseException {
for (ElementLanguageModule mod:element.getElementLanguage().getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:element.getElementLanguage().getLanguage().getLanguageModules()) {
logger.finest("Do Element Config Global Configurators: "+mod.getElementConfiguratorGlobals().size());
for (ElementConfiguratorGlobal ec:mod.getElementConfiguratorGlobals()) {
runConf.runElementConfigurator(ec,element,this);
@ -536,7 +536,7 @@ public class X4OPhaseFactory {
// do global parameters
logger.finest("Do Element Global AttributeHandlers.");
List<ElementAttributeHandler> handlers = new ArrayList<ElementAttributeHandler>();
for (ElementLanguageModule mod:element.getElementLanguage().getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:element.getElementLanguage().getLanguage().getLanguageModules()) {
for (ElementAttributeHandler global:mod.getElementAttributeHandlers()) {
String attribute = element.getAttributes().get(global.getAttributeName());
@ -578,10 +578,6 @@ public class X4OPhaseFactory {
return;
}
if (element.getElementLanguage().getLanguage().getLanguageName().equals("test")) {
System.out.println("do element; "+element.getElementClass().getTag()+" attr; "+element.getAttributes());
}
// do config
Map<String,String> attr = element.getAttributes();
ElementAttributeValueParser attrParser = element.getElementLanguage().getElementAttributeValueParser();
@ -860,7 +856,7 @@ public class X4OPhaseFactory {
public boolean isElementPhase() {
return false;
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
for (RunConfigurator conf:runConf) {
try {
if (elementLanguage.hasX4ODebugWriter()) {
@ -933,7 +929,7 @@ public class X4OPhaseFactory {
public void runElementPhase(Element element) throws X4OPhaseException {
// not used.
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
// print the properties and classes for this language/config
if (elementLanguage.hasX4ODebugWriter()) {
try {
@ -959,15 +955,15 @@ public class X4OPhaseFactory {
class ReleasePhaseListener implements X4OPhaseListener {
private int elementsReleased = 0;
/**
* @see org.x4o.xml.core.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.core.phase.X4OPhase, org.x4o.xml.element.ElementLanguage)
* @see org.x4o.xml.lang.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext)
*/
public void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
public void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
elementsReleased=0;
}
/**
* @see org.x4o.xml.core.phase.X4OPhaseListener#endRunPhase(org.x4o.xml.core.phase.X4OPhase, org.x4o.xml.element.ElementLanguage)
* @see org.x4o.xml.lang.phase.X4OPhaseListener#endRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext)
*/
public void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
public void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
if (elementLanguage.hasX4ODebugWriter()==false) {
return;
}
@ -997,7 +993,7 @@ public class X4OPhaseFactory {
public String[] getPhaseDependencies() {
return new String[] {"READ_END"};
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
}
public void runElementPhase(Element element) throws X4OPhaseException {
try {
@ -1033,7 +1029,7 @@ public class X4OPhaseFactory {
}
public void runElementPhase(Element element) throws X4OPhaseException {
}
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
// safety check
if (elementLanguage.hasX4ODebugWriter()==false) {
throw new X4OPhaseException(this,"Use debugPhase only when X4OParser.debugWriter is filled.");
@ -1058,7 +1054,7 @@ public class X4OPhaseFactory {
// note: slow version
private String getNamespaceForElement(Element e) {
for (ElementLanguageModule mod:e.getElementLanguage().getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:e.getElementLanguage().getLanguage().getLanguageModules()) {
for (ElementNamespaceContext enc:mod.getElementNamespaceContexts()) {
List<ElementClass> l = enc.getElementClasses();
if (l.contains(e.getElementClass())) {

View file

@ -21,9 +21,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
/**
@ -41,7 +41,7 @@ public interface X4OPhaseListener {
* @param elementLanguage The elementLanguage of the driver.
* @throws X4OPhaseException Is throws when listeners has error.
*/
void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException;
void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException;
/**
* Gets called after the X4OPhaseHandler is runned.
@ -49,5 +49,5 @@ public interface X4OPhaseListener {
* @param elementLanguage The elementLanguage of the driver.
* @throws X4OPhaseException Is throws when listeners has error.
*/
void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException;
void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException;
}

View file

@ -21,13 +21,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.util.Collection;
import java.util.List;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
/**
@ -51,13 +51,13 @@ public interface X4OPhaseManager {
*/
List<X4OPhase> getOrderedPhases(X4OPhaseType type);
public void doReleasePhaseManual(ElementLanguage languageContext) throws X4OPhaseException;
public void doReleasePhaseManual(X4OLanguageContext languageContext) throws X4OPhaseException;
/**
* Runs all the phases in the right order.
* @throws X4OPhaseException When a running handlers throws one.
*/
public void runPhases(ElementLanguage elementContext,X4OPhaseType type) throws X4OPhaseException;
public void runPhases(X4OLanguageContext elementContext,X4OPhaseType type) throws X4OPhaseException;
/**
* Runs phase on single element.

View file

@ -21,13 +21,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
import java.util.List;
import org.x4o.xml.core.phase.X4OPhaseFactory.X4OPhaseReadRunConfigurator;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.phase.X4OPhaseFactory.X4OPhaseReadRunConfigurator;
/**

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;
/**
* X4OPhaseType

View file

@ -27,4 +27,4 @@
* @since 1.0
*/
package org.x4o.xml.core.phase;
package org.x4o.xml.lang.phase;

View file

@ -26,8 +26,8 @@ package org.x4o.xml;
import java.util.List;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.core.config.X4OLanguageLoaderException;
import org.x4o.xml.core.phase.X4OPhaseException;
import org.x4o.xml.lang.X4OLanguageLoaderException;
import org.x4o.xml.lang.phase.X4OPhaseException;
import junit.framework.TestCase;

View file

@ -30,7 +30,7 @@ import java.util.Locale;
import org.x4o.xml.conv.text.ClassConverter;
import org.x4o.xml.conv.text.EnumConverter;
import org.x4o.xml.conv.text.URLConverter;
import org.x4o.xml.core.phase.X4OPhaseType;
import org.x4o.xml.lang.phase.X4OPhaseType;
import junit.framework.TestCase;

View file

@ -23,9 +23,9 @@
package org.x4o.xml.core;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.io.X4OReaderContext;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
@ -40,7 +40,7 @@ import junit.framework.TestCase;
public class NamespaceUriTest extends TestCase {
public void testSimpleUri() throws Exception {
ElementLanguage context = null;
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
@ -53,7 +53,7 @@ public class NamespaceUriTest extends TestCase {
}
public void testEmptyUri() throws Exception {
ElementLanguage context = null;
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
@ -67,7 +67,7 @@ public class NamespaceUriTest extends TestCase {
}
public void testSchemaUri() throws Exception {
ElementLanguage context = null;
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);

View file

@ -28,8 +28,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;

View file

@ -26,9 +26,10 @@ package org.x4o.xml.core;
import java.io.IOException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.X4OLanguageProperty;
import org.x4o.xml.eld.CelDriver;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.io.sax.X4OEntityResolver;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import org.xml.sax.EntityResolver;
@ -80,7 +81,7 @@ public class X4OEntityResolverTest extends TestCase {
public void testResolveProperty() throws Exception {
X4ODriver<TestObjectRoot> driver = new TestDriver();
ElementLanguage language = driver.createLanguageContext();
X4OLanguageContext language = driver.createLanguageContext();
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
X4OEntityResolver resolver = new X4OEntityResolver(language);
Exception e = null;
@ -96,7 +97,7 @@ public class X4OEntityResolverTest extends TestCase {
public void testResolvePropertyNull() throws Exception {
X4ODriver<TestObjectRoot> driver = new TestDriver();
ElementLanguage language = driver.createLanguageContext();
X4OLanguageContext language = driver.createLanguageContext();
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
X4OEntityResolver resolver = new X4OEntityResolver(language);
Exception e = null;

View file

@ -23,10 +23,10 @@
package org.x4o.xml.core;
import org.x4o.xml.core.config.X4OLanguageConfiguration;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.lang.X4OLanguageConfiguration;
import org.x4o.xml.test.TestDriver;
import junit.framework.TestCase;

View file

@ -26,10 +26,10 @@ package org.x4o.xml.core;
import java.util.Collection;
import java.util.List;
import org.x4o.xml.core.phase.X4OPhase;
import org.x4o.xml.core.phase.X4OPhaseManager;
import org.x4o.xml.core.phase.X4OPhaseType;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.phase.X4OPhase;
import org.x4o.xml.lang.phase.X4OPhaseManager;
import org.x4o.xml.lang.phase.X4OPhaseType;
import org.x4o.xml.test.TestDriver;
@ -51,7 +51,7 @@ public class X4OPhaseManagerTest extends TestCase {
public void testPhases() throws Exception {
TestDriver driver = TestDriver.getInstance();
ElementLanguage context = driver.createLanguageContext();
X4OLanguageContext context = driver.createLanguageContext();
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
Collection<X4OPhase> phasesAll = manager.getAllPhases();
List<X4OPhase> phases = manager.getOrderedPhases(X4OPhaseType.XML_READ);

View file

@ -29,17 +29,17 @@ import java.util.List;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.Element.ElementType;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.io.X4OSchemaWriter;
import org.x4o.xml.io.X4OWriter;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import junit.framework.TestCase;
@ -80,13 +80,13 @@ public class EldParserTest extends TestCase {
public void testRunEldParserCore() throws Exception {
X4ODriver<ElementLanguageModule> driver = (X4ODriver<ElementLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4OReader<ElementLanguageModule> reader = driver.createReader();
X4OReader<X4OLanguageModule> reader = driver.createReader();
//EldDriver parser = new EldDriver(true);
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
ElementLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
List<String> resultTags = new ArrayList<String>(50);
for (ElementNamespaceContext ns:module.getElementNamespaceContexts()) {
@ -118,8 +118,8 @@ public class EldParserTest extends TestCase {
public void testRunEldParser() throws Exception {
//EldDriver parser = new EldDriver(false);
//parser.parseResource("META-INF/test/test-lang.eld");
X4ODriver<ElementLanguageModule> driver = (X4ODriver<ElementLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4OReader<ElementLanguageModule> reader = driver.createReader();
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4OReader<X4OLanguageModule> reader = driver.createReader();
reader.readResource("META-INF/test/test-lang.eld");
}
}

View file

@ -24,9 +24,9 @@
package org.x4o.xml.eld;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;

View file

@ -21,14 +21,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.element;
import java.io.InputStream;
import java.util.logging.LogManager;
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
import org.x4o.xml.element.ElementObjectPropertyValueException;
import org.x4o.xml.impl.DefaultElementObjectPropertyValue;
import org.x4o.xml.test.models.TestObjectChild;
import junit.framework.TestCase;

View file

@ -21,14 +21,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.impl;
package org.x4o.xml.lang;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.DefaultX4OLanguageLoader;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguageLoader;
import org.x4o.xml.core.config.X4OLanguageLocal;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageLoader;
import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;

View file

@ -21,7 +21,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import junit.framework.TestCase;

View file

@ -21,9 +21,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core.config;
package org.x4o.xml.lang;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import junit.framework.TestCase;
/**

View file

@ -26,8 +26,8 @@ package org.x4o.xml.test;
import java.io.File;
import java.io.FileOutputStream;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.models.TestObjectRoot;

View file

@ -27,8 +27,8 @@ import java.io.File;
import java.io.FileOutputStream;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.models.TestObjectRoot;

View file

@ -29,12 +29,12 @@ import javax.el.ValueExpression;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.core.config.DefaultX4OLanguage;
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
import org.x4o.xml.core.config.X4OLanguage;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.lang.DefaultX4OLanguage;
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
/**
* SwiXmlParser works with the SwingEngine to config the UI tree.
@ -91,9 +91,9 @@ public class SwiXmlDriver extends X4ODriver<Component> {
* @param elementLanguage The elementLanguage to get the swingEngine out.
* @return Returns the SwingEngine for this elementLanguage.
*/
static public SwingEngine getSwingEngine(ElementLanguage elementLanguage) {
ValueExpression ee = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getELContext());
static public SwingEngine getSwingEngine(X4OLanguageContext elementLanguage) {
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext());
return se;
}

View file

@ -30,10 +30,10 @@ import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementConfigurator;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
/**
* EldDocGenerator writes documentation.
@ -43,9 +43,9 @@ import org.x4o.xml.element.ElementNamespaceContext;
*/
public class EldDocGenerator {
private ElementLanguage context = null;
private X4OLanguageContext context = null;
public EldDocGenerator(ElementLanguage context) {
public EldDocGenerator(X4OLanguageContext context) {
this.context=context;
}
@ -58,7 +58,7 @@ public class EldDocGenerator {
writer.writeOverviewNamespace(basePath, context);
writer.writeOverviewTree(basePath, context);
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
writer.writeOverviewModule(basePath, mod);

View file

@ -42,10 +42,10 @@ import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementConfigurator;
import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
/**
* EldDocHtmlWriter writes simple eld documentation.
@ -136,7 +136,7 @@ public class EldDocHtmlWriter {
}
}
public void writeIndex(File basePath,ElementLanguage context) throws IOException {
public void writeIndex(File basePath,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,"index.html");
try {
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
@ -149,7 +149,7 @@ public class EldDocHtmlWriter {
int eleConfigs = 0;
int elements = 0;
int namespaces = 0;
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
attrHandlers += mod.getElementAttributeHandlers().size();
bindHandlers += mod.getElementBindingHandlers().size();
interFaces += mod.getElementInterfaces().size();
@ -164,7 +164,7 @@ public class EldDocHtmlWriter {
printTableStart(pw,"Language Stats");
printTableRowSummary(pw,"Language:",""+context.getLanguage().getLanguageName());
printTableRowSummary(pw,"LanguageVersion:",""+context.getLanguage().getLanguageVersion());
printTableRowSummary(pw,"Modules:",""+context.getLanguage().getElementLanguageModules().size());
printTableRowSummary(pw,"Modules:",""+context.getLanguage().getLanguageModules().size());
printTableRowSummary(pw,"Namespaces:",""+namespaces);
printTableRowSummary(pw,"Elements:",""+elements);
printTableRowSummary(pw,"ElementInterfaces:",""+interFaces);
@ -181,16 +181,16 @@ public class EldDocHtmlWriter {
}
}
public void writeOverviewModule(File basePath,ElementLanguage context) throws IOException {
public void writeOverviewModule(File basePath,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,"module-overview.html");
try {
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
printHeader(pw,"Overview Modules ("+title+")","");
printPageIndexTitle(pw,title,null,null);
printTableStart(pw,"Modules");
List<ElementLanguageModule> mods = context.getLanguage().getElementLanguageModules();
List<X4OLanguageModule> mods = context.getLanguage().getLanguageModules();
Collections.sort(mods,new ElementLanguageModuleComparator());
for (ElementLanguageModule mod:mods) {
for (X4OLanguageModule mod:mods) {
printTableRowOverview(pw,toSafeUri(mod.getId())+"/index.html",mod.getId(),mod.getName());
}
printTableEnd(pw);
@ -202,16 +202,16 @@ public class EldDocHtmlWriter {
}
}
public void writeOverviewNamespace(File basePath,ElementLanguage context) throws IOException {
public void writeOverviewNamespace(File basePath,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,"namespace-overview.html");
String pathPrefix = "";
try {
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
printHeader(pw,"Overview Namespace("+title+")",pathPrefix);
printPageIndexTitle(pw,title,null,null);
List<ElementLanguageModule> mods = context.getLanguage().getElementLanguageModules();
List<X4OLanguageModule> mods = context.getLanguage().getLanguageModules();
Collections.sort(mods,new ElementLanguageModuleComparator());
for (ElementLanguageModule mod:mods) {
for (X4OLanguageModule mod:mods) {
printNamespaces(pw,mod.getElementNamespaceContexts(),pathPrefix,mod);
}
printBottom(pw,pathPrefix);
@ -222,7 +222,7 @@ public class EldDocHtmlWriter {
}
}
public void writeOverviewTree(File basePath,ElementLanguage context) throws IOException {
public void writeOverviewTree(File basePath,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,"tree-overview.html");
String pathPrefix = "";
try {
@ -231,7 +231,7 @@ public class EldDocHtmlWriter {
printPageIndexTitle(pw,title,null,null);
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
// found language root elements.
@ -260,8 +260,8 @@ public class EldDocHtmlWriter {
}
class TreeNode {
ElementLanguage context;
ElementLanguageModule module;
X4OLanguageContext context;
X4OLanguageModule module;
ElementNamespaceContext namespace;
ElementClass elementClass;
TreeNode parent;
@ -298,7 +298,7 @@ public class EldDocHtmlWriter {
if (node.indent>20) {
return result; // hard fail limit
}
for (ElementLanguageModule mod:node.context.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
for (ElementClass ec:ns.getElementClasses()) {
TreeNode n=null;
@ -370,7 +370,7 @@ public class EldDocHtmlWriter {
private List<TreeNode> findParents(TreeNode node) {
List<TreeNode> result = new ArrayList<TreeNode>(10);
TreeNode n=null;
for (ElementLanguageModule mod:node.context.getLanguage().getElementLanguageModules()) {
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
List<String> tags = node.elementClass.getElementParents(ns.getUri());
@ -434,7 +434,7 @@ public class EldDocHtmlWriter {
}
public void writeOverviewModule(File basePath,ElementLanguageModule mod) throws IOException {
public void writeOverviewModule(File basePath,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"index.html");
String pathPrefix = "../";
try {
@ -457,7 +457,7 @@ public class EldDocHtmlWriter {
}
}
public void writeOverviewElement(File basePath,ElementNamespaceContext ns,ElementLanguageModule mod) throws IOException {
public void writeOverviewElement(File basePath,ElementNamespaceContext ns,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),"index.html");
String pathPrefix = "../../";
try {
@ -495,7 +495,7 @@ public class EldDocHtmlWriter {
}
public void writeElement(File basePath,ElementClass ec,ElementNamespaceContext ns,ElementLanguageModule mod,ElementLanguage context) throws IOException {
public void writeElement(File basePath,ElementClass ec,ElementNamespaceContext ns,X4OLanguageModule mod,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"index.html");
String pathPrefix = "../../../";
try {
@ -585,7 +585,7 @@ public class EldDocHtmlWriter {
}
}
public void writeElementInterface(File basePath,ElementInterface iface,ElementLanguageModule mod) throws IOException {
public void writeElementInterface(File basePath,ElementInterface iface,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId()+".html");
String pathPrefix = "../../";
String pathLocal = toSafeUri(iface.getId())+"/";
@ -607,7 +607,7 @@ public class EldDocHtmlWriter {
}
}
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod) throws IOException {
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"conf",conf.getId()+".html");
String pathPrefix = "../../";
try {
@ -623,7 +623,7 @@ public class EldDocHtmlWriter {
}
}
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod,ElementInterface iface) throws IOException {
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod,ElementInterface iface) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"conf",conf.getId()+".html");
String pathPrefix = "../../../../";
try {
@ -639,7 +639,7 @@ public class EldDocHtmlWriter {
}
}
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod,ElementNamespaceContext ns,ElementClass ec) throws IOException {
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod,ElementNamespaceContext ns,ElementClass ec) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"conf",conf.getId()+".html");
String pathPrefix = "../../../../";
try {
@ -655,7 +655,7 @@ public class EldDocHtmlWriter {
}
}
public void writeBindingHandler(File basePath,ElementBindingHandler bind,ElementLanguageModule mod) throws IOException {
public void writeBindingHandler(File basePath,ElementBindingHandler bind,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"bind",bind.getId()+".html");
String pathPrefix = "../../";
try {
@ -678,7 +678,7 @@ public class EldDocHtmlWriter {
}
}
public void writeBindingHandler(File basePath,ElementBindingHandler bind,ElementLanguageModule mod,ElementInterface iface) throws IOException {
public void writeBindingHandler(File basePath,ElementBindingHandler bind,X4OLanguageModule mod,ElementInterface iface) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"bind",bind.getId()+".html");
String pathPrefix = "../../../../";
try {
@ -699,7 +699,7 @@ public class EldDocHtmlWriter {
}
}
public void writeAttributeHandler(File basePath,ElementAttributeHandler attr,ElementLanguageModule mod) throws IOException {
public void writeAttributeHandler(File basePath,ElementAttributeHandler attr,X4OLanguageModule mod) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"attr",attr.getId()+".html");
String pathPrefix = "../../";
try {
@ -812,7 +812,7 @@ public class EldDocHtmlWriter {
printTableEnd(pw);
}
private void printNamespaces(PrintWriter pw,List<ElementNamespaceContext> namespaces,String pathPrefix ,ElementLanguageModule mod) {
private void printNamespaces(PrintWriter pw,List<ElementNamespaceContext> namespaces,String pathPrefix ,X4OLanguageModule mod) {
printTableStart(pw,"Namespaces");
for (ElementNamespaceContext ns:namespaces) {
printTableRowOverview(pw,pathPrefix+toSafeUri(mod.getId())+"/"+toSafeUri(ns.getId())+"/index.html",ns.getId(),"<b>"+ns.getUri()+"</b><br/>"+TAB+ns.getName());
@ -1028,8 +1028,8 @@ public class EldDocHtmlWriter {
pw.print("\t\t<td class=\"NavBarCell1\"><a href=\""+pathPrefix+"tree-overview.html\">Tree</a>&nbsp;</td>\n");
}
class ElementLanguageModuleComparator implements Comparator<ElementLanguageModule> {
public int compare(ElementLanguageModule o1,ElementLanguageModule o2) {
class ElementLanguageModuleComparator implements Comparator<X4OLanguageModule> {
public int compare(X4OLanguageModule o1,X4OLanguageModule o2) {
return o1.getId().compareTo(o2.getId());
}
}

Some files were not shown because too many files have changed in this diff Show more