Package org.switchyard.annotations

Examples of org.switchyard.annotations.Requires


               
                componentModel.addService(serviceModel);
            }
           
            // Check to see if a policy requirements have been defined
            Requires requires = serviceClass.getAnnotation(Requires.class);
            if (requires != null) {
                for (SecurityPolicy secPolicy : requires.security()) {
                    if (secPolicy == SecurityPolicy.AUTHORIZATION) {
                        // authorization supports both interaction and implementation,
                        // and we want to add it as implementation to be more correct.
                        beanModel.addPolicyRequirement(secPolicy.getQName());
                    } else if (secPolicy.supports(PolicyType.INTERACTION)) {
                        serviceModel.addPolicyRequirement(secPolicy.getQName());
                    } else if (secPolicy.supports(PolicyType.IMPLEMENTATION)) {
                        beanModel.addPolicyRequirement(secPolicy.getQName());
                    } else {
                        throw BeanMessages.MESSAGES.unknownPolicy(secPolicy.toString());
                    }
                }
                for (TransactionPolicy txPolicy : requires.transaction()) {
                    if (txPolicy.supports(PolicyType.INTERACTION)) {
                        serviceModel.addPolicyRequirement(txPolicy.getQName());
                    } else if (txPolicy.supports(PolicyType.IMPLEMENTATION)) {
                        beanModel.addPolicyRequirement(txPolicy.getQName());
                    } else {
View Full Code Here


            }
           
            referenceModel.setInterface(interfaceModel);
            interfaceModel.setInterface(reference.getCanonicalName());
            // Add policy requirements to reference if specified
            Requires refRequires = field.getAnnotation(Requires.class);
            if (refRequires != null) {
                for (SecurityPolicy secPolicy : refRequires.security()) {
                    if (!secPolicy.supports(PolicyType.INTERACTION)) {
                        throw BeanMessages.MESSAGES.referenceOnlyCouldBeMarkedWithInteractionPolicyButIsNotTheOne(secPolicy.toString());
                    }
                    referenceModel.addPolicyRequirement(secPolicy.getQName());
                }
                for (TransactionPolicy txPolicy : refRequires.transaction()) {
                    if (!txPolicy.supports(PolicyType.INTERACTION)) {
                        throw BeanMessages.MESSAGES.referenceOnlyCouldBeMarkedWithInteractionPolicyButIsNotTheOne(txPolicy.toString());
                    }
                    referenceModel.addPolicyRequirement(txPolicy.getQName());
                }
View Full Code Here

TOP

Related Classes of org.switchyard.annotations.Requires

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.