Sun Java System Access Manager 7 2005Q4 Developer's Guide

Policy Management Classes

Policy Management classes are used by system administrators to manage policies in Access Manager. The interfaces for this functionality are contained in the com.sun.identity.policy package and including the following:

PolicyManager

com.sun.identity.policy.PolicyManager is the top-level administrator class for policy management. com.sun.identity.policy.PolicyManager provides methods that enable an administrator to create, modify, or delete realm policies. The PolicyManager can be obtained by passing a privileged user’s session token or by passing a privileged user’s session token with a realm name. Some of the more widely used methods of this class include the following:

getPolicyNames

Retrieves all named policies created for the realm for which the policy manager was instantiated. This method can also take a pattern (filter) as an argument.

getPolicy

Retrieves a policy when given the policy name.

addPolicy

Adds a policy to the specified realm. If a policy with the same name already exists, it will be overwritten.

removePolicy

Removes a policy from the specified realm.

replacePolicy

Replaces policy with a new policy.

Policy

com.sun.identity.policy.Policy represents a policy definition with all its intended parts (rules, subjects, referrals, conditions, and response providers). The policy object is saved in the data store if the addPolicy or replacePolicy methods from the PolicyManager class are invoked. This class contains methods for adding, removing, replacing or getting any of the parts of a policy definition.