RE: [JBoss-dev] KeyGeneratorFactory serialVersionUID

2006-05-17 Thread Dimitris Andreadis
For an example look in "our"
javax.management.modelmbean.DescriptorSupport

   private void readObject(ObjectInputStream ois)
  throws IOException, ClassNotFoundException
   {
  ObjectInputStream.GetField getField = ois.readFields();
  HashMap serMap = (HashMap) getField.get("descriptor", null);
  if (serMap == null)
 throw new StreamCorruptedException("Null descriptor?");

  // replace the keys with FieldName objects
  fieldMap = Collections.synchronizedMap(new HashMap());
  Iterator it = serMap.entrySet().iterator();
  while (it.hasNext())
  {
 Map.Entry entry = (Map.Entry) it.next();
 FieldName key = new FieldName((String)entry.getKey());
 fieldMap.put(key, entry.getValue());
  }
   } 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alexey Loubyansky
> Sent: 17 May, 2006 18:35
> To: jboss-development@lists.sourceforge.net
> Subject: Re: [JBoss-dev] KeyGeneratorFactory serialVersionUID
> 
> Dimitris Andreadis wrote:
> > We certainly need to maintain compatibility between the 4.x (and 
> > 3.2.x) versions, so the serialVersionUID must be the same, 
> although I 
> > don't know why this Mbean needs to be serializable in the 
> first place.
> 
> It should be serializable because an instance is bound to the 
> JNDI. But actually is supposed to be used locally.
> 
> > And since you are just adding fields, implementing Externalizable 
> > should not really be needed, you could initialize any 
> missing field in 
> > readObject(ObjectInputStream), I think.
> 
> But how would I know that a field is missing?
> 
> Thanks,
> 
> alex
> 
> 
> ---
> Using Tomcat but need to do more? Need to support web 
> services, security?
> Get stuff done quickly with pre-integrated technology to make 
> your job easier Download IBM WebSphere Application Server 
> v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
> dat=121642
> ___
> JBoss-Development mailing list
> JBoss-Development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
___
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development


Re: [JBoss-dev] KeyGeneratorFactory serialVersionUID

2006-05-17 Thread Alexey Loubyansky

Dimitris Andreadis wrote:

We certainly need to maintain compatibility between the 4.x (and 3.2.x)
versions, so the serialVersionUID must be the same, although I don't
know why this Mbean needs to be serializable in the first place.


It should be serializable because an instance is bound to the JNDI. But 
actually is supposed to be used locally.



And since you are just adding fields, implementing Externalizable should
not really be needed, you could initialize any missing field in
readObject(ObjectInputStream), I think.


But how would I know that a field is missing?

Thanks,

alex


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development


RE: [JBoss-dev] KeyGeneratorFactory serialVersionUID

2006-05-17 Thread Dimitris Andreadis
We certainly need to maintain compatibility between the 4.x (and 3.2.x)
versions, so the serialVersionUID must be the same, although I don't
know why this Mbean needs to be serializable in the first place.

And since you are just adding fields, implementing Externalizable should
not really be needed, you could initialize any missing field in
readObject(ObjectInputStream), I think.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Alexey Loubyansky
> Sent: 17 May, 2006 17:57
> To: jboss-development
> Subject: [JBoss-dev] KeyGeneratorFactory serialVersionUID
> 
> I added a couple of managed attributes to the class in HEAD. 
> I want to backport this to Branch_4_0 but the class there has 
> serialVersionUID.
> 
> Should I make it implement java.io.Externalizable in 
> Branch_4_0 and preserve the value of serialVersionUID?
> 
> Thanks!
> 
>  Original Message 
> Subject: [jboss-cvs] 
> jboss/src/main/org/jboss/ejb/plugins/keygenerator/hilo   ...
> Date: Wed, 17 May 2006 10:31:28 -0400
> From: Alex Loubyansky <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 
>User: aloubyansky
>Date: 06/05/17 10:31:28
> 
>Modified:src/main/org/jboss/ejb/plugins/keygenerator/hilo
>  HiLoKeyGeneratorFactory.java
>  HiLoKeyGeneratorFactoryMBean.java
>Log:
>[JBAS-3229] HiLo generator shoudn't always re-create the 
> table at startup
> 
>Revision  ChangesPath
>1.8   +45 -3 
> jboss/src/main/org/jboss/ejb/plugins/keygenerator/hilo/HiLoKey
> GeneratorFactory.java
> 
>(In the diff below, changes in quantity of whitespace are 
> not shown.)
> 
>Index: HiLoKeyGeneratorFactory.java
>===
>RCS file: 
> /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/keygenerat
> or/hilo/HiLoKeyGeneratorFactory.java,v
>retrieving revision 1.7
>retrieving revision 1.8
>diff -u -b -r1.7 -r1.8
>--- HiLoKeyGeneratorFactory.java   30 Oct 2005 00:04:07 
> - 1.7
>+++ HiLoKeyGeneratorFactory.java   17 May 2006 14:31:28 
> - 1.8
>@@ -43,7 +43,7 @@
> 
> /**
>  * @author mailto:[EMAIL PROTECTED]">Alexey Loubyansky
>- * @version $Revision: 1.7 $
>+ * @version $Revision: 1.8 $
>  * @jmx.mbean 
> name="jboss.system:service=KeyGeneratorFactory,type=HiLo"
>  * extends="org.jboss.system.ServiceMBean"
>  */
>@@ -63,6 +63,9 @@
>private String createTableDdl;
>private long blockSize;
> 
>+   private boolean createTable = true;
>+   private boolean dropTable;
>+
>/**
> * @jmx.managed-attribute
> */
>@@ -201,6 +204,38 @@
>   this.blockSize = blockSize;
>}
> 
>+   /**
>+* @jmx.managed-attribute
>+*/
>+   public boolean isCreateTable()
>+   {
>+  return createTable;
>+   }
>+
>+   /**
>+* @jmx.managed-attribute
>+*/
>+   public void setCreateTable(boolean createTable)
>+   {
>+  this.createTable = createTable;
>+   }
>+
>+   /**
>+* @jmx.managed-attribute
>+*/
>+   public boolean isDropTable()
>+   {
>+  return dropTable;
>+   }
>+
>+   /**
>+* @jmx.managed-attribute
>+*/
>+   public void setDropTable(boolean dropTable)
>+   {
>+  this.dropTable = dropTable;
>+   }
>+
>// KeyGeneratorFactory implementation
> 
>public KeyGenerator getKeyGenerator() throws Exception
>@@ -221,13 +256,17 @@
>   tm = 
> (TransactionManager)ctx.lookup("java:/TransactionManager");
> 
>   ds = lookupDataSource(dataSource);
>-  dropTableIfExists(tableName);
>   initSequence(tableName, sequenceColumn, 
> sequenceName, idColumnName);
>}
> 
>public void stopService()
>   throws Exception
>{
>+  if(dropTable)
>+  {
>+ dropTableIfExists(tableName);
>+  }
>+
>   ds = null;
>   tm = null;
> 
>@@ -241,7 +280,10 @@
>private void initSequence(String tableName, String 
> sequenceColumn, String sequenceName, String idColumnName)
>   throws SQLException, DeploymentException
>{
>+  if(createTable)
>+  {
>   createTableIfNotExists(tableName);
>+  }
> 
>   Connection con = null;
>   St

[JBoss-dev] KeyGeneratorFactory serialVersionUID

2006-05-17 Thread Alexey Loubyansky
I added a couple of managed attributes to the class in HEAD. I want to 
backport this to Branch_4_0 but the class there has serialVersionUID.


Should I make it implement java.io.Externalizable in Branch_4_0 and 
preserve the value of serialVersionUID?


Thanks!

 Original Message 
Subject: [jboss-cvs] 
jboss/src/main/org/jboss/ejb/plugins/keygenerator/hilo   ...

Date: Wed, 17 May 2006 10:31:28 -0400
From: Alex Loubyansky <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

  User: aloubyansky
  Date: 06/05/17 10:31:28

  Modified:src/main/org/jboss/ejb/plugins/keygenerator/hilo
HiLoKeyGeneratorFactory.java
HiLoKeyGeneratorFactoryMBean.java
  Log:
  [JBAS-3229] HiLo generator shoudn't always re-create the table at startup

  Revision  ChangesPath
  1.8   +45 -3 
jboss/src/main/org/jboss/ejb/plugins/keygenerator/hilo/HiLoKeyGeneratorFactory.java


  (In the diff below, changes in quantity of whitespace are not shown.)

  Index: HiLoKeyGeneratorFactory.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/keygenerator/hilo/HiLoKeyGeneratorFactory.java,v

  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- HiLoKeyGeneratorFactory.java  30 Oct 2005 00:04:07 -  1.7
  +++ HiLoKeyGeneratorFactory.java  17 May 2006 14:31:28 -  1.8
  @@ -43,7 +43,7 @@

   /**
* @author mailto:[EMAIL PROTECTED]">Alexey Loubyansky
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
* @jmx.mbean name="jboss.system:service=KeyGeneratorFactory,type=HiLo"
* extends="org.jboss.system.ServiceMBean"
*/
  @@ -63,6 +63,9 @@
  private String createTableDdl;
  private long blockSize;

  +   private boolean createTable = true;
  +   private boolean dropTable;
  +
  /**
   * @jmx.managed-attribute
   */
  @@ -201,6 +204,38 @@
 this.blockSize = blockSize;
  }

  +   /**
  +* @jmx.managed-attribute
  +*/
  +   public boolean isCreateTable()
  +   {
  +  return createTable;
  +   }
  +
  +   /**
  +* @jmx.managed-attribute
  +*/
  +   public void setCreateTable(boolean createTable)
  +   {
  +  this.createTable = createTable;
  +   }
  +
  +   /**
  +* @jmx.managed-attribute
  +*/
  +   public boolean isDropTable()
  +   {
  +  return dropTable;
  +   }
  +
  +   /**
  +* @jmx.managed-attribute
  +*/
  +   public void setDropTable(boolean dropTable)
  +   {
  +  this.dropTable = dropTable;
  +   }
  +
  // KeyGeneratorFactory implementation

  public KeyGenerator getKeyGenerator() throws Exception
  @@ -221,13 +256,17 @@
 tm = (TransactionManager)ctx.lookup("java:/TransactionManager");

 ds = lookupDataSource(dataSource);
  -  dropTableIfExists(tableName);
 initSequence(tableName, sequenceColumn, sequenceName, 
idColumnName);

  }

  public void stopService()
 throws Exception
  {
  +  if(dropTable)
  +  {
  + dropTableIfExists(tableName);
  +  }
  +
 ds = null;
 tm = null;

  @@ -241,7 +280,10 @@
  private void initSequence(String tableName, String 
sequenceColumn, String sequenceName, String idColumnName)

 throws SQLException, DeploymentException
  {
  +  if(createTable)
  +  {
 createTableIfNotExists(tableName);
  +  }

 Connection con = null;
 Statement st = null;


---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development