You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by pc...@apache.org on 2003/11/06 20:04:59 UTC
cvs commit: xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile SimpleTylarLoader.java
pcal 2003/11/06 11:04:59
Modified: v2/src/binding/org/apache/xmlbeans/impl/binding/compile
SimpleTylarLoader.java
Log:
binding: jam-related todos in SimpleTylarLoader
Revision Changes Path
1.2 +20 -4 xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/SimpleTylarLoader.java
Index: SimpleTylarLoader.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/SimpleTylarLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleTylarLoader.java 3 Nov 2003 21:58:51 -0000 1.1
+++ SimpleTylarLoader.java 6 Nov 2003 19:04:59 -0000 1.2
@@ -60,12 +60,16 @@
import org.apache.xmlbeans.impl.binding.bts.PathBindingLoader;
import org.apache.xmlbeans.impl.binding.bts.BuiltinBindingLoader;
import org.apache.xmlbeans.impl.jam.JClassLoader;
+import org.apache.xmlbeans.impl.jam.JFactory;
import org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl;
import org.apache.xmlbeans.impl.schema.PathResourceLoader;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
import java.io.File;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
public class SimpleTylarLoader implements TylarLoader
{
@@ -99,7 +103,8 @@
public static TylarLoader forClassLoader(ClassLoader loader)
{
BindingLoader bindingLoader = PathBindingLoader.forClassLoader(loader);
- JClassLoader jClassLoader = null; // todo by pcal
+ JClassLoader jClassLoader =
+ JFactory.getInstance().createClassLoader(loader,null,null);
SchemaTypeLoader sTypeLoader = XmlBeans.typeLoaderForClassLoader(loader);
return new SimpleTylarLoader(bindingLoader, jClassLoader, sTypeLoader);
@@ -108,16 +113,27 @@
public static TylarLoader forClassPath(File[] classpath)
{
BindingLoader bindingLoader = PathBindingLoader.forClasspath(classpath);
- JClassLoader jClassLoader = null; // todo by pcal
+ URL[] classpathURLs = new URL[classpath.length];
+ for(int i=0; i<classpathURLs.length; i++) {
+ try {
+ classpathURLs[i] = classpath[i].toURL();
+ } catch(MalformedURLException mue) {
+ //todo: review. MUE is unlikely, but is this the proper response?
+ throw new IllegalArgumentException("malformed path element: "+
+ classpath[i]);
+ }
+ }
+ URLClassLoader ucl = new URLClassLoader(classpathURLs);
+ JClassLoader jClassLoader =
+ JFactory.getInstance().createClassLoader(ucl,null,null);
SchemaTypeLoader sTypeLoader = SchemaTypeLoaderImpl.build(null, new PathResourceLoader(classpath), null);
-
return new SimpleTylarLoader(bindingLoader, jClassLoader, sTypeLoader);
}
public static TylarLoader forBuiltins()
{
BindingLoader bindingLoader = BuiltinBindingLoader.getInstance();
- JClassLoader jClassLoader = null; // todo by pcal
+ JClassLoader jClassLoader = JFactory.getInstance().getSystemClassLoader();
SchemaTypeLoader sTypeLoader = XmlBeans.getBuiltinTypeSystem();
return new SimpleTylarLoader(bindingLoader, jClassLoader, sTypeLoader);
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org