Examples of PolicySet


Examples of org.apache.tuscany.sca.policy.PolicySet

     * @param policySets list of attached policy sets
     * @param resolver
     */
    protected void resolvePolicySets(List<PolicySet> policySets, ModelResolver resolver) {
        List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
        PolicySet resolvedPolicySet = null;
        for (PolicySet policySet : policySets) {
            if (policySet.isUnresolved()) {
                resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
                resolvedPolicySets.add(resolvedPolicySet);
            } else {
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

    public static final QName INTEGRITY_INTENT = new QName(XMLNS_SCA_1_0, "integrity");
    public static final QName MTOM_INTENT = new QName(XMLNS_SCA_1_0, "MTOM");
    public static final QName SOAP12_INTENT = new QName(XMLNS_SCA_1_0, "soap12");

    public static PolicySet getPolicySet(Binding wsBinding, QName intentName) {
        PolicySet returnPolicySet = null;

        if (wsBinding instanceof PolicySetAttachPoint) {
            PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
            for (PolicySet policySet : policiedBinding.getPolicySets()) {
                for (Intent intent : policySet.getProvidedIntents()) {
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

                    for (Intent excluded : intent.getExcludedIntents()) {
                        if (component.getRequiredIntents().contains(excluded)) {
                            component.getRequiredIntents().remove(excluded);
                        }
                        for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
                            PolicySet cmpPolicySet = (PolicySet) i.next();
                            if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                i.remove();
                            }
                        }
                    }
                }
                for (PolicySet policySet : ((PolicySetAttachPoint)implementation).getPolicySets()) {
                    for (Intent intent : policySet.getProvidedIntents()) {
                        for (Intent excluded : intent.getExcludedIntents()) {
                            if (component.getRequiredIntents().contains(excluded)) {
                                component.getRequiredIntents().remove(excluded);
                            }
                            for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
                                PolicySet cmpPolicySet = (PolicySet) i.next();
                                if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                    i.remove();
                                }
                            }
                        }
                    }
                }
            }
            component.getRequiredIntents().addAll(((PolicySetAttachPoint)implementation).getRequiredIntents());
            component.getPolicySets().addAll(((PolicySetAttachPoint)implementation).getPolicySets());
            component.getApplicablePolicySets().addAll(((PolicySetAttachPoint)implementation).getApplicablePolicySets());
           
            if ( implementation instanceof OperationsConfigurator ) {
                boolean notFound;
                List<ConfiguredOperation> opsFromImplementation = new ArrayList<ConfiguredOperation>();
                List<ConfiguredOperation> implConfOperations =
                    new ArrayList<ConfiguredOperation>(((OperationsConfigurator)implementation).getConfiguredOperations());
                for ( ConfiguredOperation implConfOp : implConfOperations ) {
                    notFound = true;
                    for ( ConfiguredOperation compConfOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
                        if ( implConfOp.getName().equals(compConfOp.getName()) ) {
                            notFound = false;

                            if (clearImplSettings) {
                                for (Intent intent : implConfOp.getRequiredIntents()) {
                                    for (Intent excluded : intent.getExcludedIntents()) {
                                        if (compConfOp.getRequiredIntents().contains(excluded)) {
                                            compConfOp.getRequiredIntents().remove(excluded);
                                        }
                                    }
                                }
                                for (PolicySet policySet : implConfOp.getPolicySets()) {
                                    for (Intent intent : policySet.getProvidedIntents()) {
                                        for (Intent excluded : intent.getExcludedIntents()) {
                                            if (compConfOp.getRequiredIntents().contains(excluded)) {
                                                compConfOp.getRequiredIntents().remove(excluded);
                                            }
                                            for (Iterator i = compConfOp.getPolicySets().iterator(); i.hasNext(); ) {
                                                PolicySet cmpPolicySet = (PolicySet) i.next();
                                                if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
                                                    i.remove();
                                                }
                                            }
                                        }
                                    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

        QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
        Intent i2 = intentTable.get(confidentiality_transport);
        assertNotNull(i2.getQualifiableIntent());

        PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
        PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
        PolicySet securityPolicySet = policySetTable.get(securityPolicy);

        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
        assertTrue(secureMessagingPolicySet.isUnresolved());
        assertEquals(3, getNumberOfQualifiedPolicies(securityPolicySet));

        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());

        BindingType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        ImplementationType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());

        ModelResolver resolver = new DefaultModelResolver();
        policyDefinitionsProcessor.resolve(definitions, resolver, context);
        //builder.build(scaDefinitions);

        //testing if policy intents have been linked have property been linked up
        assertNotNull(i1.getRequiredIntents().get(0).getDescription());
        // assertNotNull(i2.getQualifiableIntent().getDescription());
        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());

        //testing if policysets have been properly linked up with intents
        assertFalse(secureMessagingPolicySet.isUnresolved());
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality_transport)));

        //testing if intent maps have been properly mapped to policies
        assertFalse(securityPolicySet.isUnresolved());
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality)));
        assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality_message)));

        //testing for inclusion of referred policysets
        assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertFalse(basicAuthMsgProtSecurityPolicySet.getIntentMaps().get(0).getQualifiers().isEmpty());
        assertTrue(isRealizedBy(basicAuthMsgProtSecurityPolicySet, intentTable.get(confidentiality_transport)));

        assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNotNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

  private void resolvePolicySets(ExternalAttachment attachment,
      ModelResolver resolver, ProcessorContext context) {
       List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
          for (PolicySet referredPolicySet : attachment.getPolicySets()) {
              if (referredPolicySet.isUnresolved()) {
                  PolicySet resolved = resolver.resolveModel(PolicySet.class, referredPolicySet, context);
                  if (!resolved.isUnresolved() || resolved != referredPolicySet) {
                      referredPolicySets.add(resolved);
                  } else {
                      error(context.getMonitor(), "ReferredPolicySetNotFound", attachment, referredPolicySet, attachment);
                      return;                  
                  }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

        String value = reader.getAttributeValue(null, POLICY_SETS);
        if (value != null) {
            List<PolicySet> policySets = attachment.getPolicySets();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                PolicySet policySet = policyFactory.createPolicySet();
                policySet.setName(qname);             
                policySets.add(policySet);
            }
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    Object artifact = staxProcessor.read(reader, context);
                    if (artifact instanceof PolicySet) {
                        PolicySet policySet = (PolicySet)artifact;
                        policySet.setName(new QName(namespace, policySet.getName().getLocalPart()));
                        policySetTable.put(policySet.getName(), policySet);
                    } else if (artifact instanceof Intent) {
                        Intent intent = (Intent)artifact;
                        intent.setName(new QName(namespace, intent.getName().getLocalPart()));
                        intentTable.put(intent.getName(), intent);
                        for (Intent i : intent.getQualifiedIntents()) {
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

        assertTrue(intentTable.get(confidentiality_transport) instanceof Intent);
        Intent qualifiedIntent = (Intent)intentTable.get(new QName(namespace, "confidentiality.transport"));
        assertNull(qualifiedIntent.getDescription());
        assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());

        PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
        PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
        PolicySet securityPolicySet = policySetTable.get(securityPolicy);

        assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
        assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
        assertTrue(secureMessagingPolicySet.isUnresolved());
        assertEquals(2, getNumberOfQualifiedPolicies(securityPolicySet));

        //testing to ensure that inclusion of referred policy sets has not happened
        PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
        assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
        assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());

        ExtensionType wsBindingType = bindingTypesTable.get(wsBinding);
        assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());

        ExtensionType javaImplType = implTypesTable.get(javaImpl);
        assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
        assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());

        ExternalAttachment attachment = attachmentsTable.values().iterator().next();
        PolicySet psOne = policySetTable.get(testPolicySetOne);
        assertEquals(psOne, attachment.getPolicySets().get(0));
       
        List<Intent> intents = new ArrayList<Intent>(intentTable.values());

        for (Intent intent : intents) {
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

    /**
     * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
     */
    public Interceptor createInterceptor(Operation operation) {
        PolicySet ps = findPolicySet(operation);
        return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.PolicySet

        String value = reader.getAttributeValue(null, POLICY_SETS);
        if (value != null) {
            List<PolicySet> policySets = policySetAttachPoint.getPolicySets();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                PolicySet policySet = policyFactory.createPolicySet();
                policySet.setName(qname);
                if (operation != null) {
                    //FIXME Don't we need to handle policySet specification
                    // on an operation basis?
                    //policySet.getOperations().add(operation);
                }
                policySets.add(policySet);
            }
        }
       
        value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
        if (value != null) {
            List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                PolicySet policySet = policyFactory.createPolicySet();
                policySet.setName(qname);
                if (operation != null) {
                    //FIXME Don't we need to handle policySet specification
                    // on an operation basis?
                    //policySet.getOperations().add(operation);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.