Removed core and impl package.
This commit is contained in:
parent
f2844c61f2
commit
b4225f6b0c
|
@ -25,17 +25,17 @@ package org.x4o.xml;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseException;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseType;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.io.DefaultX4OReader;
|
import org.x4o.xml.io.DefaultX4OReader;
|
||||||
import org.x4o.xml.io.DefaultX4OSchemaWriter;
|
import org.x4o.xml.io.DefaultX4OSchemaWriter;
|
||||||
import org.x4o.xml.io.DefaultX4OWriter;
|
import org.x4o.xml.io.DefaultX4OWriter;
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
import org.x4o.xml.io.X4OSchemaWriter;
|
import org.x4o.xml.io.X4OSchemaWriter;
|
||||||
import org.x4o.xml.io.X4OWriter;
|
import org.x4o.xml.io.X4OWriter;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the starting point of the XML X4O Language Driver.
|
* This is the starting point of the XML X4O Language Driver.
|
||||||
|
@ -69,13 +69,13 @@ public abstract class X4ODriver<T> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementLanguage createLanguageContext() {
|
public X4OLanguageContext createLanguageContext() {
|
||||||
return createLanguageContext(getLanguageVersionDefault());
|
return createLanguageContext(getLanguageVersionDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementLanguage createLanguageContext(String version) {
|
public X4OLanguageContext createLanguageContext(String version) {
|
||||||
X4OLanguage language = createLanguage(version);
|
X4OLanguage language = createLanguage(version);
|
||||||
ElementLanguage result = language.getLanguageConfiguration().createElementLanguage(this);
|
X4OLanguageContext result = language.getLanguageConfiguration().createElementLanguage(this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result.getLanguage().getPhaseManager().runPhases(result, X4OPhaseType.INIT);
|
result.getLanguage().getPhaseManager().runPhases(result, X4OPhaseType.INIT);
|
||||||
|
|
|
@ -35,7 +35,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Locale;
|
||||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverter;
|
import org.x4o.xml.conv.ObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a String of an className into the the Class object.
|
* Converts a String of an className into the the Class object.
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Locale;
|
||||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverter;
|
import org.x4o.xml.conv.ObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts Sring of an Enum into the enum value.
|
* Converts Sring of an Enum into the enum value.
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Locale;
|
||||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverter;
|
import org.x4o.xml.conv.ObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StringSplitConverter.
|
* StringSplitConverter.
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2012, Willem Cazander
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
||||||
* that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
|
||||||
* following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
||||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The core classes which startup the language.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
|
|
@ -24,11 +24,11 @@
|
||||||
package org.x4o.xml.eld;
|
package org.x4o.xml.eld;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguage;
|
import org.x4o.xml.lang.DefaultX4OLanguage;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
|
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementLanguageModule;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 20, 2005
|
* @version 1.0 Aug 20, 2005
|
||||||
*/
|
*/
|
||||||
public class CelDriver extends X4ODriver<ElementLanguageModule> {
|
public class CelDriver extends X4ODriver<X4OLanguageModule> {
|
||||||
|
|
||||||
/** Defines the identifier of the 'Core Element Language' language. */
|
/** Defines the identifier of the 'Core Element Language' language. */
|
||||||
public static final String LANGUAGE_NAME = "cel";
|
public static final String LANGUAGE_NAME = "cel";
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
package org.x4o.xml.eld;
|
package org.x4o.xml.eld;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguage;
|
import org.x4o.xml.lang.DefaultX4OLanguage;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
|
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ import org.x4o.xml.element.ElementLanguageModule;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 20, 2005
|
* @version 1.0 Aug 20, 2005
|
||||||
*/
|
*/
|
||||||
public class EldDriver extends X4ODriver<ElementLanguageModule> {
|
public class EldDriver extends X4ODriver<X4OLanguageModule> {
|
||||||
|
|
||||||
/** Defines the identifier of the 'Element Language Description' language. */
|
/** Defines the identifier of the 'Element Language Description' language. */
|
||||||
public static final String LANGUAGE_NAME = "eld";
|
public static final String LANGUAGE_NAME = "eld";
|
||||||
|
|
|
@ -31,13 +31,13 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.X4ODriverManager;
|
import org.x4o.xml.X4ODriverManager;
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoader;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoaderException;
|
|
||||||
import org.x4o.xml.io.DefaultX4OReader;
|
import org.x4o.xml.io.DefaultX4OReader;
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModuleLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageLocal;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 17, 2005
|
* @version 1.0 Aug 17, 2005
|
||||||
*/
|
*/
|
||||||
public class EldModuleLoader implements ElementLanguageModuleLoader {
|
public class EldModuleLoader implements X4OLanguageModuleLoader {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private String eldResource = null;
|
private String eldResource = null;
|
||||||
|
@ -81,24 +81,23 @@ public class EldModuleLoader implements ElementLanguageModuleLoader {
|
||||||
* Loads the ELD language into the module.
|
* Loads the ELD language into the module.
|
||||||
* @param elementLanguage The langauge to load for.
|
* @param elementLanguage The langauge to load for.
|
||||||
* @param elementLanguageModule The module to load it in.
|
* @param elementLanguageModule The module to load it in.
|
||||||
* @throws ElementLanguageModuleLoaderException When eld language could not be loaded.
|
* @throws X4OLanguageModuleLoaderException When eld language could not be loaded.
|
||||||
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
|
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageContext, org.x4o.xml.lang.X4OLanguageModule)
|
||||||
*/
|
*/
|
||||||
public void loadLanguageModule(X4OLanguageLocal language,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
|
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
|
||||||
logger.fine("Loading name eld file from resource: "+eldResource);
|
logger.fine("Loading name eld file from resource: "+eldResource);
|
||||||
try {
|
try {
|
||||||
//EldDriver parser = new EldDriver(elementLanguage,elementLanguageModule,isEldCore);
|
//EldDriver parser = new EldDriver(elementLanguage,elementLanguageModule,isEldCore);
|
||||||
|
|
||||||
X4ODriver driver = null;
|
X4ODriver<?> driver = null;
|
||||||
if (isEldCore) {
|
if (isEldCore) {
|
||||||
driver = X4ODriverManager.getX4ODriver(CelDriver.LANGUAGE_NAME);
|
driver = X4ODriverManager.getX4ODriver(CelDriver.LANGUAGE_NAME);
|
||||||
} else {
|
} else {
|
||||||
driver = X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
driver = X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElementLanguage eldLang = driver.createLanguageContext(driver.getLanguageVersionDefault());
|
X4OLanguageContext eldLang = driver.createLanguageContext(driver.getLanguageVersionDefault());
|
||||||
X4OReader reader = new DefaultX4OReader(eldLang); //driver.createReader();
|
X4OReader<?> reader = new DefaultX4OReader<Object>(eldLang);
|
||||||
|
|
||||||
|
|
||||||
reader.addELBeanInstance(EL_PARENT_LANGUAGE_CONFIGURATION, language.getLanguageConfiguration());
|
reader.addELBeanInstance(EL_PARENT_LANGUAGE_CONFIGURATION, language.getLanguageConfiguration());
|
||||||
reader.addELBeanInstance(EL_PARENT_LANGUAGE, language);
|
reader.addELBeanInstance(EL_PARENT_LANGUAGE, language);
|
||||||
|
@ -110,17 +109,17 @@ public class EldModuleLoader implements ElementLanguageModuleLoader {
|
||||||
|
|
||||||
reader.readResource(eldResource);
|
reader.readResource(eldResource);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage()+" while parsing: "+eldResource,e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,6 @@ import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.conv.text.ClassConverter;
|
import org.x4o.xml.conv.text.ClassConverter;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
import org.x4o.xml.eld.lang.BeanElement;
|
import org.x4o.xml.eld.lang.BeanElement;
|
||||||
import org.x4o.xml.eld.lang.DescriptionElement;
|
import org.x4o.xml.eld.lang.DescriptionElement;
|
||||||
import org.x4o.xml.eld.lang.ElementClassAddParentElement;
|
import org.x4o.xml.eld.lang.ElementClassAddParentElement;
|
||||||
|
@ -40,16 +37,19 @@ import org.x4o.xml.eld.lang.ElementInterfaceBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementModuleBindingHandler;
|
import org.x4o.xml.eld.lang.ElementModuleBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementNamespaceContextBindingHandler;
|
import org.x4o.xml.eld.lang.ElementNamespaceContextBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ModuleElement;
|
import org.x4o.xml.eld.lang.ModuleElement;
|
||||||
|
import org.x4o.xml.element.DefaultElementClass;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoader;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoaderException;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
import org.x4o.xml.impl.DefaultElementClass;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModuleLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageLocal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EldModuleLoaderCore provides a few basic elements for the core eld x4o language.
|
* EldModuleLoaderCore provides a few basic elements for the core eld x4o language.
|
||||||
|
@ -57,7 +57,7 @@ import org.x4o.xml.impl.DefaultElementClass;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jan 11, 2009
|
* @version 1.0 Jan 11, 2009
|
||||||
*/
|
*/
|
||||||
public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private static final String PP_CEL_PROVIDER = "cel.x4o.org";
|
private static final String PP_CEL_PROVIDER = "cel.x4o.org";
|
||||||
|
@ -83,9 +83,9 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
* Loads the CEL language into the module.
|
* Loads the CEL language into the module.
|
||||||
* @param elementLanguage The langauge to load for.
|
* @param elementLanguage The langauge to load for.
|
||||||
* @param elementLanguageModule The module to load it in.
|
* @param elementLanguageModule The module to load it in.
|
||||||
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
|
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.lang.X4OLanguageModule)
|
||||||
*/
|
*/
|
||||||
public void loadLanguageModule(X4OLanguageLocal language,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
|
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
|
||||||
|
|
||||||
elementLanguageModule.setId("cel-module");
|
elementLanguageModule.setId("cel-module");
|
||||||
elementLanguageModule.setName("Core Element Languag Module");
|
elementLanguageModule.setName("Core Element Languag Module");
|
||||||
|
@ -130,18 +130,18 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
try {
|
try {
|
||||||
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
|
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
|
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
|
||||||
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
|
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
|
||||||
);
|
);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace.setId(CEL_CORE);
|
namespace.setId(CEL_CORE);
|
||||||
|
@ -164,7 +164,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
try {
|
try {
|
||||||
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
||||||
} catch (ElementNamespaceInstanceProviderException e) {
|
} catch (ElementNamespaceInstanceProviderException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
elementLanguageModule.addElementNamespaceContext(namespace);
|
elementLanguageModule.addElementNamespaceContext(namespace);
|
||||||
|
@ -174,18 +174,18 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
try {
|
try {
|
||||||
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
|
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
|
namespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)
|
||||||
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
|
X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider())
|
||||||
);
|
);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace.setId(CEL_ROOT);
|
namespace.setId(CEL_ROOT);
|
||||||
|
@ -198,7 +198,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
try {
|
try {
|
||||||
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
||||||
} catch (ElementNamespaceInstanceProviderException e) {
|
} catch (ElementNamespaceInstanceProviderException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
||||||
}
|
}
|
||||||
elementLanguageModule.addElementNamespaceContext(namespace);
|
elementLanguageModule.addElementNamespaceContext(namespace);
|
||||||
}
|
}
|
||||||
|
@ -207,9 +207,9 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
* Adds only Element class beans which need extra meta info for schema.
|
* Adds only Element class beans which need extra meta info for schema.
|
||||||
*
|
*
|
||||||
* @param elementClassList The list to fill.
|
* @param elementClassList The list to fill.
|
||||||
* @throws ElementLanguageModuleLoaderException
|
* @throws X4OLanguageModuleLoaderException
|
||||||
*/
|
*/
|
||||||
private void createElementClasses(List<ElementClass> elementClassList,X4OLanguage language) throws ElementLanguageModuleLoaderException {
|
private void createElementClasses(List<ElementClass> elementClassList,X4OLanguage language) throws X4OLanguageModuleLoaderException {
|
||||||
ElementClass ec = null;
|
ElementClass ec = null;
|
||||||
ElementClassAttribute attr = null;
|
ElementClassAttribute attr = null;
|
||||||
|
|
||||||
|
@ -287,15 +287,15 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
* Creates new ElementClassAttribute instance.
|
* Creates new ElementClassAttribute instance.
|
||||||
* @param elementLanguage The ElementLanguage to create from.
|
* @param elementLanguage The ElementLanguage to create from.
|
||||||
* @return The new ElementClassAttribute instance.
|
* @return The new ElementClassAttribute instance.
|
||||||
* @throws ElementLanguageModuleLoaderException When class could not be created.
|
* @throws X4OLanguageModuleLoaderException When class could not be created.
|
||||||
*/
|
*/
|
||||||
private ElementClassAttribute newElementClassAttribute(X4OLanguage language) throws ElementLanguageModuleLoaderException {
|
private ElementClassAttribute newElementClassAttribute(X4OLanguage language) throws X4OLanguageModuleLoaderException {
|
||||||
try {
|
try {
|
||||||
return (ElementClassAttribute)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementClassAttribute());
|
return (ElementClassAttribute)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementClassAttribute());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new ElementLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
|
||||||
* @param handler The handler to add the the module.
|
* @param handler The handler to add the the module.
|
||||||
* @param elementLanguageModule The module to add the handler to.
|
* @param elementLanguageModule The module to add the handler to.
|
||||||
*/
|
*/
|
||||||
private void addBindingHandler(String id,ElementBindingHandler handler,ElementLanguageModule elementLanguageModule) {
|
private void addBindingHandler(String id,ElementBindingHandler handler,X4OLanguageModule elementLanguageModule) {
|
||||||
handler.setId(id);
|
handler.setId(id);
|
||||||
elementLanguageModule.addElementBindingHandler(handler);
|
elementLanguageModule.addElementBindingHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
|
||||||
import org.x4o.xml.element.AbstractElement;
|
import org.x4o.xml.element.AbstractElement;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeanElement fills it elementObject from source with the bean.class attribute.
|
* BeanElement fills it elementObject from source with the bean.class attribute.
|
||||||
|
|
|
@ -25,9 +25,6 @@ package org.x4o.xml.eld.lang;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.eld.EldModuleLoader;
|
import org.x4o.xml.eld.EldModuleLoader;
|
||||||
import org.x4o.xml.element.AbstractElementBindingHandler;
|
import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
|
@ -35,12 +32,14 @@ import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ParentLanguageElementConfigurator.
|
* An ParentLanguageElementConfigurator.
|
||||||
|
@ -65,7 +64,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler
|
||||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||||
*/
|
*/
|
||||||
public Class<?> getBindParentClass() {
|
public Class<?> getBindParentClass() {
|
||||||
return ElementLanguageModule.class;
|
return X4OLanguageModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +86,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler
|
||||||
}
|
}
|
||||||
X4OLanguage x4oParsingContext = (X4OLanguage)m.get(EldModuleLoader.EL_PARENT_LANGUAGE);
|
X4OLanguage x4oParsingContext = (X4OLanguage)m.get(EldModuleLoader.EL_PARENT_LANGUAGE);
|
||||||
//ElementLanguageModule elementLanguageModule = (ElementLanguageModule)m.get(EldParser.PARENT_ELEMENT_LANGUAGE_MODULE);
|
//ElementLanguageModule elementLanguageModule = (ElementLanguageModule)m.get(EldParser.PARENT_ELEMENT_LANGUAGE_MODULE);
|
||||||
ElementLanguageModule elementLanguageModule = (ElementLanguageModule)parentObject;
|
X4OLanguageModule elementLanguageModule = (X4OLanguageModule)parentObject;
|
||||||
if (x4oParsingContext==null) {
|
if (x4oParsingContext==null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,11 @@ package org.x4o.xml.eld.lang;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.eld.EldModuleLoader;
|
import org.x4o.xml.eld.EldModuleLoader;
|
||||||
import org.x4o.xml.element.AbstractElement;
|
import org.x4o.xml.element.AbstractElement;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModuleElement put in an instance from parent language module.
|
* ModuleElement put in an instance from parent language module.
|
||||||
|
@ -54,7 +54,7 @@ public class ModuleElement extends AbstractElement {
|
||||||
if (m==null) {
|
if (m==null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ElementLanguageModule elementLanguageModule = (ElementLanguageModule)m.get(EldModuleLoader.EL_PARENT_ELEMENT_LANGUAGE_MODULE);
|
X4OLanguageModule elementLanguageModule = (X4OLanguageModule)m.get(EldModuleLoader.EL_PARENT_ELEMENT_LANGUAGE_MODULE);
|
||||||
setElementObject(elementLanguageModule);
|
setElementObject(elementLanguageModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,12 @@ package org.x4o.xml.eld.xsd;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.io.sax.XMLWriter;
|
import org.x4o.xml.io.sax.XMLWriter;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.ext.DefaultHandler2;
|
import org.xml.sax.ext.DefaultHandler2;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class EldXsdXmlGenerator {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
checkNamespace(ns);
|
checkNamespace(ns);
|
||||||
FileOutputStream fio = new FileOutputStream(new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource()));
|
FileOutputStream fio = new FileOutputStream(new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource()));
|
||||||
|
|
|
@ -33,14 +33,14 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.element.ElementAttributeHandler;
|
import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.ext.DefaultHandler2;
|
import org.xml.sax.ext.DefaultHandler2;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
@ -110,13 +110,13 @@ public class EldXsdXmlWriter {
|
||||||
this.namespaces.clear();
|
this.namespaces.clear();
|
||||||
|
|
||||||
// redo this mess, add nice find for binding handlers
|
// redo this mess, add nice find for binding handlers
|
||||||
for (ElementLanguageModule modContext:language.getElementLanguageModules()) {
|
for (X4OLanguageModule modContext:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
||||||
for (ElementClass ec:nsContext.getElementClasses()) {
|
for (ElementClass ec:nsContext.getElementClasses()) {
|
||||||
Class<?> objectClass = null;
|
Class<?> objectClass = null;
|
||||||
if (ec.getObjectClass()!=null) {
|
if (ec.getObjectClass()!=null) {
|
||||||
objectClass = ec.getObjectClass();
|
objectClass = ec.getObjectClass();
|
||||||
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
for (ElementClass checkClass:ns.getElementClasses()) {
|
for (ElementClass checkClass:ns.getElementClasses()) {
|
||||||
if (checkClass.getObjectClass()==null) {
|
if (checkClass.getObjectClass()==null) {
|
||||||
|
@ -180,8 +180,8 @@ public class EldXsdXmlWriter {
|
||||||
msg = "\n".toCharArray();
|
msg = "\n".toCharArray();
|
||||||
xmlWriter.ignorableWhitespace(msg,0,msg.length);
|
xmlWriter.ignorableWhitespace(msg,0,msg.length);
|
||||||
|
|
||||||
ElementLanguageModule module = null;
|
X4OLanguageModule module = null;
|
||||||
for (ElementLanguageModule elm:language.getElementLanguageModules()) {
|
for (X4OLanguageModule elm:language.getLanguageModules()) {
|
||||||
ElementNamespaceContext s = elm.getElementNamespaceContext(ns.getUri());
|
ElementNamespaceContext s = elm.getElementNamespaceContext(ns.getUri());
|
||||||
if (s!=null) {
|
if (s!=null) {
|
||||||
module = elm;
|
module = elm;
|
||||||
|
@ -272,7 +272,7 @@ public class EldXsdXmlWriter {
|
||||||
atts.addAttribute ("", "maxOccurs", "", "", "unbounded");
|
atts.addAttribute ("", "maxOccurs", "", "", "unbounded");
|
||||||
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
|
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
|
||||||
|
|
||||||
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
writeElementClassNamespaces(ec,nsWrite,ns);
|
writeElementClassNamespaces(ec,nsWrite,ns);
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ public class EldXsdXmlWriter {
|
||||||
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
|
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ElementLanguageModule mod:language.getElementLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementAttributeHandler eah:mod.getElementAttributeHandlers()) {
|
for (ElementAttributeHandler eah:mod.getElementAttributeHandlers()) {
|
||||||
attrNames.add(eah.getAttributeName());
|
attrNames.add(eah.getAttributeName());
|
||||||
atts = new AttributesImpl();
|
atts = new AttributesImpl();
|
||||||
|
|
|
@ -54,13 +54,13 @@ public class X4OSchemaWriterExecutor {
|
||||||
String arg = arguIterator.next();
|
String arg = arguIterator.next();
|
||||||
if ("-path".equals(arg) || "-p".equals(arg)) {
|
if ("-path".equals(arg) || "-p".equals(arg)) {
|
||||||
if (arguIterator.hasNext()==false) {
|
if (arguIterator.hasNext()==false) {
|
||||||
System.out.println("No argument for "+arg+" given.");
|
System.err.println("No argument for "+arg+" given.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File schemaBasePath = new File(arguIterator.next());
|
File schemaBasePath = new File(arguIterator.next());
|
||||||
if (schemaBasePath.exists()==false) {
|
if (schemaBasePath.exists()==false) {
|
||||||
System.out.println("path does not exists; "+schemaBasePath);
|
System.err.println("path does not exists; "+schemaBasePath);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class X4OSchemaWriterExecutor {
|
||||||
}
|
}
|
||||||
if ("-language".equals(arg) || "-l".equals(arg)) {
|
if ("-language".equals(arg) || "-l".equals(arg)) {
|
||||||
if (arguIterator.hasNext()==false) {
|
if (arguIterator.hasNext()==false) {
|
||||||
System.out.println("No argument for "+arg+" given.");
|
System.err.println("No argument for "+arg+" given.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class X4OSchemaWriterExecutor {
|
||||||
e = e3;
|
e = e3;
|
||||||
}
|
}
|
||||||
if (e!=null) {
|
if (e!=null) {
|
||||||
System.out.println("Error while schema writing: "+e.getMessage());
|
System.err.println("Error while schema writing: "+e.getMessage());
|
||||||
if (printStack) {
|
if (printStack) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AbstractElement.
|
* An AbstractElement.
|
||||||
|
@ -43,7 +44,7 @@ public abstract class AbstractElement implements Element {
|
||||||
/** The config object */
|
/** The config object */
|
||||||
private Object elementObject = null;
|
private Object elementObject = null;
|
||||||
/** The language parsing context */
|
/** The language parsing context */
|
||||||
private ElementLanguage elementLanguage = null;
|
private X4OLanguageContext elementLanguage = null;
|
||||||
/** The ElementClass */
|
/** The ElementClass */
|
||||||
private ElementClass elementClass = null;
|
private ElementClass elementClass = null;
|
||||||
/** The attributes */
|
/** The attributes */
|
||||||
|
@ -93,7 +94,7 @@ public abstract class AbstractElement implements Element {
|
||||||
getAttributes().clear();
|
getAttributes().clear();
|
||||||
setElementClass(null);
|
setElementClass(null);
|
||||||
setParent(null);
|
setParent(null);
|
||||||
setElementLanguage(null);
|
setLanguageContext(null);
|
||||||
attributes.clear();
|
attributes.clear();
|
||||||
childeren.clear(); // we do not release childeren, x4o does that
|
childeren.clear(); // we do not release childeren, x4o does that
|
||||||
allChilderen.clear();
|
allChilderen.clear();
|
||||||
|
@ -114,16 +115,16 @@ public abstract class AbstractElement implements Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Element#setElementLanguage(ElementLanguage)
|
* @see Element#setLanguageContext(X4OLanguageContext)
|
||||||
*/
|
*/
|
||||||
public void setElementLanguage(ElementLanguage elementLanguage) {
|
public void setLanguageContext(X4OLanguageContext elementLanguage) {
|
||||||
this.elementLanguage=elementLanguage;
|
this.elementLanguage=elementLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Element#getElementLanguage()
|
* @see Element#getElementLanguage()
|
||||||
*/
|
*/
|
||||||
public ElementLanguage getElementLanguage() {
|
public X4OLanguageContext getElementLanguage() {
|
||||||
return elementLanguage;
|
return elementLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default element to handle the xml events.
|
* The default element to handle the xml events.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -29,11 +29,6 @@ import java.util.logging.Logger;
|
||||||
import javax.el.ValueExpression;
|
import javax.el.ValueExpression;
|
||||||
|
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.element.Element;
|
|
||||||
import org.x4o.xml.element.ElementAttributeValueParser;
|
|
||||||
import org.x4o.xml.element.ElementAttributeValueParserException;
|
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
|
||||||
import org.x4o.xml.element.ElementInterface;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,8 +107,8 @@ public class DefaultElementAttributeValueParser implements ElementAttributeValue
|
||||||
* @see org.x4o.xml.element.ElementAttributeValueParser#getELParameterValue(java.lang.String, org.x4o.xml.element.Element)
|
* @see org.x4o.xml.element.ElementAttributeValueParser#getELParameterValue(java.lang.String, org.x4o.xml.element.Element)
|
||||||
*/
|
*/
|
||||||
public Object getELParameterValue(String value, Element element) throws ElementAttributeValueParserException {
|
public Object getELParameterValue(String value, Element element) throws ElementAttributeValueParserException {
|
||||||
ValueExpression e = element.getElementLanguage().getExpressionFactory().createValueExpression(element.getElementLanguage().getELContext(), (String)value,Object.class);
|
ValueExpression e = element.getElementLanguage().getExpressionLanguageFactory().createValueExpression(element.getElementLanguage().getExpressionLanguageContext(), (String)value,Object.class);
|
||||||
return e.getValue(element.getElementLanguage().getELContext());
|
return e.getValue(element.getElementLanguage().getExpressionLanguageContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -21,17 +21,14 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.element.ElementClass;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,7 +127,7 @@ public class DefaultElementBodyCharacters implements Element {
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.Element#getElementLanguage()
|
* @see org.x4o.xml.element.Element#getElementLanguage()
|
||||||
*/
|
*/
|
||||||
public ElementLanguage getElementLanguage() {
|
public X4OLanguageContext getElementLanguage() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,9 +177,9 @@ public class DefaultElementBodyCharacters implements Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.Element#setElementLanguage(org.x4o.xml.element.ElementLanguage)
|
* @see org.x4o.xml.element.Element#setLanguageContext(org.x4o.xml.lang.X4OLanguageContext)
|
||||||
*/
|
*/
|
||||||
public void setElementLanguage(ElementLanguage elementLanguage) {
|
public void setLanguageContext(X4OLanguageContext elementLanguage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultElementBodyComment the default comment element.
|
* DefaultElementBodyComment the default comment element.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultElementBodyWhitespace the default white space element.
|
* DefaultElementBodyWhitespace the default white space element.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElementClass;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default ElementClass to store the Element information.
|
* The default ElementClass to store the Element information.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElementClassAttribute;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default ElementClassAttribute.
|
* The default ElementClassAttribute.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElementInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default ElementInterface to store config based on class interface.
|
* The default ElementInterface to store config based on class interface.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElementNamespaceContext;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default namespace context.
|
* The default namespace context.
|
|
@ -21,18 +21,13 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
import org.x4o.xml.element.ElementClass;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultElementNamespaceInstanceProvider creates and configures an Element instance.
|
* DefaultElementNamespaceInstanceProvider creates and configures an Element instance.
|
||||||
|
@ -55,7 +50,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
|
||||||
/**
|
/**
|
||||||
* @param language The elementLanguage of this provider.
|
* @param language The elementLanguage of this provider.
|
||||||
* @param elementNamespaceContext The elementNamespaceContext for this provider.
|
* @param elementNamespaceContext The elementNamespaceContext for this provider.
|
||||||
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementNamespaceContext)
|
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguageContext, org.x4o.xml.element.ElementNamespaceContext)
|
||||||
*/
|
*/
|
||||||
public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) {
|
public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) {
|
||||||
this.elementNamespaceContext=elementNamespaceContext;
|
this.elementNamespaceContext=elementNamespaceContext;
|
||||||
|
@ -68,7 +63,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
|
||||||
* @throws ElementNamespaceInstanceProviderException
|
* @throws ElementNamespaceInstanceProviderException
|
||||||
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(java.lang.String)
|
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Element createElementInstance(ElementLanguage elementLanguage,String tag) throws ElementNamespaceInstanceProviderException {
|
public Element createElementInstance(X4OLanguageContext elementLanguage,String tag) throws ElementNamespaceInstanceProviderException {
|
||||||
ElementClass elementClass = elementNamespaceContext.getElementClass(tag);
|
ElementClass elementClass = elementNamespaceContext.getElementClass(tag);
|
||||||
Element element = null;
|
Element element = null;
|
||||||
|
|
||||||
|
@ -98,7 +93,7 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
|
||||||
throw new ElementNamespaceInstanceProviderException(this,"Error while providing Element: "+e.getMessage(),e);
|
throw new ElementNamespaceInstanceProviderException(this,"Error while providing Element: "+e.getMessage(),e);
|
||||||
} */
|
} */
|
||||||
element.setElementClass(elementClass);
|
element.setElementClass(elementClass);
|
||||||
element.setElementLanguage(elementLanguage);
|
element.setLanguageContext(elementLanguage);
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -33,8 +33,6 @@ import java.util.logging.Logger;
|
||||||
import org.x4o.xml.conv.DefaultObjectConverterProvider;
|
import org.x4o.xml.conv.DefaultObjectConverterProvider;
|
||||||
import org.x4o.xml.conv.ObjectConverter;
|
import org.x4o.xml.conv.ObjectConverter;
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValue;
|
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValueException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An DefaultElementObjectPropertyValue which does does get/set operations on pojo beans.
|
* An DefaultElementObjectPropertyValue which does does get/set operations on pojo beans.
|
|
@ -21,11 +21,10 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementAttributeHandler;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -27,6 +27,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an XML element with an object.<br>
|
* Defines an XML element with an object.<br>
|
||||||
* <br>
|
* <br>
|
||||||
|
@ -134,13 +136,13 @@ public interface Element {
|
||||||
* Sets the ElementLanguage.
|
* Sets the ElementLanguage.
|
||||||
* @param elementLanguage The ElementLanguage to set.
|
* @param elementLanguage The ElementLanguage to set.
|
||||||
*/
|
*/
|
||||||
void setElementLanguage(ElementLanguage elementLanguage);
|
void setLanguageContext(X4OLanguageContext elementLanguage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ElementLanguage.
|
* Gets the ElementLanguage.
|
||||||
* @return Returns the ElementLanguage.
|
* @return Returns the ElementLanguage.
|
||||||
*/
|
*/
|
||||||
ElementLanguage getElementLanguage();
|
X4OLanguageContext getElementLanguage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the body texts on an event based system.
|
* Sets the body texts on an event based system.
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementNamespaceInstanceProvider is provider for creating new Element instances for an xml tag.<br>
|
* ElementNamespaceInstanceProvider is provider for creating new Element instances for an xml tag.<br>
|
||||||
|
@ -47,5 +48,5 @@ public interface ElementNamespaceInstanceProvider {
|
||||||
* @return An new Element instance.
|
* @return An new Element instance.
|
||||||
* @throws ElementNamespaceInstanceProviderException Thrown when error happened in language.
|
* @throws ElementNamespaceInstanceProviderException Thrown when error happened in language.
|
||||||
*/
|
*/
|
||||||
Element createElementInstance(ElementLanguage elementLanguage,String tag) throws ElementNamespaceInstanceProviderException;
|
Element createElementInstance(X4OLanguageContext elementLanguage,String tag) throws ElementNamespaceInstanceProviderException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2012, Willem Cazander
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
||||||
* that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
|
||||||
* following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
||||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ElementLanguageModuleLoaderDummy loads nothing.
|
|
||||||
*
|
|
||||||
* @author Willem Cazander
|
|
||||||
* @version 1.0 Aug 3, 2012
|
|
||||||
*/
|
|
||||||
public class DefaultElementLanguageModuleLoaderDummy implements ElementLanguageModuleLoader {
|
|
||||||
|
|
||||||
private Logger logger = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new DefaultElementLanguageModuleLoaderDummy.
|
|
||||||
*/
|
|
||||||
public DefaultElementLanguageModuleLoaderDummy() {
|
|
||||||
logger = Logger.getLogger(DefaultElementLanguageModuleLoaderDummy.class.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param elementLanguage The elementLanguage to load for.
|
|
||||||
* @param elementLanguageModule The elementLanguageModule to load for.
|
|
||||||
* @see org.x4o.xml.element.ElementLanguageModuleLoader#loadLanguageModule(org.x4o.xml.element.ElementLanguage, org.x4o.xml.element.ElementLanguageModule)
|
|
||||||
*/
|
|
||||||
public void loadLanguageModule(X4OLanguageLocal elementLanguage,ElementLanguageModule elementLanguageModule) {
|
|
||||||
logger.fine("Dummy loader loads nothing.");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2012, Willem Cazander
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
||||||
* that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
|
||||||
* following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
||||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The X4O Element and language implementation.The X4O XML Element interfaces.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
|
|
@ -23,18 +23,18 @@
|
||||||
|
|
||||||
package org.x4o.xml.io;
|
package org.x4o.xml.io;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
|
||||||
public abstract class AbstractX4OConnection implements X4OConnection {
|
public abstract class AbstractX4OConnection implements X4OConnection {
|
||||||
|
|
||||||
private ElementLanguage languageContext = null;
|
private X4OLanguageContext languageContext = null;
|
||||||
|
|
||||||
public AbstractX4OConnection(ElementLanguage languageContext) {
|
public AbstractX4OConnection(X4OLanguageContext languageContext) {
|
||||||
this.languageContext=languageContext;
|
this.languageContext=languageContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ElementLanguage getLanguageContext() {
|
protected X4OLanguageContext getLanguageContext() {
|
||||||
return languageContext;
|
return languageContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
*/
|
*/
|
||||||
abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> implements X4OReader<T> {
|
abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> implements X4OReader<T> {
|
||||||
|
|
||||||
public AbstractX4OReader(ElementLanguage elementLanguage) {
|
public AbstractX4OReader(X4OLanguageContext elementLanguage) {
|
||||||
super(elementLanguage);
|
super(elementLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ abstract public class AbstractX4OReader<T> extends AbstractX4OReaderContext<T> i
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public T read(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
|
public T read(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
|
||||||
ElementLanguage context = readContext(input, systemId, basePath);
|
X4OLanguageContext context = readContext(input, systemId, basePath);
|
||||||
return (T)context.getRootElement().getElementObject();
|
return (T)context.getRootElement().getElementObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
*/
|
*/
|
||||||
abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection implements X4OReaderContext<T> {
|
abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection implements X4OReaderContext<T> {
|
||||||
|
|
||||||
public AbstractX4OReaderContext(ElementLanguage languageContext) {
|
public AbstractX4OReaderContext(X4OLanguageContext languageContext) {
|
||||||
super(languageContext);
|
super(languageContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
public ElementLanguage readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
public X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
||||||
if (fileName==null) {
|
if (fileName==null) {
|
||||||
throw new NullPointerException("Can't convert null fileName to file object.");
|
throw new NullPointerException("Can't convert null fileName to file object.");
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
public ElementLanguage readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
public X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
||||||
if (file==null) {
|
if (file==null) {
|
||||||
throw new NullPointerException("Can't read null file.");
|
throw new NullPointerException("Can't read null file.");
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
|
||||||
* @throws SAXException
|
* @throws SAXException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public ElementLanguage readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
public X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
||||||
if (resourceName==null) {
|
if (resourceName==null) {
|
||||||
throw new NullPointerException("Can't read null resourceName from classpath.");
|
throw new NullPointerException("Can't read null resourceName from classpath.");
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
public ElementLanguage readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
|
public X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
|
||||||
if (xmlString==null) {
|
if (xmlString==null) {
|
||||||
throw new NullPointerException("Can't read null xml string.");
|
throw new NullPointerException("Can't read null xml string.");
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ abstract public class AbstractX4OReaderContext<T> extends AbstractX4OConnection
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.sax.AbstractXMLreadr#read(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
public ElementLanguage readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
|
public X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException {
|
||||||
if (url==null) {
|
if (url==null) {
|
||||||
throw new NullPointerException("Can't read null url.");
|
throw new NullPointerException("Can't read null url.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public abstract class AbstractX4OWriter<T> extends AbstractX4OWriterContext<T> implements X4OWriter<T> {
|
public abstract class AbstractX4OWriter<T> extends AbstractX4OWriterContext<T> implements X4OWriter<T> {
|
||||||
|
|
||||||
public AbstractX4OWriter(ElementLanguage elementLanguage) {
|
public AbstractX4OWriter(X4OLanguageContext elementLanguage) {
|
||||||
super(elementLanguage);
|
super(elementLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public abstract class AbstractX4OWriter<T> extends AbstractX4OWriterContext<T> i
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(T object,OutputStream output) throws ParserConfigurationException, SAXException, IOException {
|
public void write(T object,OutputStream output) throws ParserConfigurationException, SAXException, IOException {
|
||||||
ElementLanguage context = getLanguageContext();
|
X4OLanguageContext context = getLanguageContext();
|
||||||
context.getRootElement().setElementObject(object); //TODO: check ??
|
context.getRootElement().setElementObject(object); //TODO: check ??
|
||||||
writeContext(context,output);
|
writeContext(context,output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,23 +31,23 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public abstract class AbstractX4OWriterContext<T> extends AbstractX4OConnection implements X4OWriterContext<T> {
|
public abstract class AbstractX4OWriterContext<T> extends AbstractX4OConnection implements X4OWriterContext<T> {
|
||||||
|
|
||||||
public AbstractX4OWriterContext(ElementLanguage elementLanguage) {
|
public AbstractX4OWriterContext(X4OLanguageContext elementLanguage) {
|
||||||
super(elementLanguage);
|
super(elementLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeFileContext(ElementLanguage context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
public void writeFileContext(X4OLanguageContext context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
||||||
if (fileName==null) {
|
if (fileName==null) {
|
||||||
throw new NullPointerException("Can't convert null fileName to file object.");
|
throw new NullPointerException("Can't convert null fileName to file object.");
|
||||||
}
|
}
|
||||||
writeFileContext(context,new File(fileName));
|
writeFileContext(context,new File(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeFileContext(ElementLanguage context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
public void writeFileContext(X4OLanguageContext context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException {
|
||||||
if (file==null) {
|
if (file==null) {
|
||||||
throw new NullPointerException("Can't read null file.");
|
throw new NullPointerException("Can't read null file.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
package org.x4o.xml.io;
|
package org.x4o.xml.io;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguage;
|
import org.x4o.xml.lang.DefaultX4OLanguage;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
|
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
|
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
|
||||||
|
|
||||||
public class DefaultX4ODriver<T> extends X4ODriver<T> {
|
public class DefaultX4ODriver<T> extends X4ODriver<T> {
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.core.X4ODebugWriter;
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseException;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseType;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementLanguageLocal;
|
|
||||||
import org.x4o.xml.io.sax.XMLWriter;
|
import org.x4o.xml.io.sax.XMLWriter;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContextLocal;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.ext.DefaultHandler2;
|
import org.xml.sax.ext.DefaultHandler2;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
@ -59,12 +59,12 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
||||||
/** The logger to log to. */
|
/** The logger to log to. */
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
|
|
||||||
public DefaultX4OReader(ElementLanguage elementLanguage) {
|
public DefaultX4OReader(X4OLanguageContext elementLanguage) {
|
||||||
super(elementLanguage);
|
super(elementLanguage);
|
||||||
logger = Logger.getLogger(DefaultX4OReader.class.getName());
|
logger = Logger.getLogger(DefaultX4OReader.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementLanguage readContext(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
|
public X4OLanguageContext readContext(InputStream input, String systemId, URL basePath) throws ParserConfigurationException, SAXException, IOException {
|
||||||
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_STREAM, input);
|
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_STREAM, input);
|
||||||
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_SYSTEM_ID, systemId);
|
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_SYSTEM_ID, systemId);
|
||||||
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_BASE_PATH, basePath);
|
setProperty(X4OLanguagePropertyKeys.INPUT_SOURCE_BASE_PATH, basePath);
|
||||||
|
@ -96,7 +96,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
||||||
* Parses the input stream as a X4O document.
|
* Parses the input stream as a X4O document.
|
||||||
*/
|
*/
|
||||||
protected void read() throws ParserConfigurationException,SAXException,IOException {
|
protected void read() throws ParserConfigurationException,SAXException,IOException {
|
||||||
ElementLanguage elementLanguage = getLanguageContext();
|
X4OLanguageContext elementLanguage = getLanguageContext();
|
||||||
if (elementLanguage.getLanguage()==null) {
|
if (elementLanguage.getLanguage()==null) {
|
||||||
throw new ParserConfigurationException("parserConfig is broken getLanguage() returns null.");
|
throw new ParserConfigurationException("parserConfig is broken getLanguage() returns null.");
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
||||||
xmlDebugWriter.startDocument();
|
xmlDebugWriter.startDocument();
|
||||||
xmlDebugWriter.startPrefixMapping("debug", X4ODebugWriter.DEBUG_URI);
|
xmlDebugWriter.startPrefixMapping("debug", X4ODebugWriter.DEBUG_URI);
|
||||||
X4ODebugWriter debugWriter = new X4ODebugWriter(xmlDebugWriter);
|
X4ODebugWriter debugWriter = new X4ODebugWriter(xmlDebugWriter);
|
||||||
ElementLanguageLocal local = (ElementLanguageLocal)elementLanguage;
|
X4OLanguageContextLocal local = (X4OLanguageContextLocal)elementLanguage;
|
||||||
local.setX4ODebugWriter(debugWriter);
|
local.setX4ODebugWriter(debugWriter);
|
||||||
startedDebugWriter = true;
|
startedDebugWriter = true;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseContext(ElementLanguage context) throws X4OPhaseException {
|
public void releaseContext(X4OLanguageContext context) throws X4OPhaseException {
|
||||||
if (context==null) {
|
if (context==null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ package org.x4o.xml.io;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.eld.xsd.EldXsdXmlGenerator;
|
import org.x4o.xml.eld.xsd.EldXsdXmlGenerator;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
|
|
||||||
public class DefaultX4OSchemaWriter extends AbstractX4OConnection implements X4OSchemaWriter {
|
public class DefaultX4OSchemaWriter extends AbstractX4OConnection implements X4OSchemaWriter {
|
||||||
|
|
||||||
public DefaultX4OSchemaWriter(ElementLanguage languageContext) {
|
public DefaultX4OSchemaWriter(X4OLanguageContext languageContext) {
|
||||||
super(languageContext);
|
super(languageContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,16 +29,16 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
||||||
|
|
||||||
public DefaultX4OWriter(ElementLanguage elementLanguage) {
|
public DefaultX4OWriter(X4OLanguageContext elementLanguage) {
|
||||||
super(elementLanguage);
|
super(elementLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeContext(ElementLanguage context,OutputStream out) throws ParserConfigurationException,
|
public void writeContext(X4OLanguageContext context,OutputStream out) throws ParserConfigurationException,
|
||||||
FileNotFoundException, SecurityException, NullPointerException,
|
FileNotFoundException, SecurityException, NullPointerException,
|
||||||
SAXException, IOException {
|
SAXException, IOException {
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ import java.net.URL;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseException;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public interface X4OReaderContext<T> extends X4OReader<T> {
|
public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
|
|
||||||
void releaseContext(ElementLanguage context) throws X4OPhaseException;
|
void releaseContext(X4OLanguageContext context) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to parse the xml data.
|
* Method to parse the xml data.
|
||||||
|
@ -46,7 +46,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws SAXException
|
* @throws SAXException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
ElementLanguage readContext(InputStream input,String systemId,URL basePath) throws ParserConfigurationException,SAXException,IOException;
|
X4OLanguageContext readContext(InputStream input,String systemId,URL basePath) throws ParserConfigurationException,SAXException,IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the file fileName and parses it as an InputStream.
|
* Reads the file fileName and parses it as an InputStream.
|
||||||
|
@ -59,7 +59,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
ElementLanguage readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
X4OLanguageContext readFileContext(String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the file and parses it as an InputStream.
|
* Reads the file and parses it as an InputStream.
|
||||||
|
@ -72,7 +72,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
ElementLanguage readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
X4OLanguageContext readFileContext(File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an resource locaction.
|
* Parses an resource locaction.
|
||||||
|
@ -84,7 +84,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws SAXException
|
* @throws SAXException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
ElementLanguage readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
X4OLanguageContext readResourceContext(String resourceName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a String to a InputStream to is can me parsed by SAX.
|
* Converts a String to a InputStream to is can me parsed by SAX.
|
||||||
|
@ -95,7 +95,7 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
ElementLanguage readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
|
X4OLanguageContext readStringContext(String xmlString) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetched the data direct from remote url to a InputStream to is can me parsed by SAX.
|
* Fetched the data direct from remote url to a InputStream to is can me parsed by SAX.
|
||||||
|
@ -106,5 +106,5 @@ public interface X4OReaderContext<T> extends X4OReader<T> {
|
||||||
* @throws NullPointerException
|
* @throws NullPointerException
|
||||||
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
* @see org.x4o.xml.io.AbstractX4OReader#parse(java.io.InputStream,java.lang.String,java.net.URL)
|
||||||
*/
|
*/
|
||||||
ElementLanguage readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
|
X4OLanguageContext readUrlContext(URL url) throws ParserConfigurationException,SAXException,IOException,NullPointerException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,14 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public interface X4OWriterContext<T> extends X4OWriter<T> {
|
public interface X4OWriterContext<T> extends X4OWriter<T> {
|
||||||
|
|
||||||
void writeContext(ElementLanguage context,OutputStream out) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
void writeContext(X4OLanguageContext context,OutputStream out) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
|
|
||||||
void writeFileContext(ElementLanguage context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
void writeFileContext(X4OLanguageContext context,String fileName) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
|
|
||||||
void writeFileContext(ElementLanguage context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
void writeFileContext(X4OLanguageContext context,File file) throws ParserConfigurationException,FileNotFoundException,SecurityException,NullPointerException,SAXException,IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.io.sax;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -29,11 +29,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.conv.ObjectConverter;
|
import org.x4o.xml.conv.ObjectConverter;
|
||||||
import org.x4o.xml.core.config.X4OLanguageConfiguration;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseException;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhase;
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseListener;
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementAttributeHandler;
|
import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
|
@ -42,12 +37,17 @@ import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementClassBase;
|
import org.x4o.xml.element.ElementClassBase;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageConfiguration;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhase;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseListener;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.ext.DefaultHandler2;
|
import org.xml.sax.ext.DefaultHandler2;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
@ -83,9 +83,9 @@ public class X4ODebugWriter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws X4OPhaseException
|
* @throws X4OPhaseException
|
||||||
* @see org.x4o.xml.core.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.element.ElementLanguage)
|
* @see org.x4o.xml.lang.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.lang.X4OLanguageContext)
|
||||||
*/
|
*/
|
||||||
public void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
|
@ -99,7 +99,7 @@ public class X4ODebugWriter {
|
||||||
debugPhase(phase);
|
debugPhase(phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
long stopTime = System.currentTimeMillis();
|
long stopTime = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
|
@ -115,7 +115,7 @@ public class X4ODebugWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugLanguageProperties(ElementLanguage ec) throws ElementException {
|
public void debugLanguageProperties(X4OLanguageContext ec) throws ElementException {
|
||||||
try {
|
try {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
debugWriter.startElement (DEBUG_URI, "X4OLanguageProperties", "", atts);
|
debugWriter.startElement (DEBUG_URI, "X4OLanguageProperties", "", atts);
|
||||||
|
@ -136,7 +136,7 @@ public class X4ODebugWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugLanguageDefaultClasses(ElementLanguage ec) throws ElementException {
|
public void debugLanguageDefaultClasses(X4OLanguageContext ec) throws ElementException {
|
||||||
try {
|
try {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
debugWriter.startElement (DEBUG_URI, "X4OLanguageDefaultClasses", "", atts);
|
debugWriter.startElement (DEBUG_URI, "X4OLanguageDefaultClasses", "", atts);
|
||||||
|
@ -212,20 +212,20 @@ public class X4ODebugWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugElementLanguageModules(ElementLanguage elementLanguage) throws ElementException {
|
public void debugElementLanguageModules(X4OLanguageContext elementLanguage) throws ElementException {
|
||||||
try {
|
try {
|
||||||
AttributesImpl attsEmpty = new AttributesImpl();
|
AttributesImpl attsEmpty = new AttributesImpl();
|
||||||
debugWriter.startElement (DEBUG_URI, "ElementLanguageModules", "", attsEmpty);
|
debugWriter.startElement (DEBUG_URI, "ElementLanguageModules", "", attsEmpty);
|
||||||
|
|
||||||
for (ElementLanguageModule module:elementLanguage.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
atts.addAttribute ("", "className", "", "", module.getClass().getName());
|
atts.addAttribute ("", "className", "", "", module.getClass().getName());
|
||||||
atts.addAttribute ("", "name", "", "", module.getName());
|
atts.addAttribute ("", "name", "", "", module.getName());
|
||||||
atts.addAttribute ("", "providerName", "", "", module.getProviderName());
|
atts.addAttribute ("", "providerName", "", "", module.getProviderName());
|
||||||
if (module.getElementLanguageModuleLoader()==null) {
|
if (module.getLanguageModuleLoader()==null) {
|
||||||
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", "null");
|
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", "null");
|
||||||
} else {
|
} else {
|
||||||
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", module.getElementLanguageModuleLoader().getClass().getName());
|
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", module.getLanguageModuleLoader().getClass().getName());
|
||||||
}
|
}
|
||||||
debugWriter.startElement (DEBUG_URI, "ElementLanguageModule", "", atts);
|
debugWriter.startElement (DEBUG_URI, "ElementLanguageModule", "", atts);
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ public class X4ODebugWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugElementLanguage(ElementLanguage elementLanguage) throws SAXException {
|
public void debugElementLanguage(X4OLanguageContext elementLanguage) throws SAXException {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
//atts.addAttribute ("", key, "", "", value);
|
//atts.addAttribute ("", key, "", "", value);
|
||||||
atts.addAttribute ("", "language", "", "", elementLanguage.getLanguage().getLanguageName());
|
atts.addAttribute ("", "language", "", "", elementLanguage.getLanguage().getLanguageName());
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.io.sax;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -31,11 +31,11 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
import org.xml.sax.EntityResolver;
|
import org.xml.sax.EntityResolver;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -56,7 +56,7 @@ public class X4OEntityResolver implements EntityResolver {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private URL basePath = null;
|
private URL basePath = null;
|
||||||
private ElementLanguage elementContext = null;
|
private X4OLanguageContext elementContext = null;
|
||||||
private Map<String,String> schemaResources = null;
|
private Map<String,String> schemaResources = null;
|
||||||
private Map<String,String> schemaPathResources = null;
|
private Map<String,String> schemaPathResources = null;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class X4OEntityResolver implements EntityResolver {
|
||||||
* Creates an X4OEntityResolver for a language.
|
* Creates an X4OEntityResolver for a language.
|
||||||
* @param elementContext The x4o language to resolve entities for.
|
* @param elementContext The x4o language to resolve entities for.
|
||||||
*/
|
*/
|
||||||
public X4OEntityResolver(ElementLanguage elementContext) {
|
public X4OEntityResolver(X4OLanguageContext elementContext) {
|
||||||
if (elementContext==null) {
|
if (elementContext==null) {
|
||||||
throw new NullPointerException("Can't provide entities with null elementContext.");
|
throw new NullPointerException("Can't provide entities with null elementContext.");
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class X4OEntityResolver implements EntityResolver {
|
||||||
this.basePath=(URL)elementContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_BASE_PATH);
|
this.basePath=(URL)elementContext.getLanguageProperty(X4OLanguageProperty.INPUT_SOURCE_BASE_PATH);
|
||||||
this.schemaResources=new HashMap<String,String>(20);
|
this.schemaResources=new HashMap<String,String>(20);
|
||||||
this.schemaPathResources=new HashMap<String,String>(20);
|
this.schemaPathResources=new HashMap<String,String>(20);
|
||||||
for (ElementLanguageModule mod:elementContext.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:elementContext.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
if (ns.getSchemaUri()==null) {
|
if (ns.getSchemaUri()==null) {
|
||||||
continue;
|
continue;
|
|
@ -21,11 +21,11 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.io.sax;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
import org.xml.sax.ErrorHandler;
|
import org.xml.sax.ErrorHandler;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
|
@ -38,14 +38,14 @@ import org.xml.sax.SAXParseException;
|
||||||
*/
|
*/
|
||||||
public class X4OErrorHandler implements ErrorHandler {
|
public class X4OErrorHandler implements ErrorHandler {
|
||||||
|
|
||||||
private ElementLanguage elementContext = null;
|
private X4OLanguageContext elementContext = null;
|
||||||
private ErrorHandler errorHandler = null;
|
private ErrorHandler errorHandler = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new SAXErrorPrinter
|
* Construct a new SAXErrorPrinter
|
||||||
* @param language The language to get errors to.
|
* @param language The language to get errors to.
|
||||||
*/
|
*/
|
||||||
public X4OErrorHandler(ElementLanguage elementContext) {
|
public X4OErrorHandler(X4OLanguageContext elementContext) {
|
||||||
if (elementContext==null) {
|
if (elementContext==null) {
|
||||||
throw new NullPointerException("Can't debug and proxy errors with null elementContext.");
|
throw new NullPointerException("Can't debug and proxy errors with null elementContext.");
|
||||||
}
|
}
|
|
@ -21,16 +21,15 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.io.sax;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.Element.ElementType;
|
import org.x4o.xml.element.Element.ElementType;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.io.sax.AttributeMap;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.Locator;
|
import org.xml.sax.Locator;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -61,7 +60,7 @@ public class X4OTagHandler extends DefaultHandler2 {
|
||||||
private Stack<Element> elementStack = null;
|
private Stack<Element> elementStack = null;
|
||||||
|
|
||||||
/** The elememtContext */
|
/** The elememtContext */
|
||||||
private ElementLanguage elementLanguage = null;
|
private X4OLanguageContext elementLanguage = null;
|
||||||
|
|
||||||
/** Store the override element */
|
/** Store the override element */
|
||||||
private Element overrideSaxElement = null;
|
private Element overrideSaxElement = null;
|
||||||
|
@ -73,7 +72,7 @@ public class X4OTagHandler extends DefaultHandler2 {
|
||||||
* Creates an X4OTagHandler
|
* Creates an X4OTagHandler
|
||||||
* which can receice sax xml events and converts them into the Element* interfaces events.
|
* which can receice sax xml events and converts them into the Element* interfaces events.
|
||||||
*/
|
*/
|
||||||
public X4OTagHandler(ElementLanguage elementLanguage) {
|
public X4OTagHandler(X4OLanguageContext elementLanguage) {
|
||||||
logger = Logger.getLogger(X4OTagHandler.class.getName());
|
logger = Logger.getLogger(X4OTagHandler.class.getName());
|
||||||
loggerFinest = logger.isLoggable(Level.FINEST);
|
loggerFinest = logger.isLoggable(Level.FINEST);
|
||||||
elementStack = new Stack<Element>();
|
elementStack = new Stack<Element>();
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -30,10 +30,11 @@ import java.util.logging.Logger;
|
||||||
import javax.el.ELContext;
|
import javax.el.ELContext;
|
||||||
import javax.el.ExpressionFactory;
|
import javax.el.ExpressionFactory;
|
||||||
|
|
||||||
import org.x4o.xml.core.X4ODebugWriter;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.element.ElementAttributeValueParser;
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
import org.x4o.xml.element.ElementObjectPropertyValue;
|
||||||
import org.x4o.xml.core.phase.X4OPhase;
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AbstractElementLanguage.
|
* An AbstractElementLanguage.
|
||||||
|
@ -41,7 +42,7 @@ import org.x4o.xml.core.phase.X4OPhase;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 20, 2005
|
* @version 1.0 Aug 20, 2005
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
public abstract class AbstractX4OLanguageContext implements X4OLanguageContextLocal {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private X4OLanguage language = null;
|
private X4OLanguage language = null;
|
||||||
|
@ -58,7 +59,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
/**
|
/**
|
||||||
* Creates a new empty ElementLanguage.
|
* Creates a new empty ElementLanguage.
|
||||||
*/
|
*/
|
||||||
public AbstractElementLanguage(X4OLanguage language,String languageVersion) {
|
public AbstractX4OLanguageContext(X4OLanguage language,String languageVersion) {
|
||||||
if (language==null) {
|
if (language==null) {
|
||||||
throw new NullPointerException("language may not be null");
|
throw new NullPointerException("language may not be null");
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
if (languageVersion.length()==0) {
|
if (languageVersion.length()==0) {
|
||||||
throw new IllegalArgumentException("languageVersion may not be empty");
|
throw new IllegalArgumentException("languageVersion may not be empty");
|
||||||
}
|
}
|
||||||
logger = Logger.getLogger(AbstractElementLanguage.class.getName());
|
logger = Logger.getLogger(AbstractX4OLanguageContext.class.getName());
|
||||||
logger.finest("Creating new ParsingContext");
|
logger.finest("Creating new ParsingContext");
|
||||||
this.language=language;
|
this.language=language;
|
||||||
dirtyElements = new HashMap<Element, X4OPhase>(40);
|
dirtyElements = new HashMap<Element, X4OPhase>(40);
|
||||||
|
@ -82,16 +83,16 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getELContext()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getExpressionLanguageContext()
|
||||||
*/
|
*/
|
||||||
public ELContext getELContext() {
|
public ELContext getExpressionLanguageContext() {
|
||||||
return eLContext;
|
return eLContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageLocal#setELContext(javax.el.ELContext)
|
* @see org.x4o.xml.lang.X4OLanguageContextLocal#setExpressionLanguageContext(javax.el.ELContext)
|
||||||
*/
|
*/
|
||||||
public void setELContext(ELContext context) {
|
public void setExpressionLanguageContext(ELContext context) {
|
||||||
if (eLContext!=null) {
|
if (eLContext!=null) {
|
||||||
throw new IllegalStateException("Can only set elContext once.");
|
throw new IllegalStateException("Can only set elContext once.");
|
||||||
}
|
}
|
||||||
|
@ -99,16 +100,16 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getExpressionFactory()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getExpressionLanguageFactory()
|
||||||
*/
|
*/
|
||||||
public ExpressionFactory getExpressionFactory() {
|
public ExpressionFactory getExpressionLanguageFactory() {
|
||||||
return expressionFactory;
|
return expressionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageLocal#setExpressionFactory(javax.el.ExpressionFactory)
|
* @see org.x4o.xml.lang.X4OLanguageContextLocal#setExpressionLanguageFactory(javax.el.ExpressionFactory)
|
||||||
*/
|
*/
|
||||||
public void setExpressionFactory(ExpressionFactory expressionFactory) {
|
public void setExpressionLanguageFactory(ExpressionFactory expressionFactory) {
|
||||||
if (this.expressionFactory!=null) {
|
if (this.expressionFactory!=null) {
|
||||||
throw new IllegalStateException("Can only set expressionFactory once.");
|
throw new IllegalStateException("Can only set expressionFactory once.");
|
||||||
}
|
}
|
||||||
|
@ -150,21 +151,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getCurrentX4OPhase()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getCurrentX4OPhase()
|
||||||
*/
|
*/
|
||||||
public X4OPhase getCurrentX4OPhase() {
|
public X4OPhase getCurrentX4OPhase() {
|
||||||
return currentX4OPhase;
|
return currentX4OPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#setCurrentX4OPhase(org.x4o.xml.core.phase.X4OPhase)
|
* @see org.x4o.xml.lang.X4OLanguageContext#setCurrentX4OPhase(org.x4o.xml.lang.phase.X4OPhase)
|
||||||
*/
|
*/
|
||||||
public void setCurrentX4OPhase(X4OPhase currentX4OPhase) {
|
public void setCurrentX4OPhase(X4OPhase currentX4OPhase) {
|
||||||
this.currentX4OPhase = currentX4OPhase;
|
this.currentX4OPhase = currentX4OPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#addDirtyElement(org.x4o.xml.element.Element, org.x4o.xml.core.phase.X4OPhase)
|
* @see org.x4o.xml.lang.X4OLanguageContext#addDirtyElement(org.x4o.xml.element.Element, org.x4o.xml.lang.phase.X4OPhase)
|
||||||
*/
|
*/
|
||||||
public void addDirtyElement(Element element, X4OPhase phase) {
|
public void addDirtyElement(Element element, X4OPhase phase) {
|
||||||
if (dirtyElements.containsKey(element)) {
|
if (dirtyElements.containsKey(element)) {
|
||||||
|
@ -174,21 +175,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getDirtyElements()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getDirtyElements()
|
||||||
*/
|
*/
|
||||||
public Map<Element, X4OPhase> getDirtyElements() {
|
public Map<Element, X4OPhase> getDirtyElements() {
|
||||||
return dirtyElements;
|
return dirtyElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getRootElement()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getRootElement()
|
||||||
*/
|
*/
|
||||||
public Element getRootElement() {
|
public Element getRootElement() {
|
||||||
return rootElement;
|
return rootElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#setRootElement(org.x4o.xml.element.Element)
|
* @see org.x4o.xml.lang.X4OLanguageContext#setRootElement(org.x4o.xml.element.Element)
|
||||||
*/
|
*/
|
||||||
public void setRootElement(Element element) {
|
public void setRootElement(Element element) {
|
||||||
if (element==null) {
|
if (element==null) {
|
||||||
|
@ -210,14 +211,14 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageProperty(org.x4o.xml.core.config.X4OLanguageProperty)
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty)
|
||||||
*/
|
*/
|
||||||
public Object getLanguageProperty(X4OLanguageProperty property) {
|
public Object getLanguageProperty(X4OLanguageProperty property) {
|
||||||
return getLanguageProperty(property.toUri());
|
return getLanguageProperty(property.toUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#setLanguageProperty(org.x4o.xml.core.config.X4OLanguageProperty, java.lang.Object)
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setLanguageProperty(org.x4o.xml.lang.X4OLanguageProperty, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void setLanguageProperty(X4OLanguageProperty property, Object value) {
|
public void setLanguageProperty(X4OLanguageProperty property, Object value) {
|
||||||
if (property.isValueValid(value)==false) {
|
if (property.isValueValid(value)==false) {
|
||||||
|
@ -227,7 +228,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguagePropertyBoolean(org.x4o.xml.core.config.X4OLanguageProperty)
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyBoolean(org.x4o.xml.lang.X4OLanguageProperty)
|
||||||
*/
|
*/
|
||||||
public boolean getLanguagePropertyBoolean(X4OLanguageProperty property) {
|
public boolean getLanguagePropertyBoolean(X4OLanguageProperty property) {
|
||||||
Object value = getLanguageProperty(property);
|
Object value = getLanguageProperty(property);
|
||||||
|
@ -238,7 +239,7 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguagePropertyInteger(org.x4o.xml.core.config.X4OLanguageProperty)
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguagePropertyInteger(org.x4o.xml.lang.X4OLanguageProperty)
|
||||||
*/
|
*/
|
||||||
public int getLanguagePropertyInteger(X4OLanguageProperty property) {
|
public int getLanguagePropertyInteger(X4OLanguageProperty property) {
|
||||||
Object value = getLanguageProperty(property);
|
Object value = getLanguageProperty(property);
|
||||||
|
@ -257,21 +258,21 @@ public abstract class AbstractElementLanguage implements ElementLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getX4ODebugWriter()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getX4ODebugWriter()
|
||||||
*/
|
*/
|
||||||
public X4ODebugWriter getX4ODebugWriter() {
|
public X4ODebugWriter getX4ODebugWriter() {
|
||||||
return debugWriter;
|
return debugWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#hasX4ODebugWriter()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#hasX4ODebugWriter()
|
||||||
*/
|
*/
|
||||||
public boolean hasX4ODebugWriter() {
|
public boolean hasX4ODebugWriter() {
|
||||||
return debugWriter!=null;
|
return debugWriter!=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#setX4ODebugWriter(org.x4o.xml.core.X4ODebugWriter)
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#setX4ODebugWriter(org.x4o.xml.io.sax.X4ODebugWriter)
|
||||||
*/
|
*/
|
||||||
public void setX4ODebugWriter(X4ODebugWriter debugWriter) {
|
public void setX4ODebugWriter(X4ODebugWriter debugWriter) {
|
||||||
this.debugWriter=debugWriter;
|
this.debugWriter=debugWriter;
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -29,7 +29,12 @@ import java.util.HashMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
import org.x4o.xml.element.AbstractElementMetaBase;
|
||||||
|
import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
|
import org.x4o.xml.element.ElementInterface;
|
||||||
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AbstractElementLanguageModule.
|
* An AbstractElementLanguageModule.
|
||||||
|
@ -37,7 +42,7 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 2, 2012
|
* @version 1.0 Aug 2, 2012
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractElementLanguageModule extends AbstractElementMetaBase implements ElementLanguageModule {
|
public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase implements X4OLanguageModule {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
|
|
||||||
|
@ -57,13 +62,13 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
|
|
||||||
private Map<String,ElementNamespaceContext> elementNamespaceContexts = null;
|
private Map<String,ElementNamespaceContext> elementNamespaceContexts = null;
|
||||||
|
|
||||||
private ElementLanguageModuleLoader elementLanguageModuleLoader = null;
|
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new empty ElementLanguage.
|
* Creates a new empty ElementLanguage.
|
||||||
*/
|
*/
|
||||||
public AbstractElementLanguageModule() {
|
public AbstractX4OLanguageModule() {
|
||||||
logger = Logger.getLogger(AbstractElementLanguage.class.getName());
|
logger = Logger.getLogger(AbstractX4OLanguageContext.class.getName());
|
||||||
logger.finest("Creating new ParsingContext");
|
logger.finest("Creating new ParsingContext");
|
||||||
elementAttributeHandlers = new ArrayList<ElementAttributeHandler>(4);
|
elementAttributeHandlers = new ArrayList<ElementAttributeHandler>(4);
|
||||||
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
|
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
|
||||||
|
@ -101,7 +106,7 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#addElementAttributeHandler(ElementAttributeHandler)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementAttributeHandler(ElementAttributeHandler)
|
||||||
*/
|
*/
|
||||||
public void addElementAttributeHandler(ElementAttributeHandler elementAttributeHandler) {
|
public void addElementAttributeHandler(ElementAttributeHandler elementAttributeHandler) {
|
||||||
if (elementAttributeHandler==null) {
|
if (elementAttributeHandler==null) {
|
||||||
|
@ -115,14 +120,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementAttributeHandlers()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementAttributeHandlers()
|
||||||
*/
|
*/
|
||||||
public List<ElementAttributeHandler> getElementAttributeHandlers() {
|
public List<ElementAttributeHandler> getElementAttributeHandlers() {
|
||||||
return elementAttributeHandlers;
|
return elementAttributeHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#addElementBindingHandler(ElementBindingHandler)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementBindingHandler(ElementBindingHandler)
|
||||||
*/
|
*/
|
||||||
public void addElementBindingHandler(ElementBindingHandler elementBindingHandler) {
|
public void addElementBindingHandler(ElementBindingHandler elementBindingHandler) {
|
||||||
if (elementBindingHandler==null) {
|
if (elementBindingHandler==null) {
|
||||||
|
@ -143,14 +148,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementBindingHandlers()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementBindingHandlers()
|
||||||
*/
|
*/
|
||||||
public List<ElementBindingHandler> getElementBindingHandlers() {
|
public List<ElementBindingHandler> getElementBindingHandlers() {
|
||||||
return elementBindingHandlers;
|
return elementBindingHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#addElementConfiguratorGlobal(ElementConfiguratorGlobal)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementConfiguratorGlobal(ElementConfiguratorGlobal)
|
||||||
*/
|
*/
|
||||||
public void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator) {
|
public void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator) {
|
||||||
if (elementConfigurator==null) {
|
if (elementConfigurator==null) {
|
||||||
|
@ -164,14 +169,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementConfiguratorGlobals()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementConfiguratorGlobals()
|
||||||
*/
|
*/
|
||||||
public List<ElementConfiguratorGlobal> getElementConfiguratorGlobals() {
|
public List<ElementConfiguratorGlobal> getElementConfiguratorGlobals() {
|
||||||
return elementConfiguratorGlobals;
|
return elementConfiguratorGlobals;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#addElementInterface(org.x4o.xml.element.ElementInterface)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementInterface(org.x4o.xml.element.ElementInterface)
|
||||||
*/
|
*/
|
||||||
public void addElementInterface(ElementInterface elementInterface) {
|
public void addElementInterface(ElementInterface elementInterface) {
|
||||||
if (elementInterface==null) {
|
if (elementInterface==null) {
|
||||||
|
@ -187,14 +192,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementInterfaces()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementInterfaces()
|
||||||
*/
|
*/
|
||||||
public List<ElementInterface> getElementInterfaces() {
|
public List<ElementInterface> getElementInterfaces() {
|
||||||
return elementInterfaces;
|
return elementInterfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#addElementNamespaceContext(org.x4o.xml.element.ElementNamespaceContext)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementNamespaceContext(org.x4o.xml.element.ElementNamespaceContext)
|
||||||
*/
|
*/
|
||||||
public void addElementNamespaceContext(ElementNamespaceContext elementNamespaceContext) {
|
public void addElementNamespaceContext(ElementNamespaceContext elementNamespaceContext) {
|
||||||
if (elementNamespaceContext==null) {
|
if (elementNamespaceContext==null) {
|
||||||
|
@ -222,14 +227,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementNamespaceContext(java.lang.String)
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContext(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ElementNamespaceContext getElementNamespaceContext(String namespaceUri) {
|
public ElementNamespaceContext getElementNamespaceContext(String namespaceUri) {
|
||||||
return elementNamespaceContexts.get(namespaceUri);
|
return elementNamespaceContexts.get(namespaceUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguageModule#getElementNamespaceContexts()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContexts()
|
||||||
*/
|
*/
|
||||||
public List<ElementNamespaceContext> getElementNamespaceContexts() {
|
public List<ElementNamespaceContext> getElementNamespaceContexts() {
|
||||||
return new ArrayList<ElementNamespaceContext>(elementNamespaceContexts.values());
|
return new ArrayList<ElementNamespaceContext>(elementNamespaceContexts.values());
|
||||||
|
@ -238,14 +243,14 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
/**
|
/**
|
||||||
* @return the elementLanguageModuleLoader
|
* @return the elementLanguageModuleLoader
|
||||||
*/
|
*/
|
||||||
public ElementLanguageModuleLoader getElementLanguageModuleLoader() {
|
public X4OLanguageModuleLoader getLanguageModuleLoader() {
|
||||||
return elementLanguageModuleLoader;
|
return elementLanguageModuleLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param elementLanguageModuleLoader the elementLanguageModuleLoader to set
|
* @param elementLanguageModuleLoader the elementLanguageModuleLoader to set
|
||||||
*/
|
*/
|
||||||
public void setElementLanguageModuleLoader(ElementLanguageModuleLoader elementLanguageModuleLoader) {
|
public void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader) {
|
||||||
this.elementLanguageModuleLoader = elementLanguageModuleLoader;
|
this.elementLanguageModuleLoader = elementLanguageModuleLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,12 +271,12 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
|
||||||
/**
|
/**
|
||||||
* Reloads the module, experiment !!
|
* Reloads the module, experiment !!
|
||||||
*/
|
*/
|
||||||
public void reloadModule(X4OLanguageLocal elementLanguage,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException {
|
public void reloadModule(X4OLanguageLocal elementLanguage,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
|
||||||
elementAttributeHandlers.clear();
|
elementAttributeHandlers.clear();
|
||||||
elementBindingHandlers.clear();
|
elementBindingHandlers.clear();
|
||||||
elementInterfaces.clear();
|
elementInterfaces.clear();
|
||||||
elementNamespaceContexts.clear();
|
elementNamespaceContexts.clear();
|
||||||
|
|
||||||
getElementLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
|
getLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,27 +1,26 @@
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManager;
|
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseManager;
|
||||||
|
|
||||||
public class DefaultX4OLanguage implements X4OLanguageLocal {
|
public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private X4OLanguageConfiguration languageConfiguration = null;
|
private X4OLanguageConfiguration languageConfiguration = null;
|
||||||
private List<ElementLanguageModule> elementLanguageModules = null;
|
private List<X4OLanguageModule> elementLanguageModules = null;
|
||||||
private String languageName = null;
|
private String languageName = null;
|
||||||
private String languageVersion = null;
|
private String languageVersion = null;
|
||||||
private X4OPhaseManager phaseManager = null;
|
private X4OPhaseManager phaseManager = null;
|
||||||
|
|
||||||
public DefaultX4OLanguage(X4OLanguageConfiguration languageConfiguration,X4OPhaseManager phaseManager,String languageName,String languageVersion) {
|
public DefaultX4OLanguage(X4OLanguageConfiguration languageConfiguration,X4OPhaseManager phaseManager,String languageName,String languageVersion) {
|
||||||
logger = Logger.getLogger(DefaultX4OLanguage.class.getName());
|
logger = Logger.getLogger(DefaultX4OLanguage.class.getName());
|
||||||
elementLanguageModules = new ArrayList<ElementLanguageModule>(20);
|
elementLanguageModules = new ArrayList<X4OLanguageModule>(20);
|
||||||
this.languageConfiguration=languageConfiguration;
|
this.languageConfiguration=languageConfiguration;
|
||||||
this.languageName=languageName;
|
this.languageName=languageName;
|
||||||
this.languageVersion=languageVersion;
|
this.languageVersion=languageVersion;
|
||||||
|
@ -29,21 +28,21 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguage#getLanguageName()
|
* @see org.x4o.xml.lang.X4OLanguage#getLanguageName()
|
||||||
*/
|
*/
|
||||||
public String getLanguageName() {
|
public String getLanguageName() {
|
||||||
return languageName;
|
return languageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguage#getLanguageVersion()
|
* @see org.x4o.xml.lang.X4OLanguage#getLanguageVersion()
|
||||||
*/
|
*/
|
||||||
public String getLanguageVersion() {
|
public String getLanguageVersion() {
|
||||||
return languageVersion;
|
return languageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguage#getPhaseManager()
|
* @see org.x4o.xml.lang.X4OLanguage#getPhaseManager()
|
||||||
*/
|
*/
|
||||||
public X4OPhaseManager getPhaseManager() {
|
public X4OPhaseManager getPhaseManager() {
|
||||||
return phaseManager;
|
return phaseManager;
|
||||||
|
@ -64,9 +63,9 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#addElementLanguageModule(org.x4o.xml.element.ElementLanguageModule)
|
* @see org.x4o.xml.lang.X4OLanguageContext#addLanguageModule(org.x4o.xml.lang.X4OLanguageModule)
|
||||||
*/
|
*/
|
||||||
public void addElementLanguageModule(ElementLanguageModule elementLanguageModule) {
|
public void addLanguageModule(X4OLanguageModule elementLanguageModule) {
|
||||||
if (elementLanguageModule.getId()==null) {
|
if (elementLanguageModule.getId()==null) {
|
||||||
throw new NullPointerException("Can't add module without id.");
|
throw new NullPointerException("Can't add module without id.");
|
||||||
}
|
}
|
||||||
|
@ -74,20 +73,20 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#getElementLanguageModules()
|
* @see org.x4o.xml.lang.X4OLanguageContext#getLanguageModules()
|
||||||
*/
|
*/
|
||||||
public List<ElementLanguageModule> getElementLanguageModules() {
|
public List<X4OLanguageModule> getLanguageModules() {
|
||||||
return elementLanguageModules;
|
return elementLanguageModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#findElementBindingHandlers(java.lang.Object,java.lang.Object)
|
* @see org.x4o.xml.lang.X4OLanguageContext#findElementBindingHandlers(java.lang.Object,java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public List<ElementBindingHandler> findElementBindingHandlers(Object parent,Object child) {
|
public List<ElementBindingHandler> findElementBindingHandlers(Object parent,Object child) {
|
||||||
List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50);
|
List<ElementBindingHandler> result = new ArrayList<ElementBindingHandler>(50);
|
||||||
for (int i=0;i<elementLanguageModules.size();i++) {
|
for (int i=0;i<elementLanguageModules.size();i++) {
|
||||||
ElementLanguageModule module = elementLanguageModules.get(i);
|
X4OLanguageModule module = elementLanguageModules.get(i);
|
||||||
findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers());
|
findElementBindingHandlerInList(parent,child,result,module.getElementBindingHandlers());
|
||||||
}
|
}
|
||||||
for (ElementInterface ei:findElementInterfaces(parent)) {
|
for (ElementInterface ei:findElementInterfaces(parent)) {
|
||||||
|
@ -124,7 +123,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#findElementInterfaces(java.lang.Object)
|
* @see org.x4o.xml.lang.X4OLanguageContext#findElementInterfaces(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public List<ElementInterface> findElementInterfaces(Object elementObject) {
|
public List<ElementInterface> findElementInterfaces(Object elementObject) {
|
||||||
if (elementObject==null) {
|
if (elementObject==null) {
|
||||||
|
@ -132,7 +131,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
List<ElementInterface> result = new ArrayList<ElementInterface>(50);
|
List<ElementInterface> result = new ArrayList<ElementInterface>(50);
|
||||||
for (int i=0;i<elementLanguageModules.size();i++) {
|
for (int i=0;i<elementLanguageModules.size();i++) {
|
||||||
ElementLanguageModule module = elementLanguageModules.get(i);
|
X4OLanguageModule module = elementLanguageModules.get(i);
|
||||||
for (ElementInterface ei:module.getElementInterfaces()) {
|
for (ElementInterface ei:module.getElementInterfaces()) {
|
||||||
Class<?> eClass = ei.getInterfaceClass();
|
Class<?> eClass = ei.getInterfaceClass();
|
||||||
logger.finest("Checking interface handler: "+ei+" for class: "+eClass);
|
logger.finest("Checking interface handler: "+ei+" for class: "+eClass);
|
||||||
|
@ -149,14 +148,14 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementLanguage#findElementNamespaceContext(java.lang.String)
|
* @see org.x4o.xml.lang.X4OLanguageContext#findElementNamespaceContext(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) {
|
public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) {
|
||||||
|
|
||||||
// TODO: refactor so no search for every tag !!
|
// TODO: refactor so no search for every tag !!
|
||||||
ElementNamespaceContext result = null;
|
ElementNamespaceContext result = null;
|
||||||
for (int i=0;i<elementLanguageModules.size();i++) {
|
for (int i=0;i<elementLanguageModules.size();i++) {
|
||||||
ElementLanguageModule module = elementLanguageModules.get(i);
|
X4OLanguageModule module = elementLanguageModules.get(i);
|
||||||
result = module.getElementNamespaceContext(namespaceUri);
|
result = module.getElementNamespaceContext(namespaceUri);
|
||||||
if (result!=null) {
|
if (result!=null) {
|
||||||
return result;
|
return result;
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -33,24 +33,20 @@ import javax.el.ExpressionFactory;
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.el.X4OELContext;
|
import org.x4o.xml.el.X4OELContext;
|
||||||
import org.x4o.xml.eld.EldDriver;
|
import org.x4o.xml.eld.EldDriver;
|
||||||
|
import org.x4o.xml.element.DefaultElement;
|
||||||
|
import org.x4o.xml.element.DefaultElementAttributeValueParser;
|
||||||
|
import org.x4o.xml.element.DefaultElementBodyCharacters;
|
||||||
|
import org.x4o.xml.element.DefaultElementBodyComment;
|
||||||
|
import org.x4o.xml.element.DefaultElementBodyWhitespace;
|
||||||
|
import org.x4o.xml.element.DefaultElementClass;
|
||||||
|
import org.x4o.xml.element.DefaultElementClassAttribute;
|
||||||
|
import org.x4o.xml.element.DefaultElementInterface;
|
||||||
|
import org.x4o.xml.element.DefaultElementNamespaceContext;
|
||||||
|
import org.x4o.xml.element.DefaultElementNamespaceInstanceProvider;
|
||||||
|
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
||||||
|
import org.x4o.xml.element.DefaultGlobalAttributeHandlerComparator;
|
||||||
import org.x4o.xml.element.ElementAttributeValueParser;
|
import org.x4o.xml.element.ElementAttributeValueParser;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementLanguageLocal;
|
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValue;
|
import org.x4o.xml.element.ElementObjectPropertyValue;
|
||||||
import org.x4o.xml.impl.DefaultElementBodyCharacters;
|
|
||||||
import org.x4o.xml.impl.DefaultElementBodyComment;
|
|
||||||
import org.x4o.xml.impl.DefaultElement;
|
|
||||||
import org.x4o.xml.impl.DefaultElementAttributeValueParser;
|
|
||||||
import org.x4o.xml.impl.DefaultElementClass;
|
|
||||||
import org.x4o.xml.impl.DefaultElementClassAttribute;
|
|
||||||
import org.x4o.xml.impl.DefaultElementLanguage;
|
|
||||||
import org.x4o.xml.impl.DefaultElementInterface;
|
|
||||||
import org.x4o.xml.impl.DefaultElementLanguageModule;
|
|
||||||
import org.x4o.xml.impl.DefaultElementNamespaceContext;
|
|
||||||
import org.x4o.xml.impl.DefaultElementNamespaceInstanceProvider;
|
|
||||||
import org.x4o.xml.impl.DefaultElementObjectPropertyValue;
|
|
||||||
import org.x4o.xml.impl.DefaultGlobalAttributeHandlerComparator;
|
|
||||||
import org.x4o.xml.impl.DefaultElementBodyWhitespace;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,148 +61,148 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageResourcePathPrefix()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageResourcePathPrefix()
|
||||||
*/
|
*/
|
||||||
public String getLanguageResourcePathPrefix() {
|
public String getLanguageResourcePathPrefix() {
|
||||||
return X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX;
|
return X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getLanguageResourceModulesFileName()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getLanguageResourceModulesFileName()
|
||||||
*/
|
*/
|
||||||
public String getLanguageResourceModulesFileName() {
|
public String getLanguageResourceModulesFileName() {
|
||||||
return X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE;
|
return X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementNamespaceContext()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementNamespaceContext()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementNamespaceContext() {
|
public Class<?> getDefaultElementNamespaceContext() {
|
||||||
return DefaultElementNamespaceContext.class;
|
return DefaultElementNamespaceContext.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementInterface()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementInterface()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementInterface() {
|
public Class<?> getDefaultElementInterface() {
|
||||||
return DefaultElementInterface.class;
|
return DefaultElementInterface.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElement()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElement()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElement() {
|
public Class<?> getDefaultElement() {
|
||||||
return DefaultElement.class;
|
return DefaultElement.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementClass()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementClass()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementClass() {
|
public Class<?> getDefaultElementClass() {
|
||||||
return DefaultElementClass.class;
|
return DefaultElementClass.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementClassAttribute()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementClassAttribute()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementClassAttribute() {
|
public Class<?> getDefaultElementClassAttribute() {
|
||||||
return DefaultElementClassAttribute.class;
|
return DefaultElementClassAttribute.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementLanguageModule()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementLanguageModule()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementLanguageModule() {
|
public Class<?> getDefaultElementLanguageModule() {
|
||||||
return DefaultElementLanguageModule.class;
|
return DefaultX4OLanguageModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyComment()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyComment()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementBodyComment() {
|
public Class<?> getDefaultElementBodyComment() {
|
||||||
return DefaultElementBodyComment.class;
|
return DefaultElementBodyComment.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyCharacters()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyCharacters()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementBodyCharacters() {
|
public Class<?> getDefaultElementBodyCharacters() {
|
||||||
return DefaultElementBodyCharacters.class;
|
return DefaultElementBodyCharacters.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementBodyWhitespace()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementBodyWhitespace()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementBodyWhitespace() {
|
public Class<?> getDefaultElementBodyWhitespace() {
|
||||||
return DefaultElementBodyWhitespace.class;
|
return DefaultElementBodyWhitespace.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementNamespaceInstanceProvider()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementNamespaceInstanceProvider()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementNamespaceInstanceProvider() {
|
public Class<?> getDefaultElementNamespaceInstanceProvider() {
|
||||||
return DefaultElementNamespaceInstanceProvider.class;
|
return DefaultElementNamespaceInstanceProvider.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementAttributeValueParser()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementAttributeValueParser()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementAttributeValueParser() {
|
public Class<?> getDefaultElementAttributeValueParser() {
|
||||||
return DefaultElementAttributeValueParser.class;
|
return DefaultElementAttributeValueParser.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementObjectPropertyValue()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementObjectPropertyValue()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementObjectPropertyValue() {
|
public Class<?> getDefaultElementObjectPropertyValue() {
|
||||||
return DefaultElementObjectPropertyValue.class;
|
return DefaultElementObjectPropertyValue.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultElementAttributeHandlerComparator()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultElementAttributeHandlerComparator()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementAttributeHandlerComparator() {
|
public Class<?> getDefaultElementAttributeHandlerComparator() {
|
||||||
return DefaultGlobalAttributeHandlerComparator.class;
|
return DefaultGlobalAttributeHandlerComparator.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultX4OLanguageVersionFilter()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageVersionFilter()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultX4OLanguageVersionFilter() {
|
public Class<?> getDefaultX4OLanguageVersionFilter() {
|
||||||
return DefaultX4OLanguageVersionFilter.class;
|
return DefaultX4OLanguageVersionFilter.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getDefaultX4OLanguageLoader()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getDefaultX4OLanguageLoader()
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultX4OLanguageLoader() {
|
public Class<?> getDefaultX4OLanguageLoader() {
|
||||||
return DefaultX4OLanguageLoader.class;
|
return DefaultX4OLanguageLoader.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#createElementLanguage()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#createElementLanguage()
|
||||||
*/
|
*/
|
||||||
public ElementLanguage createElementLanguage(X4ODriver<?> driver) {
|
public X4OLanguageContext createElementLanguage(X4ODriver<?> driver) {
|
||||||
String v = driver.DEFAULT_LANGUAGE_VERSION; // TODO:fixme
|
String v = X4ODriver.DEFAULT_LANGUAGE_VERSION; // TODO:fixme
|
||||||
return configElementLanguage(new DefaultElementLanguage(driver.createLanguage(v),v),driver);
|
return configElementLanguage(new DefaultX4OLanguageContext(driver.createLanguage(v),v),driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ElementLanguage configElementLanguage(ElementLanguage elementLanguage,X4ODriver<?> driver) {
|
protected X4OLanguageContext configElementLanguage(X4OLanguageContext elementLanguage,X4ODriver<?> driver) {
|
||||||
if ((elementLanguage instanceof ElementLanguageLocal)==false) {
|
if ((elementLanguage instanceof X4OLanguageContextLocal)==false) {
|
||||||
throw new RuntimeException("Can't init ElementLanguage which has not ElementLanguageLocal interface obj: "+elementLanguage);
|
throw new RuntimeException("Can't init ElementLanguage which has not ElementLanguageLocal interface obj: "+elementLanguage);
|
||||||
}
|
}
|
||||||
ElementLanguageLocal contextInit = (ElementLanguageLocal)elementLanguage;
|
X4OLanguageContextLocal contextInit = (X4OLanguageContextLocal)elementLanguage;
|
||||||
//contextInit.setLanguageConfiguration(this);
|
//contextInit.setLanguageConfiguration(this);
|
||||||
for (String key:driver.getGlobalPropertyKeys()) {
|
for (String key:driver.getGlobalPropertyKeys()) {
|
||||||
Object value = driver.getGlobalProperty(key);
|
Object value = driver.getGlobalProperty(key);
|
||||||
contextInit.setLanguageProperty(key, value);
|
contextInit.setLanguageProperty(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contextInit.getExpressionFactory()==null) {
|
if (contextInit.getExpressionLanguageFactory()==null) {
|
||||||
contextInit.setExpressionFactory(configExpressionFactory(contextInit));
|
contextInit.setExpressionLanguageFactory(configExpressionFactory(contextInit));
|
||||||
}
|
}
|
||||||
if (contextInit.getELContext()==null) {
|
if (contextInit.getExpressionLanguageContext()==null) {
|
||||||
contextInit.setELContext(new X4OELContext());
|
contextInit.setExpressionLanguageContext(new X4OELContext());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (contextInit.getElementAttributeValueParser()==null) {
|
if (contextInit.getElementAttributeValueParser()==null) {
|
||||||
|
@ -221,7 +217,7 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
|
||||||
return elementLanguage;
|
return elementLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ExpressionFactory configExpressionFactory(ElementLanguage elementContext) {
|
protected ExpressionFactory configExpressionFactory(X4OLanguageContext elementContext) {
|
||||||
ExpressionFactory factory = (ExpressionFactory)elementContext.getLanguageProperty(X4OLanguageProperty.EL_FACTORY_INSTANCE);
|
ExpressionFactory factory = (ExpressionFactory)elementContext.getLanguageProperty(X4OLanguageProperty.EL_FACTORY_INSTANCE);
|
||||||
if (factory!=null) {
|
if (factory!=null) {
|
||||||
return factory;
|
return factory;
|
||||||
|
@ -242,26 +238,26 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserProperties()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserProperties()
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getSAXParserProperties(ElementLanguage elementContext) {
|
public Map<String, Object> getSAXParserProperties(X4OLanguageContext elementContext) {
|
||||||
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
|
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
|
||||||
return saxParserProperties;
|
return saxParserProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserPropertiesOptional()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserPropertiesOptional()
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getSAXParserPropertiesOptional(ElementLanguage elementContext) {
|
public Map<String, Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext) {
|
||||||
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
|
Map<String,Object> saxParserProperties = new HashMap<String,Object>(1);
|
||||||
saxParserProperties.put("http://apache.org/xml/properties/input-buffer-size",elementContext.getLanguagePropertyInteger(X4OLanguageProperty.INPUT_BUFFER_SIZE)); // Increase buffer to 8KB
|
saxParserProperties.put("http://apache.org/xml/properties/input-buffer-size",elementContext.getLanguagePropertyInteger(X4OLanguageProperty.INPUT_BUFFER_SIZE)); // Increase buffer to 8KB
|
||||||
return saxParserProperties;
|
return saxParserProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeatures()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeatures()
|
||||||
*/
|
*/
|
||||||
public Map<String, Boolean> getSAXParserFeatures(ElementLanguage elementContext) {
|
public Map<String, Boolean> getSAXParserFeatures(X4OLanguageContext elementContext) {
|
||||||
|
|
||||||
// see example: http://xerces.apache.org/xerces2-j/features.html
|
// see example: http://xerces.apache.org/xerces2-j/features.html
|
||||||
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
|
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
|
||||||
|
@ -308,9 +304,9 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeaturesOptional()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesOptional()
|
||||||
*/
|
*/
|
||||||
public Map<String, Boolean> getSAXParserFeaturesOptional(ElementLanguage elementContext) {
|
public Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext) {
|
||||||
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
|
Map<String,Boolean> saxParserFeatures = new HashMap<String,Boolean>(20);
|
||||||
|
|
||||||
// Make Sax Impl more strict.
|
// Make Sax Impl more strict.
|
||||||
|
@ -332,9 +328,9 @@ public class DefaultX4OLanguageConfiguration implements X4OLanguageConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageConfiguration#getSAXParserFeaturesRequired()
|
* @see org.x4o.xml.lang.X4OLanguageConfiguration#getSAXParserFeaturesRequired()
|
||||||
*/
|
*/
|
||||||
public List<String> getSAXParserFeaturesRequired(ElementLanguage elementContext) {
|
public List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext) {
|
||||||
List<String> result = new ArrayList<String>(5);
|
List<String> result = new ArrayList<String>(5);
|
||||||
result.add("http://xml.org/sax/features/use-attributes2"); // Attributes objects passed by the parser are ext.Attributes2 interface.
|
result.add("http://xml.org/sax/features/use-attributes2"); // Attributes objects passed by the parser are ext.Attributes2 interface.
|
||||||
result.add("http://xml.org/sax/features/use-locator2"); // Locator objects passed by the parser are org.xml.sax.ext.Locator2 interface.
|
result.add("http://xml.org/sax/features/use-locator2"); // Locator objects passed by the parser are org.xml.sax.ext.Locator2 interface.
|
|
@ -21,10 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
|
||||||
import org.x4o.xml.element.AbstractElementLanguage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An DefaultElementLanguage.
|
* An DefaultElementLanguage.
|
||||||
|
@ -32,9 +30,9 @@ import org.x4o.xml.element.AbstractElementLanguage;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Feb 16, 2007
|
* @version 1.0 Feb 16, 2007
|
||||||
*/
|
*/
|
||||||
public class DefaultElementLanguage extends AbstractElementLanguage {
|
public class DefaultX4OLanguageContext extends AbstractX4OLanguageContext {
|
||||||
|
|
||||||
public DefaultElementLanguage(X4OLanguage language, String languageVersion) {
|
public DefaultX4OLanguageContext(X4OLanguage language, String languageVersion) {
|
||||||
super(language, languageVersion);
|
super(language, languageVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -35,9 +35,6 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.eld.EldDriver;
|
import org.x4o.xml.eld.EldDriver;
|
||||||
import org.x4o.xml.eld.EldModuleLoader;
|
import org.x4o.xml.eld.EldModuleLoader;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoader;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoaderSibling;
|
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -83,7 +80,7 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageLoader#loadLanguage(org.x4o.xml.element.ElementLanguage, java.lang.String, java.lang.String)
|
* @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.element.ElementLanguage, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException {
|
public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException {
|
||||||
try {
|
try {
|
||||||
|
@ -106,14 +103,14 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
|
|
||||||
for (String key:modules.keySet()) {
|
for (String key:modules.keySet()) {
|
||||||
String value = modules.get(key);
|
String value = modules.get(key);
|
||||||
ElementLanguageModule module = (ElementLanguageModule)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
|
X4OLanguageModule module = (X4OLanguageModule)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
|
||||||
module.setSourceResource(value);
|
module.setSourceResource(value);
|
||||||
|
|
||||||
logMessage(languageLocal,"Parsing language config key: "+key+" value: "+value);
|
logMessage(languageLocal,"Parsing language config key: "+key+" value: "+value);
|
||||||
|
|
||||||
if ("module-loader".equals(key)) {
|
if ("module-loader".equals(key)) {
|
||||||
try {
|
try {
|
||||||
module.setElementLanguageModuleLoader( (ElementLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance() );
|
module.setLanguageModuleLoader( (X4OLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance() );
|
||||||
} catch (Exception ee) {
|
} catch (Exception ee) {
|
||||||
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
|
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
|
||||||
}
|
}
|
||||||
|
@ -122,9 +119,9 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
String languagePrefix = languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix();
|
String languagePrefix = languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix();
|
||||||
String resource = languagePrefix+"/"+language+"/"+value;
|
String resource = languagePrefix+"/"+language+"/"+value;
|
||||||
if (language.equals(EldDriver.LANGUAGE_NAME)) {
|
if (language.equals(EldDriver.LANGUAGE_NAME)) {
|
||||||
module.setElementLanguageModuleLoader(new EldModuleLoader(resource,true)); // load cel
|
module.setLanguageModuleLoader(new EldModuleLoader(resource,true)); // load cel
|
||||||
} else {
|
} else {
|
||||||
module.setElementLanguageModuleLoader(new EldModuleLoader(resource,false)); // load eld
|
module.setLanguageModuleLoader(new EldModuleLoader(resource,false)); // load eld
|
||||||
}
|
}
|
||||||
module.setSourceResource(resource);
|
module.setSourceResource(resource);
|
||||||
} else if ("elb-resource".equals(key)) {
|
} else if ("elb-resource".equals(key)) {
|
||||||
|
@ -134,22 +131,22 @@ public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
|
||||||
|
|
||||||
} else if ("sibling-loader".equals(key)) {
|
} else if ("sibling-loader".equals(key)) {
|
||||||
try {
|
try {
|
||||||
module.setElementLanguageModuleLoader( (ElementLanguageModuleLoaderSibling)X4OLanguageClassLoader.loadClass(value).newInstance() );
|
module.setLanguageModuleLoader( (X4OLanguageModuleLoaderSibling)X4OLanguageClassLoader.loadClass(value).newInstance() );
|
||||||
} catch (Exception ee) {
|
} catch (Exception ee) {
|
||||||
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
|
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module.getElementLanguageModuleLoader()==null) {
|
if (module.getLanguageModuleLoader()==null) {
|
||||||
logger.warning("module with null loader: "+module+" tag: "+key+" chars: "+value);
|
logger.warning("module with null loader: "+module+" tag: "+key+" chars: "+value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mmm start in order ?
|
// mmm start in order ?
|
||||||
logMessage(languageLocal,"Starting modules: "+module+" for language: "+language);
|
logMessage(languageLocal,"Starting modules: "+module+" for language: "+language);
|
||||||
module.getElementLanguageModuleLoader().loadLanguageModule(languageLocal, module);
|
module.getLanguageModuleLoader().loadLanguageModule(languageLocal, module);
|
||||||
|
|
||||||
languageLocal.addElementLanguageModule(module);
|
languageLocal.addLanguageModule(module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.element.AbstractElementLanguageModule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An DefaultElementLanguageModule.
|
* An DefaultElementLanguageModule.
|
||||||
|
@ -31,6 +30,6 @@ import org.x4o.xml.element.AbstractElementLanguageModule;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 2, 2012
|
* @version 1.0 Aug 2, 2012
|
||||||
*/
|
*/
|
||||||
public class DefaultElementLanguageModule extends AbstractElementLanguageModule {
|
public class DefaultX4OLanguageModule extends AbstractX4OLanguageModule {
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class DefaultX4OLanguageVersionFilter implements X4OLanguageVersionFilter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters to the best version.
|
* Filters to the best version.
|
||||||
* @see org.x4o.xml.core.config.X4OLanguageVersionFilter#filterVersion(java.lang.String, java.util.List)
|
* @see org.x4o.xml.lang.X4OLanguageVersionFilter#filterVersion(java.lang.String, java.util.List)
|
||||||
* @return The perfect or best match or null if no match for requested language.
|
* @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.
|
||||||
* @param versions The list of version to search in.
|
* @param versions The list of version to search in.
|
|
@ -21,15 +21,14 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManager;
|
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguage hold the defined language.
|
* X4OLanguage hold the defined language.
|
||||||
|
@ -85,5 +84,5 @@ public interface X4OLanguage {
|
||||||
/**
|
/**
|
||||||
* @return Returns a list of element language modules in this defined and loaded language.
|
* @return Returns a list of element language modules in this defined and loaded language.
|
||||||
*/
|
*/
|
||||||
List<ElementLanguageModule> getElementLanguageModules();
|
List<X4OLanguageModule> getLanguageModules();
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguageClassLoader is short hand for safe class loading.
|
* X4OLanguageClassLoader is short hand for safe class loading.
|
|
@ -21,13 +21,12 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,30 +84,30 @@ public interface X4OLanguageConfiguration {
|
||||||
* Creates and filles the inital element language used to store the language.
|
* Creates and filles the inital element language used to store the language.
|
||||||
* @return The newly created ElementLanguage.
|
* @return The newly created ElementLanguage.
|
||||||
*/
|
*/
|
||||||
ElementLanguage createElementLanguage(X4ODriver<?> driver);
|
X4OLanguageContext createElementLanguage(X4ODriver<?> driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns Map of SAX properties which are set.
|
* @return Returns Map of SAX properties which are set.
|
||||||
*/
|
*/
|
||||||
Map<String,Object> getSAXParserProperties(ElementLanguage elementContext);
|
Map<String,Object> getSAXParserProperties(X4OLanguageContext elementContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns Map of SAX properties which are optional set.
|
* @return Returns Map of SAX properties which are optional set.
|
||||||
*/
|
*/
|
||||||
Map<String,Object> getSAXParserPropertiesOptional(ElementLanguage elementContext);
|
Map<String,Object> getSAXParserPropertiesOptional(X4OLanguageContext elementContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns Map of SAX features which are set on the xml parser.
|
* @return Returns Map of SAX features which are set on the xml parser.
|
||||||
*/
|
*/
|
||||||
Map<String,Boolean> getSAXParserFeatures(ElementLanguage elementContext);
|
Map<String,Boolean> getSAXParserFeatures(X4OLanguageContext elementContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns Map of SAX features which are optional set.
|
* @return Returns Map of SAX features which are optional set.
|
||||||
*/
|
*/
|
||||||
Map<String, Boolean> getSAXParserFeaturesOptional(ElementLanguage elementContext);
|
Map<String, Boolean> getSAXParserFeaturesOptional(X4OLanguageContext elementContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns List of SAX features which are required for xml parsing.
|
* @return Returns List of SAX features which are required for xml parsing.
|
||||||
*/
|
*/
|
||||||
List<String> getSAXParserFeaturesRequired(ElementLanguage elementContext);
|
List<String> getSAXParserFeaturesRequired(X4OLanguageContext elementContext);
|
||||||
}
|
}
|
|
@ -21,17 +21,18 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.el.ELContext;
|
import javax.el.ELContext;
|
||||||
import javax.el.ExpressionFactory;
|
import javax.el.ExpressionFactory;
|
||||||
|
|
||||||
import org.x4o.xml.core.X4ODebugWriter;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.element.ElementAttributeValueParser;
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
import org.x4o.xml.element.ElementObjectPropertyValue;
|
||||||
import org.x4o.xml.core.phase.X4OPhase;
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementLanguage is the central store of the defined element language.
|
* ElementLanguage is the central store of the defined element language.
|
||||||
|
@ -39,7 +40,7 @@ import org.x4o.xml.core.phase.X4OPhase;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Feb 14, 2007
|
* @version 1.0 Feb 14, 2007
|
||||||
*/
|
*/
|
||||||
public interface ElementLanguage {
|
public interface X4OLanguageContext {
|
||||||
|
|
||||||
X4OLanguage getLanguage();
|
X4OLanguage getLanguage();
|
||||||
|
|
||||||
|
@ -47,13 +48,13 @@ public interface ElementLanguage {
|
||||||
* Gets the EL Context.
|
* Gets the EL Context.
|
||||||
* @return Returns the ELContext.
|
* @return Returns the ELContext.
|
||||||
*/
|
*/
|
||||||
ELContext getELContext();
|
ELContext getExpressionLanguageContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ExpressionFactory.
|
* Gets the ExpressionFactory.
|
||||||
* @return Returns the ExpressionFactory.
|
* @return Returns the ExpressionFactory.
|
||||||
*/
|
*/
|
||||||
ExpressionFactory getExpressionFactory();
|
ExpressionFactory getExpressionLanguageFactory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the ElementAttributeValueParser.
|
* @return Returns the ElementAttributeValueParser.
|
|
@ -21,12 +21,14 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import javax.el.ELContext;
|
import javax.el.ELContext;
|
||||||
import javax.el.ExpressionFactory;
|
import javax.el.ExpressionFactory;
|
||||||
|
|
||||||
import org.x4o.xml.core.X4ODebugWriter;
|
import org.x4o.xml.element.ElementAttributeValueParser;
|
||||||
|
import org.x4o.xml.element.ElementObjectPropertyValue;
|
||||||
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementLanguageLocal is the local set interface for ElementLanguage.
|
* ElementLanguageLocal is the local set interface for ElementLanguage.
|
||||||
|
@ -34,19 +36,19 @@ import org.x4o.xml.core.X4ODebugWriter;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Oct 28, 2009
|
* @version 1.0 Oct 28, 2009
|
||||||
*/
|
*/
|
||||||
public interface ElementLanguageLocal extends ElementLanguage {
|
public interface X4OLanguageContextLocal extends X4OLanguageContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the EL Context.
|
* Sets the EL Context.
|
||||||
* @param context The ELContext to set.
|
* @param context The ELContext to set.
|
||||||
*/
|
*/
|
||||||
void setELContext(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 setExpressionFactory(ExpressionFactory expressionFactory);
|
void setExpressionLanguageFactory(ExpressionFactory expressionFactory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param elementAttributeValueParser The elementAttributeValueParser to set.
|
* @param elementAttributeValueParser The elementAttributeValueParser to set.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the language into the contexts.
|
* Loads the language into the contexts.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is throw when there is en Exception within an Element.
|
* Is throw when there is en Exception within an Element.
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguageLocal exposes the add method to load the language.
|
* X4OLanguageLocal exposes the add method to load the language.
|
||||||
|
@ -40,8 +39,8 @@ public interface X4OLanguageLocal extends X4OLanguage {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an ElementLanguageModule to this language.
|
* Adds an X4OLanguageModule to this language.
|
||||||
* @param elementLanguageModule The element language module to add.
|
* @param languageModule The element language module to add.
|
||||||
*/
|
*/
|
||||||
void addElementLanguageModule(ElementLanguageModule elementLanguageModule);
|
void addLanguageModule(X4OLanguageModule languageModule);
|
||||||
}
|
}
|
|
@ -21,10 +21,17 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
|
import org.x4o.xml.element.ElementInterface;
|
||||||
|
import org.x4o.xml.element.ElementMetaBase;
|
||||||
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ElementLanguageModule.<br>
|
* The ElementLanguageModule.<br>
|
||||||
* This is an central store to element interfaces from one language module
|
* This is an central store to element interfaces from one language module
|
||||||
|
@ -32,7 +39,7 @@ import java.util.List;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 2, 2012
|
* @version 1.0 Aug 2, 2012
|
||||||
*/
|
*/
|
||||||
public interface ElementLanguageModule extends ElementMetaBase {
|
public interface X4OLanguageModule extends ElementMetaBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Name.
|
* @return the Name.
|
||||||
|
@ -123,12 +130,12 @@ public interface ElementLanguageModule extends ElementMetaBase {
|
||||||
/**
|
/**
|
||||||
* @param elementLanguageModuleLoader Sets the loader of this module.
|
* @param elementLanguageModuleLoader Sets the loader of this module.
|
||||||
*/
|
*/
|
||||||
void setElementLanguageModuleLoader(ElementLanguageModuleLoader elementLanguageModuleLoader);
|
void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the ElementLanguageModuleLoader of this module.
|
* @return Returns the ElementLanguageModuleLoader of this module.
|
||||||
*/
|
*/
|
||||||
ElementLanguageModuleLoader getElementLanguageModuleLoader();
|
X4OLanguageModuleLoader getLanguageModuleLoader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the sourceResource
|
* @return the sourceResource
|
|
@ -21,9 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,13 +33,13 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Jul 8, 2006
|
* @version 1.0 Jul 8, 2006
|
||||||
*/
|
*/
|
||||||
public interface ElementLanguageModuleLoader {
|
public interface X4OLanguageModuleLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the ElementProvider.
|
* Starts the ElementProvider.
|
||||||
* @param languageLocal The ElementLanguage to load for.
|
* @param languageLocal The ElementLanguage to load for.
|
||||||
* @param elementLanguageModule The ElementLanguageModule to load it into.
|
* @param elementLanguageModule The ElementLanguageModule to load it into.
|
||||||
* @throws ElementLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded.
|
* @throws X4OLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded.
|
||||||
*/
|
*/
|
||||||
void loadLanguageModule(X4OLanguageLocal languageLocal,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException;
|
void loadLanguageModule(X4OLanguageLocal languageLocal,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException;
|
||||||
}
|
}
|
|
@ -21,7 +21,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
|
import org.x4o.xml.element.ElementException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementNamespaceLoaderException holds ElementLanguageModuleLoader which created the exception.<br>
|
* ElementNamespaceLoaderException holds ElementLanguageModuleLoader which created the exception.<br>
|
||||||
|
@ -30,16 +32,16 @@ package org.x4o.xml.element;
|
||||||
* @version 1.0 Aug 29, 2008
|
* @version 1.0 Aug 29, 2008
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ElementLanguageModuleLoaderException extends ElementException {
|
public class X4OLanguageModuleLoaderException extends ElementException {
|
||||||
|
|
||||||
private ElementLanguageModuleLoader elementLanguageModuleLoader = null;
|
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
public ElementLanguageModuleLoaderException(ElementLanguageModuleLoader elementLanguageModuleLoader,String message) {
|
public X4OLanguageModuleLoaderException(X4OLanguageModuleLoader elementLanguageModuleLoader,String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
|
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +52,7 @@ public class ElementLanguageModuleLoaderException extends ElementException {
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
public ElementLanguageModuleLoaderException(ElementLanguageModuleLoader elementLanguageModuleLoader,String message,Exception exception) {
|
public X4OLanguageModuleLoaderException(X4OLanguageModuleLoader elementLanguageModuleLoader,String message,Exception exception) {
|
||||||
super(message,exception);
|
super(message,exception);
|
||||||
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
|
this.elementLanguageModuleLoader=elementLanguageModuleLoader;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +61,7 @@ public class ElementLanguageModuleLoaderException 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 ElementLanguageModuleLoader getElementProvider() {
|
public X4OLanguageModuleLoader getElementProvider() {
|
||||||
return elementLanguageModuleLoader;
|
return elementLanguageModuleLoader;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,11 +21,8 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.element;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLoaderException;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +32,7 @@ import org.x4o.xml.core.config.X4OLanguageLocal;
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 7, 2012
|
* @version 1.0 Aug 7, 2012
|
||||||
*/
|
*/
|
||||||
public interface ElementLanguageModuleLoaderSibling extends ElementLanguageModuleLoader {
|
public interface X4OLanguageModuleLoaderSibling extends X4OLanguageModuleLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads in the sibling language.
|
* Loads in the sibling language.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OLanguagePropertyKeys is shortcut to the the properties by uri.
|
* X4OLanguagePropertyKeys is shortcut to the the properties by uri.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -28,4 +28,4 @@
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
|
@ -21,13 +21,13 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,6 +98,6 @@ public abstract class AbstractX4OPhase implements X4OPhase {
|
||||||
* @param elementLanguage The language to run phase for.
|
* @param elementLanguage The language to run phase for.
|
||||||
* @throws X4OPhaseException when phase has error.
|
* @throws X4OPhaseException when phase has error.
|
||||||
*/
|
*/
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,16 +21,16 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,7 +124,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
|
||||||
* Runs all the phases in the right order.
|
* 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(ElementLanguage languageContext,X4OPhaseType type) throws X4OPhaseException {
|
public void runPhases(X4OLanguageContext languageContext,X4OPhaseType type) throws X4OPhaseException {
|
||||||
|
|
||||||
// sort for the order
|
// sort for the order
|
||||||
List<X4OPhase> x4oPhasesOrder = getOrderedPhases(type);
|
List<X4OPhase> x4oPhasesOrder = getOrderedPhases(type);
|
||||||
|
@ -198,7 +198,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
|
||||||
* @throws X4OPhaseException When a running handlers throws one.
|
* @throws X4OPhaseException When a running handlers throws one.
|
||||||
*/
|
*/
|
||||||
public void runPhasesForElement(Element e,X4OPhaseType type,X4OPhase p) throws X4OPhaseException {
|
public void runPhasesForElement(Element e,X4OPhaseType type,X4OPhase p) throws X4OPhaseException {
|
||||||
ElementLanguage languageContext = e.getElementLanguage();
|
X4OLanguageContext languageContext = e.getElementLanguage();
|
||||||
boolean skipRunPhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RUN);
|
boolean skipRunPhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RUN);
|
||||||
String stopPhase = languageContext.getLanguagePropertyString(X4OLanguageProperty.PHASE_STOP_AFTER);
|
String stopPhase = languageContext.getLanguagePropertyString(X4OLanguageProperty.PHASE_STOP_AFTER);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
|
||||||
* Run release phase manual if auto release is disabled by config.
|
* 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(ElementLanguage languageContext) throws X4OPhaseException {
|
public void doReleasePhaseManual(X4OLanguageContext languageContext) throws X4OPhaseException {
|
||||||
boolean skipReleasePhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RELEASE);
|
boolean skipReleasePhase = languageContext.getLanguagePropertyBoolean(X4OLanguageProperty.PHASE_SKIP_RELEASE);
|
||||||
if (skipReleasePhase==false) {
|
if (skipReleasePhase==false) {
|
||||||
throw new IllegalStateException("No manual release requested.");
|
throw new IllegalStateException("No manual release requested.");
|
||||||
|
@ -327,7 +327,7 @@ public class DefaultX4OPhaseManager implements X4OPhaseManager {
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
private void executePhaseRoot(ElementLanguage elementLanguage,X4OPhase phase) throws X4OPhaseException {
|
private void executePhaseRoot(X4OLanguageContext elementLanguage,X4OPhase phase) throws X4OPhaseException {
|
||||||
if (elementLanguage.getRootElement()==null) {
|
if (elementLanguage.getRootElement()==null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -21,12 +21,12 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +58,7 @@ public interface X4OPhase {
|
||||||
* @param elementLanguage The elementLanguage running this phase.
|
* @param elementLanguage The elementLanguage running this phase.
|
||||||
* @throws X4OPhaseException When error has happend.
|
* @throws X4OPhaseException When error has happend.
|
||||||
*/
|
*/
|
||||||
void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException;
|
void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all phase listeners which where added.
|
* Returns all phase listeners which where added.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is throw when there is en Exception within an Element.
|
* Is throw when there is en Exception within an Element.
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -34,14 +34,6 @@ import java.util.logging.Logger;
|
||||||
import javax.el.ValueExpression;
|
import javax.el.ValueExpression;
|
||||||
|
|
||||||
import org.x4o.xml.conv.ObjectConverterException;
|
import org.x4o.xml.conv.ObjectConverterException;
|
||||||
import org.x4o.xml.core.X4ODebugWriter;
|
|
||||||
import org.x4o.xml.core.X4OEntityResolver;
|
|
||||||
import org.x4o.xml.core.X4OErrorHandler;
|
|
||||||
import org.x4o.xml.core.X4OTagHandler;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageClassLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLoader;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementAttributeHandler;
|
import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
|
@ -51,12 +43,20 @@ import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementLanguageModuleLoaderSibling;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
|
import org.x4o.xml.io.sax.X4OEntityResolver;
|
||||||
|
import org.x4o.xml.io.sax.X4OErrorHandler;
|
||||||
|
import org.x4o.xml.io.sax.X4OTagHandler;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageLoader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageLocal;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -79,7 +79,7 @@ public class X4OPhaseFactory {
|
||||||
logger = Logger.getLogger(X4OPhaseFactory.class.getName());
|
logger = Logger.getLogger(X4OPhaseFactory.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debugPhaseMessage(String message,X4OPhase phaseHandler,ElementLanguage languageContext) throws X4OPhaseException {
|
private void debugPhaseMessage(String message,X4OPhase phaseHandler,X4OLanguageContext languageContext) throws X4OPhaseException {
|
||||||
if (languageContext.hasX4ODebugWriter()) {
|
if (languageContext.hasX4ODebugWriter()) {
|
||||||
try {
|
try {
|
||||||
languageContext.getX4ODebugWriter().debugPhaseMessage(message,phaseHandler.getClass());
|
languageContext.getX4ODebugWriter().debugPhaseMessage(message,phaseHandler.getClass());
|
||||||
|
@ -110,7 +110,7 @@ public class X4OPhaseFactory {
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -139,7 +139,7 @@ public class X4OPhaseFactory {
|
||||||
}
|
}
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
debugPhaseMessage("Loading main language: "+elementLanguage.getLanguage(),this,elementLanguage);
|
debugPhaseMessage("Loading main language: "+elementLanguage.getLanguage(),this,elementLanguage);
|
||||||
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
|
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
|
||||||
|
@ -177,17 +177,17 @@ public class X4OPhaseFactory {
|
||||||
}
|
}
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
List<ElementLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<ElementLanguageModuleLoaderSibling>(3);
|
List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(3);
|
||||||
for (ElementLanguageModule module:elementLanguage.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) {
|
||||||
if (module.getElementLanguageModuleLoader() instanceof ElementLanguageModuleLoaderSibling) {
|
if (module.getLanguageModuleLoader() instanceof X4OLanguageModuleLoaderSibling) {
|
||||||
siblingLoaders.add((ElementLanguageModuleLoaderSibling)module.getElementLanguageModuleLoader());
|
siblingLoaders.add((X4OLanguageModuleLoaderSibling)module.getLanguageModuleLoader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (siblingLoaders.isEmpty()==false) {
|
if (siblingLoaders.isEmpty()==false) {
|
||||||
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
|
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguage().getLanguageConfiguration().getDefaultX4OLanguageLoader());
|
||||||
for (ElementLanguageModuleLoaderSibling siblingLoader:siblingLoaders) {
|
for (X4OLanguageModuleLoaderSibling siblingLoader:siblingLoaders) {
|
||||||
debugPhaseMessage("Loading sibling langauge loader: "+siblingLoader,this,elementLanguage);
|
debugPhaseMessage("Loading sibling langauge loader: "+siblingLoader,this,elementLanguage);
|
||||||
siblingLoader.loadLanguageSibling((X4OLanguageLocal)elementLanguage.getLanguage(), loader);
|
siblingLoader.loadLanguageSibling((X4OLanguageLocal)elementLanguage.getLanguage(), loader);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public class X4OPhaseFactory {
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
// print the properties and classes for this language/config
|
// print the properties and classes for this language/config
|
||||||
if (elementLanguage.hasX4ODebugWriter()) {
|
if (elementLanguage.hasX4ODebugWriter()) {
|
||||||
try {
|
try {
|
||||||
|
@ -262,7 +262,7 @@ public class X4OPhaseFactory {
|
||||||
}
|
}
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
//XMLParserConfiguration config = new XIncludeAwareParserConfiguration();
|
//XMLParserConfiguration config = new XIncludeAwareParserConfiguration();
|
||||||
//config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",myFullGrammarPool);
|
//config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",myFullGrammarPool);
|
||||||
|
@ -383,7 +383,7 @@ public class X4OPhaseFactory {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
Map beanMap = (Map)elementLanguage.getLanguageProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP);
|
Map beanMap = (Map)elementLanguage.getLanguageProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP);
|
||||||
if (beanMap==null) {
|
if (beanMap==null) {
|
||||||
|
@ -391,8 +391,8 @@ public class X4OPhaseFactory {
|
||||||
}
|
}
|
||||||
for (Object elName:beanMap.keySet()) {
|
for (Object elName:beanMap.keySet()) {
|
||||||
Object o = beanMap.get(elName);
|
Object o = beanMap.get(elName);
|
||||||
ValueExpression ve = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${"+elName+"}", o.getClass());
|
ValueExpression ve = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+elName+"}", o.getClass());
|
||||||
ve.setValue(elementLanguage.getELContext(), o);
|
ve.setValue(elementLanguage.getExpressionLanguageContext(), o);
|
||||||
debugPhaseMessage("Setting el bean: ${"+elName+"} to: "+o.getClass().getName(),this,elementLanguage);
|
debugPhaseMessage("Setting el bean: ${"+elName+"} to: "+o.getClass().getName(),this,elementLanguage);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -495,7 +495,7 @@ public class X4OPhaseFactory {
|
||||||
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 (ElementLanguageModule mod:element.getElementLanguage().getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:element.getElementLanguage().getLanguage().getLanguageModules()) {
|
||||||
logger.finest("Do Element Config Global Configurators: "+mod.getElementConfiguratorGlobals().size());
|
logger.finest("Do Element Config Global Configurators: "+mod.getElementConfiguratorGlobals().size());
|
||||||
for (ElementConfiguratorGlobal ec:mod.getElementConfiguratorGlobals()) {
|
for (ElementConfiguratorGlobal ec:mod.getElementConfiguratorGlobals()) {
|
||||||
runConf.runElementConfigurator(ec,element,this);
|
runConf.runElementConfigurator(ec,element,this);
|
||||||
|
@ -536,7 +536,7 @@ public class X4OPhaseFactory {
|
||||||
// do global parameters
|
// do global parameters
|
||||||
logger.finest("Do Element Global AttributeHandlers.");
|
logger.finest("Do Element Global AttributeHandlers.");
|
||||||
List<ElementAttributeHandler> handlers = new ArrayList<ElementAttributeHandler>();
|
List<ElementAttributeHandler> handlers = new ArrayList<ElementAttributeHandler>();
|
||||||
for (ElementLanguageModule mod:element.getElementLanguage().getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:element.getElementLanguage().getLanguage().getLanguageModules()) {
|
||||||
for (ElementAttributeHandler global:mod.getElementAttributeHandlers()) {
|
for (ElementAttributeHandler global:mod.getElementAttributeHandlers()) {
|
||||||
|
|
||||||
String attribute = element.getAttributes().get(global.getAttributeName());
|
String attribute = element.getAttributes().get(global.getAttributeName());
|
||||||
|
@ -578,10 +578,6 @@ public class X4OPhaseFactory {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.getElementLanguage().getLanguage().getLanguageName().equals("test")) {
|
|
||||||
System.out.println("do element; "+element.getElementClass().getTag()+" attr; "+element.getAttributes());
|
|
||||||
}
|
|
||||||
|
|
||||||
// do config
|
// do config
|
||||||
Map<String,String> attr = element.getAttributes();
|
Map<String,String> attr = element.getAttributes();
|
||||||
ElementAttributeValueParser attrParser = element.getElementLanguage().getElementAttributeValueParser();
|
ElementAttributeValueParser attrParser = element.getElementLanguage().getElementAttributeValueParser();
|
||||||
|
@ -860,7 +856,7 @@ public class X4OPhaseFactory {
|
||||||
public boolean isElementPhase() {
|
public boolean isElementPhase() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
for (RunConfigurator conf:runConf) {
|
for (RunConfigurator conf:runConf) {
|
||||||
try {
|
try {
|
||||||
if (elementLanguage.hasX4ODebugWriter()) {
|
if (elementLanguage.hasX4ODebugWriter()) {
|
||||||
|
@ -933,7 +929,7 @@ public class X4OPhaseFactory {
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
// not used.
|
// not used.
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
// print the properties and classes for this language/config
|
// print the properties and classes for this language/config
|
||||||
if (elementLanguage.hasX4ODebugWriter()) {
|
if (elementLanguage.hasX4ODebugWriter()) {
|
||||||
try {
|
try {
|
||||||
|
@ -959,15 +955,15 @@ public class X4OPhaseFactory {
|
||||||
class ReleasePhaseListener implements X4OPhaseListener {
|
class ReleasePhaseListener implements X4OPhaseListener {
|
||||||
private int elementsReleased = 0;
|
private int elementsReleased = 0;
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.core.phase.X4OPhase, org.x4o.xml.element.ElementLanguage)
|
* @see org.x4o.xml.lang.phase.X4OPhaseListener#preRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext)
|
||||||
*/
|
*/
|
||||||
public void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
elementsReleased=0;
|
elementsReleased=0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.core.phase.X4OPhaseListener#endRunPhase(org.x4o.xml.core.phase.X4OPhase, org.x4o.xml.element.ElementLanguage)
|
* @see org.x4o.xml.lang.phase.X4OPhaseListener#endRunPhase(org.x4o.xml.lang.phase.X4OPhase, org.x4o.xml.lang.X4OLanguageContext)
|
||||||
*/
|
*/
|
||||||
public void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
if (elementLanguage.hasX4ODebugWriter()==false) {
|
if (elementLanguage.hasX4ODebugWriter()==false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -997,7 +993,7 @@ public class X4OPhaseFactory {
|
||||||
public String[] getPhaseDependencies() {
|
public String[] getPhaseDependencies() {
|
||||||
return new String[] {"READ_END"};
|
return new String[] {"READ_END"};
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
try {
|
try {
|
||||||
|
@ -1033,7 +1029,7 @@ public class X4OPhaseFactory {
|
||||||
}
|
}
|
||||||
public void runElementPhase(Element element) throws X4OPhaseException {
|
public void runElementPhase(Element element) throws X4OPhaseException {
|
||||||
}
|
}
|
||||||
public void runPhase(ElementLanguage elementLanguage) throws X4OPhaseException {
|
public void runPhase(X4OLanguageContext elementLanguage) throws X4OPhaseException {
|
||||||
// safety check
|
// safety check
|
||||||
if (elementLanguage.hasX4ODebugWriter()==false) {
|
if (elementLanguage.hasX4ODebugWriter()==false) {
|
||||||
throw new X4OPhaseException(this,"Use debugPhase only when X4OParser.debugWriter is filled.");
|
throw new X4OPhaseException(this,"Use debugPhase only when X4OParser.debugWriter is filled.");
|
||||||
|
@ -1058,7 +1054,7 @@ public class X4OPhaseFactory {
|
||||||
|
|
||||||
// note: slow version
|
// note: slow version
|
||||||
private String getNamespaceForElement(Element e) {
|
private String getNamespaceForElement(Element e) {
|
||||||
for (ElementLanguageModule mod:e.getElementLanguage().getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:e.getElementLanguage().getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext enc:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext enc:mod.getElementNamespaceContexts()) {
|
||||||
List<ElementClass> l = enc.getElementClasses();
|
List<ElementClass> l = enc.getElementClasses();
|
||||||
if (l.contains(e.getElementClass())) {
|
if (l.contains(e.getElementClass())) {
|
|
@ -21,9 +21,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +41,7 @@ public interface X4OPhaseListener {
|
||||||
* @param elementLanguage The elementLanguage of the driver.
|
* @param elementLanguage The elementLanguage of the driver.
|
||||||
* @throws X4OPhaseException Is throws when listeners has error.
|
* @throws X4OPhaseException Is throws when listeners has error.
|
||||||
*/
|
*/
|
||||||
void preRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException;
|
void preRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets called after the X4OPhaseHandler is runned.
|
* Gets called after the X4OPhaseHandler is runned.
|
||||||
|
@ -49,5 +49,5 @@ public interface X4OPhaseListener {
|
||||||
* @param elementLanguage The elementLanguage of the driver.
|
* @param elementLanguage The elementLanguage of the driver.
|
||||||
* @throws X4OPhaseException Is throws when listeners has error.
|
* @throws X4OPhaseException Is throws when listeners has error.
|
||||||
*/
|
*/
|
||||||
void endRunPhase(X4OPhase phase,ElementLanguage elementLanguage) throws X4OPhaseException;
|
void endRunPhase(X4OPhase phase,X4OLanguageContext elementLanguage) throws X4OPhaseException;
|
||||||
}
|
}
|
|
@ -21,13 +21,13 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,13 +51,13 @@ public interface X4OPhaseManager {
|
||||||
*/
|
*/
|
||||||
List<X4OPhase> getOrderedPhases(X4OPhaseType type);
|
List<X4OPhase> getOrderedPhases(X4OPhaseType type);
|
||||||
|
|
||||||
public void doReleasePhaseManual(ElementLanguage languageContext) throws X4OPhaseException;
|
public void doReleasePhaseManual(X4OLanguageContext languageContext) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs all the phases in the right order.
|
* 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(ElementLanguage elementContext,X4OPhaseType type) throws X4OPhaseException;
|
public void runPhases(X4OLanguageContext elementContext,X4OPhaseType type) throws X4OPhaseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs phase on single element.
|
* Runs phase on single element.
|
|
@ -21,13 +21,13 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.core.phase.X4OPhaseFactory.X4OPhaseReadRunConfigurator;
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.phase.X4OPhaseFactory.X4OPhaseReadRunConfigurator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X4OPhaseType
|
* X4OPhaseType
|
|
@ -27,4 +27,4 @@
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.phase;
|
package org.x4o.xml.lang.phase;
|
|
@ -26,8 +26,8 @@ package org.x4o.xml;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriverManager;
|
import org.x4o.xml.X4ODriverManager;
|
||||||
import org.x4o.xml.core.config.X4OLanguageLoaderException;
|
import org.x4o.xml.lang.X4OLanguageLoaderException;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseException;
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Locale;
|
||||||
import org.x4o.xml.conv.text.ClassConverter;
|
import org.x4o.xml.conv.text.ClassConverter;
|
||||||
import org.x4o.xml.conv.text.EnumConverter;
|
import org.x4o.xml.conv.text.EnumConverter;
|
||||||
import org.x4o.xml.conv.text.URLConverter;
|
import org.x4o.xml.conv.text.URLConverter;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseType;
|
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.core;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.io.X4OReaderContext;
|
import org.x4o.xml.io.X4OReaderContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import junit.framework.TestCase;
|
||||||
public class NamespaceUriTest extends TestCase {
|
public class NamespaceUriTest extends TestCase {
|
||||||
|
|
||||||
public void testSimpleUri() throws Exception {
|
public void testSimpleUri() throws Exception {
|
||||||
ElementLanguage context = null;
|
X4OLanguageContext context = null;
|
||||||
TestDriver driver = TestDriver.getInstance();
|
TestDriver driver = TestDriver.getInstance();
|
||||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||||
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
||||||
|
@ -53,7 +53,7 @@ public class NamespaceUriTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmptyUri() throws Exception {
|
public void testEmptyUri() throws Exception {
|
||||||
ElementLanguage context = null;
|
X4OLanguageContext context = null;
|
||||||
TestDriver driver = TestDriver.getInstance();
|
TestDriver driver = TestDriver.getInstance();
|
||||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||||
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
||||||
|
@ -67,7 +67,7 @@ public class NamespaceUriTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSchemaUri() throws Exception {
|
public void testSchemaUri() throws Exception {
|
||||||
ElementLanguage context = null;
|
X4OLanguageContext context = null;
|
||||||
TestDriver driver = TestDriver.getInstance();
|
TestDriver driver = TestDriver.getInstance();
|
||||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||||
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
||||||
|
|
|
@ -28,8 +28,8 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,10 @@ package org.x4o.xml.core;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
|
||||||
import org.x4o.xml.eld.CelDriver;
|
import org.x4o.xml.eld.CelDriver;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.io.sax.X4OEntityResolver;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
import org.xml.sax.EntityResolver;
|
import org.xml.sax.EntityResolver;
|
||||||
|
@ -80,7 +81,7 @@ public class X4OEntityResolverTest extends TestCase {
|
||||||
|
|
||||||
public void testResolveProperty() throws Exception {
|
public void testResolveProperty() throws Exception {
|
||||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||||
ElementLanguage language = driver.createLanguageContext();
|
X4OLanguageContext language = driver.createLanguageContext();
|
||||||
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
|
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
|
||||||
X4OEntityResolver resolver = new X4OEntityResolver(language);
|
X4OEntityResolver resolver = new X4OEntityResolver(language);
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
|
@ -96,7 +97,7 @@ public class X4OEntityResolverTest extends TestCase {
|
||||||
|
|
||||||
public void testResolvePropertyNull() throws Exception {
|
public void testResolvePropertyNull() throws Exception {
|
||||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||||
ElementLanguage language = driver.createLanguageContext();
|
X4OLanguageContext language = driver.createLanguageContext();
|
||||||
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
|
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
|
||||||
X4OEntityResolver resolver = new X4OEntityResolver(language);
|
X4OEntityResolver resolver = new X4OEntityResolver(language);
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
package org.x4o.xml.core;
|
package org.x4o.xml.core;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguageConfiguration;
|
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageConfiguration;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
|
@ -26,10 +26,10 @@ package org.x4o.xml.core;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.core.phase.X4OPhase;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManager;
|
import org.x4o.xml.lang.phase.X4OPhase;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseType;
|
import org.x4o.xml.lang.phase.X4OPhaseManager;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class X4OPhaseManagerTest extends TestCase {
|
||||||
|
|
||||||
public void testPhases() throws Exception {
|
public void testPhases() throws Exception {
|
||||||
TestDriver driver = TestDriver.getInstance();
|
TestDriver driver = TestDriver.getInstance();
|
||||||
ElementLanguage context = driver.createLanguageContext();
|
X4OLanguageContext context = driver.createLanguageContext();
|
||||||
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
|
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
|
||||||
Collection<X4OPhase> phasesAll = manager.getAllPhases();
|
Collection<X4OPhase> phasesAll = manager.getAllPhases();
|
||||||
List<X4OPhase> phases = manager.getOrderedPhases(X4OPhaseType.XML_READ);
|
List<X4OPhase> phases = manager.getOrderedPhases(X4OPhaseType.XML_READ);
|
||||||
|
|
|
@ -29,17 +29,17 @@ import java.util.List;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.X4ODriverManager;
|
import org.x4o.xml.X4ODriverManager;
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.eld.EldDriver;
|
import org.x4o.xml.eld.EldDriver;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.Element.ElementType;
|
import org.x4o.xml.element.Element.ElementType;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
import org.x4o.xml.io.X4OSchemaWriter;
|
import org.x4o.xml.io.X4OSchemaWriter;
|
||||||
import org.x4o.xml.io.X4OWriter;
|
import org.x4o.xml.io.X4OWriter;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
@ -80,13 +80,13 @@ public class EldParserTest extends TestCase {
|
||||||
|
|
||||||
public void testRunEldParserCore() throws Exception {
|
public void testRunEldParserCore() throws Exception {
|
||||||
|
|
||||||
X4ODriver<ElementLanguageModule> driver = (X4ODriver<ElementLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
||||||
|
|
||||||
X4OReader<ElementLanguageModule> reader = driver.createReader();
|
X4OReader<X4OLanguageModule> reader = driver.createReader();
|
||||||
//EldDriver parser = new EldDriver(true);
|
//EldDriver parser = new EldDriver(true);
|
||||||
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
||||||
try {
|
try {
|
||||||
ElementLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
|
X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
|
||||||
List<String> resultTags = new ArrayList<String>(50);
|
List<String> resultTags = new ArrayList<String>(50);
|
||||||
for (ElementNamespaceContext ns:module.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:module.getElementNamespaceContexts()) {
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ public class EldParserTest extends TestCase {
|
||||||
public void testRunEldParser() throws Exception {
|
public void testRunEldParser() throws Exception {
|
||||||
//EldDriver parser = new EldDriver(false);
|
//EldDriver parser = new EldDriver(false);
|
||||||
//parser.parseResource("META-INF/test/test-lang.eld");
|
//parser.parseResource("META-INF/test/test-lang.eld");
|
||||||
X4ODriver<ElementLanguageModule> driver = (X4ODriver<ElementLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
||||||
X4OReader<ElementLanguageModule> reader = driver.createReader();
|
X4OReader<X4OLanguageModule> reader = driver.createReader();
|
||||||
reader.readResource("META-INF/test/test-lang.eld");
|
reader.readResource("META-INF/test/test-lang.eld");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
package org.x4o.xml.eld;
|
package org.x4o.xml.eld;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.eld.EldDriver;
|
import org.x4o.xml.eld.EldDriver;
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.element;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.logging.LogManager;
|
import java.util.logging.LogManager;
|
||||||
|
|
||||||
|
|
||||||
|
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValueException;
|
import org.x4o.xml.element.ElementObjectPropertyValueException;
|
||||||
import org.x4o.xml.impl.DefaultElementObjectPropertyValue;
|
|
||||||
import org.x4o.xml.test.models.TestObjectChild;
|
import org.x4o.xml.test.models.TestObjectChild;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
|
@ -21,14 +21,12 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.impl;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguageLoader;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageLoader;
|
||||||
import org.x4o.xml.core.config.X4OLanguageLoader;
|
import org.x4o.xml.lang.X4OLanguageLocal;
|
||||||
import org.x4o.xml.core.config.X4OLanguageLocal;
|
|
||||||
import org.x4o.xml.io.X4OReader;
|
|
||||||
import org.x4o.xml.test.TestDriver;
|
import org.x4o.xml.test.TestDriver;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
|
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
|
@ -21,9 +21,11 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.x4o.xml.core.config;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
|
import org.x4o.xml.lang.X4OLanguageProperty;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -26,8 +26,8 @@ package org.x4o.xml.test;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
|
||||||
import org.x4o.xml.io.X4OReader;
|
import org.x4o.xml.io.X4OReader;
|
||||||
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.test.models.TestObjectRoot;
|
import org.x4o.xml.test.models.TestObjectRoot;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,12 @@ import javax.el.ValueExpression;
|
||||||
|
|
||||||
import org.x4o.xml.X4ODriver;
|
import org.x4o.xml.X4ODriver;
|
||||||
import org.x4o.xml.X4ODriverManager;
|
import org.x4o.xml.X4ODriverManager;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguage;
|
import org.x4o.xml.lang.DefaultX4OLanguage;
|
||||||
import org.x4o.xml.core.config.DefaultX4OLanguageConfiguration;
|
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
|
||||||
import org.x4o.xml.core.config.X4OLanguage;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
|
import org.x4o.xml.lang.X4OLanguage;
|
||||||
import org.x4o.xml.core.phase.X4OPhaseManagerFactory;
|
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
import org.x4o.xml.lang.phase.X4OPhaseManagerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwiXmlParser works with the SwingEngine to config the UI tree.
|
* SwiXmlParser works with the SwingEngine to config the UI tree.
|
||||||
|
@ -91,9 +91,9 @@ public class SwiXmlDriver extends X4ODriver<Component> {
|
||||||
* @param elementLanguage The elementLanguage to get the swingEngine out.
|
* @param elementLanguage The elementLanguage to get the swingEngine out.
|
||||||
* @return Returns the SwingEngine for this elementLanguage.
|
* @return Returns the SwingEngine for this elementLanguage.
|
||||||
*/
|
*/
|
||||||
static public SwingEngine getSwingEngine(ElementLanguage elementLanguage) {
|
static public SwingEngine getSwingEngine(X4OLanguageContext elementLanguage) {
|
||||||
ValueExpression ee = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
|
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
|
||||||
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getELContext());
|
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext());
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EldDocGenerator writes documentation.
|
* EldDocGenerator writes documentation.
|
||||||
|
@ -43,9 +43,9 @@ import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
*/
|
*/
|
||||||
public class EldDocGenerator {
|
public class EldDocGenerator {
|
||||||
|
|
||||||
private ElementLanguage context = null;
|
private X4OLanguageContext context = null;
|
||||||
|
|
||||||
public EldDocGenerator(ElementLanguage context) {
|
public EldDocGenerator(X4OLanguageContext context) {
|
||||||
this.context=context;
|
this.context=context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class EldDocGenerator {
|
||||||
writer.writeOverviewNamespace(basePath, context);
|
writer.writeOverviewNamespace(basePath, context);
|
||||||
writer.writeOverviewTree(basePath, context);
|
writer.writeOverviewTree(basePath, context);
|
||||||
|
|
||||||
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
|
|
||||||
writer.writeOverviewModule(basePath, mod);
|
writer.writeOverviewModule(basePath, mod);
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementLanguage;
|
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementLanguageModule;
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespaceContext;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EldDocHtmlWriter writes simple eld documentation.
|
* EldDocHtmlWriter writes simple eld documentation.
|
||||||
|
@ -136,7 +136,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeIndex(File basePath,ElementLanguage context) throws IOException {
|
public void writeIndex(File basePath,X4OLanguageContext context) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,"index.html");
|
PrintWriter pw = createPrintWriter(basePath,"index.html");
|
||||||
try {
|
try {
|
||||||
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
||||||
|
@ -149,7 +149,7 @@ public class EldDocHtmlWriter {
|
||||||
int eleConfigs = 0;
|
int eleConfigs = 0;
|
||||||
int elements = 0;
|
int elements = 0;
|
||||||
int namespaces = 0;
|
int namespaces = 0;
|
||||||
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
attrHandlers += mod.getElementAttributeHandlers().size();
|
attrHandlers += mod.getElementAttributeHandlers().size();
|
||||||
bindHandlers += mod.getElementBindingHandlers().size();
|
bindHandlers += mod.getElementBindingHandlers().size();
|
||||||
interFaces += mod.getElementInterfaces().size();
|
interFaces += mod.getElementInterfaces().size();
|
||||||
|
@ -164,7 +164,7 @@ public class EldDocHtmlWriter {
|
||||||
printTableStart(pw,"Language Stats");
|
printTableStart(pw,"Language Stats");
|
||||||
printTableRowSummary(pw,"Language:",""+context.getLanguage().getLanguageName());
|
printTableRowSummary(pw,"Language:",""+context.getLanguage().getLanguageName());
|
||||||
printTableRowSummary(pw,"LanguageVersion:",""+context.getLanguage().getLanguageVersion());
|
printTableRowSummary(pw,"LanguageVersion:",""+context.getLanguage().getLanguageVersion());
|
||||||
printTableRowSummary(pw,"Modules:",""+context.getLanguage().getElementLanguageModules().size());
|
printTableRowSummary(pw,"Modules:",""+context.getLanguage().getLanguageModules().size());
|
||||||
printTableRowSummary(pw,"Namespaces:",""+namespaces);
|
printTableRowSummary(pw,"Namespaces:",""+namespaces);
|
||||||
printTableRowSummary(pw,"Elements:",""+elements);
|
printTableRowSummary(pw,"Elements:",""+elements);
|
||||||
printTableRowSummary(pw,"ElementInterfaces:",""+interFaces);
|
printTableRowSummary(pw,"ElementInterfaces:",""+interFaces);
|
||||||
|
@ -181,16 +181,16 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeOverviewModule(File basePath,ElementLanguage context) throws IOException {
|
public void writeOverviewModule(File basePath,X4OLanguageContext context) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,"module-overview.html");
|
PrintWriter pw = createPrintWriter(basePath,"module-overview.html");
|
||||||
try {
|
try {
|
||||||
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
||||||
printHeader(pw,"Overview Modules ("+title+")","");
|
printHeader(pw,"Overview Modules ("+title+")","");
|
||||||
printPageIndexTitle(pw,title,null,null);
|
printPageIndexTitle(pw,title,null,null);
|
||||||
printTableStart(pw,"Modules");
|
printTableStart(pw,"Modules");
|
||||||
List<ElementLanguageModule> mods = context.getLanguage().getElementLanguageModules();
|
List<X4OLanguageModule> mods = context.getLanguage().getLanguageModules();
|
||||||
Collections.sort(mods,new ElementLanguageModuleComparator());
|
Collections.sort(mods,new ElementLanguageModuleComparator());
|
||||||
for (ElementLanguageModule mod:mods) {
|
for (X4OLanguageModule mod:mods) {
|
||||||
printTableRowOverview(pw,toSafeUri(mod.getId())+"/index.html",mod.getId(),mod.getName());
|
printTableRowOverview(pw,toSafeUri(mod.getId())+"/index.html",mod.getId(),mod.getName());
|
||||||
}
|
}
|
||||||
printTableEnd(pw);
|
printTableEnd(pw);
|
||||||
|
@ -202,16 +202,16 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeOverviewNamespace(File basePath,ElementLanguage context) throws IOException {
|
public void writeOverviewNamespace(File basePath,X4OLanguageContext context) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,"namespace-overview.html");
|
PrintWriter pw = createPrintWriter(basePath,"namespace-overview.html");
|
||||||
String pathPrefix = "";
|
String pathPrefix = "";
|
||||||
try {
|
try {
|
||||||
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
String title = context.getLanguage().getLanguageName()+" "+context.getLanguage().getLanguageVersion()+" ELD";
|
||||||
printHeader(pw,"Overview Namespace("+title+")",pathPrefix);
|
printHeader(pw,"Overview Namespace("+title+")",pathPrefix);
|
||||||
printPageIndexTitle(pw,title,null,null);
|
printPageIndexTitle(pw,title,null,null);
|
||||||
List<ElementLanguageModule> mods = context.getLanguage().getElementLanguageModules();
|
List<X4OLanguageModule> mods = context.getLanguage().getLanguageModules();
|
||||||
Collections.sort(mods,new ElementLanguageModuleComparator());
|
Collections.sort(mods,new ElementLanguageModuleComparator());
|
||||||
for (ElementLanguageModule mod:mods) {
|
for (X4OLanguageModule mod:mods) {
|
||||||
printNamespaces(pw,mod.getElementNamespaceContexts(),pathPrefix,mod);
|
printNamespaces(pw,mod.getElementNamespaceContexts(),pathPrefix,mod);
|
||||||
}
|
}
|
||||||
printBottom(pw,pathPrefix);
|
printBottom(pw,pathPrefix);
|
||||||
|
@ -222,7 +222,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeOverviewTree(File basePath,ElementLanguage context) throws IOException {
|
public void writeOverviewTree(File basePath,X4OLanguageContext context) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,"tree-overview.html");
|
PrintWriter pw = createPrintWriter(basePath,"tree-overview.html");
|
||||||
String pathPrefix = "";
|
String pathPrefix = "";
|
||||||
try {
|
try {
|
||||||
|
@ -231,7 +231,7 @@ public class EldDocHtmlWriter {
|
||||||
printPageIndexTitle(pw,title,null,null);
|
printPageIndexTitle(pw,title,null,null);
|
||||||
|
|
||||||
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
||||||
for (ElementLanguageModule mod:context.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
||||||
// found language root elements.
|
// found language root elements.
|
||||||
|
@ -260,8 +260,8 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TreeNode {
|
class TreeNode {
|
||||||
ElementLanguage context;
|
X4OLanguageContext context;
|
||||||
ElementLanguageModule module;
|
X4OLanguageModule module;
|
||||||
ElementNamespaceContext namespace;
|
ElementNamespaceContext namespace;
|
||||||
ElementClass elementClass;
|
ElementClass elementClass;
|
||||||
TreeNode parent;
|
TreeNode parent;
|
||||||
|
@ -298,7 +298,7 @@ public class EldDocHtmlWriter {
|
||||||
if (node.indent>20) {
|
if (node.indent>20) {
|
||||||
return result; // hard fail limit
|
return result; // hard fail limit
|
||||||
}
|
}
|
||||||
for (ElementLanguageModule mod:node.context.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
for (ElementClass ec:ns.getElementClasses()) {
|
for (ElementClass ec:ns.getElementClasses()) {
|
||||||
TreeNode n=null;
|
TreeNode n=null;
|
||||||
|
@ -370,7 +370,7 @@ public class EldDocHtmlWriter {
|
||||||
private List<TreeNode> findParents(TreeNode node) {
|
private List<TreeNode> findParents(TreeNode node) {
|
||||||
List<TreeNode> result = new ArrayList<TreeNode>(10);
|
List<TreeNode> result = new ArrayList<TreeNode>(10);
|
||||||
TreeNode n=null;
|
TreeNode n=null;
|
||||||
for (ElementLanguageModule mod:node.context.getLanguage().getElementLanguageModules()) {
|
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
||||||
|
|
||||||
List<String> tags = node.elementClass.getElementParents(ns.getUri());
|
List<String> tags = node.elementClass.getElementParents(ns.getUri());
|
||||||
|
@ -434,7 +434,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writeOverviewModule(File basePath,ElementLanguageModule mod) throws IOException {
|
public void writeOverviewModule(File basePath,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"index.html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"index.html");
|
||||||
String pathPrefix = "../";
|
String pathPrefix = "../";
|
||||||
try {
|
try {
|
||||||
|
@ -457,7 +457,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeOverviewElement(File basePath,ElementNamespaceContext ns,ElementLanguageModule mod) throws IOException {
|
public void writeOverviewElement(File basePath,ElementNamespaceContext ns,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),"index.html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),"index.html");
|
||||||
String pathPrefix = "../../";
|
String pathPrefix = "../../";
|
||||||
try {
|
try {
|
||||||
|
@ -495,7 +495,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writeElement(File basePath,ElementClass ec,ElementNamespaceContext ns,ElementLanguageModule mod,ElementLanguage context) throws IOException {
|
public void writeElement(File basePath,ElementClass ec,ElementNamespaceContext ns,X4OLanguageModule mod,X4OLanguageContext context) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"index.html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"index.html");
|
||||||
String pathPrefix = "../../../";
|
String pathPrefix = "../../../";
|
||||||
try {
|
try {
|
||||||
|
@ -585,7 +585,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeElementInterface(File basePath,ElementInterface iface,ElementLanguageModule mod) throws IOException {
|
public void writeElementInterface(File basePath,ElementInterface iface,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId()+".html");
|
||||||
String pathPrefix = "../../";
|
String pathPrefix = "../../";
|
||||||
String pathLocal = toSafeUri(iface.getId())+"/";
|
String pathLocal = toSafeUri(iface.getId())+"/";
|
||||||
|
@ -607,7 +607,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod) throws IOException {
|
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"conf",conf.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"conf",conf.getId()+".html");
|
||||||
String pathPrefix = "../../";
|
String pathPrefix = "../../";
|
||||||
try {
|
try {
|
||||||
|
@ -623,7 +623,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod,ElementInterface iface) throws IOException {
|
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod,ElementInterface iface) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"conf",conf.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"conf",conf.getId()+".html");
|
||||||
String pathPrefix = "../../../../";
|
String pathPrefix = "../../../../";
|
||||||
try {
|
try {
|
||||||
|
@ -639,7 +639,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeElementConfigurator(File basePath,ElementConfigurator conf,ElementLanguageModule mod,ElementNamespaceContext ns,ElementClass ec) throws IOException {
|
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod,ElementNamespaceContext ns,ElementClass ec) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"conf",conf.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"conf",conf.getId()+".html");
|
||||||
String pathPrefix = "../../../../";
|
String pathPrefix = "../../../../";
|
||||||
try {
|
try {
|
||||||
|
@ -655,7 +655,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeBindingHandler(File basePath,ElementBindingHandler bind,ElementLanguageModule mod) throws IOException {
|
public void writeBindingHandler(File basePath,ElementBindingHandler bind,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"bind",bind.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"bind",bind.getId()+".html");
|
||||||
String pathPrefix = "../../";
|
String pathPrefix = "../../";
|
||||||
try {
|
try {
|
||||||
|
@ -678,7 +678,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeBindingHandler(File basePath,ElementBindingHandler bind,ElementLanguageModule mod,ElementInterface iface) throws IOException {
|
public void writeBindingHandler(File basePath,ElementBindingHandler bind,X4OLanguageModule mod,ElementInterface iface) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"bind",bind.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"interface",iface.getId(),"bind",bind.getId()+".html");
|
||||||
String pathPrefix = "../../../../";
|
String pathPrefix = "../../../../";
|
||||||
try {
|
try {
|
||||||
|
@ -699,7 +699,7 @@ public class EldDocHtmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeAttributeHandler(File basePath,ElementAttributeHandler attr,ElementLanguageModule mod) throws IOException {
|
public void writeAttributeHandler(File basePath,ElementAttributeHandler attr,X4OLanguageModule mod) throws IOException {
|
||||||
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"attr",attr.getId()+".html");
|
PrintWriter pw = createPrintWriter(basePath,mod.getId(),"attr",attr.getId()+".html");
|
||||||
String pathPrefix = "../../";
|
String pathPrefix = "../../";
|
||||||
try {
|
try {
|
||||||
|
@ -812,7 +812,7 @@ public class EldDocHtmlWriter {
|
||||||
printTableEnd(pw);
|
printTableEnd(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printNamespaces(PrintWriter pw,List<ElementNamespaceContext> namespaces,String pathPrefix ,ElementLanguageModule mod) {
|
private void printNamespaces(PrintWriter pw,List<ElementNamespaceContext> namespaces,String pathPrefix ,X4OLanguageModule mod) {
|
||||||
printTableStart(pw,"Namespaces");
|
printTableStart(pw,"Namespaces");
|
||||||
for (ElementNamespaceContext ns:namespaces) {
|
for (ElementNamespaceContext ns:namespaces) {
|
||||||
printTableRowOverview(pw,pathPrefix+toSafeUri(mod.getId())+"/"+toSafeUri(ns.getId())+"/index.html",ns.getId(),"<b>"+ns.getUri()+"</b><br/>"+TAB+ns.getName());
|
printTableRowOverview(pw,pathPrefix+toSafeUri(mod.getId())+"/"+toSafeUri(ns.getId())+"/index.html",ns.getId(),"<b>"+ns.getUri()+"</b><br/>"+TAB+ns.getName());
|
||||||
|
@ -1028,8 +1028,8 @@ public class EldDocHtmlWriter {
|
||||||
pw.print("\t\t<td class=\"NavBarCell1\"><a href=\""+pathPrefix+"tree-overview.html\">Tree</a> </td>\n");
|
pw.print("\t\t<td class=\"NavBarCell1\"><a href=\""+pathPrefix+"tree-overview.html\">Tree</a> </td>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
class ElementLanguageModuleComparator implements Comparator<ElementLanguageModule> {
|
class ElementLanguageModuleComparator implements Comparator<X4OLanguageModule> {
|
||||||
public int compare(ElementLanguageModule o1,ElementLanguageModule o2) {
|
public int compare(X4OLanguageModule o1,X4OLanguageModule o2) {
|
||||||
return o1.getId().compareTo(o2.getId());
|
return o1.getId().compareTo(o2.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue