com.ibm.broker.config.proxy

Class PolicyProxy

  • Direct Known Subclasses:
    WLMPolicyProxy


    public class PolicyProxy
    extends AdministeredObject

    Each PolicyProxy instance represents a policy and all the data defined by that policy.

    A Policy is used to control the processing and behaviour of a message flow. To cause it to effect a message flow it must be attach to the flow. WorkloadManagement policies are attached to flows by setting the WLMPolicy property on the flow.

    In order to use PolicyProxy objects, applications must first obtain handles to them. Here is an example of how to do this:

         BrokerProxy b = BrokerProxy.getInstance(
             new IntegrationNodeConnectionParameters("localhost", 4414)); 
         PolicyManagerProxy p = b.getPolicyManager(policyType);
         PolicyProxy policy = p.getPolicy("mypolicy");
     
    
     Change Activity:
     -------- ----------- -------------   ------------------------------------
     Reason:  Date:       Originator:     Comments:
     -------- ----------- -------------   ------------------------------------
                                             
     
    Version %Z% %I% %W% %E% %U% [%H% %T%]
    • Constructor Detail

      • PolicyProxy

        public PolicyProxy(java.lang.String type,
                           java.lang.String name)
        Constructs a new policy object based on the parameters provided. The policy object is not created on the broker until the object is used in a call to either a BrokerProxy policy method (like createPolicy) or a PolicyManagerProxy object.
    • Method Detail

      • getConfigurationObjectType

        public ConfigurationObjectType getConfigurationObjectType()
        Description copied from class: AdministeredObject
        Returns the ConfigurationObjectType associated with this AdministeredObject type. For example, for ExecutionGroupProxy, ConfigurationObjectType.executiongroup is returned.
        Specified by:
        getConfigurationObjectType in class AdministeredObject
        Returns:
        ConfigurationObjectType associated with this class.
      • getConfigurationObjectTypeOfParent

        public ConfigurationObjectType getConfigurationObjectTypeOfParent()
        Description copied from class: AdministeredObject
        Returns the ConfigurationObjectType associated with the logical parent of this AdministeredObject type. For example, for ExecutionGroupProxy, ConfigurationObjectType.broker is returned.
        Specified by:
        getConfigurationObjectTypeOfParent in class AdministeredObject
        Returns:
        ConfigurationObjectType associated with this class.
      • setPolicyContent

        public void setPolicyContent(java.lang.String policyContent)
        Set the policy content
        Parameters:
        policyContent - value to set the policy content to. It must be a valid policy xml document.
      • getProperty

        public java.lang.String getProperty(java.lang.String key)
                                     throws ConfigManagerProxyPropertyNotInitializedException
        Description copied from class: AdministeredObject
        Returns the local value of the supplied attribute. The information returned will be incorrect if the broker has recently modified the required property and the IBM Integration API (CMP) has not yet received notification of the change.
        Overrides:
        getProperty in class AdministeredObject
        Parameters:
        key - The name of the property to find. Use the AttributeConstants.*_PROPERTY constants here.
        Returns:
        String the local copy of the required property, or null if the property could not be found.
        Throws:
        ConfigManagerProxyPropertyNotInitializedException - if the value of the property is unknown because the information has not yet been supplied by the broker. If this is the case, this method will issue retries in accordance with the retry characteristics set by the BrokerProxy.setRetryCharacteristics() method. Only after these retries have been exhausted will the ConfigManagerProxyPropertyNotInitializedException be thrown.
      • registerListener

        public void registerListener(AdministeredObjectListener listener)
        Asks the broker to keep the caller informed of any changes to the current AdministeredObject.

        The listener will only be invoked after a message from the broker is received by the IBM Integration API (CMP) that states the current object has been modified or deleted, or if a previous action involving this object and originated by this application has been completed.

        In order to register listeners against multiple AdministeredObjects, user applications must call registerListener() for each object for which it wishes to receive notifications.

        Overrides:
        registerListener in class AdministeredObject
        Parameters:
        listener - the object that will be notified of any events on the current AdministeredObject.
      • registerListener

        public void registerListener(AdvancedAdministeredObjectListener listener,
                                     boolean sendNotificationImmediately,
                                     java.lang.Object nextNotificationCorrelationID)
        Asks the broker to keep the caller informed of any changes to the current AdministeredObject, and ask to be provided with advanced notifications.

        Most applications will not need to use the information provided by the AdvancedAdministeredObjectListener and should therefore not call this method to register their listeners. Use registerListener(AdministeredObjectListener) if possible.

        The listener will only be invoked after a message from the broker is received by the IBM Integration API (CMP) that states the current object has been modified or deleted, or if a previous action involving this object and originated by this application has been completed.

        In order to register listeners against multiple AdministeredObjects, user applications must call registerListener() for each object for which it wishes to receive notifications.

        Each AdvancedAdministeredObjectListener instance can have at most one correlationID for each AdministeredObject for which it is registered.

        Note: If the caller sets sendNotificationImmediately to false AND the object has not yet received its complete set of attributes from the broker, this method will pause until the complete attribute list has been provided; this is done in order to establish a viable baseline from which 'changed attributes' list can be calculated. In this case, if the complete attribute list is not provided by the time the configured timeout occurs, the first processModify() message for this object may include the complete set of attributes for the AdministeredObject when the attribute list finally does arrive.

        Overrides:
        registerListener in class AdministeredObject
        Parameters:
        listener - the object that will be notified of any events
        sendNotificationImmediately - If false, processModify() will only ever be called upon receipt of a modification message from the broker. If true, the method will additionally be called as soon as the listener is registered. This special notification will contain information on all of the object's attributes.
        nextNotificationCorrelationID - This is used to group together listeners that share notification information. Specifically, when a 'modify' or 'delete' notification occurs, advanced listeners are told an approximate time till the next notification to a listener with the same correlation identifier is expected. Specify null here to not use a correlation identifier for this listener.
      • registerListener

        public void registerListener(AdvancedAdministeredObjectListener listener)
        Asks the broker to keep the caller informed of any changes to the current AdministeredObject.

        The listener will only be invoked after a message from the broker is received by the IBM Integration API (CMP) that states the current object has been modified or deleted, or if a previous action involving this object and originated by this application has been completed.

        In order to register listeners against multiple AdministeredObjects, user applications must call registerListener() for each object for which it wishes to receive notifications.

        After a successful completion of this call, no "object modified" notification will be sent to the listener until the next time a modification happens to occur on the object. Listeners that wish to receive an immediate notification (e.g. to provide a baseline for any future deltas) must call registerListener(listener, true, *) instead.

        Overrides:
        registerListener in class AdministeredObject
        Parameters:
        listener - the object that will be notified of any events on the current AdministeredObject.
      • deregisterListener

        public void deregisterListener(AdministeredObjectListener listener)
        Asks the IBM Integration API (CMP) to unsubscribe a previously registered AdministeredObjectListener, given the listener instance that was supplied during registration.

        If the supplied listener was registered with this AdministeredObject more than once, all registrations will be removed.

        If the supplied listener has not been registered with this administered object then this method does nothing.

        Overrides:
        deregisterListener in class AdministeredObject
        Parameters:
        listener - the object that will no longer be notified of any events
      • deregisterListener

        public void deregisterListener(AdvancedAdministeredObjectListener listener)
        Asks the IBM Integration API (CMP) to unsubscribe a previously registered AdvancedAdministeredObjectListener, given the listener instance that was supplied during registration.

        If the supplied listener was registered with this AdministeredObject more than once, all registrations will be removed.

        If the supplied listener has not been registered with this administered object then this method does nothing.

        Overrides:
        deregisterListener in class AdministeredObject
        Parameters:
        listener - the object that will no longer be notified of any events
      • getType

        public java.lang.String getType()
        Convenience method to return the type of this administered object. Where possible, use getConfigurationObjectType() instead, as it returns the type in a form that is more easily parsed.
        Overrides:
        getType in class AdministeredObject
        Returns:
        String The name of this AdministeredObject type.
      • setName

        public void setName(java.lang.String name)
                     throws ConfigManagerProxyLoggedException
        This method overrides the base class implementation, so that an exception is thrown if this method is invoked against an existing PolicyProxy. It is not possible to change the name of a Policy that already exists on an Integration node.
        Overrides:
        setName in class AdministeredObject
        Parameters:
        name - (this is ignored)
        Throws:
        ConfigManagerProxyLoggedException - to indicate this method should not be called.
      • refresh

        public void refresh()
                     throws ConfigManagerProxyLoggedException
        Forces this AdministeredObject to reregister itself with the broker and to re-receive the object's complete set of attributes. This call is not generally necessary, as the broker will keep the object's subscription active indefinitely and keep the application up to date with its latest information anyway.

        This method must not be called on AdministeredObject instances that do not yet exist on the broker (ie. objects initialized during a batch of creation requests).

        Overrides:
        refresh in class AdministeredObject
        Throws:
        ConfigManagerProxyLoggedException - if the request to refresh the object could not be sent to the broker.