X4O Formatted x4o driver tests cases
This commit is contained in:
parent
bd4a04a813
commit
ed096a1427
74 changed files with 1640 additions and 1453 deletions
|
|
@ -105,11 +105,9 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
|
||||||
}
|
}
|
||||||
// Check so doc tree does not loop; see EldDocHtmlWriter.findChilderen()
|
// Check so doc tree does not loop; see EldDocHtmlWriter.findChilderen()
|
||||||
/*
|
/*
|
||||||
for (Class<?> cl:elementBindingHandler.getBindChildClasses()) {
|
* for (Class<?> cl:elementBindingHandler.getBindChildClasses()) { if (elementBindingHandler.getBindParentClass().equals(cl)) { throw new
|
||||||
if (elementBindingHandler.getBindParentClass().equals(cl)) {
|
* IllegalStateException("Can't add binding handler: "+elementBindingHandler.getId()+" with same parent as child class."); } }
|
||||||
throw new IllegalStateException("Can't add binding handler: "+elementBindingHandler.getId()+" with same parent as child class.");
|
*/
|
||||||
}
|
|
||||||
}*/
|
|
||||||
logger.finer("Adding ElementBindingHandler: " + elementBindingHandler);
|
logger.finer("Adding ElementBindingHandler: " + elementBindingHandler);
|
||||||
elementBindingHandlers.add(elementBindingHandler);
|
elementBindingHandlers.add(elementBindingHandler);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ public abstract class AbstractX4OLanguageSession implements X4OLanguageSessionLo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the phase listeners for a phase.
|
* Gets the phase listeners for a phase.
|
||||||
|
*
|
||||||
* @param phaseId The phaseId of for the listeners.
|
* @param phaseId The phaseId of for the listeners.
|
||||||
* @return The x4o phase listeners.
|
* @return The x4o phase listeners.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -151,13 +151,16 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
languageSession.setExpressionLanguageFactory(X4OExpressionFactory.createExpressionFactory());
|
languageSession.setExpressionLanguageFactory(X4OExpressionFactory.createExpressionFactory());
|
||||||
}
|
}
|
||||||
if (languageSession.getExpressionLanguageContext() == null) {
|
if (languageSession.getExpressionLanguageContext() == null) {
|
||||||
languageSession.setExpressionLanguageContext(X4OExpressionFactory.createELContext(languageSession.getLanguage().getLanguageConfiguration().getDefaultExpressionLanguageContext()));
|
languageSession.setExpressionLanguageContext(
|
||||||
|
X4OExpressionFactory.createELContext(languageSession.getLanguage().getLanguageConfiguration().getDefaultExpressionLanguageContext()));
|
||||||
}
|
}
|
||||||
if (languageSession.getElementAttributeValueParser() == null) {
|
if (languageSession.getElementAttributeValueParser() == null) {
|
||||||
languageSession.setElementAttributeValueParser(X4OLanguageClassLoader.newInstance(ElementAttributeValueParser.class, getLanguageConfiguration().getDefaultElementAttributeValueParser()));
|
languageSession.setElementAttributeValueParser(X4OLanguageClassLoader.newInstance(ElementAttributeValueParser.class,
|
||||||
|
getLanguageConfiguration().getDefaultElementAttributeValueParser()));
|
||||||
}
|
}
|
||||||
if (languageSession.getElementObjectPropertyValue() == null) {
|
if (languageSession.getElementObjectPropertyValue() == null) {
|
||||||
languageSession.setElementObjectPropertyValue(X4OLanguageClassLoader.newInstance(ElementObjectPropertyValue.class, getLanguageConfiguration().getDefaultElementObjectPropertyValue()));
|
languageSession.setElementObjectPropertyValue(X4OLanguageClassLoader.newInstance(ElementObjectPropertyValue.class,
|
||||||
|
getLanguageConfiguration().getDefaultElementObjectPropertyValue()));
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public class DefaultX4OLanguageConfiguration extends AbstractX4OLanguageConfigur
|
||||||
public DefaultX4OLanguageConfiguration() {
|
public DefaultX4OLanguageConfiguration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@formatter:off
|
||||||
public void fillDefaults() {
|
public void fillDefaults() {
|
||||||
if (getLanguageResourcePathPrefix()==null) { setLanguageResourcePathPrefix( X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX); }
|
if (getLanguageResourcePathPrefix()==null) { setLanguageResourcePathPrefix( X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX); }
|
||||||
if (getLanguageResourceModulesFileName()==null) { setLanguageResourceModulesFileName( X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE);}
|
if (getLanguageResourceModulesFileName()==null) { setLanguageResourceModulesFileName( X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE);}
|
||||||
|
|
@ -74,6 +75,7 @@ public class DefaultX4OLanguageConfiguration extends AbstractX4OLanguageConfigur
|
||||||
if (getDefaultLanguageLoader()==null) { setDefaultLanguageLoader( DefaultX4OLanguageLoader.class); }
|
if (getDefaultLanguageLoader()==null) { setDefaultLanguageLoader( DefaultX4OLanguageLoader.class); }
|
||||||
if (getDefaultExpressionLanguageContext()==null) { setDefaultExpressionLanguageContext( X4OELContext.class); }
|
if (getDefaultExpressionLanguageContext()==null) { setDefaultExpressionLanguageContext( X4OELContext.class); }
|
||||||
}
|
}
|
||||||
|
//@formatter:on
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.lang.X4OLanguageConfigurationLocal#createProxy()
|
* @see org.x4o.xml.lang.X4OLanguageConfigurationLocal#createProxy()
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write log message to debug writer.
|
* Write log message to debug writer.
|
||||||
|
*
|
||||||
* @param language The X4O language we are loading.
|
* @param language The X4O language we are loading.
|
||||||
* @param message The message to log to the debug output.
|
* @param message The message to log to the debug output.
|
||||||
*/
|
*/
|
||||||
|
|
@ -80,7 +81,8 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadLanguage(X4OLanguageSession session, X4OLanguageLocal languageLocal, String language, String languageVersion) throws X4OLanguageLoaderException {
|
public void loadLanguage(X4OLanguageSession session, X4OLanguageLocal languageLocal, String language, String languageVersion)
|
||||||
|
throws X4OLanguageLoaderException {
|
||||||
logger.finer("Loading all modules for language: " + language);
|
logger.finer("Loading all modules for language: " + language);
|
||||||
List<VersionedResources> modulesAll = loadLanguageModules(session, languageLocal, language);
|
List<VersionedResources> modulesAll = loadLanguageModules(session, languageLocal, language);
|
||||||
modulesAll = filterVersionModules(modulesAll, languageLocal, languageVersion);
|
modulesAll = filterVersionModules(modulesAll, languageLocal, languageVersion);
|
||||||
|
|
@ -116,7 +118,8 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
loadModule(session, languageLocal, loader, value, versionedResources);
|
loadModule(session, languageLocal, loader, value, versionedResources);
|
||||||
if (loader instanceof X4OLanguageModuleLoaderSibling) {
|
if (loader instanceof X4OLanguageModuleLoaderSibling) {
|
||||||
// mmm
|
// mmm
|
||||||
X4OPhaseInitLanguageSiblings sibPhase = (X4OPhaseInitLanguageSiblings)languageLocal.getPhaseManager().getPhase(X4OPhaseLanguageInit.INIT_LANG_SIB);
|
X4OPhaseInitLanguageSiblings sibPhase = (X4OPhaseInitLanguageSiblings) languageLocal.getPhaseManager()
|
||||||
|
.getPhase(X4OPhaseLanguageInit.INIT_LANG_SIB);
|
||||||
sibPhase.addLanguageModuleLoaderSibling((X4OLanguageModuleLoaderSibling) loader);
|
sibPhase.addLanguageModuleLoaderSibling((X4OLanguageModuleLoaderSibling) loader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,11 +134,13 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<VersionedResources> filterVersionModules(List<VersionedResources> resources, X4OLanguageLocal languageLocal, String languageVersion) throws X4OLanguageLoaderException {
|
private List<VersionedResources> filterVersionModules(List<VersionedResources> resources, X4OLanguageLocal languageLocal, String languageVersion)
|
||||||
|
throws X4OLanguageLoaderException {
|
||||||
List<VersionedResources> result = new ArrayList<VersionedResources>(resources.size());
|
List<VersionedResources> result = new ArrayList<VersionedResources>(resources.size());
|
||||||
X4OLanguageVersionFilter lvf;
|
X4OLanguageVersionFilter lvf;
|
||||||
try {
|
try {
|
||||||
lvf = X4OLanguageClassLoader.newInstance(X4OLanguageVersionFilter.class, languageLocal.getLanguageConfiguration().getDefaultLanguageVersionFilter());
|
lvf = X4OLanguageClassLoader.newInstance(X4OLanguageVersionFilter.class,
|
||||||
|
languageLocal.getLanguageConfiguration().getDefaultLanguageVersionFilter());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new X4OLanguageLoaderException(e);
|
throw new X4OLanguageLoaderException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -173,10 +178,12 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadModule(X4OLanguageSession session, X4OLanguageLocal languageLocal, X4OLanguageModuleLoader loader, String resource, VersionedResources versionedResources) throws X4OLanguageLoaderException {
|
private void loadModule(X4OLanguageSession session, X4OLanguageLocal languageLocal, X4OLanguageModuleLoader loader, String resource,
|
||||||
|
VersionedResources versionedResources) throws X4OLanguageLoaderException {
|
||||||
X4OLanguageModuleLocal module;
|
X4OLanguageModuleLocal module;
|
||||||
try {
|
try {
|
||||||
module = X4OLanguageClassLoader.newInstance(X4OLanguageModuleLocal.class, languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
|
module = X4OLanguageClassLoader.newInstance(X4OLanguageModuleLocal.class,
|
||||||
|
languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new X4OLanguageLoaderException(e);
|
throw new X4OLanguageLoaderException(e);
|
||||||
}
|
}
|
||||||
|
|
@ -203,10 +210,12 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all modules of an language.
|
* Loads all modules of an language.
|
||||||
|
*
|
||||||
* @param languageLocal The ElementLanguage to load for.
|
* @param languageLocal The ElementLanguage to load for.
|
||||||
* @param language The language to load.
|
* @param language The language to load.
|
||||||
*/
|
*/
|
||||||
protected List<VersionedResources> loadLanguageModules(X4OLanguageSession session, X4OLanguageLocal languageLocal, String language) throws X4OLanguageLoaderException {
|
protected List<VersionedResources> loadLanguageModules(X4OLanguageSession session, X4OLanguageLocal languageLocal, String language)
|
||||||
|
throws X4OLanguageLoaderException {
|
||||||
List<VersionedResources> result = new ArrayList<VersionedResources>(15);
|
List<VersionedResources> result = new ArrayList<VersionedResources>(15);
|
||||||
StringBuilder buf = new StringBuilder(150);
|
StringBuilder buf = new StringBuilder(150);
|
||||||
buf.append(languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix());
|
buf.append(languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix());
|
||||||
|
|
@ -239,12 +248,14 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser xml inputstream to languge modules.
|
* Parser xml inputstream to languge modules.
|
||||||
|
*
|
||||||
* @param in The inputstream to parser.
|
* @param in The inputstream to parser.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws SAXException
|
* @throws SAXException
|
||||||
* @throws ParserConfigurationException
|
* @throws ParserConfigurationException
|
||||||
*/
|
*/
|
||||||
protected List<VersionedResources> loadLanguageModulesXml(InputStream in, String loadedFrom) throws IOException, SAXException, ParserConfigurationException {
|
protected List<VersionedResources> loadLanguageModulesXml(InputStream in, String loadedFrom)
|
||||||
|
throws IOException, SAXException, ParserConfigurationException {
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
throw new NullPointerException("Can't parse null input stream");
|
throw new NullPointerException("Can't parse null input stream");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.xml.lang;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An DefaultElementLanguageModule.
|
* An DefaultElementLanguageModule.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultX4OLanguageVersionFilter makes best filter match attempt.
|
* DefaultX4OLanguageVersionFilter makes best filter match attempt.
|
||||||
*
|
*
|
||||||
|
|
@ -35,6 +34,7 @@ public class DefaultX4OLanguageVersionFilter implements X4OLanguageVersionFilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters to the best version.
|
* Filters to the best version.
|
||||||
|
*
|
||||||
* @see org.x4o.xml.lang.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.
|
* @return The perfect or best match or null if no match for requested language.
|
||||||
* @param requestVersion The language version to search for.
|
* @param requestVersion The language version to search for.
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the language name of this x4o xml language.
|
* Returns the language name of this x4o xml language.
|
||||||
|
*
|
||||||
* @return Returns the language name.
|
* @return Returns the language name.
|
||||||
*/
|
*/
|
||||||
String getLanguageName();
|
String getLanguageName();
|
||||||
|
|
@ -52,6 +53,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the phase manager which runs the phases
|
* Returns the phase manager which runs the phases
|
||||||
|
*
|
||||||
* @return Returns the phase manager.
|
* @return Returns the phase manager.
|
||||||
*/
|
*/
|
||||||
X4OPhaseManager getPhaseManager();
|
X4OPhaseManager getPhaseManager();
|
||||||
|
|
@ -63,12 +65,14 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and fills the initial element language used to store the language.
|
* Creates and fills the initial element language used to store the language.
|
||||||
|
*
|
||||||
* @return The newly created X4OLanguageSession.
|
* @return The newly created X4OLanguageSession.
|
||||||
*/
|
*/
|
||||||
X4OLanguageSession createLanguageSession();
|
X4OLanguageSession createLanguageSession();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search language for object and create element for it.
|
* Search language for object and create element for it.
|
||||||
|
*
|
||||||
* @param context The X4O language context to create for.
|
* @param context The X4O language context to create for.
|
||||||
* @param objectClass The object to search for.
|
* @param objectClass The object to search for.
|
||||||
* @return Returns an new Element instance for the object.
|
* @return Returns an new Element instance for the object.
|
||||||
|
|
@ -77,6 +81,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all ElementBindingHandlers which are possible for parent.
|
* Gets all ElementBindingHandlers which are possible for parent.
|
||||||
|
*
|
||||||
* @param parent The parent element object or class to search for.
|
* @param parent The parent element object or class to search for.
|
||||||
* @return Returns an List with all ElementBindingHandler for the search.
|
* @return Returns an List with all ElementBindingHandler for the search.
|
||||||
*/
|
*/
|
||||||
|
|
@ -84,6 +89,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all ElementBindingHandlers for parent and child combination.
|
* Gets all ElementBindingHandlers for parent and child combination.
|
||||||
|
*
|
||||||
* @param parent The parent element object or class to search for.
|
* @param parent The parent element object or class to search for.
|
||||||
* @param child The parent element object or class to search for.
|
* @param child The parent element object or class to search for.
|
||||||
* @return Returns an List with all ElementBindingHandler for the search pair.
|
* @return Returns an List with all ElementBindingHandler for the search pair.
|
||||||
|
|
@ -92,6 +98,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of ElementInterfaces for an element.
|
* Returns list of ElementInterfaces for an element.
|
||||||
|
*
|
||||||
* @param object The element object or class to search for.
|
* @param object The element object or class to search for.
|
||||||
* @return The list of elementInterfaces.
|
* @return The list of elementInterfaces.
|
||||||
*/
|
*/
|
||||||
|
|
@ -99,6 +106,7 @@ public interface X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the namespace context for an namespace uri.
|
* Returns the namespace context for an namespace uri.
|
||||||
|
*
|
||||||
* @param namespaceUri the namespace uri.
|
* @param namespaceUri the namespace uri.
|
||||||
* @return The ElementNamespace.
|
* @return The ElementNamespace.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public final class X4OLanguageClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the thread classloader or the normal classloader.
|
* Gets the thread classloader or the normal classloader.
|
||||||
|
*
|
||||||
* @return Returns the ClassLoader.
|
* @return Returns the ClassLoader.
|
||||||
*/
|
*/
|
||||||
public static ClassLoader getClassLoader() {
|
public static ClassLoader getClassLoader() {
|
||||||
|
|
@ -53,8 +54,7 @@ public final class X4OLanguageClassLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a Class from the ContextClassLoader and if that is not set, then
|
* Loads a Class from the ContextClassLoader and if that is not set, then uses the class of the String className instance.
|
||||||
* uses the class of the String className instance.
|
|
||||||
*
|
*
|
||||||
* @param className The class name to load
|
* @param className The class name to load
|
||||||
* @return The loaded class
|
* @return The loaded class
|
||||||
|
|
@ -66,6 +66,7 @@ public final class X4OLanguageClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of clazz.
|
* Creates new instance of clazz.
|
||||||
|
*
|
||||||
* @param resultType The result type to cast to..
|
* @param resultType The result type to cast to..
|
||||||
* @param clazz The class to make object from.
|
* @param clazz The class to make object from.
|
||||||
* @return The object of the clazz.
|
* @return The object of the clazz.
|
||||||
|
|
@ -78,6 +79,7 @@ public final class X4OLanguageClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of clazz.
|
* Creates new instance of clazz.
|
||||||
|
*
|
||||||
* @param clazz The class to make object from.
|
* @param clazz The class to make object from.
|
||||||
* @return The object of the clazz.
|
* @return The object of the clazz.
|
||||||
* @throws ClassNotFoundException On any construct access or invoke error.
|
* @throws ClassNotFoundException On any construct access or invoke error.
|
||||||
|
|
@ -85,13 +87,15 @@ public final class X4OLanguageClassLoader {
|
||||||
public static Object newInstance(Class<?> clazz) throws ClassNotFoundException {
|
public static Object newInstance(Class<?> clazz) throws ClassNotFoundException {
|
||||||
try {
|
try {
|
||||||
return clazz.getConstructor().newInstance();
|
return clazz.getConstructor().newInstance();
|
||||||
} catch (IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException e) {
|
} catch (IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | InstantiationException
|
||||||
|
| IllegalAccessException e) {
|
||||||
throw new ClassNotFoundException(e.getMessage(), e);
|
throw new ClassNotFoundException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of className.
|
* Creates new instance of className.
|
||||||
|
*
|
||||||
* @param className The className to create object from.
|
* @param className The className to create object from.
|
||||||
* @return The object of the className.
|
* @return The object of the className.
|
||||||
* @throws ClassNotFoundException When className is not found or can't be created.
|
* @throws ClassNotFoundException When className is not found or can't be created.
|
||||||
|
|
@ -102,6 +106,7 @@ public final class X4OLanguageClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a resource from the classloader to an url.
|
* Gets a resource from the classloader to an url.
|
||||||
|
*
|
||||||
* @param resourceName The resource to get from the classloader.
|
* @param resourceName The resource to get from the classloader.
|
||||||
* @return The url to the resource or null if not found.
|
* @return The url to the resource or null if not found.
|
||||||
* @see java.lang.ClassLoader#getResource(String)
|
* @see java.lang.ClassLoader#getResource(String)
|
||||||
|
|
@ -112,6 +117,7 @@ public final class X4OLanguageClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a resource from the classloader to an inputstream.
|
* Gets a resource from the classloader to an inputstream.
|
||||||
|
*
|
||||||
* @param resourceName The resource to get from the classloader.
|
* @param resourceName The resource to get from the classloader.
|
||||||
* @return The inputstream to the resource or null if not found.
|
* @return The inputstream to the resource or null if not found.
|
||||||
* @see java.lang.ClassLoader#getResourceAsStream(String)
|
* @see java.lang.ClassLoader#getResourceAsStream(String)
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,30 @@ public interface X4OLanguageConfiguration {
|
||||||
|
|
||||||
// Core interfaces are also in class for text reference without instance
|
// Core interfaces are also in class for text reference without instance
|
||||||
Class<?> getDefaultElementNamespace();
|
Class<?> getDefaultElementNamespace();
|
||||||
|
|
||||||
Class<?> getDefaultElementInterface();
|
Class<?> getDefaultElementInterface();
|
||||||
|
|
||||||
Class<?> getDefaultElement();
|
Class<?> getDefaultElement();
|
||||||
|
|
||||||
Class<?> getDefaultElementClass();
|
Class<?> getDefaultElementClass();
|
||||||
|
|
||||||
Class<?> getDefaultElementClassAttribute();
|
Class<?> getDefaultElementClassAttribute();
|
||||||
|
|
||||||
// Other needed interfaces in class form also
|
// Other needed interfaces in class form also
|
||||||
Class<?> getDefaultElementLanguageModule();
|
Class<?> getDefaultElementLanguageModule();
|
||||||
|
|
||||||
Class<?> getDefaultElementBodyComment();
|
Class<?> getDefaultElementBodyComment();
|
||||||
|
|
||||||
Class<?> getDefaultElementBodyCharacters();
|
Class<?> getDefaultElementBodyCharacters();
|
||||||
|
|
||||||
Class<?> getDefaultElementBodyWhitespace();
|
Class<?> getDefaultElementBodyWhitespace();
|
||||||
|
|
||||||
Class<?> getDefaultElementNamespaceInstanceProvider();
|
Class<?> getDefaultElementNamespaceInstanceProvider();
|
||||||
|
|
||||||
Class<?> getDefaultElementAttributeValueParser();
|
Class<?> getDefaultElementAttributeValueParser();
|
||||||
|
|
||||||
Class<?> getDefaultElementObjectPropertyValue();
|
Class<?> getDefaultElementObjectPropertyValue();
|
||||||
|
|
||||||
Class<?> getDefaultElementNamespaceAttributeComparator();
|
Class<?> getDefaultElementNamespaceAttributeComparator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,38 @@ public interface X4OLanguageConfigurationLocal extends X4OLanguageConfiguration
|
||||||
X4OLanguageConfiguration createProxy();
|
X4OLanguageConfiguration createProxy();
|
||||||
|
|
||||||
void setLanguageResourcePathPrefix(String value);
|
void setLanguageResourcePathPrefix(String value);
|
||||||
|
|
||||||
void setLanguageResourceModulesFileName(String value);
|
void setLanguageResourceModulesFileName(String value);
|
||||||
|
|
||||||
void setDefaultElementNamespace(Class<?> value);
|
void setDefaultElementNamespace(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementInterface(Class<?> value);
|
void setDefaultElementInterface(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElement(Class<?> value);
|
void setDefaultElement(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementClass(Class<?> value);
|
void setDefaultElementClass(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementClassAttribute(Class<?> value);
|
void setDefaultElementClassAttribute(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementLanguageModule(Class<?> value);
|
void setDefaultElementLanguageModule(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementBodyComment(Class<?> value);
|
void setDefaultElementBodyComment(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementBodyCharacters(Class<?> value);
|
void setDefaultElementBodyCharacters(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementBodyWhitespace(Class<?> value);
|
void setDefaultElementBodyWhitespace(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementNamespaceInstanceProvider(Class<?> value);
|
void setDefaultElementNamespaceInstanceProvider(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementAttributeValueParser(Class<?> value);
|
void setDefaultElementAttributeValueParser(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementObjectPropertyValue(Class<?> value);
|
void setDefaultElementObjectPropertyValue(Class<?> value);
|
||||||
|
|
||||||
void setDefaultElementNamespaceAttributeComparator(Class<?> value);
|
void setDefaultElementNamespaceAttributeComparator(Class<?> value);
|
||||||
|
|
||||||
void setDefaultLanguageVersionFilter(Class<?> value);
|
void setDefaultLanguageVersionFilter(Class<?> value);
|
||||||
|
|
||||||
void setDefaultLanguageLoader(Class<?> value);
|
void setDefaultLanguageLoader(Class<?> value);
|
||||||
|
|
||||||
void setDefaultExpressionLanguageContext(Class<?> value);
|
void setDefaultExpressionLanguageContext(Class<?> value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public interface X4OLanguageLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the language modules.
|
* Loads the language modules.
|
||||||
|
*
|
||||||
* @param session The session we run in.
|
* @param session The session we run in.
|
||||||
* @param language The local Language to load for.
|
* @param language The local Language to load for.
|
||||||
* @param languageName The language name to load.
|
* @param languageName The language name to load.
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public class X4OLanguageLoaderException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an X4OLanguageLoaderException with a detail message.
|
* Constructs an X4OLanguageLoaderException with a detail message.
|
||||||
|
*
|
||||||
* @param message The message of this Exception
|
* @param message The message of this Exception
|
||||||
*/
|
*/
|
||||||
public X4OLanguageLoaderException(String message) {
|
public X4OLanguageLoaderException(String message) {
|
||||||
|
|
@ -50,6 +51,7 @@ public class X4OLanguageLoaderException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an X4OLanguageLoaderException from a parent exception.
|
* Creates an X4OLanguageLoaderException from a parent exception.
|
||||||
|
*
|
||||||
* @param e The exception.
|
* @param e The exception.
|
||||||
*/
|
*/
|
||||||
public X4OLanguageLoaderException(Exception e) {
|
public X4OLanguageLoaderException(Exception e) {
|
||||||
|
|
@ -58,6 +60,7 @@ public class X4OLanguageLoaderException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an X4OLanguageLoaderException with a detail message.
|
* Constructs an X4OLanguageLoaderException with a detail message.
|
||||||
|
*
|
||||||
* @param message The message of this Exception
|
* @param message The message of this Exception
|
||||||
* @param e The exception.
|
* @param e The exception.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public interface X4OLanguageLocal extends X4OLanguage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an X4OLanguageModule to this language.
|
* Adds an X4OLanguageModule to this language.
|
||||||
|
*
|
||||||
* @param languageModule The element language module to add.
|
* @param languageModule The element language module to add.
|
||||||
*/
|
*/
|
||||||
void addLanguageModule(X4OLanguageModule languageModule);
|
void addLanguageModule(X4OLanguageModule languageModule);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ public interface X4OLanguageModule /* extends ElementMetaBase TODO add local lay
|
||||||
|
|
||||||
// temp here see local
|
// temp here see local
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -54,24 +55,28 @@ public interface X4OLanguageModule /* extends ElementMetaBase TODO add local lay
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all ElementBindingHandlers.
|
* Gets all ElementBindingHandlers.
|
||||||
|
*
|
||||||
* @return Returns an List with all ElementBindingHandlers.
|
* @return Returns an List with all ElementBindingHandlers.
|
||||||
*/
|
*/
|
||||||
List<ElementBindingHandler> getElementBindingHandlers();
|
List<ElementBindingHandler> getElementBindingHandlers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all ElementConfiguratorGlobals.
|
* Gets all ElementConfiguratorGlobals.
|
||||||
|
*
|
||||||
* @return All gloval ElementConfigurators.
|
* @return All gloval ElementConfigurators.
|
||||||
*/
|
*/
|
||||||
List<ElementConfiguratorGlobal> getElementConfiguratorGlobals();
|
List<ElementConfiguratorGlobal> getElementConfiguratorGlobals();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of ElementInterfaces in this context.
|
* Returns list of ElementInterfaces in this context.
|
||||||
|
*
|
||||||
* @return The list of elementInterfaces.
|
* @return The list of elementInterfaces.
|
||||||
*/
|
*/
|
||||||
List<ElementInterface> getElementInterfaces();
|
List<ElementInterface> getElementInterfaces();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the namespace context for an namespace uri.
|
* Returns the namespace context for an namespace uri.
|
||||||
|
*
|
||||||
* @param namespaceUri the namespace uri.
|
* @param namespaceUri the namespace uri.
|
||||||
* @return The ElementNamespace.
|
* @return The ElementNamespace.
|
||||||
*/
|
*/
|
||||||
|
|
@ -84,6 +89,7 @@ public interface X4OLanguageModule /* extends ElementMetaBase TODO add local lay
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets module loader meta result info.
|
* Gets module loader meta result info.
|
||||||
|
*
|
||||||
* @param key The key to get info of.
|
* @param key The key to get info of.
|
||||||
* @return The value of the info.
|
* @return The value of the info.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,7 @@
|
||||||
package org.x4o.xml.lang;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguageModuleLoader Loads all elements and other options
|
* X4OLanguageModuleLoader Loads all elements and other options into the X4OLanguageModule for the X4OLanguageLocal language.
|
||||||
* into the X4OLanguageModule for the X4OLanguageLocal language.
|
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jul 8, 2006
|
* @version 1.0 Jul 8, 2006
|
||||||
|
|
@ -33,6 +32,7 @@ public interface X4OLanguageModuleLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the ElementProvider.
|
* Starts the ElementProvider.
|
||||||
|
*
|
||||||
* @param session The session we run in.
|
* @param session The session we run in.
|
||||||
* @param language The local Language to load for.
|
* @param language The local Language to load for.
|
||||||
* @param module The language module to load it into.
|
* @param module The language module to load it into.
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public class X4OLanguageModuleLoaderException extends ElementException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates module loader exception.
|
* Creates module loader exception.
|
||||||
|
*
|
||||||
* @param elementLanguageModuleLoader The loader module which creates this exception.
|
* @param elementLanguageModuleLoader The loader module which creates this exception.
|
||||||
* @param message The message of the exception.
|
* @param message The message of the exception.
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,6 +48,7 @@ public class X4OLanguageModuleLoaderException extends ElementException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates module loader exception.
|
* Creates module loader exception.
|
||||||
|
*
|
||||||
* @param elementLanguageModuleLoader The loader module which creates this exception.
|
* @param elementLanguageModuleLoader The loader module which creates this exception.
|
||||||
* @param message The message of the exception.
|
* @param message The message of the exception.
|
||||||
* @param exception The root cause of the exception.
|
* @param exception The root cause of the exception.
|
||||||
|
|
@ -58,6 +60,7 @@ public class X4OLanguageModuleLoaderException extends ElementException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the module loader which created the exception.
|
* Returns the module loader which created the exception.
|
||||||
|
*
|
||||||
* @return Returns the module loader.
|
* @return Returns the module loader.
|
||||||
*/
|
*/
|
||||||
public X4OLanguageModuleLoader getElementProvider() {
|
public X4OLanguageModuleLoader getElementProvider() {
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,12 @@ package org.x4o.xml.lang;
|
||||||
*/
|
*/
|
||||||
public enum X4OLanguageModuleLoaderResult {
|
public enum X4OLanguageModuleLoaderResult {
|
||||||
|
|
||||||
|
//@formatter:off
|
||||||
LOAD_MODULE_RESOURCE,
|
LOAD_MODULE_RESOURCE,
|
||||||
LOAD_FROM_RESOURCE,
|
LOAD_FROM_RESOURCE,
|
||||||
LOAD_VERSION,
|
LOAD_VERSION,
|
||||||
LOAD_CLASS,
|
LOAD_CLASS,
|
||||||
LOAD_TIME,
|
LOAD_TIME,
|
||||||
LOAD_DATE;
|
LOAD_DATE;
|
||||||
|
//@formatter:on
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.xml.lang;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementLanguageModuleLoaderSibling provides sibling language loading support.
|
* ElementLanguageModuleLoaderSibling provides sibling language loading support.
|
||||||
*
|
*
|
||||||
|
|
@ -35,6 +33,7 @@ public interface X4OLanguageModuleLoaderSibling extends X4OLanguageModuleLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads in the sibling language.
|
* Loads in the sibling language.
|
||||||
|
*
|
||||||
* @param session The session we run in.
|
* @param session The session we run in.
|
||||||
* @param language The local Language to load for.
|
* @param language The local Language to load for.
|
||||||
* @param loader The loader to use to load the x4o languages.
|
* @param loader The loader to use to load the x4o languages.
|
||||||
|
|
|
||||||
|
|
@ -48,30 +48,35 @@ public interface X4OLanguageModuleLocal extends X4OLanguageModule,ElementMetaBas
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an ElementBindingHanlder.
|
* Adds an ElementBindingHanlder.
|
||||||
|
*
|
||||||
* @param elementBindingHandler The ElementBindingHandler to add.
|
* @param elementBindingHandler The ElementBindingHandler to add.
|
||||||
*/
|
*/
|
||||||
void addElementBindingHandler(ElementBindingHandler elementBindingHandler);
|
void addElementBindingHandler(ElementBindingHandler elementBindingHandler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an ElementConfiguratorGlobal.
|
* Adds an ElementConfiguratorGlobal.
|
||||||
|
*
|
||||||
* @param elementConfigurator The ElementConfigurtor to add.
|
* @param elementConfigurator The ElementConfigurtor to add.
|
||||||
*/
|
*/
|
||||||
void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator);
|
void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an ElementInterface.
|
* Adds an ElementInterface.
|
||||||
|
*
|
||||||
* @param elementInterface The elementInterface to add.
|
* @param elementInterface The elementInterface to add.
|
||||||
*/
|
*/
|
||||||
void addElementInterface(ElementInterface elementInterface);
|
void addElementInterface(ElementInterface elementInterface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an namespace to this langauge module.
|
* Adds an namespace to this langauge module.
|
||||||
|
*
|
||||||
* @param elementNamespace Adds an ElementNamespace to this langauge module.
|
* @param elementNamespace Adds an ElementNamespace to this langauge module.
|
||||||
*/
|
*/
|
||||||
void addElementNamespace(ElementNamespace elementNamespace);
|
void addElementNamespace(ElementNamespace elementNamespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets module loader meta result info.
|
* Sets module loader meta result info.
|
||||||
|
*
|
||||||
* @param key The key of the info.
|
* @param key The key of the info.
|
||||||
* @param value The value of the info.
|
* @param value The value of the info.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,14 @@ public interface X4OLanguageSession extends AutoCloseable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the EL Context.
|
* Gets the EL Context.
|
||||||
|
*
|
||||||
* @return Returns the ELContext.
|
* @return Returns the ELContext.
|
||||||
*/
|
*/
|
||||||
ELContext getExpressionLanguageContext();
|
ELContext getExpressionLanguageContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ExpressionFactory.
|
* Gets the ExpressionFactory.
|
||||||
|
*
|
||||||
* @return Returns the ExpressionFactory.
|
* @return Returns the ExpressionFactory.
|
||||||
*/
|
*/
|
||||||
ExpressionFactory getExpressionLanguageFactory();
|
ExpressionFactory getExpressionLanguageFactory();
|
||||||
|
|
@ -78,18 +80,21 @@ public interface X4OLanguageSession extends AutoCloseable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Dirty Elements.
|
* Get all Dirty Elements.
|
||||||
|
*
|
||||||
* @return Returns List with dirty elements.
|
* @return Returns List with dirty elements.
|
||||||
*/
|
*/
|
||||||
List<Element> getDirtyElements();
|
List<Element> getDirtyElements();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root Element which starts the xml tree.
|
* Returns the root Element which starts the xml tree.
|
||||||
|
*
|
||||||
* @return Returns the root element of the document instance we parse.
|
* @return Returns the root element of the document instance we parse.
|
||||||
*/
|
*/
|
||||||
Element getRootElement();
|
Element getRootElement();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the root element.
|
* Sets the root element.
|
||||||
|
*
|
||||||
* @param element The root element to set.
|
* @param element The root element to set.
|
||||||
*/
|
*/
|
||||||
void setRootElement(Element element);
|
void setRootElement(Element element);
|
||||||
|
|
@ -106,6 +111,7 @@ public interface X4OLanguageSession extends AutoCloseable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current X4OPhase of the parser.
|
* Returns the current X4OPhase of the parser.
|
||||||
|
*
|
||||||
* @return Returns the current phase.
|
* @return Returns the current phase.
|
||||||
*/
|
*/
|
||||||
X4OPhase getPhaseCurrent();
|
X4OPhase getPhaseCurrent();
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ import org.x4o.xml.lang.phase.X4OPhaseListener;
|
||||||
public interface X4OLanguageSessionLocal extends X4OLanguageSession {
|
public interface X4OLanguageSessionLocal extends X4OLanguageSession {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of phase listeners which where added to it.
|
* Returns list of phase listeners which where added to it. TODO: bad api here
|
||||||
* TODO: bad api here
|
*
|
||||||
* @param phaseId The phaseId of for the listeners.
|
* @param phaseId The phaseId of for the listeners.
|
||||||
* @return All X4OPhaseListeners.
|
* @return All X4OPhaseListeners.
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,12 +51,14 @@ public interface X4OLanguageSessionLocal extends X4OLanguageSession {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the EL Context.
|
* Sets the EL Context.
|
||||||
|
*
|
||||||
* @param context The ELContext to set.
|
* @param context The ELContext to set.
|
||||||
*/
|
*/
|
||||||
void setExpressionLanguageContext(ELContext context);
|
void setExpressionLanguageContext(ELContext context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ExpressionFactory.
|
* Sets the ExpressionFactory.
|
||||||
|
*
|
||||||
* @param expressionFactory The ExpressionFactory to set.
|
* @param expressionFactory The ExpressionFactory to set.
|
||||||
*/
|
*/
|
||||||
void setExpressionLanguageFactory(ExpressionFactory expressionFactory);
|
void setExpressionLanguageFactory(ExpressionFactory expressionFactory);
|
||||||
|
|
@ -78,6 +80,7 @@ public interface X4OLanguageSessionLocal extends X4OLanguageSession {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the phase of the context.
|
* Sets the phase of the context.
|
||||||
|
*
|
||||||
* @param phase The current phase to set.
|
* @param phase The current phase to set.
|
||||||
*/
|
*/
|
||||||
void setPhaseCurrent(X4OPhase phase);
|
void setPhaseCurrent(X4OPhase phase);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import org.x4o.xml.element.AbstractElementNamespaceAttribute;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementConfiguratorException;
|
import org.x4o.xml.element.ElementConfiguratorException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores an ElementObject into the EL context.
|
* Stores an ElementObject into the EL context.
|
||||||
*
|
*
|
||||||
|
|
@ -44,7 +43,9 @@ public class ELIDAttributeHandler extends AbstractElementNamespaceAttribute {
|
||||||
*/
|
*/
|
||||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||||
String attributeValue = element.getAttributes().get(getAttributeName());
|
String attributeValue = element.getAttributes().get(getAttributeName());
|
||||||
if(attributeValue==null) { return; }
|
if (attributeValue == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (element.getElementObject() == null) {
|
if (element.getElementObject() == null) {
|
||||||
if (this.isConfigAction()) {
|
if (this.isConfigAction()) {
|
||||||
throw new NullPointerException("Can't bind null object to el context");
|
throw new NullPointerException("Can't bind null object to el context");
|
||||||
|
|
@ -52,9 +53,13 @@ public class ELIDAttributeHandler extends AbstractElementNamespaceAttribute {
|
||||||
this.setConfigAction(true);
|
this.setConfigAction(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(element.getElementObject()==null) { throw new NullPointerException("Can't bind null object to el context"); }
|
if (element.getElementObject() == null) {
|
||||||
ValueExpression ee = element.getLanguageSession().getExpressionLanguageFactory().createValueExpression(element.getLanguageSession().getExpressionLanguageContext(),"${"+attributeValue+"}", element.getElementObject().getClass());
|
throw new NullPointerException("Can't bind null object to el context");
|
||||||
Logger.getLogger(ELIDAttributeHandler.class.getName()).finer("Set Variable in ELContext: "+"${"+attributeValue+"}"+" object SET: "+element.getElementObject());
|
}
|
||||||
|
ValueExpression ee = element.getLanguageSession().getExpressionLanguageFactory().createValueExpression(
|
||||||
|
element.getLanguageSession().getExpressionLanguageContext(), "${" + attributeValue + "}", element.getElementObject().getClass());
|
||||||
|
Logger.getLogger(ELIDAttributeHandler.class.getName())
|
||||||
|
.finer("Set Variable in ELContext: " + "${" + attributeValue + "}" + " object SET: " + element.getElementObject());
|
||||||
ee.setValue(element.getLanguageSession().getExpressionLanguageContext(), element.getElementObject());
|
ee.setValue(element.getLanguageSession().getExpressionLanguageContext(), element.getElementObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import javax.el.ValueExpression;
|
||||||
import org.x4o.xml.element.AbstractElement;
|
import org.x4o.xml.element.AbstractElement;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ELReferenceElement.<br>
|
* An ELReferenceElement.<br>
|
||||||
* Fills the ElementObject with an object from el.
|
* Fills the ElementObject with an object from el.
|
||||||
|
|
@ -42,8 +41,11 @@ public class ELReferenceElement extends AbstractElement {
|
||||||
@Override
|
@Override
|
||||||
public void doElementRun() throws ElementException {
|
public void doElementRun() throws ElementException {
|
||||||
String attributeValue = getAttributes().get("el.ref");
|
String attributeValue = getAttributes().get("el.ref");
|
||||||
if("".equals(attributeValue) | attributeValue==null) { throw new ElementException("Set the el.ref attribute"); }
|
if ("".equals(attributeValue) | attributeValue == null) {
|
||||||
ValueExpression ee = getLanguageSession().getExpressionLanguageFactory().createValueExpression(getLanguageSession().getExpressionLanguageContext(),"${"+attributeValue+"}",Object.class);
|
throw new ElementException("Set the el.ref attribute");
|
||||||
|
}
|
||||||
|
ValueExpression ee = getLanguageSession().getExpressionLanguageFactory().createValueExpression(getLanguageSession().getExpressionLanguageContext(),
|
||||||
|
"${" + attributeValue + "}", Object.class);
|
||||||
Logger.getLogger(ELReferenceElement.class.getName()).finer("Get Variable in ELContext: ${" + attributeValue + "}");
|
Logger.getLogger(ELReferenceElement.class.getName()).finer("Get Variable in ELContext: ${" + attributeValue + "}");
|
||||||
setElementObject(ee.getValue(getLanguageSession().getExpressionLanguageContext()));
|
setElementObject(ee.getValue(getLanguageSession().getExpressionLanguageContext()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,8 @@ public class MetaLanguageSiblingLoader implements X4OLanguageModuleLoaderSibling
|
||||||
public static final String META_LANGUAGE_DESCRIPTION = "X4O Meta XML Language Module.";
|
public static final String META_LANGUAGE_DESCRIPTION = "X4O Meta XML Language Module.";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadLanguageModule(X4OLanguageSession session, X4OLanguageLocal language, X4OLanguageModuleLocal module) throws X4OLanguageModuleLoaderException {
|
public void loadLanguageModule(X4OLanguageSession session, X4OLanguageLocal language, X4OLanguageModuleLocal module)
|
||||||
|
throws X4OLanguageModuleLoaderException {
|
||||||
module.setId(META_LANGUAGE);
|
module.setId(META_LANGUAGE);
|
||||||
module.setProviderHost(META_LANGUAGE_HOST);
|
module.setProviderHost(META_LANGUAGE_HOST);
|
||||||
module.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName());
|
module.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName());
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import java.lang.reflect.Method;
|
||||||
import org.x4o.xml.element.AbstractElement;
|
import org.x4o.xml.element.AbstractElement;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MethodElement invokes an method on a element object.
|
* MethodElement invokes an method on a element object.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import org.x4o.xml.eld.lang.BeanElement;
|
||||||
import org.x4o.xml.element.AbstractElement;
|
import org.x4o.xml.element.AbstractElement;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An PropertyElement.<br>
|
* An PropertyElement.<br>
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.lang.X4OLanguageSession;
|
import org.x4o.xml.lang.X4OLanguageSession;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractX4OPhaseHandler a base class for creating a phase handler.
|
* AbstractX4OPhaseHandler a base class for creating a phase handler.
|
||||||
*
|
*
|
||||||
|
|
@ -50,6 +49,7 @@ public abstract class AbstractX4OPhase implements X4OPhase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If returns true then this handler will run on all elements.
|
* If returns true then this handler will run on all elements.
|
||||||
|
*
|
||||||
* @return defaults to true.
|
* @return defaults to true.
|
||||||
*/
|
*/
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
|
|
@ -58,6 +58,7 @@ public abstract class AbstractX4OPhase implements X4OPhase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract method.
|
* Abstract method.
|
||||||
|
*
|
||||||
* @param element The element to run phase for.
|
* @param element The element to run phase for.
|
||||||
* @throws X4OPhaseException when phase has error.
|
* @throws X4OPhaseException when phase has error.
|
||||||
*/
|
*/
|
||||||
|
|
@ -65,6 +66,7 @@ public abstract class AbstractX4OPhase implements X4OPhase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty method.
|
* Empty method.
|
||||||
|
*
|
||||||
* @param elementLanguage The language to run phase for.
|
* @param elementLanguage The language to run phase for.
|
||||||
* @throws X4OPhaseException when phase has error.
|
* @throws X4OPhaseException when phase has error.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ import org.x4o.xml.lang.X4OLanguageSession;
|
||||||
import org.x4o.xml.lang.X4OLanguageSessionLocal;
|
import org.x4o.xml.lang.X4OLanguageSessionLocal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OPhaseManager stores the X4OPhaseHandler and puts them in the right order.
|
* X4OPhaseManager stores the X4OPhaseHandler and puts them in the right order. And will execute the phases when runPhases is called.
|
||||||
* And will execute the phases when runPhases is called.
|
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jan 6, 2008
|
* @version 1.0 Jan 6, 2008
|
||||||
|
|
@ -50,7 +49,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManagerLocal {
|
||||||
x4oPhases = new ArrayList<X4OPhase>(25);
|
x4oPhases = new ArrayList<X4OPhase>(25);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
//@formatter:off
|
||||||
PHASE_ORDER = { *startupX4OPhase,
|
PHASE_ORDER = { *startupX4OPhase,
|
||||||
*createLanguagePhase,
|
*createLanguagePhase,
|
||||||
*createLanguageSiblingsPhase,
|
*createLanguageSiblingsPhase,
|
||||||
|
|
@ -64,7 +63,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
*releasePhase
|
*releasePhase
|
||||||
};
|
};
|
||||||
* = runOnce
|
* = runOnce
|
||||||
|
//@formatter:on
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public X4OPhase getPhase(String phaseName) {
|
public X4OPhase getPhase(String phaseName) {
|
||||||
|
|
@ -86,6 +85,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an X4OPhaseHandler.
|
* Adds an X4OPhaseHandler.
|
||||||
|
*
|
||||||
* @param phase The X4OPhaseHandler to add.
|
* @param phase The X4OPhaseHandler to add.
|
||||||
*/
|
*/
|
||||||
public void addX4OPhase(X4OPhase phase) {
|
public void addX4OPhase(X4OPhase phase) {
|
||||||
|
|
@ -101,6 +101,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the X4OPhaseHandlers.
|
* Returns all the X4OPhaseHandlers.
|
||||||
|
*
|
||||||
* @return Returns all X4OPhaseHandlers.
|
* @return Returns all X4OPhaseHandlers.
|
||||||
*/
|
*/
|
||||||
public List<X4OPhase> getAllPhases() {
|
public List<X4OPhase> getAllPhases() {
|
||||||
|
|
@ -109,6 +110,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the X4OPhaseHandlers in ordered list.
|
* Returns all the X4OPhaseHandlers in ordered list.
|
||||||
|
*
|
||||||
* @return Returns all X4OPhaseHandler is order.
|
* @return Returns all X4OPhaseHandler is order.
|
||||||
*/
|
*/
|
||||||
public List<X4OPhase> getOrderedPhases(X4OPhaseType type) {
|
public List<X4OPhase> getOrderedPhases(X4OPhaseType type) {
|
||||||
|
|
@ -124,6 +126,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs all the phases in the right order.
|
* Runs all the phases in the right order.
|
||||||
|
*
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
public void runPhases(X4OLanguageSession languageSession, X4OPhaseType type) throws X4OPhaseException {
|
public void runPhases(X4OLanguageSession languageSession, X4OPhaseType type) throws X4OPhaseException {
|
||||||
|
|
@ -178,6 +181,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs phase on single element.
|
* Runs phase on single element.
|
||||||
|
*
|
||||||
* @param e The Element to process.
|
* @param e The Element to process.
|
||||||
* @param p The phase to run.
|
* @param p The phase to run.
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
|
|
@ -214,6 +218,7 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run release phase manual if auto release is disabled by config.
|
* Run release phase manual if auto release is disabled by config.
|
||||||
|
*
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
public void doReleasePhaseManual(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void doReleasePhaseManual(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
|
|
@ -273,46 +278,12 @@ PHASE_ORDER = { *startupX4OPhase,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
|
||||||
if (p1==p2) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
if (p1==X4OPhase.debugPhase) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (p2==X4OPhase.debugPhase) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i1 = phaseOrder(p1);
|
|
||||||
int i2 = phaseOrder(p2);
|
|
||||||
|
|
||||||
if (i1>i2) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (i1<i2) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
private int phaseOrder(X4OPhase check) {
|
|
||||||
int result=0;
|
|
||||||
for (X4OPhase p:X4OPhase.PHASE_ORDER) {
|
|
||||||
if (p==check) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute element phase handler on full tree.
|
* Execute element phase handler on full tree.
|
||||||
|
*
|
||||||
* @param phase The phase to run.
|
* @param phase The phase to run.
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public interface X4OPhase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the X4OPhase for which this handler was written.
|
* Returns the X4OPhase for which this handler was written.
|
||||||
|
*
|
||||||
* @return Returns the phase for which this handler works.
|
* @return Returns the phase for which this handler works.
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
@ -45,27 +46,30 @@ public interface X4OPhase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a flag indicating that this phase is runnable multiple times.
|
* Returns a flag indicating that this phase is runnable multiple times.
|
||||||
|
*
|
||||||
* @return True if phase is restricted to run once.
|
* @return True if phase is restricted to run once.
|
||||||
*/
|
*/
|
||||||
boolean isRunOnce();
|
boolean isRunOnce();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs this phase.
|
* Runs this phase.
|
||||||
|
*
|
||||||
* @param elementLanguage The elementLanguage running this phase.
|
* @param elementLanguage The elementLanguage running this phase.
|
||||||
* @throws X4OPhaseException When error has happend.
|
* @throws X4OPhaseException When error has happend.
|
||||||
*/
|
*/
|
||||||
void runPhase(X4OLanguageSession elementLanguage) throws X4OPhaseException;
|
void runPhase(X4OLanguageSession elementLanguage) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* runPhase is called but should do nothig.
|
* runPhase is called but should do nothig. When elementPhase is enables x4o tries to merge all element phases so we don't need to loop element tree to
|
||||||
* When elementPhase is enables x4o tries to merge all element phases so
|
* often.
|
||||||
* we don't need to loop element tree to often.
|
*
|
||||||
* @return True if to run in config.
|
* @return True if to run in config.
|
||||||
*/
|
*/
|
||||||
boolean isElementPhase();
|
boolean isElementPhase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run this phase for this Element.
|
* Run this phase for this Element.
|
||||||
|
*
|
||||||
* @param element The element to run this phase for.
|
* @param element The element to run this phase for.
|
||||||
* @throws X4OPhaseException Is thrown when error has happen.
|
* @throws X4OPhaseException Is thrown when error has happen.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public class X4OPhaseException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ElementException from a parent exception.
|
* Creates an ElementException from a parent exception.
|
||||||
|
*
|
||||||
* @param exceptionPhase The handler which throwed.
|
* @param exceptionPhase The handler which throwed.
|
||||||
* @param e The Exception.
|
* @param e The Exception.
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,6 +48,7 @@ public class X4OPhaseException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ElementException from a parent exception.
|
* Creates an ElementException from a parent exception.
|
||||||
|
*
|
||||||
* @param exceptionPhase The handler which throwed.
|
* @param exceptionPhase The handler which throwed.
|
||||||
* @param message The message of the error.
|
* @param message The message of the error.
|
||||||
*/
|
*/
|
||||||
|
|
@ -57,6 +59,7 @@ public class X4OPhaseException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ElementException from a parent exception.
|
* Creates an ElementException from a parent exception.
|
||||||
|
*
|
||||||
* @param exceptionPhase The handler which throwed.
|
* @param exceptionPhase The handler which throwed.
|
||||||
* @param message The message of the error.
|
* @param message The message of the error.
|
||||||
* @param e The Exception.
|
* @param e The Exception.
|
||||||
|
|
@ -68,6 +71,7 @@ public class X4OPhaseException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the X4OPhaseHandler which created this Exception.
|
* Returns the X4OPhaseHandler which created this Exception.
|
||||||
|
*
|
||||||
* @return An X4OPhaseHandler
|
* @return An X4OPhaseHandler
|
||||||
*/
|
*/
|
||||||
public X4OPhase getX4OPhaseHandler() {
|
public X4OPhase getX4OPhaseHandler() {
|
||||||
|
|
|
||||||
|
|
@ -65,45 +65,55 @@ public class X4OPhaseLanguageInit {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.INIT;
|
return X4OPhaseType.INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return INIT_START;
|
return INIT_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] {};
|
return new String[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
logger.finest("Run init start phase");
|
logger.finest("Run init start phase");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all the modules a language.
|
* Loads all the modules a language. Then creates the ElementProviders
|
||||||
* Then creates the ElementProviders
|
|
||||||
*/
|
*/
|
||||||
class X4OPhaseInitLanguage extends AbstractX4OPhase {
|
class X4OPhaseInitLanguage extends AbstractX4OPhase {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.INIT;
|
return X4OPhaseType.INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return INIT_LANG;
|
return INIT_LANG;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { INIT_START };
|
return new String[] { INIT_START };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
debugPhaseMessage(languageSession, "Load main language: " + languageSession.getLanguage().getLanguageName());
|
debugPhaseMessage(languageSession, "Load main language: " + languageSession.getLanguage().getLanguageName());
|
||||||
X4OLanguageLoader loader = X4OLanguageClassLoader.newInstance(X4OLanguageLoader.class, languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader());
|
X4OLanguageLoader loader = X4OLanguageClassLoader.newInstance(X4OLanguageLoader.class,
|
||||||
|
languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader());
|
||||||
X4OLanguageLocal language = (X4OLanguageLocal) languageSession.getLanguage();
|
X4OLanguageLocal language = (X4OLanguageLocal) languageSession.getLanguage();
|
||||||
loader.loadLanguage(languageSession, language, language.getLanguageName(), language.getLanguageVersion());
|
loader.loadLanguage(languageSession, language, language.getLanguageName(), language.getLanguageVersion());
|
||||||
|
|
||||||
|
|
@ -121,28 +131,36 @@ public class X4OPhaseLanguageInit {
|
||||||
*/
|
*/
|
||||||
public class X4OPhaseInitLanguageSiblings extends AbstractX4OPhase {
|
public class X4OPhaseInitLanguageSiblings extends AbstractX4OPhase {
|
||||||
private List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(2);
|
private List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(2);
|
||||||
|
|
||||||
// mmmm think of better then cast
|
// mmmm think of better then cast
|
||||||
public void addLanguageModuleLoaderSibling(X4OLanguageModuleLoaderSibling loader) {
|
public void addLanguageModuleLoaderSibling(X4OLanguageModuleLoaderSibling loader) {
|
||||||
siblingLoaders.add(loader);
|
siblingLoaders.add(loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.INIT;
|
return X4OPhaseType.INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return INIT_LANG_SIB;
|
return INIT_LANG_SIB;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { INIT_LANG };
|
return new String[] { INIT_LANG };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
if (siblingLoaders.isEmpty() == false) {
|
if (siblingLoaders.isEmpty() == false) {
|
||||||
X4OLanguageLoader loader = X4OLanguageClassLoader.newInstance(X4OLanguageLoader.class, languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader());
|
X4OLanguageLoader loader = X4OLanguageClassLoader.newInstance(X4OLanguageLoader.class,
|
||||||
|
languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader());
|
||||||
X4OLanguageLocal language = (X4OLanguageLocal) languageSession.getLanguage();
|
X4OLanguageLocal language = (X4OLanguageLocal) languageSession.getLanguage();
|
||||||
for (X4OLanguageModuleLoaderSibling siblingLoader : siblingLoaders) {
|
for (X4OLanguageModuleLoaderSibling siblingLoader : siblingLoaders) {
|
||||||
debugPhaseMessage(languageSession, "Loading sibling langauge loader: " + siblingLoader);
|
debugPhaseMessage(languageSession, "Loading sibling langauge loader: " + siblingLoader);
|
||||||
|
|
@ -166,17 +184,22 @@ public class X4OPhaseLanguageInit {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.INIT;
|
return X4OPhaseType.INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return INIT_END;
|
return INIT_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { INIT_LANG_SIB };
|
return new String[] { INIT_LANG_SIB };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
logger.finest("Run init end phase");
|
logger.finest("Run init end phase");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,18 +117,23 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_BEGIN;
|
return READ_BEGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] {};
|
return new String[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
// print the properties and classes for this language/config
|
// print the properties and classes for this language/config
|
||||||
if (languageSession.hasX4ODebugWriter()) {
|
if (languageSession.hasX4ODebugWriter()) {
|
||||||
|
|
@ -147,18 +152,23 @@ public class X4OPhaseLanguageRead {
|
||||||
*/
|
*/
|
||||||
class X4OPhaseReadConfigElement extends AbstractX4OPhase {
|
class X4OPhaseReadConfigElement extends AbstractX4OPhase {
|
||||||
private X4OPhaseReadRunConfigurator runConf = null;
|
private X4OPhaseReadRunConfigurator runConf = null;
|
||||||
|
|
||||||
public X4OPhaseReadConfigElement(X4OPhaseReadRunConfigurator runConf) {
|
public X4OPhaseReadConfigElement(X4OPhaseReadRunConfigurator runConf) {
|
||||||
this.runConf = runConf;
|
this.runConf = runConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_CONFIG_ELEMENT;
|
return READ_CONFIG_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_BEGIN };
|
return new String[] { READ_BEGIN };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
|
|
||||||
// First phase is to rename attributes, maybe move so sax phase
|
// First phase is to rename attributes, maybe move so sax phase
|
||||||
|
|
@ -188,18 +198,23 @@ public class X4OPhaseLanguageRead {
|
||||||
*/
|
*/
|
||||||
class X4OPhaseReadConfigElementInterface extends AbstractX4OPhase {
|
class X4OPhaseReadConfigElementInterface extends AbstractX4OPhase {
|
||||||
private X4OPhaseReadRunConfigurator runConf = null;
|
private X4OPhaseReadRunConfigurator runConf = null;
|
||||||
|
|
||||||
public X4OPhaseReadConfigElementInterface(X4OPhaseReadRunConfigurator runConf) {
|
public X4OPhaseReadConfigElementInterface(X4OPhaseReadRunConfigurator runConf) {
|
||||||
this.runConf = runConf;
|
this.runConf = runConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_CONFIG_ELEMENT_INTERFACE;
|
return READ_CONFIG_ELEMENT_INTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_CONFIG_ELEMENT };
|
return new String[] { READ_CONFIG_ELEMENT };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
if (element.getElementObject() == null) {
|
if (element.getElementObject() == null) {
|
||||||
logger.finest("Null elementObject skipping, interfaces");
|
logger.finest("Null elementObject skipping, interfaces");
|
||||||
|
|
@ -219,18 +234,23 @@ public class X4OPhaseLanguageRead {
|
||||||
*/
|
*/
|
||||||
class X4OPhaseReadConfigGlobalElement extends AbstractX4OPhase {
|
class X4OPhaseReadConfigGlobalElement extends AbstractX4OPhase {
|
||||||
private X4OPhaseReadRunConfigurator runConf = null;
|
private X4OPhaseReadRunConfigurator runConf = null;
|
||||||
|
|
||||||
public X4OPhaseReadConfigGlobalElement(X4OPhaseReadRunConfigurator runConf) {
|
public X4OPhaseReadConfigGlobalElement(X4OPhaseReadRunConfigurator runConf) {
|
||||||
this.runConf = runConf;
|
this.runConf = runConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_CONFIG_GLOBAL_ELEMENT;
|
return READ_CONFIG_GLOBAL_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_CONFIG_ELEMENT, READ_CONFIG_ELEMENT_INTERFACE };
|
return new String[] { READ_CONFIG_ELEMENT, READ_CONFIG_ELEMENT_INTERFACE };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
for (X4OLanguageModule mod : element.getLanguageSession().getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod : element.getLanguageSession().getLanguage().getLanguageModules()) {
|
||||||
logger.finest("Do Element Config Global Configurators: " + mod.getElementConfiguratorGlobals().size());
|
logger.finest("Do Element Config Global Configurators: " + mod.getElementConfiguratorGlobals().size());
|
||||||
|
|
@ -247,23 +267,29 @@ public class X4OPhaseLanguageRead {
|
||||||
class X4OPhaseReadConfigGlobalAttribute extends AbstractX4OPhase {
|
class X4OPhaseReadConfigGlobalAttribute extends AbstractX4OPhase {
|
||||||
Comparator<ElementNamespaceAttribute> elementNamespaceAttributeComparator = null;
|
Comparator<ElementNamespaceAttribute> elementNamespaceAttributeComparator = null;
|
||||||
private X4OPhaseReadRunConfigurator runConf = null;
|
private X4OPhaseReadRunConfigurator runConf = null;
|
||||||
|
|
||||||
public X4OPhaseReadConfigGlobalAttribute(X4OPhaseReadRunConfigurator runConf) {
|
public X4OPhaseReadConfigGlobalAttribute(X4OPhaseReadRunConfigurator runConf) {
|
||||||
this.runConf = runConf;
|
this.runConf = runConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_CONFIG_GLOBAL_ATTRIBUTE;
|
return READ_CONFIG_GLOBAL_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_CONFIG_GLOBAL_ELEMENT };
|
return new String[] { READ_CONFIG_GLOBAL_ELEMENT };
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
if (elementNamespaceAttributeComparator == null) {
|
if (elementNamespaceAttributeComparator == null) {
|
||||||
try {
|
try {
|
||||||
elementNamespaceAttributeComparator = (Comparator<ElementNamespaceAttribute>)X4OLanguageClassLoader.newInstance(element.getLanguageSession().getLanguage().getLanguageConfiguration().getDefaultElementNamespaceAttributeComparator());
|
elementNamespaceAttributeComparator = (Comparator<ElementNamespaceAttribute>) X4OLanguageClassLoader
|
||||||
|
.newInstance(element.getLanguageSession().getLanguage().getLanguageConfiguration().getDefaultElementNamespaceAttributeComparator());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new X4OPhaseException(this, e);
|
throw new X4OPhaseException(this, e);
|
||||||
}
|
}
|
||||||
|
|
@ -298,12 +324,15 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RUN_ATTRIBUTE;
|
return READ_RUN_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_CONFIG_GLOBAL_ATTRIBUTE };
|
return new String[] { READ_CONFIG_GLOBAL_ATTRIBUTE };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// we only can config ElementObjects
|
// we only can config ElementObjects
|
||||||
if (element.getElementObject() == null) {
|
if (element.getElementObject() == null) {
|
||||||
|
|
@ -374,12 +403,15 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_FILL_TEMPLATE;
|
return READ_FILL_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_RUN_ATTRIBUTE };
|
return new String[] { READ_RUN_ATTRIBUTE };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -391,12 +423,15 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_TRANSFORM;
|
return READ_TRANSFORM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_FILL_TEMPLATE };
|
return new String[] { READ_FILL_TEMPLATE };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
if (element.isTransformingTree() == false) {
|
if (element.isTransformingTree() == false) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -417,18 +452,23 @@ public class X4OPhaseLanguageRead {
|
||||||
*/
|
*/
|
||||||
class X4OPhaseReadRunDirty extends AbstractX4OPhase {
|
class X4OPhaseReadRunDirty extends AbstractX4OPhase {
|
||||||
private X4OPhaseManager phaseManager = null;
|
private X4OPhaseManager phaseManager = null;
|
||||||
|
|
||||||
public X4OPhaseReadRunDirty(X4OPhaseManager phaseManager) {
|
public X4OPhaseReadRunDirty(X4OPhaseManager phaseManager) {
|
||||||
this.phaseManager = phaseManager;
|
this.phaseManager = phaseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RUN_DIRTY;
|
return READ_RUN_DIRTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_TRANSFORM };
|
return new String[] { READ_TRANSFORM };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
List<Element> dirtyElements = element.getLanguageSession().getDirtyElements();
|
List<Element> dirtyElements = element.getLanguageSession().getDirtyElements();
|
||||||
if (dirtyElements.isEmpty()) {
|
if (dirtyElements.isEmpty()) {
|
||||||
|
|
@ -448,18 +488,23 @@ public class X4OPhaseLanguageRead {
|
||||||
*/
|
*/
|
||||||
class X4OPhaseReadRunDirtyLast extends AbstractX4OPhase {
|
class X4OPhaseReadRunDirtyLast extends AbstractX4OPhase {
|
||||||
private X4OPhaseManager phaseManager = null;
|
private X4OPhaseManager phaseManager = null;
|
||||||
|
|
||||||
public X4OPhaseReadRunDirtyLast(X4OPhaseManager phaseManager) {
|
public X4OPhaseReadRunDirtyLast(X4OPhaseManager phaseManager) {
|
||||||
this.phaseManager = phaseManager;
|
this.phaseManager = phaseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RUN_DIRTY_LAST;
|
return READ_RUN_DIRTY_LAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_RUN };
|
return new String[] { READ_RUN };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
List<Element> dirtyElements = element.getLanguageSession().getDirtyElements();
|
List<Element> dirtyElements = element.getLanguageSession().getDirtyElements();
|
||||||
if (dirtyElements.isEmpty()) {
|
if (dirtyElements.isEmpty()) {
|
||||||
|
|
@ -481,12 +526,15 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_BIND_ELEMENT;
|
return READ_BIND_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_RUN_DIRTY };
|
return new String[] { READ_RUN_DIRTY };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
Element parentElement = element.getParent();
|
Element parentElement = element.getParent();
|
||||||
if (parentElement == null) {
|
if (parentElement == null) {
|
||||||
|
|
@ -526,12 +574,15 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RUN;
|
return READ_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_BIND_ELEMENT };
|
return new String[] { READ_BIND_ELEMENT };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
if (element.isTransformingTree()) {
|
if (element.isTransformingTree()) {
|
||||||
return; // has already runned.
|
return; // has already runned.
|
||||||
|
|
@ -549,21 +600,27 @@ public class X4OPhaseLanguageRead {
|
||||||
|
|
||||||
class X4OPhaseReadRunConfigurator extends AbstractX4OPhase {
|
class X4OPhaseReadRunConfigurator extends AbstractX4OPhase {
|
||||||
private List<RunConfigurator> runConf = null;
|
private List<RunConfigurator> runConf = null;
|
||||||
|
|
||||||
protected X4OPhaseReadRunConfigurator() {
|
protected X4OPhaseReadRunConfigurator() {
|
||||||
runConf = new ArrayList<RunConfigurator>(10);
|
runConf = new ArrayList<RunConfigurator>(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RUN_CONFIGURATOR;
|
return READ_RUN_CONFIGURATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_RUN };
|
return new String[] { READ_RUN };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
for (RunConfigurator conf : runConf) {
|
for (RunConfigurator conf : runConf) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -576,17 +633,21 @@ public class X4OPhaseLanguageRead {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RunConfigurator {
|
class RunConfigurator {
|
||||||
Element element;
|
Element element;
|
||||||
ElementConfigurator elementConfigurator;
|
ElementConfigurator elementConfigurator;
|
||||||
|
|
||||||
RunConfigurator(Element element, ElementConfigurator elementConfigurator) {
|
RunConfigurator(Element element, ElementConfigurator elementConfigurator) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.elementConfigurator = elementConfigurator;
|
this.elementConfigurator = elementConfigurator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementConfigurator(ElementConfigurator ec, Element e, X4OPhase phase) throws X4OPhaseException {
|
public void runElementConfigurator(ElementConfigurator ec, Element e, X4OPhase phase) throws X4OPhaseException {
|
||||||
if (ec.isConfigAction()) {
|
if (ec.isConfigAction()) {
|
||||||
runConf.add(new RunConfigurator(e, ec));
|
runConf.add(new RunConfigurator(e, ec));
|
||||||
|
|
@ -615,18 +676,23 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_END;
|
return READ_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_RUN_CONFIGURATOR };
|
return new String[] { READ_RUN_CONFIGURATOR };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
// print the properties and classes for this language/config
|
// print the properties and classes for this language/config
|
||||||
if (languageSession.hasX4ODebugWriter()) {
|
if (languageSession.hasX4ODebugWriter()) {
|
||||||
|
|
@ -647,29 +713,14 @@ public class X4OPhaseLanguageRead {
|
||||||
|
|
||||||
// for debug output TODO: redo release counters
|
// for debug output TODO: redo release counters
|
||||||
/*
|
/*
|
||||||
class ReleasePhaseListener implements X4OPhaseListener {
|
* class ReleasePhaseListener implements X4OPhaseListener { private int elementsReleased = 0; public void preRunPhase(X4OPhase phase,X4OLanguageSession
|
||||||
private int elementsReleased = 0;
|
* languageSession) throws X4OPhaseException { elementsReleased=0; } public void endRunPhase(X4OPhase phase,X4OLanguageSession languageSession) throws
|
||||||
public void preRunPhase(X4OPhase phase,X4OLanguageSession languageSession) throws X4OPhaseException {
|
* X4OPhaseException { if (languageSession.hasX4ODebugWriter()==false) { return; } try { AttributesImpl atts = new AttributesImpl(); atts.addAttribute
|
||||||
elementsReleased=0;
|
* ("", "elements", "", "", elementsReleased+""); languageSession.getX4ODebugWriter().getContentWriter().startElement (X4ODebugWriter.DEBUG_URI,
|
||||||
}
|
* "executeReleases", "", atts); languageSession.getX4ODebugWriter().getContentWriter().endElement (X4ODebugWriter.DEBUG_URI, "executeReleases" , ""); }
|
||||||
public void endRunPhase(X4OPhase phase,X4OLanguageSession languageSession) throws X4OPhaseException {
|
* catch (SAXException e) { throw new X4OPhaseException(phase,e); } }
|
||||||
if (languageSession.hasX4ODebugWriter()==false) {
|
*
|
||||||
return;
|
* public void addReleasedElement() { elementsReleased++; } }
|
||||||
}
|
|
||||||
try {
|
|
||||||
AttributesImpl atts = new AttributesImpl();
|
|
||||||
atts.addAttribute ("", "elements", "", "", elementsReleased+"");
|
|
||||||
languageSession.getX4ODebugWriter().getContentWriter().startElement (X4ODebugWriter.DEBUG_URI, "executeReleases", "", atts);
|
|
||||||
languageSession.getX4ODebugWriter().getContentWriter().endElement (X4ODebugWriter.DEBUG_URI, "executeReleases" , "");
|
|
||||||
} catch (SAXException e) {
|
|
||||||
throw new X4OPhaseException(phase,e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addReleasedElement() {
|
|
||||||
elementsReleased++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// final ReleasePhaseListener releaseCounter = new ReleasePhaseListener();
|
// final ReleasePhaseListener releaseCounter = new ReleasePhaseListener();
|
||||||
|
|
@ -677,14 +728,18 @@ public class X4OPhaseLanguageRead {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_READ;
|
return X4OPhaseType.XML_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return READ_RELEASE;
|
return READ_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { READ_END };
|
return new String[] { READ_END };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
element.release();
|
element.release();
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,22 @@ public class X4OPhaseLanguageWrite {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_WRITE;
|
return X4OPhaseType.XML_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return WRITE_BEGIN;
|
return WRITE_BEGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] {};
|
return new String[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
logger.finest("Run init begin phase");
|
logger.finest("Run init begin phase");
|
||||||
}
|
}
|
||||||
|
|
@ -89,17 +94,22 @@ public class X4OPhaseLanguageWrite {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_WRITE;
|
return X4OPhaseType.XML_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return WRITE_FILL_TREE;
|
return WRITE_FILL_TREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { WRITE_BEGIN };
|
return new String[] { WRITE_BEGIN };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
Element root = languageSession.getRootElement();
|
Element root = languageSession.getRootElement();
|
||||||
|
|
@ -112,7 +122,8 @@ public class X4OPhaseLanguageWrite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Element fillElementTree(X4OLanguageSession languageSession,Object object) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException {
|
private Element fillElementTree(X4OLanguageSession languageSession, Object object)
|
||||||
|
throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException {
|
||||||
Element element = findRootElement(languageSession, object.getClass());
|
Element element = findRootElement(languageSession, object.getClass());
|
||||||
element.setElementObject(object);
|
element.setElementObject(object);
|
||||||
languageSession.setRootElement(element);
|
languageSession.setRootElement(element);
|
||||||
|
|
@ -124,7 +135,8 @@ public class X4OPhaseLanguageWrite {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillTree(X4OLanguageSession languageSession,Element element) throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException {
|
private void fillTree(X4OLanguageSession languageSession, Element element)
|
||||||
|
throws ElementNamespaceInstanceProviderException, ElementBindingHandlerException {
|
||||||
for (Element e : element.getChilderen()) {
|
for (Element e : element.getChilderen()) {
|
||||||
Object object = e.getElementObject();
|
Object object = e.getElementObject();
|
||||||
for (ElementBindingHandler bind : languageSession.getLanguage().findElementBindingHandlers(object)) {
|
for (ElementBindingHandler bind : languageSession.getLanguage().findElementBindingHandlers(object)) {
|
||||||
|
|
@ -167,17 +179,22 @@ public class X4OPhaseLanguageWrite {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_WRITE;
|
return X4OPhaseType.XML_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return WRITE_END;
|
return WRITE_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { WRITE_FILL_TREE };
|
return new String[] { WRITE_FILL_TREE };
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
logger.finest("Run init end phase");
|
logger.finest("Run init end phase");
|
||||||
}
|
}
|
||||||
|
|
@ -187,22 +204,26 @@ public class X4OPhaseLanguageWrite {
|
||||||
public X4OPhaseType getType() {
|
public X4OPhaseType getType() {
|
||||||
return X4OPhaseType.XML_WRITE;
|
return X4OPhaseType.XML_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return WRITE_RELEASE;
|
return WRITE_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] { WRITE_END };
|
return new String[] { WRITE_END };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
element.release();
|
element.release();
|
||||||
} catch (ElementException e) {
|
} catch (ElementException e) {
|
||||||
throw new X4OPhaseException(this, e);
|
throw new X4OPhaseException(this, e);
|
||||||
}/* finally {
|
} /*
|
||||||
releaseCounter.addReleasedElement();
|
* finally { releaseCounter.addReleasedElement(); }
|
||||||
}*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,8 @@ package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import org.x4o.xml.lang.X4OLanguageSession;
|
import org.x4o.xml.lang.X4OLanguageSession;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An X4OPhaseListener can be placed on an X4OPhaseHandler and is called
|
* An X4OPhaseListener can be placed on an X4OPhaseHandler and is called before and after the phase has runned.
|
||||||
* before and after the phase has runned.
|
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Dec 31, 2008
|
* @version 1.0 Dec 31, 2008
|
||||||
|
|
@ -36,6 +34,7 @@ public interface X4OPhaseListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets called before the X4OPhaseHandler is run.
|
* Gets called before the X4OPhaseHandler is run.
|
||||||
|
*
|
||||||
* @param phase The phase to be run.
|
* @param phase The phase to be run.
|
||||||
* @param languageSession The X4O language session of the driver.
|
* @param languageSession The X4O language session of the driver.
|
||||||
* @throws X4OPhaseException Is throws when listeners has error.
|
* @throws X4OPhaseException Is throws when listeners has error.
|
||||||
|
|
@ -44,6 +43,7 @@ public interface X4OPhaseListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets called after the X4OPhaseHandler is runned.
|
* Gets called after the X4OPhaseHandler is runned.
|
||||||
|
*
|
||||||
* @param phase The phase just run.
|
* @param phase The phase just run.
|
||||||
* @param languageSession The X4O language session of the driver.
|
* @param languageSession The X4O language session of the driver.
|
||||||
* @throws X4OPhaseException Is throws when listeners has error.
|
* @throws X4OPhaseException Is throws when listeners has error.
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,7 @@ import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.lang.X4OLanguageSession;
|
import org.x4o.xml.lang.X4OLanguageSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OPhaseManager stores the X4OPhaseHandler and puts them in the right order.
|
* X4OPhaseManager stores the X4OPhaseHandler and puts them in the right order. And will execute the phases when runPhases is called.
|
||||||
* And will execute the phases when runPhases is called.
|
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jan 6, 2008
|
* @version 1.0 Jan 6, 2008
|
||||||
|
|
@ -38,6 +37,7 @@ public interface X4OPhaseManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an X4OPhase object by the phaseName.
|
* Gets an X4OPhase object by the phaseName.
|
||||||
|
*
|
||||||
* @param phaseName The phaseName to lookup.
|
* @param phaseName The phaseName to lookup.
|
||||||
* @return The X4OPhase requested or null.
|
* @return The X4OPhase requested or null.
|
||||||
*/
|
*/
|
||||||
|
|
@ -45,12 +45,14 @@ public interface X4OPhaseManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the keys of the phases registrated whith this phase manager.
|
* Gets all the keys of the phases registrated whith this phase manager.
|
||||||
|
*
|
||||||
* @return The phase keys.
|
* @return The phase keys.
|
||||||
*/
|
*/
|
||||||
List<String> getPhaseKeys();
|
List<String> getPhaseKeys();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs release phase if it was requested not to run it automaticly.
|
* Runs release phase if it was requested not to run it automaticly.
|
||||||
|
*
|
||||||
* @param languageSession The session to release.
|
* @param languageSession The session to release.
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,12 +60,14 @@ public interface X4OPhaseManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs all the phases in the right order.
|
* Runs all the phases in the right order.
|
||||||
|
*
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
void runPhases(X4OLanguageSession elementContext, X4OPhaseType type) throws X4OPhaseException;
|
void runPhases(X4OLanguageSession elementContext, X4OPhaseType type) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs phase on single element.
|
* Runs phase on single element.
|
||||||
|
*
|
||||||
* @param e The Element to process.
|
* @param e The Element to process.
|
||||||
* @param p The phase to run.
|
* @param p The phase to run.
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.xml.lang.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OPhaseManagerLocal has the local config methods.
|
* X4OPhaseManagerLocal has the local config methods.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ package org.x4o.xml.lang.task;
|
||||||
|
|
||||||
import org.x4o.xml.lang.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguageTaskExecutor runs the language task.
|
* X4OLanguageTaskExecutor runs the language task.
|
||||||
*
|
*
|
||||||
|
|
@ -35,6 +34,7 @@ public interface X4OLanguageTaskExecutor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a task for which this executor is created.
|
* Executes a task for which this executor is created.
|
||||||
|
*
|
||||||
* @param language The language for which we run the task.
|
* @param language The language for which we run the task.
|
||||||
* @throws X4OLanguageTaskException Can be thrown in case of error.
|
* @throws X4OLanguageTaskException Can be thrown in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ import org.xml.sax.SAXException;
|
||||||
*/
|
*/
|
||||||
public class X4OStaticWriter {
|
public class X4OStaticWriter {
|
||||||
|
|
||||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"x4o-static/";
|
//@formatter:off
|
||||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||||
|
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"x4o-static/";
|
||||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||||
public final static String OUTPUT_OASIS_XMLNS_CATALOG = PROPERTY_CONTEXT_PREFIX+"output/oasis-xml-catalog";
|
public final static String OUTPUT_OASIS_XMLNS_CATALOG = PROPERTY_CONTEXT_PREFIX+"output/oasis-xml-catalog";
|
||||||
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class X4OStaticWriter {
|
||||||
new PropertyConfigItem(OUTPUT_OASIS_XMLNS_CATALOG, Boolean.class, false)
|
new PropertyConfigItem(OUTPUT_OASIS_XMLNS_CATALOG, Boolean.class, false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
//@formatter:on
|
||||||
|
|
||||||
private final SAX3PropertyConfig propertyConfig;
|
private final SAX3PropertyConfig propertyConfig;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,13 +197,16 @@ public class X4OTaskCommandLine {
|
||||||
StringBuilder buf = new StringBuilder(defaultValue.length() + 10);
|
StringBuilder buf = new StringBuilder(defaultValue.length() + 10);
|
||||||
for (char c : defaultValue.toCharArray()) {
|
for (char c : defaultValue.toCharArray()) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
buf.append("\\n");continue;
|
buf.append("\\n");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\t') {
|
if (c == '\t') {
|
||||||
buf.append("\\t");continue;
|
buf.append("\\t");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\r') {
|
if (c == '\r') {
|
||||||
buf.append("\\r");continue;
|
buf.append("\\r");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
buf.append(c);
|
buf.append(c);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ public class X4OTaskProperty {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsed line like 'key=value' into a X4OTaskProperty object.
|
* Parsed line like 'key=value' into a X4OTaskProperty object.
|
||||||
|
*
|
||||||
* @param line The text line to parse.
|
* @param line The text line to parse.
|
||||||
* @return The filled X4OTaskProperty.
|
* @return The filled X4OTaskProperty.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,7 @@ import org.x4o.xml.lang.task.X4OLanguageTaskException;
|
||||||
import org.x4o.xml.lang.task.X4OLanguageTaskExecutor;
|
import org.x4o.xml.lang.task.X4OLanguageTaskExecutor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OTaskRunner finds all x4o objects and configs and then run the x4o langauge
|
* X4OTaskRunner finds all x4o objects and configs and then run the x4o langauge task.
|
||||||
* task.
|
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 30, 2013
|
* @version 1.0 Aug 30, 2013
|
||||||
|
|
|
||||||
|
|
@ -101,16 +101,13 @@ public class X4ODriverManagerTest {
|
||||||
e = catchE;
|
e = catchE;
|
||||||
}
|
}
|
||||||
Assertions.assertNotNull(e);
|
Assertions.assertNotNull(e);
|
||||||
/* TODO
|
/*
|
||||||
assertNotNull(e);
|
* TODO assertNotNull(e); assertNotNull(e.getCause()); assertNotNull(e.getCause().getCause()); assertEquals(X4OPhaseException.class,
|
||||||
assertNotNull(e.getCause());
|
* e.getCause().getClass()); assertEquals(X4OLanguageLoaderException.class, e.getCause().getCause().getClass());
|
||||||
assertNotNull(e.getCause().getCause());
|
* assertTrue("Error message string is missing language",e.getMessage().contains("language"));
|
||||||
assertEquals(X4OPhaseException.class, e.getCause().getClass());
|
* assertTrue("Error message string is missing test",e.getMessage().contains("test"));
|
||||||
assertEquals(X4OLanguageLoaderException.class, e.getCause().getCause().getClass());
|
* assertTrue("Error message string is missing modules",e.getMessage().contains("modules"));
|
||||||
assertTrue("Error message string is missing language",e.getMessage().contains("language"));
|
* assertTrue("Error message string is missing 2.0",e.getMessage().contains("2.0"));
|
||||||
assertTrue("Error message string is missing test",e.getMessage().contains("test"));
|
|
||||||
assertTrue("Error message string is missing modules",e.getMessage().contains("modules"));
|
|
||||||
assertTrue("Error message string is missing 2.0",e.getMessage().contains("2.0"));
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,8 +155,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
@Override
|
||||||
@Override public String getLanguageName() { return null; }
|
public String[] getLanguageVersions() {
|
||||||
|
return new String[] { "1.0" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception catchE) {
|
} catch (Exception catchE) {
|
||||||
|
|
@ -175,8 +179,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
@Override
|
||||||
@Override public String getLanguageName() { return ""; }
|
public String[] getLanguageVersions() {
|
||||||
|
return new String[] { "1.0" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception catchE) {
|
} catch (Exception catchE) {
|
||||||
|
|
@ -192,8 +203,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return null; }
|
@Override
|
||||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
public String[] getLanguageVersions() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return "junit-driver-test";
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception catchE) {
|
} catch (Exception catchE) {
|
||||||
|
|
@ -209,8 +227,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return new String[]{}; }
|
@Override
|
||||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
public String[] getLanguageVersions() {
|
||||||
|
return new String[] {};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return "junit-driver-test";
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception catchE) {
|
} catch (Exception catchE) {
|
||||||
|
|
@ -239,8 +264,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriverManager.deregisterX4ODriver(new X4ODriver<Object>() {
|
X4ODriverManager.deregisterX4ODriver(new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
@Override
|
||||||
@Override public String getLanguageName() { return null; }
|
public String[] getLanguageVersions() {
|
||||||
|
return new String[] { "1.0" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (Exception catchE) {
|
} catch (Exception catchE) {
|
||||||
|
|
@ -256,8 +288,15 @@ public class X4ODriverManagerTest {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
X4ODriver<?> driver = new X4ODriver<Object>() {
|
X4ODriver<?> driver = new X4ODriver<Object>() {
|
||||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
@Override
|
||||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
public String[] getLanguageVersions() {
|
||||||
|
return new String[] { "1.0" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguageName() {
|
||||||
|
return "junit-driver-test";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
X4ODriverManager.registerX4ODriver(driver);
|
X4ODriverManager.registerX4ODriver(driver);
|
||||||
Assertions.assertEquals(driver.hashCode(), X4ODriverManager.getX4ODriver("junit-driver-test").hashCode());
|
Assertions.assertEquals(driver.hashCode(), X4ODriverManager.getX4ODriver("junit-driver-test").hashCode());
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests some code for testing x4o phases.
|
* Tests some code for testing x4o phases. *
|
||||||
* *
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jan 15, 2009
|
* @version 1.0 Jan 15, 2009
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,18 +67,9 @@ public class X4OPhaseManagerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public void testPhaseManager() throws Exception {
|
* public void testPhaseManager() throws Exception { TestDriver driver = TestDriver.getInstance(); ElementLanguage context = driver.createLanguageSession();
|
||||||
TestDriver driver = TestDriver.getInstance();
|
* X4OPhaseManager manager = context.getLanguage().getPhaseManager();
|
||||||
ElementLanguage context = driver.createLanguageSession();
|
*
|
||||||
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
|
* Exception e = null; try { manager.addX4OPhaseHandler(null); } catch (NullPointerException ee) { e = ee; } Assertions.assertEquals(true, e!=null ); }
|
||||||
|
|
||||||
Exception e = null;
|
|
||||||
try {
|
|
||||||
manager.addX4OPhaseHandler(null);
|
|
||||||
} catch (NullPointerException ee) {
|
|
||||||
e = ee;
|
|
||||||
}
|
|
||||||
Assertions.assertEquals(true, e!=null );
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,24 +78,12 @@ public class X4OWriteLanguageDocExecutorTest {
|
||||||
testDoc(TestDriver.LANGUAGE_NAME, "junit-doc-test");
|
testDoc(TestDriver.LANGUAGE_NAME, "junit-doc-test");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@Test
|
* @Test public void testSwiXml2Doc() throws Exception { testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld"); EldDocLanguageTask writer = new
|
||||||
public void testSwiXml2Doc() throws Exception {
|
* EldDocLanguageTask(); writer.setBasePath(createOutputTargetPath("junit-swixml2")); writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
||||||
testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld");
|
* writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_2); writer.execute(); }
|
||||||
EldDocLanguageTask writer = new EldDocLanguageTask();
|
*
|
||||||
writer.setBasePath(createOutputTargetPath("junit-swixml2"));
|
* @Test public void testSwiXml3Doc() throws Exception { testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld"); EldDocLanguageTask writer = new
|
||||||
writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
* EldDocLanguageTask(); writer.setBasePath(createOutputTargetPath("junit-swixml3")); writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
||||||
writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_2);
|
* writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_3); writer.execute(); }
|
||||||
writer.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwiXml3Doc() throws Exception {
|
|
||||||
testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld");
|
|
||||||
EldDocLanguageTask writer = new EldDocLanguageTask();
|
|
||||||
writer.setBasePath(createOutputTargetPath("junit-swixml3"));
|
|
||||||
writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
|
||||||
writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_3);
|
|
||||||
writer.execute();
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,12 +180,9 @@ public class X4OReaderSessionTest {
|
||||||
public void testReadString() throws Exception {
|
public void testReadString() throws Exception {
|
||||||
TestDriver driver = TestDriver.getInstance();
|
TestDriver driver = TestDriver.getInstance();
|
||||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||||
TestObjectRoot root = reader.readString(
|
TestObjectRoot root = reader.readString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
|
+ "<root:root xmlns:root=\"http://test.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"
|
||||||
"<root:root xmlns:root=\"http://test.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"+
|
+ "<testBean privateIntegerTypeField=\"987654321\"/>" + "</root:root>");
|
||||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
|
||||||
"</root:root>"
|
|
||||||
);
|
|
||||||
Assertions.assertNotNull(root);
|
Assertions.assertNotNull(root);
|
||||||
Assertions.assertTrue(root.getTestBeans().size() > 0);
|
Assertions.assertTrue(root.getTestBeans().size() > 0);
|
||||||
TestBean bean = root.getTestBeans().get(0);
|
TestBean bean = root.getTestBeans().get(0);
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,9 @@ public class X4OReaderTest {
|
||||||
public void testReadString() throws Exception {
|
public void testReadString() throws Exception {
|
||||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||||
TestObjectRoot root = reader.readString(
|
TestObjectRoot root = reader.readString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
|
+ "<root:root xmlns:root=\"http://test.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"
|
||||||
"<root:root xmlns:root=\"http://test.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"+
|
+ "<testBean privateIntegerTypeField=\"987654321\"/>" + "</root:root>");
|
||||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
|
||||||
"</root:root>"
|
|
||||||
);
|
|
||||||
Assertions.assertNotNull(root);
|
Assertions.assertNotNull(root);
|
||||||
Assertions.assertTrue(root.getTestBeans().size() > 0);
|
Assertions.assertTrue(root.getTestBeans().size() > 0);
|
||||||
TestBean bean = root.getTestBeans().get(0);
|
TestBean bean = root.getTestBeans().get(0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue