Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.ibm.policy.manager

This package includes the API of the Policy Manager runtime.

See:
Description

Interface Summary
PolicyManagerService | Portal service to query the Policy server side system for applicable Policy Value Sets.

## Package com.ibm.policy.manager Description

This package includes the API of the Policy Manager runtime. Policy Manager returns objects typed as Policy Value Sets, which are derivatives of simple Maps. A Policy Value Set (PVS) is a set of application specific attributes that create points of variability in some apsect of the calling application. The goal of the Policy Manager API is to provide the same API to policy consumers, or applications , independant of the platforms they are calling from. For example, the same policy code could be made from a server side portlet running within Websphere Portal, as well as from an application on the rich client.
Targets are rules engine objects to assist policy in navigating the tree of subpolicies. Execution of a Target results in a list of profiles, that provide the next possible step down the policy subtree. Targets' uses are limited to the server side consumers of policy. Alternative to Targets, if policy consumers know the policy tree topology, they can form their own policy path in the form of a String.
Use the WebSphere Portal JNDI portlet service lookup mechanism to locate the PolicyManager implementation.

Usage examples:

- Code with a known policy path:

          import com.ibm.policy.manager.*;
          import javax.naming.InitialContext;
          import javax.naming.Context;
              import javax.naming.NamingException;
              ...

          PolicyManagerService pms;
          javax.naming.Context ctx = new javax.naming.InitialContext();
          try {
              pms = (PolicyManagerService)ctx.lookup("portal:service/policy/PolicyManager");
          } catch(javax.naming.NameNotFoundException ex) {
               ... error handling ...
          }
           ...
          // request the service via the home interface
          PolicyManager pManager = pms.getPolicyManager();

          String knownPolicyPath="Taxes/UnitedStates/NorthCarolina";
          PolicyValueSet set=pManager.getPVSByPath(knownPolicyPath);
          int taxRate=set.get("rate");

- Code requesting evaluation of the current request to determine applicable policy.

              import com.ibm.policy.manager.*;
              import com.ibm.policy.manager.portal.*;
              import javax.naming.InitialContext;
              import javax.naming.Context;
              import javax.naming.NamingException;

              ...

          PolicyManager pManager=null;

          PolicyManagerService pms;
          Context ctx = new InitialContext();
          try {
              pms = (PolicyManagerService)ctx.lookup("portal:service/policy/PolicyManager");
          } catch(javax.naming.NameNotFoundException ex) {
               ... error handling ...
          }
          ...
          // request the service via the home interface
          PolicyManager pManager = pms.getPolicyManager();

          String knownPolicyType="Taxes";
          RuleContext ruleCtx=new PortletRequestRuleContext(portletRequest);
          Target tar=pManager.createTarget(ruleCtx);
          PolicyValueSet set=pManager.getPVSByTarget(tar, knownPolicyType);
          Integer taxRate=set.get("rate");

Please note that as a general rule, all of the interfaces of this API must not be implemented. Your code may only implement an interface if the according interface description explicitely states that this is allowed.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES