Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mq.sm.file
Class DynamicStateManager

    java.lang.Object
      org.jboss.mx.util.JBossNotificationBroadcasterSupport
          org.jboss.system.ServiceMBeanSupport
              org.jboss.mq.sm.AbstractStateManager
                  org.jboss.mq.sm.file.DynamicStateManager

All Implemented Interfaces:
  AbstractStateManagerMBean, DynamicStateManagerMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, StateManager

public class DynamicStateManager
extends AbstractStateManager
implements DynamicStateManagerMBean

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.

Example file format:

    <StateManager>
     <Users>
       <User>
        <Name>john</Name>
        <Password>needle</Password>
        <Id>DurableSubscriberExample</Id><!-- optional -->
       </User>
     </Users>

     <Roles>
      <Role name="guest">
        <UserName>john</UserName>
      </Role>

     </Roles>

     <DurableSubscriptions>
       <DurableSubscription>
         <ClientID>needle</ClientID>
         <Name>myDurableSub</Name>
         <TopicName>TestTopic...</TopicName>
       </DurableSubscription>

     </DurableSubscriptions>
    </StateManager>

Version:
  $Revision: 1.8 $
Author:
  Norbert Lataille, Hiram Chirino, Peter Antman

Nested Class Summary

Nested classes inherited from class org.jboss.mq.sm.AbstractStateManager
`AbstractStateManager.DurableSubscription`

Field Summary

Fields inherited from class org.jboss.system.ServiceMBeanSupport
`log, server, SERVICE_CONTROLLER_SIG, serviceName`

Fields inherited from interface org.jboss.system.ServiceMBean
`CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED`

Constructor Summary
`DynamicStateManager()`

Method Summary
`void` | `addRole(String name)`
`void` | `addUser(String name, String password, String preconfID)`
`void` | `addUserToRole(String roleName, String user)`
`protected void` | `checkLoggedOnClientId(String clientID)` Check if the clientID belonges to a preconfigured user.
`protected void` | `createService()`
`String` | `displayStateConfig()` Show the current configuration.
`protected XElement` | `findRole(String role)`
`protected XElement` | `findUser(String user)`
`protected XElement` | `findUserInRole(XElement role, String user)`
`protected AbstractStateManager.DurableSubscription` | `getDurableSubscription(DurableSubscriptionID sub)` Search for a configurated durable subscription.
`Collection` | `getDurableSubscriptionIdsForTopic(SpyTopic topic)` Get all configured durable subscriptions for a particular topic.
`StateManager` | `getInstance()` Get an instance if the StateManager (Singleton).
`protected String` | `getPreconfClientId(String login, String passwd)` Return preconfigured client id.
`String[]` | `getRoles(String user)` We currently only support one Group type Roles.
`String` | `getStateFile()` Get name of file.
`boolean` | `hasSecurityManager()`
`void` | `loadConfig()`
`protected void` | `removeDurableSubscription(AbstractStateManager.DurableSubscription ds)` Remove the subscription and save to persistent storage.
`void` | `removeRole(String name)`
`void` | `removeUser(String name)`
`void` | `removeUserFromRole(String roleName, String user)`
`void` | `saveConfig()`
`protected void` | `saveDurableSubscription(AbstractStateManager.DurableSubscription ds)` Add to durable subs and save the subsrcription to persistent storage.
`void` | `setHasSecurityManager(boolean hasSecurityManager)`
`void` | `setStateFile(String newStateFile)` Set the name of the statefile.
`void` | `startService()`
`boolean` | `validatePassword(String user, String inputPassword)` Validate the user/password combination.

Methods inherited from class org.jboss.mq.sm.AbstractStateManager
`addLoggedOnClientId, checkUser, getDurableTopic, removeLoggedOnClientId, setDurableSubscription`

Methods inherited from class org.jboss.system.ServiceMBeanSupport
`create, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService`

Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
`addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jboss.system.ServiceMBean
`getName, getState, getStateString, jbossInternalLifecycle`

Methods inherited from interface org.jboss.system.Service
`create, destroy, start, stop`

Constructor Detail

### DynamicStateManager

    public DynamicStateManager()

Method Detail

### getInstance

    public StateManager getInstance()

  Description copied from interface: `AbstractStateManagerMBean`
  Get an instance if the StateManager (Singleton).

  Specified by:
    `getInstance` in interface `AbstractStateManagerMBean`

### createService

    protected void createService()
                          throws Exception

  Throws:
    `Exception`

### startService

    public void startService()
                      throws Exception

  Throws:
    `Exception`

### displayStateConfig

    public String displayStateConfig()
                              throws Exception

  Show the current configuration.

  Throws:
    `Exception`

### setStateFile

    public void setStateFile(String newStateFile)

  Set the name of the statefile.

  Specified by:
    `setStateFile` in interface `DynamicStateManagerMBean`
  Parameters:
    `newStateFile` - java.lang.String

### getStateFile

    public String getStateFile()

  Get name of file.

  Specified by:
    `getStateFile` in interface `DynamicStateManagerMBean`
  Returns:
    java.lang.String

### hasSecurityManager

    public boolean hasSecurityManager()

  Specified by:
    `hasSecurityManager` in interface `DynamicStateManagerMBean`

### setHasSecurityManager

    public void setHasSecurityManager(boolean hasSecurityManager)

  Specified by:
    `setHasSecurityManager` in interface `DynamicStateManagerMBean`

### loadConfig

    public void loadConfig()
                    throws IOException,
                           XElementException

  Specified by:
    `loadConfig` in interface `DynamicStateManagerMBean`
  Throws:
    `IOException`
    `XElementException`

### saveConfig

    public void saveConfig()
                    throws IOException

  Specified by:
    `saveConfig` in interface `DynamicStateManagerMBean`
  Throws:
    `IOException`

### getPreconfClientId

    protected String getPreconfClientId(String login,
                                        String passwd)
                                 throws javax.jms.JMSException

  Return preconfigured client id. Only if hasSecurityManager is false will a password be required to get the clientID and will the method throw a JMSSecurityException if the clientID was not found.

  Specified by:
    `getPreconfClientId` in class `AbstractStateManager`
  Parameters:
    `login` - the user name
    `passwd` - the password
  Returns:
    any preconfigured client id
  Throws:
    `javax.jms.JMSException` - for any error

### getDurableSubscription

    protected AbstractStateManager.DurableSubscription getDurableSubscription(DurableSubscriptionID sub)
                                                                       throws javax.jms.JMSException

  Search for a configurated durable subscription.

  Specified by:
    `getDurableSubscription` in class `AbstractStateManager`
  Parameters:
    `sub` - the durable subscription id
  Returns:
    the durable subscription or null if not found
  Throws:
    `javax.jms.JMSException` - for any error

### checkLoggedOnClientId

    protected void checkLoggedOnClientId(String clientID)
                                  throws javax.jms.JMSException

  Check if the clientID belonges to a preconfigured user. If this is the case, a InvalidClientIDException will be raised.

  Specified by:
    `checkLoggedOnClientId` in class `AbstractStateManager`
  Parameters:
    `clientID` - the client id to check
  Throws:
    `javax.jms.JMSException` - for any error

### saveDurableSubscription

    protected void saveDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                    throws javax.jms.JMSException

  Description copied from class: `AbstractStateManager`
  Add to durable subs and save the subsrcription to persistent storage.

  Called by this class so the sublclass can save. This may be both a new subscription or a changed one. It is up to the sublcass to know how to find a changed on. (Only the topic will have changed, and it is the same DurableSubscription that is saved again that this class got through getDurableSubscription.

  Specified by:
    `saveDurableSubscription` in class `AbstractStateManager`
  Parameters:
    `ds` - the durable subscription to save
  Throws:
    `javax.jms.JMSException` - for any error

### removeDurableSubscription

    protected void removeDurableSubscription(AbstractStateManager.DurableSubscription ds)
                                      throws javax.jms.JMSException

  Description copied from class: `AbstractStateManager`
  Remove the subscription and save to persistent storage.

  Called by this class so the sublclass can remove.

  Specified by:
    `removeDurableSubscription` in class `AbstractStateManager`
  Parameters:
    `ds` - the durable subscription to save
  Throws:
    `javax.jms.JMSException` - for any error

### getDurableSubscriptionIdsForTopic

    public Collection getDurableSubscriptionIdsForTopic(SpyTopic topic)
                                                 throws javax.jms.JMSException

  Description copied from interface: `StateManager`
  Get all configured durable subscriptions for a particular topic.

  Specified by:
    `getDurableSubscriptionIdsForTopic` in interface `StateManager`
  Specified by:
    `getDurableSubscriptionIdsForTopic` in class `AbstractStateManager`
  Throws:
    `javax.jms.JMSException`

### addUser

    public void addUser(String name,
                        String password,
                        String preconfID)
                 throws Exception

  Specified by:
    `addUser` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### removeUser

    public void removeUser(String name)
                    throws Exception

  Specified by:
    `removeUser` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### addRole

    public void addRole(String name)
                 throws Exception

  Specified by:
    `addRole` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### removeRole

    public void removeRole(String name)
                    throws Exception

  Specified by:
    `removeRole` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### addUserToRole

    public void addUserToRole(String roleName,
                              String user)
                       throws Exception

  Specified by:
    `addUserToRole` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### removeUserFromRole

    public void removeUserFromRole(String roleName,
                                   String user)
                            throws Exception

  Specified by:
    `removeUserFromRole` in interface `DynamicStateManagerMBean`
  Throws:
    `Exception`

### findUser

    protected XElement findUser(String user)
                         throws Exception

  Throws:
    `Exception`

### findRole

    protected XElement findRole(String role)
                         throws Exception

  Throws:
    `Exception`

### findUserInRole

    protected XElement findUserInRole(XElement role,
                                      String user)
                               throws Exception

  Throws:
    `Exception`

### getRoles

    public String[] getRoles(String user)
                      throws Exception

  We currently only support one Group type Roles. The role named returned should typically be put into a Roles Group principal.

  Throws:
    `Exception`

### validatePassword

    public boolean validatePassword(String user,
                                    String inputPassword)
                             throws Exception

  Validate the user/password combination. A null inputPassword will allways reurn false.

  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.