User: user57  
  Date: 02/04/03 20:35:07

  Modified:    src/main/org/jboss/mq/sm/file DynamicStateManager.java
                        OldStateManager.java
  Removed:     src/main/org/jboss/mq/sm/file DynamicStateManagerMBean.java
                        OldStateManagerMBean.java
  Log:
   o Using ServerConfigLocator instead of ServerConfigImplMBean
   o Using XDoclet to generate some *MBean interfaces
  
  Revision  Changes    Path
  1.2       +58 -20    jbossmq/src/main/org/jboss/mq/sm/file/DynamicStateManager.java
  
  Index: DynamicStateManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/sm/file/DynamicStateManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DynamicStateManager.java  6 Mar 2002 17:27:51 -0000       1.1
  +++ DynamicStateManager.java  4 Apr 2002 04:35:07 -0000       1.2
  @@ -21,7 +21,7 @@
   import javax.jms.JMSException;
   import javax.jms.JMSSecurityException;
   
  -import org.jboss.system.server.ServerConfigImplMBean;
  +import org.jboss.system.server.ServerConfigLocator;
   import org.jboss.mq.DurableSubscriptionID;
   import org.jboss.mq.SpyTopic;
   import org.jboss.mq.SpyJMSException;
  @@ -31,21 +31,15 @@
   import org.jboss.mq.sm.StateManager;
   import org.jboss.mq.sm.AbstractStateManager;
   
  -
   /**
    * A state manager that allowed durable subscriptions to be dynamically
    * created if configured to support it. Otherwise backward compatible with
    * the old StateManager.
    *
  - * Backed by an XML file.
  + * <p>Backed by an XML file.
    *
  - * @author     <a href="[EMAIL PROTECTED]">Norbert Lataille</a>
  - * @author     <a href="[EMAIL PROTECTED]">Hiram Chirino</a>
  - * @author     <a href="[EMAIL PROTECTED]">Peter Antman</a>
  - * @version $Revision: 1.1 $
  - */
  -/*
  -Example of fileformat
  + * <p>Example file format:
  + * <xmp>
   <StateManager>
    <Users>
      <User>
  @@ -71,11 +65,19 @@
   
    </DurableSubscriptions>
   </StateManager>
  + * </xmp>
  + *
  + * @jmx:mbean extends="org.jboss.mq.sm.AbstractStateManagerMBean"
  + *
  + * @author     <a href="[EMAIL PROTECTED]">Norbert Lataille</a>
  + * @author     <a href="[EMAIL PROTECTED]">Hiram Chirino</a>
  + * @author     <a href="[EMAIL PROTECTED]">Peter Antman</a>
  + * @version $Revision: 1.2 $
    */
  -public class DynamicStateManager  extends AbstractStateManager
  -                                          implements DynamicStateManagerMBean
  +public class DynamicStateManager 
  +   extends AbstractStateManager
  +   implements DynamicStateManagerMBean
   {
  -   
      class DynamicDurableSubscription extends DurableSubscription {
         XElement element;
         public  DynamicDurableSubscription(XElement element) throws XElementException{
  @@ -104,7 +106,9 @@
      boolean hasSecurityManager = true; 
      
      XElement stateConfig = new XElement("StateManager");//So sync allways work
  -   private String stateFile = "conf/default/jbossmq-state.xml";
  +
  +   /** State file is relateive to systemConfigURL. */
  +   private String stateFile = "jbossmq-state.xml";
      private URL systemConfigURL;
      
      
  @@ -118,20 +122,18 @@
      {
         return this;
      }
  -   
   
  -   protected void createService() throws Exception {
  +   protected void createService() throws Exception 
  +   {
         // Get the system configuration URL
  -      systemConfigURL = (URL)
  -         server.getAttribute(ServerConfigImplMBean.OBJECT_NAME, "ServerConfigURL");
  +      systemConfigURL = ServerConfigLocator.locate().getServerConfigURL();
      }
      
      public void startService() throws Exception
      {
  -
         loadConfig();
  -
      }
  +
      /**
       * Show the current configuration.
       */
  @@ -139,9 +141,12 @@
      {
         return stateConfig.toString();
      }
  +
      /**
       * Set the name of the statefile.
       *
  +    * @jmx:managed-attribute
  +    *
       * @param  newStateFile  java.lang.String
       */
      public void setStateFile(String newStateFile)
  @@ -152,6 +157,8 @@
      /**
       * Get name of file.
       *
  +    * @jmx:managed-attribute
  +    *
       * @return    java.lang.String
       */
      public String getStateFile()
  @@ -159,14 +166,23 @@
         return stateFile;
      }
   
  +   /**
  +    * @jmx:managed-attribute
  +    */
      public boolean hasSecurityManager() {
         return hasSecurityManager;
      }
   
  +   /**
  +    * @jmx:managed-attribute
  +    */
      public void setHasSecurityManager(boolean hasSecurityManager) {
         this.hasSecurityManager = hasSecurityManager;
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void loadConfig() throws IOException, XElementException
      {
         URL configURL = new URL(systemConfigURL, stateFile);
  @@ -185,6 +201,9 @@
         }
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void saveConfig() throws IOException
      {
         URL configURL = new URL(systemConfigURL, stateFile);
  @@ -432,6 +451,10 @@
      //
      // The methods that allow dynamic edititing of state manager.
      //
  +
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void addUser(String name, String password, String preconfID) throws 
Exception {
         if (findUser(name) != null)
            throw new Exception("Can not add, user exist");
  @@ -446,6 +469,9 @@
         saveConfig();
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void removeUser(String name) throws Exception {
         XElement user = findUser(name);
         if (user == null)
  @@ -468,6 +494,9 @@
         saveConfig();
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void addRole(String name) throws Exception {
         if(findRole(name)!=null)
            throw new Exception("Cant add role, it already exists");
  @@ -479,6 +508,9 @@
         saveConfig();
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void removeRole(String name) throws Exception {
         XElement role = findRole(name);
         if (role == null)
  @@ -489,6 +521,9 @@
      }
   
      // FIXME; no sanity check that the "real" user does exist.
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void addUserToRole(String roleName, String user) throws Exception {
         XElement role = findRole(roleName);
         if (role == null)
  @@ -506,6 +541,9 @@
         saveConfig();      
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void removeUserFromRole(String roleName, String user) throws Exception {
         XElement role = findRole(roleName);
         if (role == null)
  
  
  
  1.3       +29 -11    jbossmq/src/main/org/jboss/mq/sm/file/OldStateManager.java
  
  Index: OldStateManager.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/sm/file/OldStateManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OldStateManager.java      23 Mar 2002 21:11:01 -0000      1.2
  +++ OldStateManager.java      4 Apr 2002 04:35:07 -0000       1.3
  @@ -38,15 +38,19 @@
   import org.jboss.mq.server.JMSTopic;
   
   import org.jboss.system.ServiceMBeanSupport;
  -import org.jboss.system.server.ServerConfigImplMBean;
  +import org.jboss.system.server.ServerConfigLocator;
   
   /**
    * This class is a simple User Manager. It handles credential issues.
  - * This is the old state manager.
  + *
  + * <p>This is the old state manager.
  + *
  + * @jmx:mbean extends="org.jboss.system.ServiceMBean"
  + *
    * @author     Norbert Lataille ([EMAIL PROTECTED])
    * @author     <a href="[EMAIL PROTECTED]">Hiram Chirino</a>
    * @author     <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>
  - * @version    $Revision: 1.2 $
  + * @version    $Revision: 1.3 $
    */
   public class OldStateManager
      extends ServiceMBeanSupport
  @@ -70,21 +74,24 @@
   
      protected void createService() throws Exception {
         // Get the system configuration URL
  -      systemConfigURL = (URL)
  -         server.getAttribute(ServerConfigImplMBean.OBJECT_NAME, "ServerConfigURL");
  +      systemConfigURL = ServerConfigLocator.locate().getServerConfigURL();
      }
      
      /**
  -    *  Insert the method's description here. Creation date: (7/10/2001 11:17:33
  -    *  PM)
  +    * Sets the StateFile attribute of the StateManagerMBean object
       *
  -    * @param  newStateFile  java.lang.String
  +    * @jmx:managed-attribute
  +    *
  +    * @param newStateFile    The new StateFile value
       */
      public void setStateFile(String newStateFile)
      {
         stateFile = newStateFile.trim();
      }
   
  +   /**
  +    * @jmx:managed-attribute
  +    */
      public StateManager getInstance()
      {
         return this;
  @@ -283,10 +290,11 @@
      }
   
      /**
  -    *  Insert the method's description here. Creation date: (7/10/2001 11:17:33
  -    *  PM)
  +    * Gets the StateFile attribute of the StateManagerMBean object
       *
  -    * @return    java.lang.String
  +    * @jmx:managed-attribute
  +    *
  +    * @return    The StateFile value
       */
      public String getStateFile()
      {
  @@ -504,6 +512,9 @@
        }
      */
      
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void loadConfig() throws IOException, XElementException
      {
         URL configURL = new URL(systemConfigURL, stateFile);
  @@ -520,6 +531,9 @@
         }
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public void saveConfig() throws IOException
      {
         URL configURL = new URL(systemConfigURL, stateFile);
  @@ -543,10 +557,14 @@
         }
      }
   
  +   /**
  +    * @jmx:managed-operation
  +    */
      public String displayStateConfig() throws Exception
      {
         return stateConfig.toString();
      }
  +
      /*
        Does not seem to be used
      public class Identity
  
  
  

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

Reply via email to