[jboss-cvs] JBossAS SVN: r103508 - in projects/jboss-jca/trunk: doc/developerguide/en/modules and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Apr 4 09:50:35 EDT 2010
Author: jesper.pedersen
Date: 2010-04-04 09:50:34 -0400 (Sun, 04 Apr 2010)
New Revision: 103508
Added:
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/ClassLoaderFactory.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ArchiveClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoaderRepository.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/NonExportClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentFirstClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentLastClassLoader.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/VersionComparator.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/package.html
Removed:
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelClassLoader.java
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml
projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelConfiguration.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelImpl.java
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/SecurityActions.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java
Log:
[JBJCA-305] Class loader subsystem
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -32,6 +32,8 @@
import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
import org.jboss.jca.core.connectionmanager.pool.PoolParams;
import org.jboss.jca.core.connectionmanager.pool.strategy.OnePool;
+import org.jboss.jca.fungal.api.ClassLoaderFactory;
+import org.jboss.jca.fungal.api.KernelClassLoader;
import org.jboss.jca.fungal.deployers.CloneableDeployer;
import org.jboss.jca.fungal.deployers.DeployException;
import org.jboss.jca.fungal.deployers.Deployer;
@@ -60,7 +62,6 @@
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -298,7 +299,7 @@
// Create classloader
URL[] urls = getUrls(root);
- URLClassLoader cl = SecurityActions.createURLCLassLoader(urls, parent);
+ KernelClassLoader cl = ClassLoaderFactory.create(ClassLoaderFactory.TYPE_PARENT_LAST, urls, parent);
SecurityActions.setThreadContextClassLoader(cl);
// Parse metadata
Modified: projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml
===================================================================
--- projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml 2010-04-04 13:50:34 UTC (rev 103508)
@@ -335,7 +335,7 @@
<section id="fungal_classloading">
<title>Classloading</title>
- <para>JBoss JCA/Fungal features a simple 3-level classloader model:</para>
+ <para>JBoss JCA/Fungal features a 3-tier classloader model:</para>
<orderedlist>
<listitem>
@@ -345,16 +345,54 @@
</listitem>
<listitem>
<para>Kernel classloader (KernelCL).</para>
- <para>An URLClassLoader based class loader with AppCL as its parent which loads
+ <para>A class loader with AppCL as its parent which loads
all libraries used by the kernel.</para>
</listitem>
<listitem>
<para>Deployment classloader (DCL).</para>
- <para>Each deployment is running in its own classloader with
- KernelCL as its parent.</para>
+ <para>Each deployment can run in its own classloader with KernelCL as its parent.</para>
</listitem>
</orderedlist>
+ <section id="fungal_classloading_types">
+ <title>Class loader types</title>
+
+ <para>The JBoss JCA/Fungal kernel class loader mechanisms are controlled through
+ the</para>
+
+ <programlisting>
+org.jboss.jca.fungal.api.ClassLoaderFactory
+ </programlisting>
+
+ <para>class which creates class loaders based on the parameters given.</para>
+
+ <para>The following types are supported:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><code>TYPE_PARENT_FIRST</code></para>
+ <para>The parent class loader is checked before the child class loader.</para>
+ </listitem>
+ <listitem>
+ <para><code>TYPE_PARENT_LAST</code></para>
+ <para>The parent class loader is after the child class loader.</para>
+ </listitem>
+ <listitem>
+ <para><code>TYPE_EXPORT</code></para>
+ <para>This class loader type can be compared to the OSGi class loader model
+ where each Java library that contains OSGi manifest information will be isolated.
+ This allows multiple versions of the same library to be active at the same time and
+ will allow deployment to declare their dependencies on a specific library version.</para>
+ <para>Note, that this type is not a valid OSGi class loader model implementation, but
+ only borrows some of the ideas in that model.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>All class loader types are implemented as a <code>org.jboss.jca.fungal.api.KernelClassLoader</code>
+ which extends the <code>java.net.URLClassLoader</code> class.</para>
+
+ </section>
+
</section>
<section id="fungal_deployers">
Modified: projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -22,6 +22,7 @@
package org.jboss.jca.embedded;
+import org.jboss.jca.fungal.api.ClassLoaderFactory;
import org.jboss.jca.fungal.api.Kernel;
import org.jboss.jca.fungal.api.KernelConfiguration;
import org.jboss.jca.fungal.api.KernelFactory;
@@ -82,6 +83,7 @@
{
KernelConfiguration kernelConfiguration = new KernelConfiguration();
kernelConfiguration = kernelConfiguration.name("jboss.jca");
+ kernelConfiguration = kernelConfiguration.classLoader(ClassLoaderFactory.TYPE_PARENT_FIRST);
kernelConfiguration = kernelConfiguration.parallelDeploy(false);
kernelConfiguration = kernelConfiguration.remoteAccess(false);
kernelConfiguration = kernelConfiguration.hotDeployment(false);
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/ClassLoaderFactory.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/ClassLoaderFactory.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/ClassLoaderFactory.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.api;
+
+import java.lang.reflect.Constructor;
+import java.net.URL;
+
+/**
+ * Class loader factory
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ClassLoaderFactory
+{
+ /** Type: Parent first */
+ public static final int TYPE_PARENT_FIRST = 0;
+
+ /** Type: Parent last */
+ public static final int TYPE_PARENT_LAST = 1;
+
+ /** Type: Export */
+ public static final int TYPE_EXPORT = 2;
+
+ /** ClassLoader: Parent first */
+ private static final String CLASSLOADER_PARENT_FIRST =
+ "org.jboss.jca.fungal.impl.classloader.ParentFirstClassLoader";
+
+ /** ClassLoader: Parent last */
+ private static final String CLASSLOADER_PARENT_LAST =
+ "org.jboss.jca.fungal.impl.classloader.ParentLastClassLoader";
+
+ /** ClassLoader: Export */
+ private static final String CLASSLOADER_EXPORT =
+ "org.jboss.jca.fungal.impl.classloader.ExportClassLoader";
+
+ /**
+ * Create a class loader
+ * @param type The class loader type
+ * @param urls The resource URLs
+ * @param parent The parent class loader
+ * @return The kernel class loader
+ * @exception IllegalArgumentException Thrown if unknown type is passed
+ * @exception IllegalStateException Thrown if a classloader can't be created
+ */
+ public static synchronized KernelClassLoader create(int type, URL[] urls, ClassLoader parent)
+ throws IllegalArgumentException, IllegalStateException
+ {
+ if (type == TYPE_PARENT_FIRST)
+ {
+ try
+ {
+ Class<?> clz = Class.forName(CLASSLOADER_PARENT_FIRST);
+ Constructor<?> constructor = clz.getDeclaredConstructor(URL[].class, ClassLoader.class);
+
+ return (KernelClassLoader)constructor.newInstance(urls, parent);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Unable to create parent first classloader", t);
+ }
+ }
+ else if (type == TYPE_PARENT_LAST)
+ {
+ try
+ {
+ Class<?> clz = Class.forName(CLASSLOADER_PARENT_LAST);
+ Constructor<?> constructor = clz.getDeclaredConstructor(URL[].class, ClassLoader.class);
+
+ return (KernelClassLoader)constructor.newInstance(urls, parent);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Unable to create parent last classloader", t);
+ }
+ }
+ else if (type == TYPE_EXPORT)
+ {
+ try
+ {
+ Class<?> clz = Class.forName(CLASSLOADER_EXPORT);
+ Constructor<?> constructor = clz.getDeclaredConstructor(URL[].class, ClassLoader.class);
+
+ return (KernelClassLoader)constructor.newInstance(urls, parent);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Unable to create export classloader", t);
+ }
+ }
+
+ throw new IllegalArgumentException("Unknown type: " + type);
+ }
+}
Copied: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelClassLoader.java (from rev 102269, projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelClassLoader.java)
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.api;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * Kernel class loader
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @see org.jboss.jca.fungal.api.ClassLoaderFactory
+ */
+public abstract class KernelClassLoader extends URLClassLoader implements Closeable
+{
+ /** Simple types */
+ private static ConcurrentMap<String, Class<?>> simpleTypes = new ConcurrentHashMap<String, Class<?>>(9);
+
+ static
+ {
+ simpleTypes.put(void.class.getName(), void.class);
+ simpleTypes.put(byte.class.getName(), byte.class);
+ simpleTypes.put(short.class.getName(), short.class);
+ simpleTypes.put(int.class.getName(), int.class);
+ simpleTypes.put(long.class.getName(), long.class);
+ simpleTypes.put(char.class.getName(), char.class);
+ simpleTypes.put(boolean.class.getName(), boolean.class);
+ simpleTypes.put(float.class.getName(), float.class);
+ simpleTypes.put(double.class.getName(), double.class);
+ }
+
+ /**
+ * Constructor
+ * @param urls The URLs for JAR archives or directories
+ * @param parent The parent class loader
+ */
+ protected KernelClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(urls, parent);
+ }
+
+ /**
+ * Load a class
+ * @param name The fully qualified class name
+ * @return The class
+ * @throws ClassNotFoundException If the class could not be found
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ return simpleTypes.get(name);
+ }
+
+ /**
+ * Close - no operation as shutdown needs to be called explicit
+ * @exception IOException Thrown if an error occurs
+ */
+ public void close() throws IOException
+ {
+ }
+
+ /**
+ * Shutdown
+ * @exception IOException Thrown if an error occurs
+ */
+ public void shutdown() throws IOException
+ {
+ }
+}
Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelConfiguration.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelConfiguration.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/api/KernelConfiguration.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -36,6 +36,9 @@
/** Home */
private URL home;
+ /** Kernel class loader */
+ private int classLoader;
+
/** Library */
private String library;
@@ -73,6 +76,7 @@
{
name = "fungal";
home = null;
+ classLoader = ClassLoaderFactory.TYPE_EXPORT;
library = "lib";
configuration = "config";
deploy = "deploy";
@@ -128,6 +132,27 @@
}
/**
+ * Set the kernel class loader type; default <code>ClassLoaderFactory.TYPE_EXPORT</code>
+ * @param type The type
+ * @return The configuration
+ */
+ public KernelConfiguration classLoader(int type)
+ {
+ this.classLoader = type;
+
+ return this;
+ }
+
+ /**
+ * Get the kernel class loader type
+ * @return The type
+ */
+ public int getClassLoader()
+ {
+ return classLoader;
+ }
+
+ /**
* Set the library directory; default <code>lib</code>
* @param value The value
* @return The configuration
Deleted: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelClassLoader.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jca.fungal.impl;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Kernel class loader
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class KernelClassLoader extends URLClassLoader implements Closeable
-{
- /** Simple types */
- private static ConcurrentMap<String, Class<?>> simpleTypes = new ConcurrentHashMap<String, Class<?>>(9);
-
- static
- {
- simpleTypes.put(void.class.getName(), void.class);
- simpleTypes.put(byte.class.getName(), byte.class);
- simpleTypes.put(short.class.getName(), short.class);
- simpleTypes.put(int.class.getName(), int.class);
- simpleTypes.put(long.class.getName(), long.class);
- simpleTypes.put(char.class.getName(), char.class);
- simpleTypes.put(boolean.class.getName(), boolean.class);
- simpleTypes.put(float.class.getName(), float.class);
- simpleTypes.put(double.class.getName(), double.class);
- }
-
- /**
- * Constructor
- * @param urls The URLs for JAR archives or directories
- * @param parent The parent class loader
- */
- public KernelClassLoader(URL[] urls, ClassLoader parent)
- {
- super(urls, parent);
- }
-
- /**
- * Load a class
- * @param name The fully qualified class name
- * @return The class
- * @throws ClassNotFoundException If the class could not be found
- */
- public Class<?> loadClass(String name) throws ClassNotFoundException
- {
- Class<?> result = simpleTypes.get(name);
- if (result != null)
- return result;
-
- return loadClass(name, false);
- }
-
- /**
- * Close - no operation as shutdown needs to be called explicit
- * @exception IOException Thrown if an error occurs
- */
- public void close() throws IOException
- {
- }
-
- /**
- * Shutdown
- * @exception IOException Thrown if an error occurs
- */
- public void shutdown() throws IOException
- {
- // Implement this by calling super.close() when JDK7
- }
-}
Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelImpl.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelImpl.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/KernelImpl.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -22,7 +22,9 @@
package org.jboss.jca.fungal.impl;
+import org.jboss.jca.fungal.api.ClassLoaderFactory;
import org.jboss.jca.fungal.api.Kernel;
+import org.jboss.jca.fungal.api.KernelClassLoader;
import org.jboss.jca.fungal.api.KernelConfiguration;
import org.jboss.jca.fungal.api.MainDeployer;
import org.jboss.jca.fungal.deployers.Deployment;
@@ -68,7 +70,7 @@
public class KernelImpl implements Kernel
{
/** Version information */
- private static final String VERSION = "Fungal 0.6.1";
+ private static final String VERSION = "Fungal 0.7";
/** Kernel configuration */
private KernelConfiguration kernelConfiguration;
@@ -209,7 +211,7 @@
URL[] urls = mergeUrls(libUrls, confUrls);
- kernelClassLoader = SecurityActions.createKernelClassLoader(urls, oldClassLoader);
+ kernelClassLoader = ClassLoaderFactory.create(kernelConfiguration.getClassLoader(), urls, oldClassLoader);
SecurityActions.setThreadContextClassLoader(kernelClassLoader);
SecurityActions.setSystemProperty("xb.builder.useUnorderedSequence", "true");
Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/SecurityActions.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/SecurityActions.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/SecurityActions.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -22,7 +22,6 @@
package org.jboss.jca.fungal.impl;
-import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;
@@ -118,21 +117,4 @@
}
});
}
-
- /**
- * Create a kernel class loader
- * @param urls The urls
- * @param parent The parent class loader
- * @return The class loader
- */
- static KernelClassLoader createKernelClassLoader(final URL[] urls, final ClassLoader parent)
- {
- return (KernelClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- return new KernelClassLoader(urls, parent);
- }
- });
- }
}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ArchiveClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ArchiveClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ArchiveClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import org.jboss.jca.fungal.api.KernelClassLoader;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Archive class loader
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+class ArchiveClassLoader extends KernelClassLoader
+{
+ /** Class loader id */
+ private Integer id;
+
+ /** Export packages */
+ private Set<String> exportPackages;
+
+ /** Import classloaders */
+ private Set<Integer> importClassLoaders;
+
+ /**
+ * Constructor
+ * @param id The class loader id
+ * @param url The URL for JAR archive or directory
+ * @param exportPackages The export packages
+ */
+ ArchiveClassLoader(Integer id, URL url, Set<String> exportPackages)
+ {
+ super(new URL[] {url}, ClassLoader.getSystemClassLoader());
+
+ this.id = id;
+ this.exportPackages = exportPackages;
+ }
+
+ /**
+ * Get the identifier
+ * @return The id
+ */
+ Integer getId()
+ {
+ return id;
+ }
+
+ /**
+ * Add an import classloader
+ * @param id The identifier
+ */
+ void addImportClassLoader(Integer id)
+ {
+ if (importClassLoaders == null)
+ importClassLoaders = new HashSet<Integer>(1);
+
+ importClassLoaders.add(id);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ // Don't call super.loadClass(String) as it is done in ExportClassLoader
+
+ if (isClassRegistered(name))
+ {
+ return loadClass(name, false);
+ }
+ else
+ {
+ try
+ {
+ return Class.forName(name, true, ClassLoader.getSystemClassLoader());
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ if (importClassLoaders != null)
+ {
+ for (Integer id : importClassLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ try
+ {
+ return acl.lookup(name);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ return eclr.getNonExportClassLoader().lookup(name);
+ }
+ }
+ }
+
+ /**
+ * Lookup a class
+ * @param name The fully qualified class name
+ * @return The class
+ * @throws ClassNotFoundException If the class could not be found
+ */
+ public Class<?> lookup(String name) throws ClassNotFoundException
+ {
+ return loadClass(name, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ if (isClassRegistered(name))
+ return findClass(name, true);
+
+ throw new ClassNotFoundException("Unable to load class: " + name);
+ }
+
+ /**
+ * Find a class
+ * @param name The fully qualified class name
+ * @param fullScan Should a full be performed
+ * @return The class
+ * @exception ClassNotFoundException Thrown if the class couldn't be found
+ */
+ public Class<?> findClass(String name, boolean fullScan) throws ClassNotFoundException
+ {
+ try
+ {
+ return super.findClass(name);
+ }
+ catch (Throwable t)
+ {
+ if (fullScan && importClassLoaders != null)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ for (Integer id : importClassLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ try
+ {
+ return acl.findClass(name, false);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+ }
+ throw new ClassNotFoundException("Unable to load class: " + name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setClassAssertionStatus(String className, boolean enabled)
+ {
+ if (isClassRegistered(className))
+ super.setClassAssertionStatus(className, enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setPackageAssertionStatus(String packageName, boolean enabled)
+ {
+ if (isPackageRegistered(packageName))
+ super.setPackageAssertionStatus(packageName, enabled);
+ }
+
+ /**
+ * Is the class registered for this class loader
+ * @param name The fully qualified class name
+ * @return True if registered; otherwise false
+ */
+ private boolean isClassRegistered(String name)
+ {
+ String packageName = "";
+ int lastDot = name.lastIndexOf(".");
+
+ if (lastDot != -1)
+ packageName = name.substring(0, lastDot);
+
+ return exportPackages.contains(packageName);
+ }
+
+ /**
+ * Is the package registered for this class loader
+ * @param name The package name
+ * @return True if registered; otherwise false
+ */
+ private boolean isPackageRegistered(String name)
+ {
+ return exportPackages.contains(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb = sb.append(ArchiveClassLoader.class.getName());
+ sb = sb.append("{");
+
+ sb = sb.append("Id=");
+ sb = sb.append(id);
+ sb = sb.append(",");
+
+ sb = sb.append("Url=");
+ sb = sb.append(super.getURLs()[0]);
+ sb = sb.append(",");
+
+ sb = sb.append("ExportPackages=");
+ sb = sb.append(exportPackages);
+ sb = sb.append(",");
+
+ sb = sb.append("ImportClassLoaders=");
+ sb = sb.append(importClassLoaders);
+
+ sb = sb.append("}");
+
+ return sb.toString();
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,400 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import org.jboss.jca.fungal.api.KernelClassLoader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+/**
+ * Export class loader (OSGi like)
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ExportClassLoader extends KernelClassLoader
+{
+ /** Class Loaders */
+ private Set<Integer> classLoaders;
+
+ /**
+ * Constructor
+ * @param urls The URLs for JAR archives or directories
+ * @param parent The parent class loader
+ */
+ public ExportClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(new URL[0], parent);
+
+ if (urls != null)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ classLoaders = eclr.register(urls);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ Class<?> result = super.loadClass(name);
+
+ if (result != null)
+ return result;
+
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ try
+ {
+ result = acl.loadClass(name);
+
+ if (result != null)
+ return result;
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ try
+ {
+ result = eclr.getNonExportClassLoader().loadClass(name);
+
+ if (result != null)
+ return result;
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Ignore
+ }
+
+ return loadClass(name, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL getResource(String name)
+ {
+ URL resource = null;
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ resource = acl.getResource(name);
+
+ if (resource != null)
+ return resource;
+ }
+ }
+ }
+
+ resource = eclr.getNonExportClassLoader().getResource(name);
+
+ if (resource != null)
+ return resource;
+
+ return super.getResource(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public InputStream getResourceAsStream(String name)
+ {
+ InputStream is = null;
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ is = acl.getResourceAsStream(name);
+
+ if (is != null)
+ return is;
+ }
+ }
+ }
+
+ is = eclr.getNonExportClassLoader().getResourceAsStream(name);
+
+ if (is != null)
+ return is;
+
+ return super.getResourceAsStream(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Enumeration<URL> getResources(String name)
+ throws IOException
+ {
+ Vector<URL> v = new Vector<URL>();
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ Enumeration<URL> e = null;
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ e = acl.getResources(name);
+
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ v.add(e.nextElement());
+ }
+ }
+ }
+ }
+ }
+
+ e = eclr.getNonExportClassLoader().getResources(name);
+
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ v.add(e.nextElement());
+ }
+ }
+
+ e = super.getResources(name);
+
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ v.add(e.nextElement());
+ }
+ }
+
+ return v.elements();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void clearAssertionStatus()
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ acl.clearAssertionStatus();
+ }
+ }
+ }
+
+ eclr.getNonExportClassLoader().clearAssertionStatus();
+
+ super.clearAssertionStatus();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setClassAssertionStatus(String className, boolean enabled)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ acl.setClassAssertionStatus(className, enabled);
+ }
+ }
+ }
+
+ eclr.getNonExportClassLoader().setClassAssertionStatus(className, enabled);
+
+ super.setClassAssertionStatus(className, enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDefaultAssertionStatus(boolean enabled)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ acl.setDefaultAssertionStatus(enabled);
+ }
+ }
+ }
+
+ eclr.getNonExportClassLoader().setDefaultAssertionStatus(enabled);
+
+ super.setDefaultAssertionStatus(enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setPackageAssertionStatus(String packageName, boolean enabled)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ acl.setPackageAssertionStatus(packageName, enabled);
+ }
+ }
+ }
+
+ eclr.getNonExportClassLoader().setPackageAssertionStatus(packageName, enabled);
+
+ super.setPackageAssertionStatus(packageName, enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL[] getURLs()
+ {
+ List<URL> result = null;
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ URL[] urls = null;
+
+ if (classLoaders != null)
+ {
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ urls = acl.getURLs();
+
+ if (urls != null)
+ {
+ result = new ArrayList<URL>(urls.length);
+ for (URL u : urls)
+ {
+ result.add(u);
+ }
+ }
+ }
+ }
+ }
+
+ urls = eclr.getNonExportClassLoader().getURLs();
+
+ if (result == null)
+ result = new ArrayList<URL>(urls.length);
+
+ if (urls != null)
+ {
+ for (URL u : urls)
+ {
+ result.add(u);
+ }
+ }
+
+ urls = super.getURLs();
+
+ if (result == null)
+ result = new ArrayList<URL>(urls.length);
+
+ if (urls != null)
+ {
+ for (URL u : urls)
+ {
+ result.add(u);
+ }
+ }
+
+ if (result == null)
+ return new URL[0];
+
+ return result.toArray(new URL[result.size()]);
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoaderRepository.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoaderRepository.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ExportClassLoaderRepository.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,421 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+/**
+ * Export class loader repository
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+class ExportClassLoaderRepository
+{
+ /** Instance */
+ private static final ExportClassLoaderRepository INSTANCE = new ExportClassLoaderRepository();
+
+ /** Nob export class loader */
+ private static NonExportClassLoader nonExportClassLoader;
+
+ /** Id counter */
+ private static AtomicInteger idCounter;
+
+ /** Class loaders */
+ private static ConcurrentMap<Integer, ArchiveClassLoader> classLoaders;
+
+ /** Package + Version mapping */
+ private static ConcurrentMap<String, SortedMap<String, Set<Integer>>> packages;
+
+ /**
+ * Constructor
+ */
+ private ExportClassLoaderRepository()
+ {
+ nonExportClassLoader = new NonExportClassLoader();
+ idCounter = new AtomicInteger(0);
+ classLoaders = new ConcurrentHashMap<Integer, ArchiveClassLoader>();
+ packages = new ConcurrentHashMap<String, SortedMap<String, Set<Integer>>>();
+ }
+
+ /**
+ * Get the singleton
+ * @return The instance
+ */
+ static ExportClassLoaderRepository getInstance()
+ {
+ return INSTANCE;
+ }
+
+ /**
+ * Get the non export class loader
+ * @return The class loader
+ */
+ NonExportClassLoader getNonExportClassLoader()
+ {
+ return nonExportClassLoader;
+ }
+
+ /**
+ * Get a class loader
+ * @param id The identifier
+ * @return The class loader
+ */
+ ArchiveClassLoader getClassLoader(Integer id)
+ {
+ return classLoaders.get(id);
+ }
+
+ /**
+ * Get archive class loaders
+ * @param clz The fully qualified class name
+ * @return The class loader ids; <code>null</code> if no archive class loaders were found
+ */
+ Set<Integer> getClassLoaders(String clz)
+ {
+ String pkgName = getPackageName(clz);
+
+ SortedMap<String, Set<Integer>> sm = packages.get(pkgName);
+
+ if (sm != null)
+ {
+ String lastKey = sm.lastKey();
+ return sm.get(lastKey);
+ }
+
+ return null;
+ }
+
+ /**
+ * Get archive class loaders
+ * @return The class loaders
+ */
+ Set<Integer> getClassLoaders()
+ {
+ Set<Integer> result = new HashSet<Integer>();
+
+ Collection<SortedMap<String, Set<Integer>>> sms = packages.values();
+
+ for (SortedMap<String, Set<Integer>> sm : sms)
+ {
+ String lastKey = sm.lastKey();
+ Set<Integer> values = sm.get(lastKey);
+
+ if (values != null)
+ result.addAll(values);
+ }
+
+ return result;
+ }
+
+ /**
+ * Register
+ * @param urls The urls
+ * @return The identifiers for the classloaders; <code>null</code> if <code>NonExportClassLoader</code> is used
+ */
+ synchronized Set<Integer> register(URL[] urls)
+ {
+ if (urls == null)
+ return null;
+
+ Set<Integer> result = null;
+
+ // Classloader id -> Version, Packages
+ Map<Integer, Map<String, List<String>>> imports = new HashMap<Integer, Map<String, List<String>>>();
+
+ for (URL url : urls)
+ {
+ boolean added = false;
+
+ if ("file".equals(url.getProtocol()))
+ {
+ JarFile jarFile = null;
+ try
+ {
+ File f = new File(url.toURI());
+
+ if (f.isFile())
+ {
+ jarFile = new JarFile(f);
+
+ Manifest manifest = jarFile.getManifest();
+ if (manifest != null)
+ {
+ Attributes mainAttributes = manifest.getMainAttributes();
+
+ String bundleManifestVersion = mainAttributes.getValue("Bundle-ManifestVersion");
+ if (bundleManifestVersion != null)
+ {
+ Integer identifier = Integer.valueOf(idCounter.getAndIncrement());
+ String bundleVersion = mainAttributes.getValue("Bundle-Version");
+
+ // Export-Package
+ String input = mainAttributes.getValue("Export-Package");
+
+ boolean semi = false;
+ boolean quote = false;
+ StringBuilder sb = new StringBuilder();
+
+ Set<String> exportPackages = new HashSet<String>(1);
+
+ for (int i = 0; i < input.length(); i++)
+ {
+ char c = input.charAt(i);
+
+ if (c == ',')
+ {
+ if (!quote)
+ {
+ String exportPackage = sb.toString().trim();
+
+ semi = false;
+ quote = false;
+ sb = new StringBuilder();
+
+ if (!exportPackage.equals(""))
+ {
+ exportPackages.add(exportPackage);
+ }
+ }
+ }
+ else if (c == ';')
+ {
+ semi = true;
+ }
+ else if (c == '\"')
+ {
+ quote = !quote;
+ }
+ else
+ {
+ if (!semi)
+ sb = sb.append(c);
+ }
+ }
+
+ // Import-Package
+ input = mainAttributes.getValue("Import-Package");
+
+ if (input != null)
+ {
+ StringTokenizer st = new StringTokenizer(input, ",");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken().trim();
+
+ int versionIndex = token.indexOf(";version=");
+ if (versionIndex != -1)
+ {
+ String pkg = token.substring(0, versionIndex);
+ String ver = token.substring(versionIndex + 9);
+
+ if (pkg.indexOf(";") != -1)
+ pkg = pkg.substring(0, pkg.indexOf(";"));
+
+ if (ver.startsWith("\""))
+ ver = ver.substring(1);
+
+ if (ver.endsWith("\""))
+ ver = ver.substring(0, ver.length() - 1);
+
+ Map<String, List<String>> value = imports.get(identifier);
+
+ if (value == null)
+ value = new HashMap<String, List<String>>();
+
+ List<String> l = value.get(ver);
+
+ if (l == null)
+ l = new ArrayList<String>();
+
+ l.add(pkg);
+ value.put(ver, l);
+ imports.put(identifier, value);
+ }
+ }
+ }
+ // Require-Bundle
+ input = mainAttributes.getValue("Require-Bundle");
+
+ if (input != null)
+ {
+ StringTokenizer st = new StringTokenizer(input, ",");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken().trim();
+
+ int delimiter = token.indexOf(";");
+
+ if (delimiter != -1)
+ token = token.substring(0, delimiter);
+
+ Map<String, List<String>> value = imports.get(identifier);
+
+ if (value == null)
+ value = new HashMap<String, List<String>>();
+
+ List<String> l = value.get(null);
+
+ if (l == null)
+ l = new ArrayList<String>();
+
+ l.add(token);
+ value.put(null, l);
+ imports.put(identifier, value);
+ }
+ }
+
+ for (String s : exportPackages)
+ {
+ SortedMap<String, Set<Integer>> sm = packages.get(s);
+
+ if (sm == null)
+ sm = new TreeMap<String, Set<Integer>>(new VersionComparator());
+
+ Set<Integer> cls = sm.get(bundleVersion);
+
+ if (cls == null)
+ cls = new HashSet<Integer>(1);
+
+ cls.add(identifier);
+ sm.put(bundleVersion, cls);
+ packages.put(s, sm);
+ }
+
+ ArchiveClassLoader acl = new ArchiveClassLoader(identifier, url, exportPackages);
+
+ classLoaders.put(acl.getId(), acl);
+
+ if (result == null)
+ result = new HashSet<Integer>();
+
+ result.add(identifier);
+
+ added = true;
+ }
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ System.out.println("REPO: (" + url + ") =");
+ t.printStackTrace(System.out);
+ }
+ finally
+ {
+ if (jarFile != null)
+ {
+ try
+ {
+ jarFile.close();
+ }
+ catch (IOException ioe)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ if (!added)
+ nonExportClassLoader.addURL(url);
+ }
+
+ if (imports.size() > 0)
+ {
+ Iterator<Map.Entry<Integer, Map<String, List<String>>>> cit = imports.entrySet().iterator();
+ while (cit.hasNext())
+ {
+ Map.Entry<Integer, Map<String, List<String>>> cEntry = cit.next();
+
+ Integer classLoaderId = cEntry.getKey();
+ Map<String, List<String>> value = cEntry.getValue();
+
+ ArchiveClassLoader acl = getClassLoader(classLoaderId);
+
+ Iterator<Map.Entry<String, List<String>>> vit = value.entrySet().iterator();
+ while (vit.hasNext())
+ {
+ Map.Entry<String, List<String>> vEntry = vit.next();
+
+ String version = vEntry.getKey();
+ List<String> pkgs = vEntry.getValue();
+
+ for (String pkg : pkgs)
+ {
+ SortedMap<String, Set<Integer>> sm = packages.get(pkg);
+
+ if (sm != null)
+ {
+ Set<Integer> clIds = sm.get(version);
+
+ if (clIds == null)
+ clIds = sm.get(sm.lastKey());
+
+ for (Integer cid : clIds)
+ {
+ acl.addImportClassLoader(cid);
+ result.add(cid);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the package name for a class
+ * @param name The fully qualified class name
+ * @return The package name
+ */
+ private String getPackageName(String name)
+ {
+ String packageName = "";
+ int lastDot = name.lastIndexOf(".");
+
+ if (lastDot != -1)
+ packageName = name.substring(0, lastDot);
+
+ return packageName;
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/NonExportClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/NonExportClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/NonExportClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import org.jboss.jca.fungal.api.KernelClassLoader;
+
+import java.net.URL;
+import java.util.Set;
+
+/**
+ * Non export class loader
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+class NonExportClassLoader extends KernelClassLoader
+{
+ /**
+ * Constructor
+ */
+ NonExportClassLoader()
+ {
+ this(new URL[0], ClassLoader.getSystemClassLoader());
+ }
+
+ /**
+ * Constructor
+ * @param urls The URLs
+ * @param cl The parent class loader
+ */
+ private NonExportClassLoader(URL[] urls, ClassLoader cl)
+ {
+ super(urls, cl);
+ }
+
+ /**
+ * Load a class
+ * @param name The fully qualified class name
+ * @return The class
+ * @throws ClassNotFoundException If the class could not be found
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ // Don't call super.loadClass(String) as it is done in ExportClassLoader
+
+ try
+ {
+ return loadClass(name, false);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ Set<Integer> classLoaders = eclr.getClassLoaders();
+
+ for (Integer id : classLoaders)
+ {
+ try
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+ return acl.loadClass(name);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // Ignore
+ }
+ }
+
+ throw cnfe;
+ }
+ }
+
+ /**
+ * Lookup a class
+ * @param name The fully qualified class name
+ * @return The class
+ * @throws ClassNotFoundException If the class could not be found
+ */
+ public Class<?> lookup(String name) throws ClassNotFoundException
+ {
+ try
+ {
+ return loadClass(name, false);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ Set<Integer> cls = eclr.getClassLoaders(name);
+
+ if (cls != null)
+ {
+ for (Integer id : cls)
+ {
+ try
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+ return acl.loadClass(name);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ throw cnfe;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ try
+ {
+ return super.findClass(name);
+ }
+ catch (Throwable t)
+ {
+ ExportClassLoaderRepository eclr = ExportClassLoaderRepository.getInstance();
+ Set<Integer> classLoaders = eclr.getClassLoaders();
+
+ for (Integer id : classLoaders)
+ {
+ ArchiveClassLoader acl = eclr.getClassLoader(id);
+
+ if (acl != null)
+ {
+ try
+ {
+ return acl.findClass(name, false);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ throw new ClassNotFoundException("Unable to load class: " + name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void addURL(URL url)
+ {
+ super.addURL(url);
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentFirstClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentFirstClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentFirstClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import org.jboss.jca.fungal.api.KernelClassLoader;
+
+import java.net.URL;
+
+/**
+ * Parent first class loader
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ParentFirstClassLoader extends KernelClassLoader
+{
+ /**
+ * Constructor
+ * @param urls The URLs for JAR archives or directories
+ * @param parent The parent class loader
+ */
+ public ParentFirstClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(urls, parent);
+ }
+
+ /**
+ * Load a class
+ * @param name The fully qualified class name
+ * @return The class
+ * @throws ClassNotFoundException If the class could not be found
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ Class<?> result = super.loadClass(name);
+
+ if (result != null)
+ return result;
+
+ return loadClass(name, false);
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentLastClassLoader.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentLastClassLoader.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/ParentLastClassLoader.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import org.jboss.jca.fungal.api.KernelClassLoader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Parent last class loader
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ParentLastClassLoader extends KernelClassLoader
+{
+ /** Local URLClassLoader */
+ private URLClassLoader children;
+
+ /**
+ * Constructor
+ * @param urls The URLs for JAR archives or directories
+ * @param parent The parent class loader
+ */
+ public ParentLastClassLoader(URL[] urls, ClassLoader parent)
+ {
+ super(new URL[0], parent);
+
+ this.children = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ Class<?> result = super.loadClass(name);
+
+ if (result != null)
+ return result;
+
+ try
+ {
+ return children.loadClass(name);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // Default to parent
+ }
+
+ return loadClass(name, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL getResource(String name)
+ {
+ URL resource = children.getResource(name);
+
+ if (resource != null)
+ return resource;
+
+ return super.getResource(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public InputStream getResourceAsStream(String name)
+ {
+ InputStream is = children.getResourceAsStream(name);
+
+ if (is != null)
+ return is;
+
+ return super.getResourceAsStream(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Enumeration<URL> getResources(String name)
+ throws IOException
+ {
+ Vector<URL> v = new Vector<URL>();
+
+ Enumeration<URL> e = children.getResources(name);
+
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ v.add(e.nextElement());
+ }
+ }
+
+ e = super.getResources(name);
+
+ if (e != null)
+ {
+ while (e.hasMoreElements())
+ {
+ v.add(e.nextElement());
+ }
+ }
+
+ return v.elements();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void clearAssertionStatus()
+ {
+ super.clearAssertionStatus();
+ children.clearAssertionStatus();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setClassAssertionStatus(String className, boolean enabled)
+ {
+ children.setClassAssertionStatus(className, enabled);
+ super.setClassAssertionStatus(className, enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDefaultAssertionStatus(boolean enabled)
+ {
+ children.setDefaultAssertionStatus(enabled);
+ super.setDefaultAssertionStatus(enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setPackageAssertionStatus(String packageName, boolean enabled)
+ {
+ children.setPackageAssertionStatus(packageName, enabled);
+ super.setPackageAssertionStatus(packageName, enabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URL[] getURLs()
+ {
+ List<URL> result = null;
+
+ URL[] urls = children.getURLs();
+
+ if (urls != null)
+ {
+ result = new ArrayList<URL>(urls.length);
+ for (URL u : urls)
+ {
+ result.add(u);
+ }
+ }
+
+ urls = super.getURLs();
+
+ if (urls != null)
+ {
+ for (URL u : urls)
+ {
+ result.add(u);
+ }
+ }
+
+ if (result == null)
+ return new URL[0];
+
+ return result.toArray(new URL[result.size()]);
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/VersionComparator.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/VersionComparator.java (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/VersionComparator.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.impl.classloader;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/**
+ * Version comparator
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class VersionComparator implements Comparator<String>, Serializable
+{
+ /** Serial version UID */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor
+ */
+ public VersionComparator()
+ {
+ }
+
+ /**
+ * Compare
+ * @param o1 First object
+ * @param o2 Second object
+ * @return -1 if o1 is less than o2; 0 if o1 equals o2; 1 if o1 is greater than o2
+ */
+ public int compare(String o1, String o2)
+ {
+ int oneMajor = 0;
+ int oneMinor = 0;
+ int onePatch = 0;
+
+ int twoMajor = 0;
+ int twoMinor = 0;
+ int twoPatch = 0;
+
+ if (o1 != null)
+ {
+ int index = o1.indexOf(".");
+
+ if (index != -1)
+ {
+ try
+ {
+ oneMajor = Integer.valueOf(o1.substring(0, index)).intValue();
+
+ int nextIndex = o1.indexOf(".", index + 1);
+
+ if (nextIndex != -1)
+ {
+ oneMinor = Integer.valueOf(o1.substring(index + 1, nextIndex)).intValue();
+
+ onePatch = Integer.valueOf(o1.substring(nextIndex + 1)).intValue();
+ }
+ }
+ catch (NumberFormatException nfe)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ if (o2 != null)
+ {
+ int index = o2.indexOf(".");
+
+ if (index != -1)
+ {
+ try
+ {
+ twoMajor = Integer.valueOf(o2.substring(0, index)).intValue();
+
+ int nextIndex = o2.indexOf(".", index + 1);
+
+ if (nextIndex != -1)
+ {
+ twoMinor = Integer.valueOf(o2.substring(index + 1, nextIndex)).intValue();
+
+ twoPatch = Integer.valueOf(o2.substring(nextIndex + 1)).intValue();
+ }
+ }
+ catch (NumberFormatException nfe)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ if (oneMajor < twoMajor)
+ {
+ return -1;
+ }
+ else if (oneMajor > twoMajor)
+ {
+ return 1;
+ }
+
+ if (oneMinor < twoMinor)
+ {
+ return -1;
+ }
+ else if (oneMinor > twoMinor)
+ {
+ return 1;
+ }
+
+ if (onePatch < twoPatch)
+ {
+ return -1;
+ }
+ else if (onePatch > twoPatch)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Equals
+ * @param other The other object
+ * @return True if equal; otherwise false
+ */
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+
+ if (!(other instanceof VersionComparator))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Hash code
+ * @return The hash
+ */
+ public int hashCode()
+ {
+ return 42;
+ }
+}
Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/package.html
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/package.html (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/classloader/package.html 2010-04-04 13:50:34 UTC (rev 103508)
@@ -0,0 +1,3 @@
+<body>
+This package contains the various class loaders for the JBoss JCA/Fungal kernel implementation
+</body>
Modified: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java 2010-04-04 13:44:31 UTC (rev 103507)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/Main.java 2010-04-04 13:50:34 UTC (rev 103508)
@@ -22,6 +22,7 @@
package org.jboss.jca.sjc;
+import org.jboss.jca.fungal.api.ClassLoaderFactory;
import org.jboss.jca.fungal.api.Kernel;
import org.jboss.jca.fungal.api.KernelConfiguration;
import org.jboss.jca.fungal.api.KernelFactory;
@@ -60,6 +61,7 @@
{
KernelConfiguration kernelConfiguration = new KernelConfiguration();
kernelConfiguration = kernelConfiguration.name("jboss.jca");
+ kernelConfiguration = kernelConfiguration.classLoader(ClassLoaderFactory.TYPE_PARENT_FIRST);
kernelConfiguration = kernelConfiguration.parallelDeploy(false);
String home = SecurityActions.getSystemProperty("jboss.jca.home");
More information about the jboss-cvs-commits
mailing list