You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2006/11/01 12:47:51 UTC
svn commit: r469873 -
/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java
Author: rajdavies
Date: Wed Nov 1 03:47:51 2006
New Revision: 469873
URL: http://svn.apache.org/viewvc?view=rev&rev=469873
Log:
Ensure Administered objects are Serializable
Modified:
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java?view=diff&rev=469873&r1=469872&r2=469873
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/jndi/JNDIBaseStorable.java Wed Nov 1 03:47:51 2006
@@ -19,13 +19,18 @@
import javax.naming.NamingException;
import javax.naming.Reference;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.Properties;
/**
* Faciliates objects to be stored in JNDI as properties
*/
-public abstract class JNDIBaseStorable implements JNDIStorableInterface {
+public abstract class JNDIBaseStorable implements JNDIStorableInterface, Externalizable{
+
private Properties properties = null;
@@ -78,6 +83,30 @@
*/
public Reference getReference() throws NamingException {
return JNDIReferenceFactory.createReference(this.getClass().getName(), this);
+ }
+
+ /**
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException{
+ Properties props = (Properties)in.readObject();
+ if (props != null) {
+ setProperties(props);
+ }
+
+ }
+
+ /**
+ * @param out
+ * @throws IOException
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException{
+ out.writeObject(getProperties());
+
}
}