Author: rareddy
Date: 2011-12-01 16:54:57 -0500 (Thu, 01 Dec 2011)
New Revision: 3715
Modified:
trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
Log:
TEIID-1720: Updating the code base to use Jboss-as-7.1.0.Beta1
Modified: trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2011-12-01 18:19:11
UTC (rev 3714)
+++ trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2011-12-01 21:54:57
UTC (rev 3715)
@@ -373,6 +373,14 @@
<login-module code="UsersRoles"
flag="required"/>
</authentication>
</security-domain>
+ <security-domain name="teiid-security"
cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles"
flag="required">
+ <module-option name="usersProperties"
value="teiid-security-users.properties"/>
+ <module-option name="rolesProperties"
value="teiid-security-roles.properties"/>
+ </login-module>
+ </authentication>
+ </security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:teiid:1.0">
Modified:
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
---
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-12-01
18:19:11 UTC (rev 3714)
+++
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-12-01
21:54:57 UTC (rev 3715)
@@ -22,7 +22,13 @@
package org.teiid.replication.jboss;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -53,6 +59,7 @@
import org.jgroups.blocks.RequestOptions;
import org.jgroups.blocks.ResponseMode;
import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.util.Buffer;
import org.jgroups.util.Promise;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
@@ -83,6 +90,7 @@
this.object = object;
this.methodMap = methodMap;
this.methodList = methodList;
+ setMarshaller(new ContextAwareMarshaller(getClass().getClassLoader()));
}
@Override
@@ -570,5 +578,48 @@
}
}
}
+ }
+
+ // This class is used so that the objects are loaded with the current classes class
loader
+ // rather than foreign class loader
+ static class ContextAwareMarshaller implements RpcDispatcher.Marshaller {
+ private ClassLoader classloader;
+
+ public ContextAwareMarshaller(ClassLoader classloader) {
+ this.classloader = classloader;
+ }
+
+ @Override
+ public Buffer objectToBuffer(Object obj) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ out.writeObject(obj);
+ out.close();
+ return new Buffer(baos.toByteArray());
+ }
+
+ @Override
+ public Object objectFromBuffer(byte[] buf, int offset, int length) throws Exception {
+ ObjectInputStream in = new CLAwareObjectInputStream(new ByteArrayInputStream(buf,
offset, length), this.classloader);
+ Object anObj = in.readObject();
+ in.close();
+ return anObj;
+ }
}
+
+ static class CLAwareObjectInputStream extends ObjectInputStream {
+ private ClassLoader classloader;
+ @Override
+ public Class resolveClass(ObjectStreamClass desc) throws IOException,
ClassNotFoundException {
+ try {
+ return this.classloader.loadClass(desc.getName());
+ } catch (Throwable t) {
+ }
+ return super.resolveClass(desc);
+ }
+ public CLAwareObjectInputStream(InputStream in, ClassLoader classloader) throws
IOException {
+ super(in);
+ this.classloader = classloader;
+ }
+ }
}
Show replies by date