[JBoss-dev] CVS update: jbossmx/src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java
User: slaboure Date: 02/02/09 07:29:39 Modified:src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java Log: Was using the bad stream class Revision ChangesPath 1.5 +70 -70 jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java Index: CMPClusteredInMemoryPersistenceManager.java === RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CMPClusteredInMemoryPersistenceManager.java 6 Jan 2002 16:04:22 - 1.4 +++ CMPClusteredInMemoryPersistenceManager.java 9 Feb 2002 15:29:39 - 1.5 @@ -30,7 +30,7 @@ * @see org.jboss.ha.framework.interfaces.DistributedState * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a. - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * * pbRevisions:/b * @@ -42,31 +42,31 @@ public class CMPClusteredInMemoryPersistenceManager implements org.jboss.ejb.EntityPersistenceStore { - - // Constants - - + + // Constants - + // Attributes - - protected org.jboss.ejb.EntityContainer con = null; + + protected org.jboss.ejb.EntityContainer con = null; protected Field idField = null; - + protected DistributedState ds = null; - + protected String DS_CATEGORY = null; - + /** * Optional isModified method used by storeEntity */ protected Method isModified = null; - + // Static - + // Constructors -- - + public CMPClusteredInMemoryPersistenceManager () { } - + /** * create the service, do expensive operations etc */ @@ -74,13 +74,13 @@ { String name = jboss:service=DistributedState,partitionName=DefaultPartition; ds = (DistributedState)org.jboss.system.Registry.lookup (name); - + String ejbName = con.getBeanMetaData ().getEjbName (); - + this.DS_CATEGORY = CMPClusteredInMemoryPersistenceManager- + ejbName; - + idField = con.getBeanClass ().getField (id); - + try { isModified = con.getBeanClass ().getMethod (isModified, new Class[0]); @@ -90,14 +90,14 @@ catch (NoSuchMethodException ignored) {} } - + /** * start the service, create is already called */ public void start () throws Exception { } - + /** * This callback is set by the container so that the plugin may access it * @@ -107,26 +107,26 @@ { this.con = (org.jboss.ejb.EntityContainer)con; } - + /** * stop the service */ public void stop () - { + { } - - + + /** * destroy the service, tear down */ public void destroy () { } - + // Public - + // EntityPersistenceStore implementation -- - + /** * Returns a new instance of the bean class or a subclass of the bean class. * @@ -138,7 +138,7 @@ { return con.getBeanClass ().newInstance (); } - + /** * Initializes the instance context. * @@ -156,10 +156,10 @@ Class ejbClass = instance.getClass (); Field cmpField; Class cmpFieldType; - + org.jboss.metadata.EntityMetaData metaData = (org.jboss.metadata.EntityMetaData)con.getBeanMetaData (); java.util.Iterator i= metaData.getCMPFields (); - + while(i.hasNext ()) { try @@ -220,7 +220,7 @@ } } } - + /** * This method is called whenever an entity is to be created. * The persistence manager is responsible for handling the results properly @@ -238,16 +238,16 @@ { try { - + Object id = idField.get (ctx.getInstance ()); - + // Check exist if (this.ds.get (DS_CATEGORY, id.toString ()) != null) throw new javax.ejb.DuplicateKeyException (Already exists:+id); - + // Store to file storeEntity (id, ctx.getInstance ()); - + return id; } catch
[JBoss-dev] CVS update: jbossmx/src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java
User: slaboure Date: 02/01/06 08:04:22 Modified:src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java Log: Bug in findAll when no beans in store Revision ChangesPath 1.4 +9 -2 jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java Index: CMPClusteredInMemoryPersistenceManager.java === RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CMPClusteredInMemoryPersistenceManager.java 2002/01/03 04:00:52 1.3 +++ CMPClusteredInMemoryPersistenceManager.java 2002/01/06 16:04:22 1.4 @@ -11,6 +11,7 @@ import java.lang.reflect.Method; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import javax.ejb.EJBException; @@ -29,7 +30,7 @@ * @see org.jboss.ha.framework.interfaces.DistributedState * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a. - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * * pbRevisions:/b * @@ -303,7 +304,13 @@ { if (finderMethod.getName ().equals (findAll)) { - ArrayList result = new ArrayList (this.ds.getAllKeys (DS_CATEGORY)); + Collection tmpColl = this.ds.getAllKeys (DS_CATEGORY); + + ArrayList result = null; + if (tmpColl == null) +result = new ArrayList (); + else +result = new ArrayList (tmpColl); return new FinderResults (result,null,null,null); } else ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbossmx/src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java ClusterSyncEntityInstanceCache.java
User: user57 Date: 02/01/02 20:00:52 Modified:src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java ClusterSyncEntityInstanceCache.java Log: o migrated all components to a new JMX domain name model. jboss.system is now where to core/spine components live. moved all components that were in JBOSS-SYSTEM that did not move into a jboss.* domain into jboss (where the server is now registered). The point was to limit the members of jboss.system to core bits only. o Created org.jboss.system.Server, which does the work of initialization that org.jboss.Main used to do. Main now only parses the command line, sets up basic legecy properties and creates a Server instance. o Moved functionality of Shutdown (component not cl tool) into Server ( which is bound as jboss.system:service=Server) o Moved more Runtime access from Info into Server. Exposed memory info as attributes. o Logging a WARN everywhere that uses System.getProperty(jboss.system.home) as that should go away soon/eventually. o Initialized the invokerMap in the harmi impl to avoid NPE o Made getopt.jar a member of the lib/* dir instead of adding it to the run.jar and shutdown.jars each time. o Minor cosmetic changes along the way. Revision ChangesPath 1.3 +2 -3 jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java Index: CMPClusteredInMemoryPersistenceManager.java === RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CMPClusteredInMemoryPersistenceManager.java 2001/12/31 15:13:45 1.2 +++ CMPClusteredInMemoryPersistenceManager.java 2002/01/03 04:00:52 1.3 @@ -7,7 +7,6 @@ package org.jboss.ejb.plugins; - import java.lang.reflect.Field; import java.lang.reflect.Method; import java.io.IOException; @@ -30,7 +29,7 @@ * @see org.jboss.ha.framework.interfaces.DistributedState * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a. - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * * pbRevisions:/b * @@ -72,7 +71,7 @@ */ public void create () throws Exception { - String name = JBOSS-SYSTEM:service=DistributedState,partitionName=DefaultPartition; + String name = jboss:service=DistributedState,partitionName=DefaultPartition; ds = (DistributedState)org.jboss.system.Registry.lookup (name); String ejbName = con.getBeanMetaData ().getEjbName (); 1.2 +4 -4 jbossmx/src/main/org/jboss/ejb/plugins/ClusterSyncEntityInstanceCache.java Index: ClusterSyncEntityInstanceCache.java === RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/ClusterSyncEntityInstanceCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ClusterSyncEntityInstanceCache.java 2001/12/29 16:23:11 1.1 +++ ClusterSyncEntityInstanceCache.java 2002/01/03 04:00:52 1.2 @@ -23,11 +23,11 @@ * distributed cache corruption mechanism. * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class ClusterSyncEntityInstanceCache -extends EntityInstanceCache -implements org.jboss.ha.framework.interfaces.DistributedState.DSListener + extends EntityInstanceCache + implements org.jboss.ha.framework.interfaces.DistributedState.DSListener { // Constants - @@ -48,7 +48,7 @@ // Get a reference to the DS service // - String name = JBOSS-SYSTEM:service=DistributedState,partitionName=DefaultPartition; + String name = jboss:service=DistributedState,partitionName=DefaultPartition; ds = (DistributedState)org.jboss.system.Registry.lookup (name); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbossmx/src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java
User: slaboure Date: 01/12/31 07:13:45 Modified:src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java Log: Used the new DS interface with the optional (a-)synchronous set/remove flag Revision ChangesPath 1.2 +2 -2 jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java Index: CMPClusteredInMemoryPersistenceManager.java === RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CMPClusteredInMemoryPersistenceManager.java 2001/12/29 16:21:32 1.1 +++ CMPClusteredInMemoryPersistenceManager.java 2001/12/31 15:13:45 1.2 @@ -30,7 +30,7 @@ * @see org.jboss.ha.framework.interfaces.DistributedState * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a. - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * * pbRevisions:/b * @@ -434,7 +434,7 @@ { try { - if (this.ds.remove (this.DS_CATEGORY, ctx.getId ().toString ()) == null) + if (this.ds.remove (this.DS_CATEGORY, ctx.getId ().toString (), false) == null) throw new javax.ejb.RemoveException (Could not remove bean: + ctx.getId ()); } @@ -466,7 +466,7 @@ out.close (); - this.ds.set (this.DS_CATEGORY, id.toString (), baos.toByteArray ()); + this.ds.set (this.DS_CATEGORY, id.toString (), baos.toByteArray (), false); } catch (Exception e) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbossmx/src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java
User: slaboure Date: 01/12/29 08:21:32 Added: src/main/org/jboss/ejb/plugins CMPClusteredInMemoryPersistenceManager.java Log: Clustered In-memory persistence manager based on DistributedState (itself based on HAPartition) Revision ChangesPath 1.1 jbossmx/src/main/org/jboss/ejb/plugins/CMPClusteredInMemoryPersistenceManager.java Index: CMPClusteredInMemoryPersistenceManager.java === /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.ejb.plugins; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.io.IOException; import java.util.ArrayList; import javax.ejb.EJBException; import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.util.FinderResults; import org.jboss.ha.framework.interfaces.DistributedState; /** * EntityPersistenceStore implementation storing values in-memory * and shared accross the cluster through the DistributedState service * from the clustering framework. It always uses the DefaultPartition. * * @see org.jboss.ejb.EntityPersistenceStore * @see org.jboss.ejb.plugins.CMPInMemoryPersistenceManager * @see org.jboss.ha.framework.interfaces.DistributedState * * @author a href=mailto:[EMAIL PROTECTED];Sacha Labourey/a. * @version $Revision: 1.1 $ * * pbRevisions:/b * * pb29.12.2001 - Sacha Labourey:/b * ul * li First implementation highly based on CMPInMemoryPersistenceManager/li * /ul */ public class CMPClusteredInMemoryPersistenceManager implements org.jboss.ejb.EntityPersistenceStore { // Constants - // Attributes protected org.jboss.ejb.EntityContainer con = null; protected Field idField = null; protected DistributedState ds = null; protected String DS_CATEGORY = null; /** * Optional isModified method used by storeEntity */ protected Method isModified = null; // Static // Constructors -- public CMPClusteredInMemoryPersistenceManager () { } /** * create the service, do expensive operations etc */ public void create () throws Exception { String name = JBOSS-SYSTEM:service=DistributedState,partitionName=DefaultPartition; ds = (DistributedState)org.jboss.system.Registry.lookup (name); String ejbName = con.getBeanMetaData ().getEjbName (); this.DS_CATEGORY = CMPClusteredInMemoryPersistenceManager- + ejbName; idField = con.getBeanClass ().getField (id); try { isModified = con.getBeanClass ().getMethod (isModified, new Class[0]); if (!isModified.getReturnType ().equals (Boolean.TYPE)) isModified = null; // Has to have boolean as return type! } catch (NoSuchMethodException ignored) {} } /** * start the service, create is already called */ public void start () throws Exception { } /** * This callback is set by the container so that the plugin may access it * * @param conThe container using this plugin. */ public void setContainer (org.jboss.ejb.Container con) { this.con = (org.jboss.ejb.EntityContainer)con; } /** * stop the service */ public void stop () { } /** * destroy the service, tear down */ public void destroy () { } // Public // EntityPersistenceStore implementation -- /** * Returns a new instance of the bean class or a subclass of the bean class. * * @return the new instance * * @throws Exception */ public Object createBeanClassInstance () throws Exception { return con.getBeanClass ().newInstance (); } /** * Initializes the instance context. * * pThis method is called before createEntity, and should * reset the value of all cmpFields to 0 or null. * * @param ctx * * @throws RemoteException */ public void initEntity (EntityEnterpriseContext ctx) { // first get cmp metadata of this entity Object instance = ctx.getInstance (); Class ejbClass = instance.getClass (); Field cmpField; Class cmpFieldType;