2 Replies Latest reply on Dec 10, 2004 4:03 AM by peter neville

    XMBean will not make attributes persistent

    Christofer Dutz Newbie

      Hi,

      I created a small XMBean with only one attribute. Unfortunately it's content is never persisted ... I don't know what I'm doing wrong :(

      Here the code:

      /*
      * Created on 03.06.2004
      *
      * TODO To change the template for this generated file go to
      * Window - Preferences - Java - Code Style - Code Templates
      */
      package de.cware.cweb.framework.config;

      import java.io.Serializable;

      import org.dom4j.Document;
      import org.jboss.system.ServiceMBeanSupport;

      /**
      * This class is a JMX bean, which can be accessed and controlled from the
      * J2EE server's JMX console, assuming there is one.
      *
      * @jmx.mbean name="de.cware.cweb.framework.config:service=TestConfigService"
      * description="An MBean that handles a services configuration data"
      * extends="org.jboss.system.ServiceMBean"
      * persistLocation="${jboss.server.data.dir}/cweb/"
      * persistName="test.ser"
      * state-action-on-update="restart"
      * persistence-manager="org.jboss.mx.persistence.ObjectStreamPersistenceManager"
      *
      * @jboss.service servicefile="jboss"
      * @jboss.xmbean
      */
      public class Configuration extends ServiceMBeanSupport implements Serializable {
      private Document config;

      /**
      * Default constructor
      * @jmx:managed-constructor description="Default constructor"
      */
      public Configuration() {
      }

      /**
      * Get configuration data
      * @jmx.managed-attribute
      * access="read-write"
      * persistPolicy="OnUpdate"
      * description="Get configuration data"
      */
      public Document getConfiguration() {
      return this.config;
      }

      /**
      * @jmx.managed-attribute
      */
      public void setConfiguration(Document config) {
      this.config = config;
      }
      }


      Chris