|
Project Aristotle - ArisID Attribute Services | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openliberty.arisid.policy.PolicyHandler
public class PolicyHandler
WS-Policy Handler for managing and manipulating WS-Policy objects. This
handler supports the ability to use different WS-Policy implementations. To
switch WS-Policy libraries, a wrapper module (provider) must be written that
implements the IArisWSPolicy
interface, along with implementations of
other interfaces in the org.openliberty.arisid.policy package.
To switch policy providers, set the system property
"org.openliberty.policy.wspolicy.class" WS_POLICY_CLASS
to the name of the class implementing IArisWSPolicy
. The policy
implementation will be instantiated on the first class to
PolicyHandler.getInstance() and will invoke the
IArisWSPolicy.initialize()
method.
Field Summary | |
---|---|
static java.lang.String |
DEF_WSPOLICY_CLASS
|
static java.lang.String |
WS_POLICY_CLASS
|
Method Summary | |
---|---|
boolean |
addConstraintOrAssertionToPolicy(IAssertion[] assertions,
IPolicy targetPolicy,
boolean isAll)
Adds a array of WS Policy IAssertion to an existing IPolicy
object |
boolean |
addConstraintOrAssertionToPolicy(IAssertion assertion,
IPolicy targetPolicy,
boolean isAll)
Adds a WS Policy IAssertion to an existing IPolicy object |
void |
addLocalityConstraint(java.lang.String language,
IAttributeValue value)
Adds a localization constraint to a specified IAttributeValue . |
java.util.Map<java.lang.String,IPolicy> |
addLocalityConstraint(java.lang.String language,
java.lang.String name,
java.util.Map<java.lang.String,IPolicy> constraintMap)
Adds a localization constraint to a policy map for a specified attribute name. |
java.util.Map<java.lang.String,IPolicy> |
applyValueConstraints(IAttributeValue attrValue,
java.lang.String language,
java.util.Map<java.lang.String,IPolicy> constraintMap)
When used as part of an interaction using an IAttributeValue (add, modify, compare), a preferred locality, or policies can be applied. |
IAddValuesConstraint |
createAddValuesConstraint()
Create a constraint that changes a modify to indicate values should add too, rather than replace, current values. |
IContractOrLegalConstraint |
createContractOrLegalConstraint(java.net.URI contractUri,
java.net.URI issuer)
Create a constraint that defines the legal or contractual context under which information is being exchanged. |
IDataDisplayMaskConstraint |
createDataDisplayMaskConstraint(java.lang.String maskPattern,
java.net.URI issuer)
Describes components of string data which should be masked when data is displayed or logged. |
IDataLossOrBreachConstraint |
createDataLossOrBreachConstraint(java.net.URI breachReportUri,
java.net.URI issuer)
Describes the entities (e.g. |
IDeleteValuesConstraint |
createDeleteValuesConstraint()
Generates a constraint used to change a modify operation to cause specific values provided to be deleted. |
ILifetimeConstraint |
createLifetimeConstraint(java.util.Date startDate,
java.util.Date endDate)
Generates a Lifetime constraint that specifies for how long an assertion is valid. |
ILifetimeConstraint |
createLifetimeConstraint(int hours,
int mins)
Generates a Lifetime constraint that specifies for how long an assertion is valid specified in hours and minutes from receipt. |
ILocalizationConstraint |
createLocalizationConstraint(java.lang.String languageCode)
Creates a localization constraint request. |
IPolicy |
createNewPolicy()
Creates a new empty IPolicy object. |
IPropagateConstraint |
createPropagateConstraint(java.net.URI propagateUri,
java.net.URI issuer)
Creates a constrint on the services or end-points to which the data may be propagated or forwarded. |
IPurposeConstraint |
createPurposeConstraint(java.net.URI purposeUri,
java.net.URI issuer)
Describes the usage context in which data is sought or the context in which data is being provided. |
IRetentionConstraint |
createRetentionConstraint(java.net.URI retentionUri,
java.net.URI issuer)
Indicates whether the data value can be retained by the requestor, in memory or otherwise. |
IRetentionConstraint |
createRetentionConstraint(java.net.URI retentionUri,
java.net.URI issuer,
ILifetimeConstraint lifetime)
Indicates whether the data value can be retained by the requestor, in memory or otherwise, and the time period for which it can be retained. |
IAssertion |
getConstraint(IPolicy policy,
javax.xml.namespace.QName assertionName)
Returns the first instance of a constraint located within a policy. |
static PolicyHandler |
getInstance()
Obtains a handle to the WS-Policy service. |
IPolicy |
getInteractionPolicy(IInteraction ixn)
Return any policy associated with an Interaction definition. |
java.util.List<java.lang.String> |
getLocalityConstraints(IAttributeValue value)
Returns a list of localization languages for a particular IAttributeValue object. |
java.util.List<java.lang.String> |
getLocalityConstraints(IPolicy policy)
Return any constraints related to locality in the specified policy |
IPolicy |
getSchemaRefPolicy(IInteraction ixn,
schemaRef attrPredOrRoleRef)
Returns the WS-Policy as referenced in any AttributeRef ,
PredicateRef , or RoleRef object. |
boolean |
isAddValuesOnModify(IAttributeValue value,
IModifyInteraction ixn)
Used to check weather a set of values being used in a modify transaction are intended to add specific values rather than replace all values (the default). |
boolean |
isAssertionPresent(IPolicy policy,
javax.xml.namespace.QName assertionName)
A utility to test for the presence of a particular constraint or assertion class present in a Policy. |
boolean |
isDeleteValuesOnModify(IAttributeValue value,
IModifyInteraction ixn)
Used to check weather a set of values being used in a modify transaction are intended to delete specific values rather than replace all values (the default). |
IPolicy |
loadPolicyByReference(java.net.URI policyRef)
Loads a Policy by URI reference. |
IPolicy |
parseDomPolicy(org.w3c.dom.Node policyNode)
Takes a DOM parsed Node object and uses the WS-Policy
implementation provider to generate an IPolicy object containing
a native policy object. |
IPolicy |
parseStringPolicy(java.lang.String policyString)
Invokes the selected DOM parser and WS-Policy implementation to parse an XML String into an IPolicy object. |
org.w3c.dom.Element |
parseStringToElement(java.lang.String pol)
Converts a String representation of WS-Policy into a DOM Element. |
org.w3c.dom.Element |
policyToElement(java.lang.Object policy)
Deprecated. Use of this method will tie calling code to a specific implementation of WS-Policy and may impact flexibility. |
java.lang.String |
policyToString(java.lang.Object policy)
Converts a policy object (from the policy provider) to a String representation. |
void |
setAddValuesOnModifyConstraint(IAttributeValue value)
Used to change the way a modify request works so that specific values listed can be added without having to replace all existing values. |
void |
setDeleteValuesOnModifyConstraint(IAttributeValue value)
Used to change the way a modify request works so that specific values listed can be deleted. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String WS_POLICY_CLASS
public static final java.lang.String DEF_WSPOLICY_CLASS
Method Detail |
---|
public static PolicyHandler getInstance()
IArisWSPolicy
) will be instantiated. The default is:
org.openliberty.arisid.policy.neethi.PolicyImpl
To override the default, set the system property
"org.openliberty.policy.wspolicy.class" to the name of the class
implementing IArisWSPolicy
interface.
java.lang.ClassCastException
- If the specified class does not implement
IArisWSPolicy
java.lang.ClassNotFoundException
- If the specified class cannot be loaded.public void addLocalityConstraint(java.lang.String language, IAttributeValue value) throws PolicyException
IAttributeValue
.
Note that the localization applies to all values in IAttributeValue. When
localization is applied to a value, the intent is usually to tag or
indicate that a particular value is of a particular locality.
language
- Language token as defined by RFC3066
http://www.w3.org/TR/xmlschema-2/#RFC3066value
- The IAttributeValue
for which the constraint is to be
applied.
PolicyException
- LanguageCode must not be null or empty string.public java.util.Map<java.lang.String,IPolicy> addLocalityConstraint(java.lang.String language, java.lang.String name, java.util.Map<java.lang.String,IPolicy> constraintMap) throws PolicyException
language
- Language token as defined by RFC3066
http://www.w3.org/TR/xmlschema-2/#RFC3066name
- Name identifier of the attribute the constraint is to be
associated with.constraintMap
- A Map containing existing existing constraints for which the
language constraint is to be added. To create a new map, pass
a null.
PolicyException
public java.util.Map<java.lang.String,IPolicy> applyValueConstraints(IAttributeValue attrValue, java.lang.String language, java.util.Map<java.lang.String,IPolicy> constraintMap) throws PolicyException
attrValue
- An IAttributeValue for which the locality constraint is to be
set. An IAttributeValue object for whom the localization
request constraint is to be added. To set the constraint for
all data in the interaction, specify the interaction name
instead of the data element name.language
- Language token as defined by RFC3066
http://www.w3.org/TR/xmlschema-2/#RFC3066 (may be null)constraintMap
- A Map containing existing existing constraints for which the
language constraint is to be added. To create a new map, pass
a null. Existing values will overwrite policy already set in
attrValue.
PolicyException
- If attrValue is null, or if both language and constraintMap
is null.public IAssertion getConstraint(IPolicy policy, javax.xml.namespace.QName assertionName)
policy
- The IPolicy
object within which to search for the
constraint or assertion.assertionName
- An String representing a IAssertion
in QName form to
search for.
IAssertion
located or nullpublic IPolicy getInteractionPolicy(IInteraction ixn)
ixn
- A handle to a IInteraction
object for which associated
policy is to be returned.
public java.util.List<java.lang.String> getLocalityConstraints(IPolicy policy)
policy
- A WS-Policy object that may contain a locality constraint
public java.util.List<java.lang.String> getLocalityConstraints(IAttributeValue value)
IAttributeValue
object.
For a returned valued, the order should reflect the languages of the
returned values.
value
- The value object that may contain localized values.
public IPolicy getSchemaRefPolicy(IInteraction ixn, schemaRef attrPredOrRoleRef)
AttributeRef
,
PredicateRef
, or RoleRef
object.
ixn
- The interaction that contains the schemaRef object.attrPredOrRoleRef
- The particular AttributeRef, PredicateRef, or RoleRef whose
policy needs to be returned.
IPolicy
declared for this particular use of schema
for this Interaction.public boolean isAddValuesOnModify(IAttributeValue value, IModifyInteraction ixn)
value
- The IAttributeValue to be tested.ixn
- The modify interaction definition for the transaction.
IAddValuesConstraint
is present.public boolean isAssertionPresent(IPolicy policy, javax.xml.namespace.QName assertionName)
policy
- The policy object to be tested for the presence of
assertionName.assertionName
- The assertion name to look for within the policy.
public boolean isDeleteValuesOnModify(IAttributeValue value, IModifyInteraction ixn)
value
- The IAttributeValue to be tested.ixn
- The modify interaction definition for the transaction.
IDeleteValuesConstraint
is present.public IPolicy parseStringPolicy(java.lang.String policyString) throws java.lang.Exception
IPolicy
object.
policyString
- An XML String representing a WS-Policy or WS-PolicyReference
object
IPolicy
containing the parsed policy. Use
IPolicy.getPolicy()
to obtain the actual native policy
built by the selected WS-Policy implementation.
java.lang.Exception
public org.w3c.dom.Element parseStringToElement(java.lang.String pol)
pol
- An XML String representation of WS-Policy
public org.w3c.dom.Element policyToElement(java.lang.Object policy)
policy
- A Java object representing the WS-Provider native
implementation of a WS Policy object. Typically obtained from
IPolicy.getPolicy()
.
public java.lang.String policyToString(java.lang.Object policy)
IPolicy
or native policy objects.
WARNING: Use of native policy objects is discouraged as this causes binding
to specific WS-Policy implementations and may impact deployability.
policy
- An IPolicy
object or native ws-policy object to be converted. Typically
obtained from IPolicy.getPolicy()
.
public IPolicy parseDomPolicy(org.w3c.dom.Node policyNode)
Node
object and uses the WS-Policy
implementation provider to generate an IPolicy
object containing
a native policy object.
policyNode
- A DOM Node
containing a Policy or PolicyReference
node.
IPolicy
object holding the WS-Policy object.public void setAddValuesOnModifyConstraint(IAttributeValue value) throws PolicyException
value
- The IAttributeValue object that is to be used in a modify
request.
PolicyException
public void setDeleteValuesOnModifyConstraint(IAttributeValue value) throws PolicyException
value
- The IAttributeValue object that is to be used in a modify
request.
PolicyException
public IPolicy loadPolicyByReference(java.net.URI policyRef)
policyRef
- A URI referencing a WS-Policy document.
IPolicy
object containing the obtained and parsed
policy.public IAddValuesConstraint createAddValuesConstraint()
IAddValuesConstraint
constraint objectpublic IContractOrLegalConstraint createContractOrLegalConstraint(java.net.URI contractUri, java.net.URI issuer)
IContractOrLegalConstraint
for more information.
contractUri
- A URI that defines the legal context under which information
is being exchanged.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IContractOrLegalConstraint
constraint object.public IDataDisplayMaskConstraint createDataDisplayMaskConstraint(java.lang.String maskPattern, java.net.URI issuer)
maskPattern
- A masking pattern (depending on industry convention)
indicating how value is to be masked.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IDataDisplayMaskConstraint
constraint object.public IDataLossOrBreachConstraint createDataLossOrBreachConstraint(java.net.URI breachReportUri, java.net.URI issuer)
breachReportUri
- URI breach notification URI value.
A URI indicatig the party asserting the constraint (user,
relying party, provider service).issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IDataLossOrBreachConstraint
constraint objectpublic IDeleteValuesConstraint createDeleteValuesConstraint()
IDeleteValuesConstraint
constraint objectpublic ILifetimeConstraint createLifetimeConstraint(int hours, int mins)
hours
- the number of hours from receipt the values are valid.mins
- the number of minutes from receipt the values are valid.
ILifetimeConstraint
constraint objectpublic ILifetimeConstraint createLifetimeConstraint(java.util.Date startDate, java.util.Date endDate)
startDate
- the date from which values are valid.endDate
- the date until which values are valid.
ILifetimeConstraint
constraint objectpublic ILocalizationConstraint createLocalizationConstraint(java.lang.String languageCode) throws PolicyException
languageCode
- Language token as defined by RFC3066
http://www.w3.org/TR/xmlschema-2/#RFC3066
PolicyException
- LanguageCode must not be null or empty string.public IPropagateConstraint createPropagateConstraint(java.net.URI propagateUri, java.net.URI issuer)
propagateUri
- The URI describing propagate restrictions.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IPropagateConstraint
constraint objectpublic IPurposeConstraint createPurposeConstraint(java.net.URI purposeUri, java.net.URI issuer)
purposeUri
- A URI describing the designated transaction purpose.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IPurposeConstraint
constraint object.public IRetentionConstraint createRetentionConstraint(java.net.URI retentionUri, java.net.URI issuer)
retentionUri
- The URI indicating permitted type of retention.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).
IRetentionConstraint
constraint object.public IRetentionConstraint createRetentionConstraint(java.net.URI retentionUri, java.net.URI issuer, ILifetimeConstraint lifetime)
retentionUri
- The URI indicating permitted type of retention.issuer
- A URI indicatig the party asserting the constraint (user,
relying party, provider service).lifetime
- An ILifetimeConstraint
indicating the period of
retention.
IRetentionConstraint
constraint object.public IPolicy createNewPolicy()
IPolicy.getPolicy()
to obtain the actual policy object
created by the WS-Policy provider.
public boolean addConstraintOrAssertionToPolicy(IAssertion assertion, IPolicy targetPolicy, boolean isAll)
IAssertion
to an existing IPolicy object
assertion
- An assertion implementing the IAssertion
interfacetargetPolicy
- A policy object implementing IPolicy
isAll
- If true, policy will be added using a WS-Policy ALL structure,
or ExactlyOne if false.
public boolean addConstraintOrAssertionToPolicy(IAssertion[] assertions, IPolicy targetPolicy, boolean isAll)
IAssertion
to an existing IPolicy
object
assertions
- An assertion implementing the IAssertion
interfacetargetPolicy
- A policy object implementing IPolicy
isAll
- If true, policy will be added using a WS-Policy ALL structure,
or ExactlyOne if false.
|
OpenLiberty.org - Licensed under Apache APL 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |