Author: mstruk
Date: 2011-09-28 15:28:00 -0400 (Wed, 28 Sep 2011)
New Revision: 7551
Modified:
sandbox/as7_support/exo.kernel.container/trunk/pom.xml
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/util/ContainerUtil.java
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/xml/object/XMLObject.java
Log:
Classloading patch to make it work in AS7
Modified: sandbox/as7_support/exo.kernel.container/trunk/pom.xml
===================================================================
--- sandbox/as7_support/exo.kernel.container/trunk/pom.xml 2011-09-28 13:55:18 UTC (rev
7550)
+++ sandbox/as7_support/exo.kernel.container/trunk/pom.xml 2011-09-28 19:28:00 UTC (rev
7551)
@@ -15,16 +15,23 @@
<version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
+ <version>2.3.0-GA-AS7</version>
<name>eXo Kernel :: Container</name>
<description>eXo Kernel Container</description>
+
+ <properties>
+ <version.exo.kernel>2.3.0-GA</version.exo.kernel>
+ </properties>
<dependencies>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.commons</artifactId>
+ <version>${version.exo.kernel}</version>
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.commons.test</artifactId>
+ <version>${version.exo.kernel}</version>
</dependency>
<dependency>
<groupId>org.exoplatform.tool</groupId>
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2011-09-28
13:55:18 UTC (rev 7550)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2011-09-28
19:28:00 UTC (rev 7551)
@@ -23,6 +23,7 @@
import org.exoplatform.container.component.ComponentLifecycle;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.container.xml.Component;
import org.exoplatform.container.xml.ExternalComponentPlugins;
import org.exoplatform.container.xml.InitParams;
@@ -150,7 +151,7 @@
try
{
- Class pluginClass = Class.forName(plugin.getType());
+ Class pluginClass = ContainerUtil.loadClass(plugin.getType());
ComponentPlugin cplugin =
(ComponentPlugin)container.createComponent(pluginClass, plugin.getInitParams());
cplugin.setName(plugin.getName());
cplugin.setDescription(plugin.getDescription());
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/util/ContainerUtil.java
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2011-09-28
13:55:18 UTC (rev 7550)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2011-09-28
19:28:00 UTC (rev 7551)
@@ -311,4 +311,23 @@
}
return props;
}
+
+ public static Class loadClass(String type) throws ClassNotFoundException
+ {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ ClassLoader localCl = ContainerUtil.class.getClassLoader();
+ ClassLoader cl = tccl != null ? tccl : localCl;
+ try
+ {
+ return cl.loadClass(type);
+ }
+ catch (ClassNotFoundException e)
+ {
+ if (cl == tccl)
+ return localCl.loadClass(type);
+
+ throw e;
+ }
+ }
+
}
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/xml/object/XMLObject.java
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/xml/object/XMLObject.java 2011-09-28
13:55:18 UTC (rev 7550)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/xml/object/XMLObject.java 2011-09-28
19:28:00 UTC (rev 7551)
@@ -19,6 +19,7 @@
package org.exoplatform.xml.object;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -172,7 +173,7 @@
public Object toObject() throws Exception
{
- Class clazz = Class.forName(type);
+ Class clazz = ContainerUtil.loadClass(type);
Map fields = getFields(clazz);
Object instance = clazz.newInstance();
Iterator i = fields_.values().iterator();