org.apache.tuscany.sca.policy.util
Class PolicyComputationUtils

java.lang.Object
  extended by org.apache.tuscany.sca.policy.util.PolicyComputationUtils

public class PolicyComputationUtils
extends java.lang.Object

Utility methods used during computation of PolicyIntents and PolicySets sets


Constructor Summary
PolicyComputationUtils()
           
 
Method Summary
static byte[] addApplicablePolicySets(java.io.InputStream is, java.util.Collection<PolicySet> domainPolicySets, javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
           
static void addDefaultPolicies(java.util.List<Intent> sourceIntents, java.util.List<PolicySet> sourcePolicySets, java.util.List<Intent> targetIntents, java.util.List<PolicySet> targetPolicySets)
          This method is used to inherit intents and policy sets between hierarchical levels within the same composite (e.g.
static void addInheritedIntents(java.util.List<Intent> sourceList, java.util.List<Intent> targetList)
          This method unconditionally adds intents from the source list to the target list.
static void addInheritedPolicySets(java.util.List<PolicySet> sourceList, java.util.List<PolicySet> targetList, boolean checkOverrides)
           
static void checkForMutuallyExclusiveIntents(java.util.List<Intent> intents, java.util.List<PolicySet> policySets, IntentAttachPointType intentAttachPointType, java.lang.String id)
           
static void expandProfileIntents(java.util.List<Intent> intents)
           
static java.util.List<Intent> findAndExpandProfileIntents(java.util.List<Intent> intents)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyComputationUtils

public PolicyComputationUtils()
Method Detail

addInheritedIntents

public static void addInheritedIntents(java.util.List<Intent> sourceList,
                                       java.util.List<Intent> targetList)
This method unconditionally adds intents from the source list to the target list. It is used for intermediate intent inheritance between promotion levels (e.g. between a composite service and a component service). It does not check whether there are conflicting (mutually exclusive) intents. This is because promotion cannot override intents. If the resulting target list has conflicting intents, this will be detected later during policy computation.


addInheritedPolicySets

public static void addInheritedPolicySets(java.util.List<PolicySet> sourceList,
                                          java.util.List<PolicySet> targetList,
                                          boolean checkOverrides)

addDefaultPolicies

public static void addDefaultPolicies(java.util.List<Intent> sourceIntents,
                                      java.util.List<PolicySet> sourcePolicySets,
                                      java.util.List<Intent> targetIntents,
                                      java.util.List<PolicySet> targetPolicySets)
This method is used to inherit intents and policy sets between hierarchical levels within the same composite (e.g. between a component and its services and references). In this case the source intents and policy sets provide defaults which are inherited into the target lists only when there is no conflict. For example consider a component with 3 references. The component level requires intent 'propagatesTransaction'. Reference 1 and 2 do not specify an intent, but reference 3 requires 'suspendsTransaction'. In this case the 'propagatesTransaction' intent is inherited by reference 1 and 2 but not by reference 3.


checkForMutuallyExclusiveIntents

public static void checkForMutuallyExclusiveIntents(java.util.List<Intent> intents,
                                                    java.util.List<PolicySet> policySets,
                                                    IntentAttachPointType intentAttachPointType,
                                                    java.lang.String id)
                                             throws PolicyValidationException
Throws:
PolicyValidationException

expandProfileIntents

public static void expandProfileIntents(java.util.List<Intent> intents)

findAndExpandProfileIntents

public static java.util.List<Intent> findAndExpandProfileIntents(java.util.List<Intent> intents)

addApplicablePolicySets

public static byte[] addApplicablePolicySets(java.io.InputStream is,
                                             java.util.Collection<PolicySet> domainPolicySets,
                                             javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
                                      throws java.lang.Exception
Throws:
java.lang.Exception