User: juhalindfors
  Date: 02/01/23 14:03:34

  Modified:    src/main/org/jboss/mx/modelmbean ModelBase.java
  Log:
  cleanup + persistence interceptor
  
  Revision  Changes    Path
  1.3       +23 -53    jmx/src/main/org/jboss/mx/modelmbean/ModelBase.java
  
  Index: ModelBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/modelmbean/ModelBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ModelBase.java    2002/01/12 20:08:59     1.2
  +++ ModelBase.java    2002/01/23 22:03:33     1.3
  @@ -19,6 +19,9 @@
   import javax.management.NotificationBroadcaster;
   import javax.management.NotificationBroadcasterSupport;
   import javax.management.MBeanNotificationInfo;
  +import javax.management.MBeanRegistration;
  +import javax.management.MBeanServer;
  +import javax.management.ObjectName;
   import javax.management.JMException;
   import javax.management.MBeanException;
   import javax.management.ListenerNotFoundException;
  @@ -33,6 +36,8 @@
   import javax.management.modelmbean.InvalidTargetObjectTypeException;
   
   import org.jboss.mx.server.MBeanInvoker;
  +import org.jboss.mx.interceptor.ModelMBeanInterceptor;
  +import org.jboss.mx.interceptor.PersistenceInterceptor;
   import org.jboss.mx.persistence.NullPersistence;
   import org.jboss.mx.persistence.PersistenceManager;
   
  @@ -44,23 +49,21 @@
    * @see org.jboss.mx.modelmbean.ModelMBeanConstants
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
  - * @version $Revision: 1.2 $  
  + * @version $Revision: 1.3 $  
    */
   public abstract class ModelBase 
      extends MBeanInvoker
  -   implements ModelMBean, ModelMBeanConstants
  +   implements ModelMBean, ModelMBeanConstants, MBeanRegistration
   {
   
      // Attributes ----------------------------------------------------
  -   //protected Object resource                  = null;
      protected String resourceType              = null;
      protected ModelMBeanInfoSupport metadata   = null;
      protected PersistenceManager persistence   = new NullPersistence();
  -   protected NotificationBroadcasterSupport notifier = new 
NotificationBroadcasterSupport();
  +   protected NotificationBroadcasterSupport notifier = new 
NotificationBroadcasterSupport();   
      
  -   // Static --------------------------------------------------------
  -   protected static long notifierSequence     = 1;
  -   protected static long attrNotifierSequence = 1;
  +   protected long notifierSequence     = 1;
  +   protected long attrNotifierSequence = 1;
      
      
      // Constructors --------------------------------------------------
  @@ -201,53 +204,20 @@
         persistence.store(metadata);
      }
   
  -   // DynamicMBean implementation -----------------------------------
  -/*   public AttributeList getAttributes(String[] attributes)
  -   {
  -      if (attributes == null)
  -         throw new IllegalArgumentException("null array");
  -
  -      AttributeList list = new AttributeList();
  -
  -      for (int i = 0; i < attributes.length; ++i)
  -      {
  -         try
  -         {
  -            list.add(new Attribute(attributes[i], getAttribute(attributes[i])));
  -         }
  -         catch (JMException ignored)
  -         {
  -            // if the attribute could not be retrieved, skip it
  -         }
  -      }
  -
  -      return list;
  +   // MBeanRegistration implementation ------------------------------
  +   public ObjectName preRegister(MBeanServer server, ObjectName name) throws 
Exception
  +   {    
  +      //this.descriptors = metadata.getDescriptors(ALL_DESCRIPTORS);
  +      this.stack = new PersistenceInterceptor(server, this, 
metadata.getDescriptors(ALL_DESCRIPTORS));
  +      this.stack.insertLast(new ModelMBeanInterceptor(resource, metadata));
  +      
  +      return name;
      }
  +   
  +   public void postRegister(Boolean registrationSuccessful) { }
  +   public void preDeregister() throws Exception { }
  +   public void postDeregister() { }
  +   
   
  -   public AttributeList setAttributes(AttributeList list)
  -   {
  -      if (list == null)
  -         throw new IllegalArgumentException("null list");
  -
  -      AttributeList results = new AttributeList();
  -      Iterator it           = list.iterator();
  -
  -      while (it.hasNext())
  -      {
  -         try
  -         {
  -            Attribute attr = (Attribute)it.next();
  -            setAttribute(attr);
  -            results.add(attr);
  -         }
  -         catch (JMException ignored)
  -         {
  -            // if unable to set the attribute, skip it
  -         }
  -      }
  -
  -      return results;
  -   }
  -*/
   }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to