Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.ConfiguredOperation


    private List<AuthorizationPolicy> findAuthorizationPolicies(Operation op) {
        List<AuthorizationPolicy> polices = new ArrayList<AuthorizationPolicy>();
       

        // check explicity added policies first
        ConfiguredOperation configuredOperation = findOperation(op);
        if (configuredOperation!= null && configuredOperation.getPolicySets().size() > 0) {
            for ( PolicySet ps : configuredOperation.getPolicySets()) {
                for (Object p : ps.getPolicies()) {
                    if (p instanceof AuthorizationPolicy) {
                        polices.add((AuthorizationPolicy)p);
                    }
                }
View Full Code Here


     * Find a given configured operation
     * @param operation
     * @return
     */
    private ConfiguredOperation findOperation(Operation operation) {
        ConfiguredOperation configuredOperation = null;
       
        for (ConfiguredOperation cOperation : ((OperationsConfigurator)component).getConfiguredOperations()) {
            if(cOperation.getName().equals(operation.getName())) {
                configuredOperation = cOperation;
                break;
View Full Code Here

                    } else if ("operationProperties".equals(elementName)) {
                        parseOperationProperties(reader, jmsBinding);
                    } else if ("SubscriptionHeaders".equals(elementName)) {
                        parseSubscriptionHeaders(reader, jmsBinding);
                    } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
                        ConfiguredOperation confOp = configuredOperationProcessor.read(reader);
                        if (confOp != null) {
                            ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
                        }
                    } else {
                        Object extension = extensionProcessor.read(reader);
View Full Code Here

        this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
        this.monitor = monitor;
    }

    public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        ConfiguredOperation  configuredOp = assemblyFactory.createConfiguredOperation();

        //Read an <operation>
        configuredOp.setName(reader.getAttributeValue(null, NAME));
        configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
        configuredOp.setUnresolved(true);

        // Read policies
        policyProcessor.readPolicies(configuredOp, reader);

        //Skip to end element
View Full Code Here

                                              PolicySetAttachPoint attachPoint) throws PolicyValidationException {

        List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
        for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
            boolean found = false;
            ConfiguredOperation targetConfOp = null;
            for ( ConfiguredOperation confOp : target.getConfiguredOperations() ) {
                if ( sourceConfOp.getName().equals(confOp.getName())) {
                    targetConfOp = confOp;
                    found = true;
                    break;
                }
            }                   
            if ( !found ) {
                // Create a new target configured operation and copy everything from the source
                // except the intents and policy sets (which must be computed below).
                try {
                    targetConfOp = (ConfiguredOperation) sourceConfOp.clone();
                    targetConfOp.setRequiredIntents(new ArrayList<Intent>());
                    targetConfOp.setPolicySets(new ArrayList<PolicySet>());
                } catch (CloneNotSupportedException e) {
                    // will not happen
               
            }


            List<Intent> prunedIntents =
                computeInheritableIntents(attachPoint.getType(), sourceConfOp.getRequiredIntents());
            PolicyComputationUtils.addInheritedIntents(prunedIntents, targetConfOp.getRequiredIntents());

            List<PolicySet> prunedPolicySets =
                computeInheritablePolicySets(sourceConfOp.getPolicySets(), attachPoint.getApplicablePolicySets());
            PolicyComputationUtils.addInheritedPolicySets(prunedPolicySets, targetConfOp.getPolicySets(), true);

            // If this is a new target configured operation, we will add it to the target list
            // if it has required intents or policy sets.
            if (!found && (!targetConfOp.getRequiredIntents().isEmpty() || !targetConfOp.getPolicySets().isEmpty())) {
                additionalOperations.add(targetConfOp);
            }
        }

        if ( !additionalOperations.isEmpty() ) {
View Full Code Here

                    } else if ("operationProperties".equals(elementName)) {
                        parseOperationProperties(reader, jmsBinding, monitor);
                    } else if ("messageSelection".equals(elementName)) {
                        parseSubscriptionHeaders(reader, jmsBinding);
                    } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
                        ConfiguredOperation confOp = configuredOperationProcessor.read(reader, context);
                        if (confOp != null) {
                            ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
                        }
                    } else {
                        Object extension = extensionProcessor.read(reader, context);
View Full Code Here

        this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
        this.policyProcessor = new PolicySubjectProcessor(policyFactory);
    }

    public ConfiguredOperation read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        ConfiguredOperation  configuredOp = assemblyFactory.createConfiguredOperation();

        //Read an <operation>
        configuredOp.setName(reader.getAttributeValue(null, NAME));
        configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
        configuredOp.setUnresolved(true);

        // Read policies
        policyProcessor.readPolicies(configuredOp, reader);

        //Skip to end element
View Full Code Here



        // read operation elements if exists or skip unto end element
        int event;
        ConfiguredOperation confOp = null;
        while (reader.hasNext()) {
            event = reader.next();
            switch ( event ) {
                case START_ELEMENT  : {
                    if ( Constants.OPERATION_QNAME.equals(reader.getName()) ) {
View Full Code Here

                    } else if ("operationProperties".equals(elementName)) {
                        parseOperationProperties(reader, jmsBinding, monitor);
                    } else if ("messageSelection".equals(elementName)) {
                        parseSubscriptionHeaders(reader, jmsBinding);
                    } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
                        ConfiguredOperation confOp = configuredOperationProcessor.read(reader, context);
                        if (confOp != null) {
                            ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
                        }
                    } else {
                        Object extension = extensionProcessor.read(reader, context);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.ConfiguredOperation

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.