public class PolicyModelTranslator
extends java.lang.Object
PolicySourceModel structure to a normalized Policy expression.
The resulting Policy is disconnected from its model, thus any additional changes in the model will have no effect on the Policy
expression.| Modifier and Type | Class and Description |
|---|---|
private static class |
PolicyModelTranslator.ContentDecomposition |
private static class |
PolicyModelTranslator.RawAlternative |
private static class |
PolicyModelTranslator.RawAssertion |
private static class |
PolicyModelTranslator.RawPolicy |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,PolicyAssertionCreator> |
assertionCreators |
private static PolicyAssertionCreator |
defaultCreator |
private static PolicyLogger |
LOGGER |
| Modifier | Constructor and Description |
|---|---|
private |
PolicyModelTranslator() |
protected |
PolicyModelTranslator(java.util.Collection<PolicyAssertionCreator> creators) |
| Modifier and Type | Method and Description |
|---|---|
private java.util.Collection<AssertionSet> |
createPolicyAlternatives(PolicySourceModel model)
Method creates policy alternatives according to provided model.
|
private PolicyAssertion |
createPolicyAssertion(AssertionData data,
java.util.Collection<PolicyAssertion> assertionParameters,
AssertionSet nestedAlternative) |
private PolicyAssertion |
createPolicyAssertionParameter(ModelNode parameterNode) |
private void |
decompose(java.util.Collection<ModelNode> content,
PolicyModelTranslator.ContentDecomposition decomposition)
Decomposes the unprocessed alternative content into two different collections:
Content of 'EXACTLY_ONE' child nodes is expanded and placed in one list and
'ASSERTION' nodes are placed into other list.
|
private java.util.Collection<ModelNode> |
expandsExactlyOneContent(java.util.Collection<ModelNode> content)
Expands content of 'EXACTLY_ONE' node.
|
private static ModelNode |
getReferencedModelRootNode(ModelNode policyReferenceNode) |
static PolicyModelTranslator |
getTranslator()
Method returns thread-safe policy model translator instance.
|
private java.util.List<AssertionSet> |
normalizeRawAlternative(PolicyModelTranslator.RawAlternative alternative) |
private java.util.List<PolicyAssertion> |
normalizeRawAssertion(PolicyModelTranslator.RawAssertion assertion) |
Policy |
translate(PolicySourceModel model)
The method translates
PolicySourceModel structure into normalized Policy expression. |
private static final PolicyLogger LOGGER
private static final PolicyAssertionCreator defaultCreator
private final java.util.Map<java.lang.String,PolicyAssertionCreator> assertionCreators
private PolicyModelTranslator()
throws PolicyException
PolicyExceptionprotected PolicyModelTranslator(java.util.Collection<PolicyAssertionCreator> creators) throws PolicyException
PolicyExceptionpublic static PolicyModelTranslator getTranslator() throws PolicyException
PolicyException - If instantiating a PolicyAssertionCreator failed.public Policy translate(PolicySourceModel model) throws PolicyException
PolicySourceModel structure into normalized Policy expression. The resulting Policy
is disconnected from its model, thus any additional changes in model will have no effect on the Policy expression.model - the model to be translated into normalized policy expression. Must not be null.PolicyException - in case of translation failureprivate java.util.Collection<AssertionSet> createPolicyAlternatives(PolicySourceModel model) throws PolicyException
PolicyExceptionprivate void decompose(java.util.Collection<ModelNode> content, PolicyModelTranslator.ContentDecomposition decomposition) throws PolicyException
PolicyExceptionprivate static ModelNode getReferencedModelRootNode(ModelNode policyReferenceNode) throws PolicyException
PolicyExceptionprivate java.util.Collection<ModelNode> expandsExactlyOneContent(java.util.Collection<ModelNode> content) throws PolicyException
PolicyExceptionprivate java.util.List<AssertionSet> normalizeRawAlternative(PolicyModelTranslator.RawAlternative alternative) throws AssertionCreationException, PolicyException
private java.util.List<PolicyAssertion> normalizeRawAssertion(PolicyModelTranslator.RawAssertion assertion) throws AssertionCreationException, PolicyException
private PolicyAssertion createPolicyAssertionParameter(ModelNode parameterNode) throws AssertionCreationException, PolicyException
private PolicyAssertion createPolicyAssertion(AssertionData data, java.util.Collection<PolicyAssertion> assertionParameters, AssertionSet nestedAlternative) throws AssertionCreationException
AssertionCreationException