Fixed loader bug and refactory module with local interface and removed

loader object from language tree.
This commit is contained in:
Willem Cazander 2014-03-07 15:26:54 +01:00
parent 5f08acb488
commit cad493bc69
14 changed files with 315 additions and 219 deletions

View file

@ -33,6 +33,7 @@ import org.x4o.xml.io.X4OConnectionException;
import org.x4o.xml.io.X4OReader; import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguage; import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageModule; import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLocal;
import org.x4o.xml.lang.X4OLanguageSession; import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageModuleLoader; import org.x4o.xml.lang.X4OLanguageModuleLoader;
import org.x4o.xml.lang.X4OLanguageModuleLoaderException; import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
@ -78,7 +79,7 @@ public class EldModuleLoader implements X4OLanguageModuleLoader {
* @throws X4OLanguageModuleLoaderException When eld language could not be loaded. * @throws X4OLanguageModuleLoaderException When eld language could not be loaded.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModuleLocal languageModule) throws X4OLanguageModuleLoaderException {
logger.fine("Loading name eld file from resource: "+eldResource); logger.fine("Loading name eld file from resource: "+eldResource);
try { try {
X4ODriver<?> driver = null; X4ODriver<?> driver = null;

View file

@ -26,7 +26,6 @@ import java.util.logging.Logger;
import org.x4o.xml.conv.ObjectConverter; import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.text.ClassConverter; import org.x4o.xml.conv.text.ClassConverter;
import org.x4o.xml.eld.lang.AttributeAliasElement; import org.x4o.xml.eld.lang.AttributeAliasElement;
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;
@ -37,20 +36,18 @@ 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.ElementNamespaceBindingHandler; import org.x4o.xml.eld.lang.ElementNamespaceBindingHandler;
import org.x4o.xml.eld.lang.ModuleElement; import org.x4o.xml.eld.lang.ModuleElement;
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.ElementNamespace; import org.x4o.xml.element.ElementNamespace;
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.X4OLanguage; import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageLocal; import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.lang.X4OLanguageClassLoader; import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLoader; import org.x4o.xml.lang.X4OLanguageModuleLoader;
import org.x4o.xml.lang.X4OLanguageModuleLoaderException; import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
import org.x4o.xml.lang.X4OLanguageModuleLocal;
/** /**
* EldModuleLoaderCore provides a few basic elements for the core eld x4o language. * EldModuleLoaderCore provides a few basic elements for the core eld x4o language.
@ -90,7 +87,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
* @param languageModule The module to load it in. * @param languageModule The module to load it in.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModuleLocal languageModule) throws X4OLanguageModuleLoaderException {
// Config module meta data // Config module meta data
configLanguageModule(languageModule); configLanguageModule(languageModule);
@ -193,15 +190,14 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
namespace.addElementClass(ec); namespace.addElementClass(ec);
} }
private void configLanguageModule(X4OLanguageModule languageModule) { private void configLanguageModule(X4OLanguageModuleLocal languageModule) {
languageModule.setId("cel-module"); languageModule.setId("cel-module");
languageModule.setProviderName("Core Element Languag Module"); languageModule.setProviderName("Core Element Languag Module");
languageModule.setProviderHost(PP_CEL_PROVIDER_HOST); languageModule.setProviderHost(PP_CEL_PROVIDER_HOST);
languageModule.setDescription("Core Element Language Module Loader"); languageModule.setDescription("Core Element Language Module Loader");
languageModule.setSourceResource(this.getClass().getSimpleName()); //TODO: check if oke.
} }
private void startAndAddNamespace(X4OLanguageLocal language,X4OLanguageModule languageModule,ElementNamespace namespace) throws X4OLanguageModuleLoaderException { private void startAndAddNamespace(X4OLanguageLocal language,X4OLanguageModuleLocal languageModule,ElementNamespace namespace) throws X4OLanguageModuleLoaderException {
try { try {
namespace.getElementNamespaceInstanceProvider().start(language, namespace); namespace.getElementNamespaceInstanceProvider().start(language, namespace);
} catch (ElementNamespaceInstanceProviderException e) { } catch (ElementNamespaceInstanceProviderException e) {
@ -287,7 +283,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
* @param id The handler id. * @param id The handler id.
* @param description The handler descripion. * @param description The handler descripion.
*/ */
private void addBindingHandler(X4OLanguageModule languageModule,ElementBindingHandler handler,String id,String description) { private void addBindingHandler(X4OLanguageModuleLocal languageModule,ElementBindingHandler handler,String id,String description) {
handler.setId(id); handler.setId(id);
handler.setDescription(description); handler.setDescription(description);
languageModule.addElementBindingHandler(handler); languageModule.addElementBindingHandler(handler);

View file

@ -32,9 +32,9 @@ import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementNamespace; import org.x4o.xml.element.ElementNamespace;
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.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageClassLoader; import org.x4o.xml.lang.X4OLanguageClassLoader;
import org.x4o.xml.lang.X4OLanguageModuleLocal;
/** /**
* An ParentLanguageElementConfigurator. * An ParentLanguageElementConfigurator.
@ -44,7 +44,7 @@ import org.x4o.xml.lang.X4OLanguageClassLoader;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Jan 19, 2007 * @version 1.0 Jan 19, 2007
*/ */
public class ElementModuleBindingHandler extends AbstractElementBindingHandler<X4OLanguageModule> { public class ElementModuleBindingHandler extends AbstractElementBindingHandler<X4OLanguageModuleLocal> {
private final static Class<?>[] CLASSES_CHILD = new Class[] { private final static Class<?>[] CLASSES_CHILD = new Class[] {
ElementInterface.class, ElementInterface.class,
@ -58,7 +58,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 X4OLanguageModule.class; return X4OLanguageModuleLocal.class;
} }
/** /**
@ -71,7 +71,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement,X4OLanguageModule languageModule, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement,X4OLanguageModuleLocal languageModule, Object childObject) throws ElementBindingHandlerException {
X4OLanguage x4oParsingContext = EldModuleLoader.getLanguage(childElement.getLanguageSession()); X4OLanguage x4oParsingContext = EldModuleLoader.getLanguage(childElement.getLanguageSession());
if (x4oParsingContext==null) { if (x4oParsingContext==null) {
@ -159,7 +159,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
public void createChilderen(Element parentElement,X4OLanguageModule parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement,X4OLanguageModuleLocal parent) throws ElementBindingHandlerException {
for (ElementInterface child:parent.getElementInterfaces()) { for (ElementInterface child:parent.getElementInterfaces()) {
createChild(parentElement, child); createChild(parentElement, child);
} }

View file

@ -42,6 +42,7 @@ import org.x4o.xml.element.ElementNamespace;
import org.x4o.xml.element.ElementNamespaceInstanceProvider; import org.x4o.xml.element.ElementNamespaceInstanceProvider;
import org.x4o.xml.io.sax.ext.ContentWriter; import org.x4o.xml.io.sax.ext.ContentWriter;
import org.x4o.xml.lang.X4OLanguageModule; import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLoaderResult;
import org.x4o.xml.lang.X4OLanguageSession; import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageConfiguration; import org.x4o.xml.lang.X4OLanguageConfiguration;
import org.x4o.xml.lang.phase.X4OPhase; import org.x4o.xml.lang.phase.X4OPhase;
@ -223,13 +224,20 @@ public class X4ODebugWriter {
atts.addAttribute ("", "id", "", "", module.getId()); atts.addAttribute ("", "id", "", "", module.getId());
atts.addAttribute ("", "providerName", "", "", module.getProviderName()); atts.addAttribute ("", "providerName", "", "", module.getProviderName());
atts.addAttribute ("", "providerHost", "", "", module.getProviderHost()); atts.addAttribute ("", "providerHost", "", "", module.getProviderHost());
if (module.getLanguageModuleLoader()==null) {
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", "null");
} else {
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", module.getLanguageModuleLoader().getClass().getName());
}
contentWriter.startElement (DEBUG_URI, "ElementLanguageModule", "", atts); contentWriter.startElement (DEBUG_URI, "ElementLanguageModule", "", atts);
for (X4OLanguageModuleLoaderResult result:X4OLanguageModuleLoaderResult.values()) {
String value = module.getLoaderResult(result);
if (value==null) {
continue;
}
atts = new AttributesImpl();
atts.addAttribute ("", "resultKey", "", "", result.name());
atts.addAttribute ("", "resultValue", "", "", value);
contentWriter.startElement (DEBUG_URI, "ElementLanguageModuleResult", "", atts);
contentWriter.endElement(DEBUG_URI, "ElementLanguageModuleResult", "");
}
debugElementConfiguratorGlobal(module.getElementConfiguratorGlobals()); debugElementConfiguratorGlobal(module.getElementConfiguratorGlobals());
debugElementBindingHandler(module.getElementBindingHandlers()); debugElementBindingHandler(module.getElementBindingHandlers());

View file

@ -40,18 +40,17 @@ import org.x4o.xml.element.ElementNamespace;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Aug 2, 2012 * @version 1.0 Aug 2, 2012
*/ */
public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase implements X4OLanguageModule { public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase implements X4OLanguageModuleLocal {
private Logger logger = null; private Logger logger = null;
private String providerName=null; private String providerName=null;
private String providerHost=null; private String providerHost=null;
private String sourceResource = null;
private List<ElementBindingHandler> elementBindingHandlers = null; private List<ElementBindingHandler> elementBindingHandlers = null;
private List<ElementConfiguratorGlobal> elementConfiguratorGlobals = null; private List<ElementConfiguratorGlobal> elementConfiguratorGlobals = null;
private List<ElementInterface> elementInterfaces = null; private List<ElementInterface> elementInterfaces = null;
private Map<String,ElementNamespace> elementNamespaces = null; private Map<String,ElementNamespace> elementNamespaces = null;
private X4OLanguageModuleLoader elementLanguageModuleLoader = null; private Map<X4OLanguageModuleLoaderResult,String> loaderResults = null;
/** /**
* Creates a new empty ElementLanguage. * Creates a new empty ElementLanguage.
@ -63,6 +62,7 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
elementConfiguratorGlobals = new ArrayList<ElementConfiguratorGlobal>(4); elementConfiguratorGlobals = new ArrayList<ElementConfiguratorGlobal>(4);
elementInterfaces = new ArrayList<ElementInterface>(20); elementInterfaces = new ArrayList<ElementInterface>(20);
elementNamespaces = new HashMap<String,ElementNamespace>(10); elementNamespaces = new HashMap<String,ElementNamespace>(10);
loaderResults = new HashMap<X4OLanguageModuleLoaderResult,String>(10);
} }
/** /**
@ -194,41 +194,16 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
} }
/** /**
* @return the elementLanguageModuleLoader * @see org.x4o.xml.lang.X4OLanguageModule#getLoaderResult(org.x4o.xml.lang.X4OLanguageModuleLoaderResult)
*/ */
public X4OLanguageModuleLoader getLanguageModuleLoader() { public String getLoaderResult(X4OLanguageModuleLoaderResult key) {
return elementLanguageModuleLoader; return loaderResults.get(key);
} }
/** /**
* @param elementLanguageModuleLoader the elementLanguageModuleLoader to set * @see org.x4o.xml.lang.X4OLanguageModuleLocal#putLoaderResult(org.x4o.xml.lang.X4OLanguageModuleLoaderResult, java.lang.String)
*/ */
public void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader) { public void putLoaderResult(X4OLanguageModuleLoaderResult key, String value) {
this.elementLanguageModuleLoader = elementLanguageModuleLoader; loaderResults.put(key, value);
}
/**
* @return the sourceResource
*/
public String getSourceResource() {
return sourceResource;
}
/**
* @param sourceResource the sourceResource to set
*/
public void setSourceResource(String sourceResource) {
this.sourceResource = sourceResource;
}
/**
* Reloads the module, experiment !!
*/
public void reloadModule(X4OLanguageLocal elementLanguage,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException {
elementBindingHandlers.clear();
elementInterfaces.clear();
elementNamespaces.clear();
getLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
} }
} }

View file

@ -26,14 +26,14 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.logging.Logger; 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.lang.phase.X4OPhaseLanguageInit.X4OPhaseInitLanguageSiblings;
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;
@ -50,14 +50,14 @@ import org.xml.sax.helpers.XMLReaderFactory;
public class DefaultX4OLanguageLoader implements X4OLanguageLoader { public class DefaultX4OLanguageLoader implements X4OLanguageLoader {
private Logger logger = null; private Logger logger = null;
protected List<Map<String,Map<String,String>>> modulesAll = null; protected List<VersionedResources> modulesAll = null;
/** /**
* Creates the DefaultX4OLanguageLoader. * Creates the DefaultX4OLanguageLoader.
*/ */
public DefaultX4OLanguageLoader() { public DefaultX4OLanguageLoader() {
logger = Logger.getLogger(DefaultX4OLanguageLoader.class.getName()); logger = Logger.getLogger(DefaultX4OLanguageLoader.class.getName());
modulesAll = new ArrayList<Map<String,Map<String,String>>>(20); modulesAll = new ArrayList<VersionedResources>(20);
} }
/** /**
@ -82,76 +82,104 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
* @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.lang.X4OLanguageLocal, java.lang.String, java.lang.String) * @see org.x4o.xml.lang.X4OLanguageLoader#loadLanguage(org.x4o.xml.lang.X4OLanguageLocal, java.lang.String, java.lang.String)
*/ */
public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException { public void loadLanguage(X4OLanguageLocal languageLocal, String language,String languageVersion) throws X4OLanguageLoaderException {
try {
logger.finer("Loading all modules for language: "+language); logger.finer("Loading all modules for language: "+language);
try {
loadLanguageModules(languageLocal,language); loadLanguageModules(languageLocal,language);
} catch (IOException e) {
throw new X4OLanguageLoaderException(e);
} catch (SAXException e) {
throw new X4OLanguageLoaderException(e);
}
X4OLanguageVersionFilter lvf = (X4OLanguageVersionFilter)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultLanguageVersionFilter()); X4OLanguageVersionFilter lvf;
try {
for (Map<String,Map<String,String>> map:modulesAll) { lvf = (X4OLanguageVersionFilter)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultLanguageVersionFilter());
List<String> versions = new ArrayList<String>(map.keySet()); } catch (InstantiationException e) {
throw new X4OLanguageLoaderException(e);
} catch (IllegalAccessException e) {
throw new X4OLanguageLoaderException(e);
}
int loaded = 0;
for (VersionedResources versionedResources:modulesAll) {
List<String> versions = new ArrayList<String>();
versions.add(versionedResources.version); // FIXME
String modulesVersion = lvf.filterVersion(languageVersion, versions); String modulesVersion = lvf.filterVersion(languageVersion, versions);
if (modulesVersion==null) { if (modulesVersion==null) {
throw new X4OLanguageLoaderException("No modules config for version: "+languageVersion);
}
Map<String,String> modules = map.get(modulesVersion);
logger.finer("Filtered modules to version: "+modulesVersion);
if (modules==null) {
throw new X4OLanguageLoaderException("No modules defined for version: "+modulesVersion);
}
for (String key:modules.keySet()) {
String value = modules.get(key);
X4OLanguageModule module = (X4OLanguageModule)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
module.setSourceResource(value);
logMessage(languageLocal,"Parsing language config key: "+key+" value: "+value);
if ("module-loader".equals(key)) {
try {
module.setLanguageModuleLoader( (X4OLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance() );
} catch (Exception ee) {
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
}
} else if ("eld-resource".equals(key)) {
String languagePrefix = languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix();
String resource = languagePrefix+"/"+language+"/"+value;
if (language.equals(EldDriver.LANGUAGE_NAME)) {
module.setLanguageModuleLoader(new EldModuleLoader(resource,true)); // load cel
} else {
module.setLanguageModuleLoader(new EldModuleLoader(resource,false)); // load eld
}
module.setSourceResource(resource);
} else if ("elb-resource".equals(key)) {
// todo
logger.finer("elb-resources are not done yet.");
} else if ("sibling-loader".equals(key)) {
try {
module.setLanguageModuleLoader( (X4OLanguageModuleLoaderSibling)X4OLanguageClassLoader.loadClass(value).newInstance() );
} catch (Exception ee) {
throw new SAXException("Could not load: "+value+" error: "+ee.getMessage(),ee);
}
}
if (module.getLanguageModuleLoader()==null) {
logger.warning("module with null loader: "+module+" tag: "+key+" chars: "+value);
continue; continue;
} }
// mmm start in order ? X4OLanguageModuleLoader loader;
logMessage(languageLocal,"Starting modules: "+module+" for language: "+language); for (String value:versionedResources.eldResources) {
module.getLanguageModuleLoader().loadLanguageModule(languageLocal, module); String languagePrefix = languageLocal.getLanguageConfiguration().getLanguageResourcePathPrefix();
String resource = languagePrefix+"/"+language+"/"+value;
if (language.equals(EldDriver.LANGUAGE_NAME)) {
loader = new EldModuleLoader(resource,true); // load cel
} else {
loader = new EldModuleLoader(resource,false); // load eld
}
loadModule(languageLocal,loader,value,versionedResources);
}
for (String value:versionedResources.moduleLoaders) {
try {
loader = (X4OLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance();
} catch (Exception ee) {
throw new X4OLanguageLoaderException("Could not load class: "+value+" error: "+ee.getMessage(),ee);
}
loadModule(languageLocal,loader,value,versionedResources);
}
for (String value:versionedResources.siblingLoaders) {
try {
loader = (X4OLanguageModuleLoader)X4OLanguageClassLoader.loadClass(value).newInstance();
} catch (Exception ee) {
throw new X4OLanguageLoaderException("Could not load class: "+value+" error: "+ee.getMessage(),ee);
}
loadModule(languageLocal,loader,value,versionedResources);
if (loader instanceof X4OLanguageModuleLoaderSibling) {
X4OPhaseInitLanguageSiblings sibPhase = (X4OPhaseInitLanguageSiblings)languageLocal.getPhaseManager().getPhase("INIT_LANG_SIB");
sibPhase.addLanguageModuleLoaderSibling((X4OLanguageModuleLoaderSibling)loader);
}
}
for (String value:versionedResources.elbResources) {
// TODO: add elb support
logger.finer("elb-resources are not done yet; "+value);
}
loaded++;
}
if (loaded==0) {
throw new X4OLanguageLoaderException("No modules defined for version: "+languageVersion);
}
}
private void loadModule(X4OLanguageLocal languageLocal,X4OLanguageModuleLoader loader,String resource,VersionedResources versionedResources) throws X4OLanguageLoaderException {
X4OLanguageModuleLocal module;
try {
module = (X4OLanguageModuleLocal)X4OLanguageClassLoader.newInstance(languageLocal.getLanguageConfiguration().getDefaultElementLanguageModule());
} catch (InstantiationException e) {
throw new X4OLanguageLoaderException(e);
} catch (IllegalAccessException e) {
throw new X4OLanguageLoaderException(e);
}
logMessage(languageLocal,"Created module: "+module);
long startTime = System.currentTimeMillis();
try {
logMessage(languageLocal,"Starting modules: "+module+" for language: "+languageLocal.getLanguageName());
loader.loadLanguageModule(languageLocal, module);
} catch (X4OLanguageModuleLoaderException e) {
throw new X4OLanguageLoaderException(e); // FIXME info
}
long totalTime = System.currentTimeMillis() - startTime;
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_TIME, ""+totalTime);
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_VERSION, versionedResources.version);
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_CLASS, loader.getClass().getName());
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_DATE, ""+new Date());
if (resource!=null) {
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_MODULE_RESOURCE, resource);
}
module.putLoaderResult(X4OLanguageModuleLoaderResult.LOAD_FROM_RESOURCE, versionedResources.loadedFrom);
languageLocal.addLanguageModule(module); languageLocal.addLanguageModule(module);
} }
}
} catch (Exception e1) {
throw new X4OLanguageLoaderException(e1.getMessage()+" for language: "+language,e1);
}
}
/** /**
* Loads all modules of an language. * Loads all modules of an language.
@ -172,14 +200,14 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
while(e.hasMoreElements()) { while(e.hasMoreElements()) {
URL u = e.nextElement(); URL u = e.nextElement();
logMessage(languageLocal,"Loading relative modules: "+u+" for: "+language); logMessage(languageLocal,"Loading relative modules: "+u+" for: "+language);
loadModulesXml(u.openStream()); loadModulesXml(u.openStream(),u.toString());
} }
e = Thread.currentThread().getContextClassLoader().getResources("/"+buf.toString()); e = Thread.currentThread().getContextClassLoader().getResources("/"+buf.toString());
while(e.hasMoreElements()) { while(e.hasMoreElements()) {
URL u = e.nextElement(); URL u = e.nextElement();
logMessage(languageLocal,"Loading root modules: "+u+" for: "+language); logMessage(languageLocal,"Loading root modules: "+u+" for: "+language);
loadModulesXml(u.openStream()); loadModulesXml(u.openStream(),u.toString());
} }
} }
@ -189,11 +217,11 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
* @throws IOException * @throws IOException
* @throws SAXException * @throws SAXException
*/ */
private void loadModulesXml(InputStream in) throws IOException, SAXException { protected void loadModulesXml(InputStream in,String loadedFrom) throws IOException, SAXException {
if (in==null) { if (in==null) {
throw new NullPointerException("Can't parse null input stream"); throw new NullPointerException("Can't parse null input stream");
} }
ModulesTagHandler xth = new ModulesTagHandler(); ModulesTagHandler xth = new ModulesTagHandler(loadedFrom);
XMLReader saxParser = XMLReaderFactory.createXMLReader(); XMLReader saxParser = XMLReaderFactory.createXMLReader();
saxParser.setContentHandler(xth); saxParser.setContentHandler(xth);
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", xth); saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", xth);
@ -207,17 +235,24 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
private class ModulesTagHandler extends DefaultHandler2 { private class ModulesTagHandler extends DefaultHandler2 {
private StringBuffer buf = new StringBuffer(); private StringBuffer buf = new StringBuffer();
private String version = null; private String loadedFrom = null;
private VersionedResources versionedResources = null;
public ModulesTagHandler(String loadedFrom) {
this.loadedFrom=loadedFrom;
}
@Override @Override
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
modulesAll.add(new HashMap<String,Map<String,String>>(20));
} }
@Override @Override
public void startElement(String namespaceUri, String tag, String qName,Attributes attr) throws SAXException { public void startElement(String namespaceUri, String tag, String qName,Attributes attr) throws SAXException {
if ("language".equals(tag)) { if ("language".equals(tag)) {
version = attr.getValue("version"); String version = attr.getValue("version");
versionedResources = new VersionedResources();
versionedResources.version=version;
versionedResources.loadedFrom=loadedFrom;
logger.finest("Version attribute: "+version); logger.finest("Version attribute: "+version);
} }
} }
@ -234,19 +269,23 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
return; return;
} }
if ("language".equals(tag)) { if ("language".equals(tag)) {
modulesAll.add(versionedResources);
versionedResources = null;
return; return;
} }
if (version==null) { if (versionedResources==null) {
return; return;
} }
// Store in key map if ("eld-resource".equals(tag)) {
Map<String,String> modules = modulesAll.get(modulesAll.size()-1).get(version); versionedResources.eldResources.add(value);
if (modules==null) { } else if ("module-loader".equals(tag)) {
modules = new HashMap<String,String>(20); versionedResources.moduleLoaders.add(value);
modulesAll.get(modulesAll.size()-1).put(version, modules); } else if ("elb-resource".equals(tag)) {
versionedResources.elbResources.add(value);
} else if ("sibling-loader".equals(tag)) {
versionedResources.siblingLoaders.add(value);
} }
modules.put(tag, value);
logger.finest("Stored tag: "+tag+" value: "+value); logger.finest("Stored tag: "+tag+" value: "+value);
} }
@ -259,4 +298,13 @@ TODO: if (language.getLanguageConfiguration().hasX4ODebugWriter()) {
buf.append(text); buf.append(text);
} }
} }
private class VersionedResources {
public String version;
public String loadedFrom;
public List<String> eldResources = new ArrayList<String>(5);
public List<String> moduleLoaders = new ArrayList<String>(5);
public List<String> elbResources = new ArrayList<String>(5);
public List<String> siblingLoaders = new ArrayList<String>(5);
}
} }

View file

@ -27,7 +27,6 @@ import java.util.List;
import org.x4o.xml.element.ElementBindingHandler; import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementConfiguratorGlobal; import org.x4o.xml.element.ElementConfiguratorGlobal;
import org.x4o.xml.element.ElementInterface; import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementMetaBase;
import org.x4o.xml.element.ElementNamespace; import org.x4o.xml.element.ElementNamespace;
/** /**
@ -37,70 +36,40 @@ import org.x4o.xml.element.ElementNamespace;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Aug 2, 2012 * @version 1.0 Aug 2, 2012
*/ */
public interface X4OLanguageModule extends ElementMetaBase { public interface X4OLanguageModule /* extends ElementMetaBase TODO add local layer? */ {
// temp here see local
String getId();
String getDescription();
/** /**
* @return the providerName. * @return the providerName.
*/ */
String getProviderName(); String getProviderName();
/**
* @param providerName the providerName to set.
*/
void setProviderName(String providerName);
/** /**
* @return the providerHost * @return the providerHost
*/ */
String getProviderHost(); String getProviderHost();
/**
* @param providerHost the providerHost to set
*/
void setProviderHost(String providerHost);
/**
* Adds an ElementBindingHanlder.
* @param elementBindingHandler The ElementBindingHandler to add.
*/
void addElementBindingHandler(ElementBindingHandler elementBindingHandler);
/** /**
* Gets all ElementBindingHandlers. * Gets all ElementBindingHandlers.
* @return Returns an List with all ElementBindingHandlers. * @return Returns an List with all ElementBindingHandlers.
*/ */
List<ElementBindingHandler> getElementBindingHandlers(); List<ElementBindingHandler> getElementBindingHandlers();
/**
* Adds an ElementConfiguratorGlobal.
* @param elementConfigurator The ElementConfigurtor to add.
*/
void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator);
/** /**
* Gets all ElementConfiguratorGlobals. * Gets all ElementConfiguratorGlobals.
* @return All gloval ElementConfigurators. * @return All gloval ElementConfigurators.
*/ */
List<ElementConfiguratorGlobal> getElementConfiguratorGlobals(); List<ElementConfiguratorGlobal> getElementConfiguratorGlobals();
/**
* Adds an ElementInterface.
* @param elementInterface The elementInterface to add.
*/
void addElementInterface(ElementInterface elementInterface);
/** /**
* Returns list of ElementInterfaces in this context. * Returns list of ElementInterfaces in this context.
* @return The list of elementInterfaces. * @return The list of elementInterfaces.
*/ */
List<ElementInterface> getElementInterfaces(); List<ElementInterface> getElementInterfaces();
/**
* Adds an namespace to this langauge module.
* @param elementNamespace Adds an ElementNamespace to this langauge module.
*/
void addElementNamespace(ElementNamespace elementNamespace);
/** /**
* Returns the namespace context for an namespace uri. * Returns the namespace context for an namespace uri.
* @param namespaceUri the namespace uri. * @param namespaceUri the namespace uri.
@ -114,31 +83,9 @@ public interface X4OLanguageModule extends ElementMetaBase {
List<ElementNamespace> getElementNamespaces(); List<ElementNamespace> getElementNamespaces();
/** /**
* @param elementLanguageModuleLoader Sets the loader of this module. * Gets module loader meta result info.
*/ * @param key The key to get info of.
void setLanguageModuleLoader(X4OLanguageModuleLoader elementLanguageModuleLoader); * @return The value of the info.
/**
* @return Returns the ElementLanguageModuleLoader of this module.
*/
X4OLanguageModuleLoader getLanguageModuleLoader();
/**
* @return the sourceResource
*/
String getSourceResource();
/**
* @param sourceResource the sourceResource to set
*/
void setSourceResource(String sourceResource);
/*
*
* @param elementLanguage
* @param elementLanguageModule
* @throws ElementLanguageModuleLoaderException
void reloadModule(ElementLanguage elementLanguage,ElementLanguageModule elementLanguageModule) throws ElementLanguageModuleLoaderException;
*/ */
String getLoaderResult(X4OLanguageModuleLoaderResult key);
} }

View file

@ -33,9 +33,9 @@ public interface X4OLanguageModuleLoader {
/** /**
* Starts the ElementProvider. * Starts the ElementProvider.
* @param languageLocal The ElementLanguage to load for. * @param language The ElementLanguage to load for.
* @param elementLanguageModule The ElementLanguageModule to load it into. * @param module The ElementLanguageModule to load it into.
* @throws X4OLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded. * @throws X4OLanguageModuleLoaderException Gets thrown when modules could not be correctly loaded.
*/ */
void loadLanguageModule(X4OLanguageLocal languageLocal,X4OLanguageModule elementLanguageModule) throws X4OLanguageModuleLoaderException; void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModuleLocal module) throws X4OLanguageModuleLoaderException;
} }

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2004-2013, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.lang;
/**
* X4OLanguageModuleLoaderResult are keys of meta info results from the loader which loaded the module.
*
* @author Willem Cazander
* @version 1.0 Mar 7, 2014
*/
public enum X4OLanguageModuleLoaderResult {
LOAD_MODULE_RESOURCE,
LOAD_FROM_RESOURCE,
LOAD_VERSION,
LOAD_CLASS,
LOAD_TIME,
LOAD_DATE;
}

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 2004-2013, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.lang;
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.ElementNamespace;
/**
* The ElementLanguageModuleLocal is for local loading of the object.
*
* @author Willem Cazander
* @version 1.0 Mar 7, 2014
*/
public interface X4OLanguageModuleLocal extends X4OLanguageModule,ElementMetaBase {
/**
* @param providerName the providerName to set.
*/
void setProviderName(String providerName);
/**
* @param providerHost the providerHost to set
*/
void setProviderHost(String providerHost);
/**
* Adds an ElementBindingHanlder.
* @param elementBindingHandler The ElementBindingHandler to add.
*/
void addElementBindingHandler(ElementBindingHandler elementBindingHandler);
/**
* Adds an ElementConfiguratorGlobal.
* @param elementConfigurator The ElementConfigurtor to add.
*/
void addElementConfiguratorGlobal(ElementConfiguratorGlobal elementConfigurator);
/**
* Adds an ElementInterface.
* @param elementInterface The elementInterface to add.
*/
void addElementInterface(ElementInterface elementInterface);
/**
* Adds an namespace to this langauge module.
* @param elementNamespace Adds an ElementNamespace to this langauge module.
*/
void addElementNamespace(ElementNamespace elementNamespace);
/**
* Sets module loader meta result info.
* @param key The key of the info.
* @param value The value of the info.
*/
void putLoaderResult(X4OLanguageModuleLoaderResult key,String value);
}

View file

@ -27,7 +27,6 @@ import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.x4o.xml.element.Element; import org.x4o.xml.element.Element;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageSession; import org.x4o.xml.lang.X4OLanguageSession;
import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling; import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling;
import org.x4o.xml.lang.X4OLanguageClassLoader; import org.x4o.xml.lang.X4OLanguageClassLoader;
@ -115,7 +114,12 @@ public class X4OPhaseLanguageInit {
/** /**
* Loads all sibling languages. * Loads all sibling languages.
*/ */
class X4OPhaseInitLanguageSiblings extends AbstractX4OPhase { public class X4OPhaseInitLanguageSiblings extends AbstractX4OPhase {
private List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(2);
// mmmm think of better then cast
public void addLanguageModuleLoaderSibling(X4OLanguageModuleLoaderSibling loader) {
siblingLoaders.add(loader);
}
public X4OPhaseType getType() { public X4OPhaseType getType() {
return X4OPhaseType.INIT; return X4OPhaseType.INIT;
} }
@ -132,12 +136,6 @@ public class X4OPhaseLanguageInit {
} }
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException { public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
try { try {
List<X4OLanguageModuleLoaderSibling> siblingLoaders = new ArrayList<X4OLanguageModuleLoaderSibling>(3);
for (X4OLanguageModule module:languageSession.getLanguage().getLanguageModules()) {
if (module.getLanguageModuleLoader() instanceof X4OLanguageModuleLoaderSibling) {
siblingLoaders.add((X4OLanguageModuleLoaderSibling)module.getLanguageModuleLoader());
}
}
if (siblingLoaders.isEmpty()==false) { if (siblingLoaders.isEmpty()==false) {
X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader()); X4OLanguageLoader loader = (X4OLanguageLoader)X4OLanguageClassLoader.newInstance(languageSession.getLanguage().getLanguageConfiguration().getDefaultLanguageLoader());
for (X4OLanguageModuleLoaderSibling siblingLoader:siblingLoaders) { for (X4OLanguageModuleLoaderSibling siblingLoader:siblingLoaders) {
@ -147,6 +145,7 @@ public class X4OPhaseLanguageInit {
if (languageSession.hasX4ODebugWriter()) { if (languageSession.hasX4ODebugWriter()) {
languageSession.getX4ODebugWriter().debugElementLanguageModules(languageSession); languageSession.getX4ODebugWriter().debugElementLanguageModules(languageSession);
} }
siblingLoaders.clear();
} }
} catch (Exception e) { } catch (Exception e) {
throw new X4OPhaseException(this,e); throw new X4OPhaseException(this,e);

View file

@ -45,14 +45,14 @@ import junit.framework.TestCase;
public class DefaultX4OLanguageLoaderTest extends TestCase { public class DefaultX4OLanguageLoaderTest extends TestCase {
X4ODriver<TestObjectRoot> driver; X4ODriver<TestObjectRoot> driver;
X4OLanguageLoader loader; DefaultX4OLanguageLoader loader;
public void setUp() throws Exception { public void setUp() throws Exception {
driver = TestDriver.getInstance(); driver = TestDriver.getInstance();
//X4OReader<TestObjectRoot> reader = driver.createReader(); //X4OReader<TestObjectRoot> reader = driver.createReader();
//reader.readResource("tests/namespace/uri-simple.xml"); //reader.readResource("tests/namespace/uri-simple.xml");
X4OLanguage language = driver.createLanguage(); X4OLanguage language = driver.createLanguage();
loader = (X4OLanguageLoader)language.getLanguageConfiguration().getDefaultLanguageLoader().newInstance(); loader = (DefaultX4OLanguageLoader)language.getLanguageConfiguration().getDefaultLanguageLoader().newInstance();
} }
@ -80,6 +80,10 @@ public class DefaultX4OLanguageLoaderTest extends TestCase {
loader.loadLanguage((X4OLanguageLocal)result, "test", "1.0"); loader.loadLanguage((X4OLanguageLocal)result, "test", "1.0");
} }
public void testLanguag() throws Exception {
// loader.loadModulesXml(in);
}
/* /*
public void testLanguageURINameSpaceTest() throws Exception { public void testLanguageURINameSpaceTest() throws Exception {
Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "test"); Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "test");

View file

@ -22,12 +22,12 @@
*/ */
package org.x4o.xml.lang.meta; package org.x4o.xml.lang.meta;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageModuleLoaderException; import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling; import org.x4o.xml.lang.X4OLanguageModuleLoaderSibling;
import org.x4o.xml.lang.X4OLanguageLoader; import org.x4o.xml.lang.X4OLanguageLoader;
import org.x4o.xml.lang.X4OLanguageLoaderException; import org.x4o.xml.lang.X4OLanguageLoaderException;
import org.x4o.xml.lang.X4OLanguageLocal; import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.lang.X4OLanguageModuleLocal;
/** /**
* MetaLanguageSiblingLoader loads the generic x4o meta language into defined language. * MetaLanguageSiblingLoader loads the generic x4o meta language into defined language.
@ -56,7 +56,7 @@ public class MetaLanguageSiblingLoader implements X4OLanguageModuleLoaderSibling
* @throws X4OLanguageModuleLoaderException Is thrown when meta language could not be loaded. * @throws X4OLanguageModuleLoaderException Is thrown when meta language could not be loaded.
* @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule) * @see org.x4o.xml.lang.X4OLanguageModuleLoader#loadLanguageModule(org.x4o.xml.lang.X4OLanguageLocal, org.x4o.xml.lang.X4OLanguageModule)
*/ */
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException { public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModuleLocal languageModule) throws X4OLanguageModuleLoaderException {
languageModule.setId(META_LANGUAGE); languageModule.setId(META_LANGUAGE);
languageModule.setProviderHost(META_LANGUAGE_HOST); languageModule.setProviderHost(META_LANGUAGE_HOST);
languageModule.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName()); languageModule.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName());

View file

@ -29,8 +29,8 @@
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv" xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd" xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="mtest.x4o.org" providerHost="mtest.x4o.org"
name="Meta Test Language" providerName="Meta Test Language"
id="mtest-lang" id="mtest-lang"
> >
<eld:namespace <eld:namespace