Package com.sun.identity.policy
Class Rule
- java.lang.Object
-
- com.sun.identity.policy.Rule
-
- All Implemented Interfaces:
Cloneable
@Deprecated public class Rule extends Object implements Cloneable
Deprecated.since 12.0.0The classRuleprovides interfaces to manage a rule that can be added to a policy. A rule constains the rule name, service type, a resource and a map containing action names and action values.
-
-
Field Summary
Fields Modifier and Type Field Description static StringEMPTY_RESOURCE_NAMEDeprecated.Empty resource name.
-
Constructor Summary
Constructors Modifier Constructor Description protectedRule()Deprecated.Contruct aRule.Rule(String ruleName, String serviceName, String resourceName, Map actions)Deprecated.Constructor to create a rule object with rule name, service name, resource name and actions.Rule(String serviceName, String resourceName, Map actions)Deprecated.Constructor to create a rule object with the service name, resource name and actions.Rule(String serviceName, Map actions)Deprecated.Constructor to create a rule object with the service name and actions.protectedRule(Node ruleNode)Deprecated.Constructor to create aRuleobject from a XML Node.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectclone()Deprecated.Creates and returns a copy of this object.booleanequals(Object obj)Deprecated.Checks if two rule objects are identical.SetgetActionNames()Deprecated.Returns the action names that have been set for the rule.MapgetActionValues()Deprecated.Returns aMapof all action names and their corresponding action values that have been set in the rule.SetgetActionValues(String actionName)Deprecated.Returns a set of action values that have been set for the specified action name.StringgetApplicationName()Deprecated.Returns application name.StringgetName()Deprecated.Returns the name assigned to the rule.StringgetResourceName()Deprecated.Returns the resource name for which the rule has been created.Set<String>getResourceNames()Deprecated.Returns the resource names for which the rule has been created.protected ServiceTypegetServiceType()Deprecated.Returns service type of this rules.StringgetServiceTypeName()Deprecated.Returns the service name for which the rule has been created.inthashCode()Deprecated.This added by when CheckStyle noticed there was an implementation of equals without an implementation of hashCode - usually a recipe for disaster.ResourceMatchisResourceMatch(String serviceName, String resourceName)Deprecated.Compares the given service and resource names with the service and resource name specified in this rule.voidsetActionValues(Map actionValues)Deprecated.Sets the action names and their corresponding actions values (or permissions) for the resource or the service.voidsetApplicationName(String applicationName)Deprecated.Sets application Name.voidsetName(String ruleName)Deprecated.Sets the name for the rule.voidsetResourceNames(Set<String> resourceNames)Deprecated.Sets the resource names for which the rule has been created.protected StringtoResourcesXml(String policyName)Deprecated.Returns an XML respresentation of the rule with policy name to use in resource index tree.StringtoString()Deprecated.Returns xml string representation of the rule.StringtoXML()Deprecated.Returns an XML string representing the rule.
-
-
-
Field Detail
-
EMPTY_RESOURCE_NAME
public static final String EMPTY_RESOURCE_NAME
Deprecated.Empty resource name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Rule
protected Rule()
Deprecated.Contruct aRule.
-
Rule
public Rule(String serviceName, String resourceName, Map actions) throws NameNotFoundException, InvalidNameException
Deprecated.Constructor to create a rule object with the service name, resource name and actions. The actions provided as aMapmust have the action name as key and aSetofStrings as its value. The action names and action values must conform to the schema specified for the service. Otherwise,InvalidNameExceptionis thrown. The parametersruleNameandresourceNamecan benull.- Parameters:
serviceName- name of the service type as defined by the service schemaresourceName- name of the resource for the service typeactions- map of action and action values for the resource- Throws:
NameNotFoundException- the service name provided does not existInvalidNameException- the resource name, action name, or values is not valid
-
Rule
public Rule(String serviceName, Map actions) throws NameNotFoundException, InvalidNameException
Deprecated.Constructor to create a rule object with the service name and actions. This is useful for services (and possibly action names) that do not have resource names. The actions provided as aMapmust have the action name as it key and aSetofStrings as its value. The action names and action values must conform to the schema specified for the service. Otherwise,InvalidNameExceptionis thrown. The parametersruleNameandresourceNamecan benull.- Parameters:
serviceName- name of the service type as defined by the service schemaactions- map of action and action values for the resource- Throws:
NameNotFoundException- the service name provided does not existInvalidNameException- the resource name, action name, or values is not valid
-
Rule
public Rule(String ruleName, String serviceName, String resourceName, Map actions) throws NameNotFoundException, InvalidNameException
Deprecated.Constructor to create a rule object with rule name, service name, resource name and actions. The actions provided as aMapmust have the action name as it key and aSetofStrings as its value. The action names and action values must conform to the service schema. Otherwise,InvalidNameExceptionis thrown. The parametersruleNameandresourceNamecan benull.- Parameters:
ruleName- name of the ruleserviceName- name of the service type as defined by the service schemaresourceName- name of the resource for the service typeactions- map of action and action values for the resource- Throws:
NameNotFoundException- the service name provided does not existInvalidNameException- the resource name, action name, or values is not valid
-
Rule
protected Rule(Node ruleNode) throws InvalidFormatException, InvalidNameException, NameNotFoundException
Deprecated.Constructor to create aRuleobject from a XML Node.- Parameters:
ruleNode- XML node representation ofRule- Throws:
InvalidFormatException- on invalid xmlInvalidNameException- thrown by called routinesNameNotFoundException- thrown by called routines
-
-
Method Detail
-
setApplicationName
public void setApplicationName(String applicationName)
Deprecated.Sets application Name.- Parameters:
applicationName- Application name.
-
getApplicationName
public String getApplicationName()
Deprecated.Returns application name.- Returns:
- application name.
-
getName
public String getName()
Deprecated.Returns the name assigned to the rule. It could benullif it was not constructed with a name.- Returns:
- rule name
-
setName
public void setName(String ruleName) throws InvalidNameException
Deprecated.Sets the name for the rule. If a name has already been assigned, it will be replaced with the given name.- Parameters:
ruleName- rule name.- Throws:
InvalidNameException- if rule name is invalid.
-
getServiceTypeName
public String getServiceTypeName()
Deprecated.Returns the service name for which the rule has been created. The service name of the rule cannot be changed once the rule is created.- Returns:
- service name
-
getResourceName
public String getResourceName()
Deprecated.Returns the resource name for which the rule has been created. If the service does not support resource names, the method will returnnull. The resource name of the rule cannot be changed once the rule is created.- Returns:
- resource name
-
getResourceNames
public Set<String> getResourceNames()
Deprecated.Returns the resource names for which the rule has been created. If the service does not support resource names, the method will returnnull. The resource name of the rule cannot be changed once the rule is created.- Returns:
- resource name
-
setResourceNames
public void setResourceNames(Set<String> resourceNames)
Deprecated.Sets the resource names for which the rule has been created. If the service does not support resource names, the method will returnnull. The resource name of the rule cannot be changed once the rule is created.- Parameters:
resourceNames- resource name
-
getActionNames
public Set getActionNames()
Deprecated.Returns the action names that have been set for the rule. The action names returned could be the same as the service's action names or a subset of it.- Returns:
- action names defined in this rule for the service
-
getActionValues
public Set getActionValues(String actionName) throws NameNotFoundException
Deprecated.Returns a set of action values that have been set for the specified action name.- Parameters:
actionName- action name for which to compute values.- Returns:
- action names defined in this rule for the service
- Throws:
NameNotFoundException- if actions name is not found in the rule
-
getActionValues
public Map getActionValues()
Deprecated.Returns aMapof all action names and their corresponding action values that have been set in the rule. The "key" of theMapwill be the action name as a string, and its "value" will be aSetwhich contains the action values as strings.- Returns:
- all action names and corresponding action values
-
setActionValues
public void setActionValues(Map actionValues) throws InvalidNameException
Deprecated.Sets the action names and their corresponding actions values (or permissions) for the resource or the service.- Parameters:
actionValues- action names and their corresponding values- Throws:
InvalidNameException- if action name is invalid.
-
equals
public boolean equals(Object obj)
Deprecated.Checks if two rule objects are identical. Two rules are identical only if the service name, resource name, action name and values match.
-
hashCode
public int hashCode()
Deprecated.This added by when CheckStyle noticed there was an implementation of equals without an implementation of hashCode - usually a recipe for disaster.
-
isResourceMatch
public ResourceMatch isResourceMatch(String serviceName, String resourceName)
Deprecated.Compares the given service and resource names with the service and resource name specified in this rule. The method returns aResourceMatchobject which specifies if the resources match exactly, do not match, or one of them is a subordinate resource of the other. If the service name does not match, the method returnsNO_MATCH.- Parameters:
serviceName- name of the serviceresourceName- name of the resource- Returns:
- returns
ResourceMatchthat specifies if the service name and resource name are exact match, or otherwise.
-
toXML
public String toXML()
Deprecated.Returns an XML string representing the rule.- Returns:
- an XML string representing the rule.
-
getServiceType
protected ServiceType getServiceType()
Deprecated.Returns service type of this rules.- Returns:
- service type of this rule
-
toResourcesXml
protected String toResourcesXml(String policyName)
Deprecated.Returns an XML respresentation of the rule with policy name to use in resource index tree.- Parameters:
policyName- policy name to use while creating xml representation- Returns:
- an XML respresentation of the rule with policy name to use in resource index tree
-
toString
public String toString()
Deprecated.Returns xml string representation of the rule.
-
clone
public Object clone()
Deprecated.Creates and returns a copy of this object. The returnedRuleobject will have the same rule name, resource, service name, and actions such thatx.clone().equals(x)will betrue. Howeverx.clone()will not be the same asx, i.e.,x.clone() != x.
-
-