Examples of PolicySubject


Examples of org.apache.axis2.description.PolicySubject

        Policy bindingOperationPolicy = null;
        Iterator operations = axisBinding.getChildren();
        while (operations.hasNext()) {
            AxisBindingOperation currentOperation = (AxisBindingOperation) operations.next();
            if (currentOperation.getName().toString().equals(operationName)) {
                PolicySubject bindingOperationPolicySubject = currentOperation.getPolicySubject();
                List<PolicyComponent> policyList =
                        new ArrayList<PolicyComponent>(bindingOperationPolicySubject.getAttachedPolicyComponents());
                bindingOperationPolicy =
                        org.apache.axis2.util.PolicyUtil.getMergedPolicy(policyList, axisService);
                break;
            }
        }
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

        Policy bindingOperationMessagePolicy = null;
        Iterator operations = axisBinding.getChildren();
        while (operations.hasNext()) {
            AxisBindingOperation currentOperation = (AxisBindingOperation) operations.next();
            if (currentOperation.getName().toString().equals(operationName)) {
                PolicySubject bindingOperationMessagePolicySubject =
                        currentOperation.getChild(messageType).getPolicySubject();
                List<PolicyComponent> policyList =
                        new ArrayList<PolicyComponent>(
                                bindingOperationMessagePolicySubject.getAttachedPolicyComponents());
                bindingOperationMessagePolicy =
                        org.apache.axis2.util.PolicyUtil.getMergedPolicy(policyList, axisService);
                break;
            }
        }
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

public class RelayModule implements Module {
    private Log log = LogFactory.getLog(RelayModule.class);

    public void init(ConfigurationContext configurationContext, AxisModule axisModule)
            throws AxisFault {
        PolicySubject policy = axisModule.getPolicySubject();
        RelayConfiguration configuration = null;
        if (policy != null) {
            try {
                configuration = PolicyProcessor.processCachingPolicy(policy);
            } catch (CachingException e) {
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

    private static Log log = LogFactory.getLog(CachingEngageUtils.class);

    public static void enguage(AxisDescription axisDescription) throws AxisFault {
        CacheConfiguration cacheConfig;
        PolicySubject policySubject = axisDescription.getPolicySubject();

        if (policySubject != null) {
            try {
                cacheConfig = CachingPolicyProcessor.processCachingPolicy(policySubject);
            } catch (CachingException e) {
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

        CacheConfiguration cacheConfig = null;
        CachingObserver cachingObserver = new CachingObserver();
        AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
        axisConfiguration.addObservers(cachingObserver);

        PolicySubject policySubject = module.getPolicySubject();

        if (policySubject != null) {
            try {
                cacheConfig = CachingPolicyProcessor.processCachingPolicy(policySubject);
            } catch (CachingException e) {
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

        }
    }
   
    public static void addPoliciesAsExtensibleElement(
      AxisDescription description, OMElement descriptionElement) {
    PolicySubject policySubject = description.getPolicySubject();
    Collection attachPolicyComponents = policySubject
        .getAttachedPolicyComponents();
    ArrayList policies = new ArrayList();

    for (Iterator iterator = attachPolicyComponents.iterator(); iterator
        .hasNext();) {
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

                               Throttle defaultThrottle) throws AxisFault {
        String currentServiceName;
        if (axisDescription instanceof AxisService) {
            Throttle throttle = null;
            AxisService currentService = ((AxisService) axisDescription);
            PolicySubject policySubject = currentService.getPolicySubject();
            if (policySubject != null) {
                try {
                    List policies = new ArrayList(policySubject.getAttachedPolicyComponents());
                    Policy currentPolicy = PolicyUtil.getMergedPolicy(policies, currentService);
                    if (currentPolicy != null) {
                        throttle = ThrottleFactory.createServiceThrottle(currentPolicy);
                        if(throttle == null) {
                            //this is for the scenario when throttle policy is empty rather than
                            // null (eg: removing the throttle policy via policy editor)
                            throttle = defaultThrottle;
                        }
                        //todo - done by isuru, recheck
                    } else {
                        AxisConfiguration axisConfig = configctx.getAxisConfiguration();
                        AxisModule throttleModule = axisConfig.getModule(
                                ThrottleConstants.THROTTLE_MODULE_NAME);
                        policySubject = throttleModule.getPolicySubject();
                        if (policySubject != null) {
                            currentPolicy = ThrottleEnguageUtils.getThrottlePolicy(
                                    policySubject.getAttachedPolicyComponents());
                            if (currentPolicy != null) {
                                throttle = ThrottleFactory.createModuleThrottle(currentPolicy);
                            }
                        }
                        //todo - done by isuru
                    }
                } catch (ThrottleException e) {

                    log.error("Error was occurred when engaging throttle module for" +
                              " the service :" +
                              currentService.getName() + e.getMessage());
                    log.info("Throttling will occur using default module policy");
                    throttle = defaultThrottle;
                }
                if (throttle != null) {
                    Map throttles =
                            (Map) configctx.getPropertyNonReplicable(
                                    ThrottleConstants.THROTTLES_MAP);
                    if (throttles == null) {
                        throttles = new HashMap();
                        configctx.setNonReplicableProperty(
                                ThrottleConstants.THROTTLES_MAP, throttles);
                    }
                    String serviceName = currentService.getName();
                    throttle.setId(serviceName);
                    throttles.put(serviceName, throttle);
                    ConcurrentAccessController cac = throttle.getConcurrentAccessController();
                    if (cac != null) {
                        String cacKey = ThrottleConstants.THROTTLE_PROPERTY_PREFIX
                                        + serviceName + ThrottleConstants.CAC_SUFFIX;
                        configctx.setProperty(cacKey, cac);
                    }
                }
            }
        } else if (axisDescription instanceof AxisOperation) {

            Throttle throttle = null;
            AxisOperation currentOperation = ((AxisOperation) axisDescription);
            AxisService axisService = (AxisService) currentOperation.getParent();
            if (axisService != null) {
                currentServiceName = axisService.getName();
                PolicySubject policySubject = currentOperation.getPolicySubject();
                if (policySubject != null) {
                    try {
                        List policies = new ArrayList(policySubject.getAttachedPolicyComponents());
                        Policy currentPolicy = PolicyUtil.getMergedPolicy(policies,
                                                                          currentOperation);
                        if (currentPolicy != null) {
                            throttle = ThrottleFactory.createOperationThrottle(currentPolicy);
                        }
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

     */
    private List<Resource> getModulePolicies(AxisModule axisModule) throws Exception {
        // List of policies to return
        List<Resource> modulePolicies = new ArrayList<Resource>();

        PolicySubject modulePolicySubject = axisModule.getPolicySubject();
        List<PolicyComponent> policyList = new ArrayList<PolicyComponent>(modulePolicySubject
                .getAttachedPolicyComponents());

        // Get the merged module policy
        Policy policy = null;
        for (Object policyElement : policyList) {
            if (policyElement instanceof Policy) {
                policy = (policy == null) ?
                        (Policy) policyElement : policy.merge((Policy) policyElement);
            } else {
                PolicyReference policyReference = (PolicyReference) policyElement;
                String key = policyReference.getURI();
                int pos = key.indexOf("#");
                if (pos == 0) {
                    key = key.substring(1);
                } else if (pos > 0) {
                    key = key.substring(0, pos);
                }

                PolicyComponent attachedPolicyComponent = modulePolicySubject
                        .getAttachedPolicyComponent(key);

                if (attachedPolicyComponent != null && attachedPolicyComponent instanceof Policy) {
                    policy = (Policy) attachedPolicyComponent;
                }
View Full Code Here

Examples of org.apache.axis2.description.PolicySubject

        }
    }
   
    public static void addPoliciesAsExtensibleElement(
      AxisDescription description, OMElement descriptionElement) {
    PolicySubject policySubject = description.getPolicySubject();
    Collection attachPolicyComponents = policySubject
        .getAttachedPolicyComponents();
    ArrayList policies = new ArrayList();

    for (Iterator iterator = attachPolicyComponents.iterator(); iterator
        .hasNext();) {
View Full Code Here

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

     * @param reader
     */
    private void readIntents(Object subject, Operation operation, XMLStreamReader reader) {
        if (!(subject instanceof PolicySubject))
            return;
        PolicySubject intentAttachPoint = (PolicySubject)subject;
        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) {
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.