Package org.apache.tuscany.sca.policy

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


    private void buildIntentsInMappedPolicies(PolicySet policySet, Map<QName, Intent> definedIntents)
        throws DefinitionsBuilderException {
        Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
        for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
            Intent mappedIntent = entry.getKey();
            if (mappedIntent.isUnresolved()) {
                Intent resolvedMappedIntent = definedIntents.get(mappedIntent.getName());

                if (resolvedMappedIntent != null) {
                    mappedPolicies.put(resolvedMappedIntent, entry.getValue());
                } else {
                    throw new DefinitionsBuilderException("Mapped Intent - " + mappedIntent
View Full Code Here


                    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

            String[] intentNames = intentAnnotation.value();
            if (intentNames.length != 0) {
                for (String intentName : intentNames) {

                    // Add each intent to the list
                    Intent intent = policyFactory.createIntent();
                    intent.setName(getQName(intentName));
                    requiredIntents.add(intent);
                }
            }
        }
       
View Full Code Here

                //operation.setUnresolved(true);
                for (String intentName : intentNames) {

                    // Add each intent to the list, associated with the
                    // operation corresponding to the annotated method
                    Intent intent = policyFactory.createIntent();
                    intent.setName(getQName(intentName));
                    //intent.getOperations().add(operation);
                    requiredIntents.add(intent);
                }
            }
        }
View Full Code Here

                if(! intentName.equals(POLICY_CONVERSATIONAL)) {
                    //process the intent
                    System.out.println(">>> Intent : " + intentName);
                   
                    // Add each intent to the list
                    Intent intent = policyFactory.createIntent();
                    intent.setName(intentName);
                   
                    wsdlInterface.getRequiredIntents().add(intent);
                }
            }
           
View Full Code Here

            event = reader.getEventType();
            switch (event) {
                case START_ELEMENT: {
                    name = reader.getName();
                    if (POLICY_INTENT_MAP_QNAME.equals(name)) {
                        Intent mappedIntent = policyFactory.createIntent();
                        String provides = reader.getAttributeValue(null, PROVIDES);
                        if (provides != null) {
                            mappedIntent.setName(getQName(reader, PROVIDES));
                            if (policySet.getProvidedIntents().contains(mappedIntent)) {
                                readIntentMap(reader, policySet, mappedIntent);
                            } else {
                                error("IntentNotSpecified", policySet, policySetName);
                                //throw new ContributionReadException("Intent Map provides for Intent not specified as provided by parent PolicySet - " + policySetName);
View Full Code Here

            //mappedIntent.setName(getQName(reader, PROVIDES));
            String defaultQualifier = getString(reader, DEFAULT);

            String qualifierName = null;
            String qualfiedIntentName = null;
            Intent qualifiedIntent = null;

            int event = reader.getEventType();
            try {
                reader.next();
                while (reader.hasNext()) {
                    event = reader.getEventType();
                    switch (event) {
                        case START_ELEMENT: {
                            name = reader.getName();
                            if (POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
                                qualifierName = getString(reader, NAME);
                                if (qualifierName != null) {
                                    qualfiedIntentName =
                                        mappedIntent.getName().getLocalPart() + QUALIFIER + qualifierName;
                                    qualifiedIntent = policyFactory.createIntent();
                                    qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
                                                                      qualfiedIntentName));
                                } else {
                                    error("QualifierNameMissing", reader, policySet.getName());
                                }
                            } else if (POLICY_INTENT_MAP_QNAME.equals(name)) {
                                QName providedIntent = getQName(reader, PROVIDES);
                                if (qualifierName.equals(providedIntent.getLocalPart())) {
                                    readIntentMap(reader, policySet, qualifiedIntent);
                                } else {
                                    error("IntentMapDoesNotMatch",
                                          providedIntent,
                                          providedIntent,
                                          qualifierName,
                                          policySet);
                                    //throw new ContributionReadException("Intent provided by IntentMap " +
                                    //providedIntent + " does not match parent qualifier " + qualifierName +
                                    //" in policyset - " + policySet);
                                }
                            }/* else if ( WS_POLICY_QNAME.equals(name) )  {
                                                            OMElement policyElement = loadElement(reader);
                                                            Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
                                                            policySet.getPolicies().add(wsPolicy);
                                                           
                                                            List<Object> policyList = mappedPolicies.get(qualifiedIntent);
                                                            if ( policyList == null ) {
                                                                policyList = new ArrayList<Object>();
                                                                mappedPolicies.put(qualifiedIntent, policyList);
                                                               
                                                                if (qualifierName.equals(defaultQualifier)) {
                                                                    mappedPolicies.put(mappedIntent, policyList);
                                                                }
                                                            }
                                                            policyList.add((Policy)wsPolicy);
                                                        }*/else {
                                Object extension = extensionProcessor.read(reader);
                                if (extension != null && qualifiedIntent != null) {
                                    List<Object> policyList = mappedPolicies.get(qualifiedIntent);
                                    if (policyList == null) {
                                        policyList = new ArrayList<Object>();
                                        mappedPolicies.put(qualifiedIntent, policyList);

                                        if (qualifierName.equals(defaultQualifier)) {
                                            mappedPolicies.put(mappedIntent, policyList);
                                        }
                                    }
                                    policyList.add(extension);
                                }
                            }
                            break;
                        }
                        case END_ELEMENT: {
                            if (POLICY_INTENT_MAP_QNAME.equals(reader.getName())) {
                                if (defaultQualifier != null) {
                                    String qualifiedIntentName =
                                        mappedIntent.getName().getLocalPart() + QUALIFIER + defaultQualifier;
                                    Intent defaultQualifiedIntent = policyFactory.createIntent();
                                    defaultQualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
                                                                             qualifiedIntentName));
                                    List<Object> policyList = mappedPolicies.get(defaultQualifiedIntent);
                                    if (policyList != null) {
                                        mappedPolicies.put(mappedIntent, policyList);
                                    } else {
View Full Code Here

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

        if (policySet != null) {
            //resolve all provided intents
            List<Intent> providedIntents = new ArrayList<Intent>();
            for (Intent providedIntent : policySet.getProvidedIntents()) {
                if (providedIntent.isUnresolved()) {
                    Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
                    if (!resolvedProvidedIntent.isUnresolved()) {
                        providedIntents.add(resolvedProvidedIntent);
                    } else {
                        error("ProvidedIntentNotFound", policySet, providedIntent, policySet);
                        return;
                        //throw new ContributionResolveException("Provided Intent - " + providedIntent
View Full Code Here

    private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver)
        throws ContributionResolveException {
        Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
        for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
            Intent mappedIntent = entry.getKey();
            if (mappedIntent.isUnresolved()) {
                Intent resolvedMappedIntent = resolver.resolveModel(Intent.class, mappedIntent);
                if (!resolvedMappedIntent.isUnresolved()) {
                    mappedPolicies.put(resolvedMappedIntent, entry.getValue());
                } else {
                    error("MappedIntentNotFound", policySet, mappedIntent, policySet);
                    return;
                    //throw new ContributionResolveException("Mapped Intent - " + mappedIntent
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.policy.Intent

Copyright © 2018 www.massapicom. 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.