Examples of Intent


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

   
    WebResult webResultAnnotation = m.getAnnotation(WebResult.class);
    if (webResultAnnotation != null) {
      if (webResultAnnotation.header()) {
        // Add SOAP intent
        Intent intent = policyFactory.createIntent();
        intent.setName(Constants.SOAP_INTENT);
        requiredIntents.add(intent);
        return;
      }
    }
   
    Annotation[][] parameterAnnotations = m.getParameterAnnotations();
    for ( int i=0; i < parameterAnnotations.length; i++ ) {
      for ( int j=0; j < parameterAnnotations[i].length; j++) {
        if ( parameterAnnotations[i][j] instanceof WebParam ) {
          WebParam webParam = (WebParam)parameterAnnotations[i][j];
          if ( webParam.header() ) {
            // Add SOAP intent
            Intent intent = policyFactory.createIntent();
            intent.setName(Constants.SOAP_INTENT);
            requiredIntents.add(intent);
            return;
          }
        }
      }
View Full Code Here

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

                    }
                }
            }
            qualifiers.remove("");
            if (qualifiers.isEmpty()) {
                Intent intent = policyFactory.createIntent();
                intent.setUnresolved(true);
                intent.setName(qname);
                requiredIntents.add(intent);
            } else {
                for (String q : qualifiers) {
                    Intent intent = policyFactory.createIntent();
                    intent.setUnresolved(true);
                    qname = new QName(qname.getNamespaceURI(), qname.getLocalPart() + "." + q);
                    intent.setName(qname);
                    requiredIntents.add(intent);
                }
            }
        }
    }
View Full Code Here

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

                    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()));
                        if ( intent instanceof QualifiedIntent ) {
                            ((QualifiedIntent)intent).getQualifiableIntent().
                                    setName(new QName(namespace,
                                                      ((QualifiedIntent)intent).getQualifiableIntent().getName().getLocalPart()));
                        }
                        intentTable.put(intent.getName(), intent);
                    } else if ( artifact instanceof BindingTypeImpl ) {
                        IntentAttachPointType bindingType = (IntentAttachPointType)artifact;
                        bindingTypesTable.put(bindingType.getName(), bindingType);
                    } else if ( artifact instanceof ImplementationTypeImpl ) {
                        IntentAttachPointType implType = (IntentAttachPointType)artifact;
View Full Code Here

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

     * @param policyIntents list of policy intents
     * @param resolver
     */
    protected void resolveIntents(List<Intent> policyIntents, ModelResolver resolver) {
        List<Intent> requiredIntents = new ArrayList<Intent>();
        Intent resolvedIntent = null;
        for (Intent intent : policyIntents) {
            resolvedIntent = resolver.resolveModel(Intent.class, intent);
            requiredIntents.add(resolvedIntent);
        }
        policyIntents.clear();
View Full Code Here

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

        return count;
    }

    @Test
    public void testResolveSCADefinitions() throws Exception {
        Intent i1 = intentTable.get(messageProtection);
        assertTrue(!i1.getRequiredIntents().isEmpty());
        assertNull(i1.getRequiredIntents().get(0).getDescription());

        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);
View Full Code Here

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

         if (attachment != null) {
              //resolve all provided intents
              List<Intent> providedIntents = new ArrayList<Intent>();
              for (Intent providedIntent : attachment.getIntents()) {
                  if (providedIntent.isUnresolved()) {
                      Intent resolved = resolver.resolveModel(Intent.class, providedIntent, context);
                      if (!resolved.isUnresolved() || resolved != providedIntent) {
                          providedIntents.add(resolved);
                      } else {
                          error(context.getMonitor(), "ProvidedIntentNotFound", attachment, providedIntent, attachment);
                          return;                       
                      }
View Full Code Here

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

        String value = reader.getAttributeValue(null, INTENTS);
          if (value != null) {
              List<Intent> intents = attachment.getIntents();
              for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                  QName qname = getQNameValue(reader, tokens.nextToken());
                  Intent intent = policyFactory.createIntent();
                  intent.setName(qname);                
                  intents.add(intent);
              }
          }
   
  }
View Full Code Here

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

                    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()) {
                            i.setName(new QName(namespace, i.getName().getLocalPart()));
                            intentTable.put(i.getName(), i);
                            resolver.addModel(i, context);
                        }
                    } else if (artifact instanceof BindingType) {
View Full Code Here

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

    }

    @Test
    public void testResolution() throws Exception {
        assertTrue(!intentTable.get(messageProtection).getRequiredIntents().isEmpty());
        Intent profileIntent = intentTable.get(new QName(namespace, "messageProtection"));
        assertNull(profileIntent.getRequiredIntents().get(0).getDescription());

        QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
        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) {
            staxProcessor.resolve(intent, resolver, context);
        }

        for (PolicySet policySet : policySetTable.values()) {
            if (policySet.getReferencedPolicySets().isEmpty())
                staxProcessor.resolve(policySet, resolver, context);
        }

        for (PolicySet policySet : policySetTable.values()) {
            if (!policySet.getReferencedPolicySets().isEmpty())
                staxProcessor.resolve(policySet, resolver, context);
        }

        for (ExtensionType bindingType : bindingTypesTable.values()) {
            staxProcessor.resolve(bindingType, resolver, context);
        }

        for (ExtensionType implType : implTypesTable.values()) {
            staxProcessor.resolve(implType, resolver, context);
        }
       
        for ( ExternalAttachment ea : attachmentsTable.values()) {
          staxProcessor.resolve(ea, resolver, context);
        }

        //testing if policy intents have been linked have property been linked up
        assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
        assertNotNull(qualifiedIntent.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());
View Full Code Here

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

        String value = reader.getAttributeValue(null, REQUIRES);
        if (value != null) {
            List<Intent> requiredIntents = intentAttachPoint.getRequiredIntents();
            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
                QName qname = getQNameValue(reader, tokens.nextToken());
                Intent intent = policyFactory.createIntent();
                intent.setName(qname);
                if (operation != null) {
                    //FIXME Don't we need to handle intent specification
                    // on an operation basis?
                    //intent.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.