/** * @deprecated As of 1.4 release. You can't override a policies that * applicable for the current policy scope via * {@link PolicyInclude #setEffectivePolicy(Policy)}. In case * you need to make a policy the only policy that is within the * policy cache of an {@link AxisDescription} please use * {@link PolicySubject #clear()} and * {@link PolicySubject #attachPolicy(Policy)} accordingly. * */ public void setEffectivePolicy(Policy effectivePolicy) { this.effectivePolicy = effectivePolicy; if (description != null && effectivePolicy != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(effectivePolicy); } }
/** * @deprecated As of 1.4 release. You can't override a policies that * applicable for the current policy scope via * {@link PolicyInclude #setEffectivePolicy(Policy)}. In case * you need to make a policy the only policy that is within the * policy cache of an {@link AxisDescription} please use * {@link PolicySubject #clear()} and * {@link PolicySubject #attachPolicy(Policy)} accordingly. * */ public void setEffectivePolicy(Policy effectivePolicy) { this.effectivePolicy = effectivePolicy; if (description != null && effectivePolicy != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(effectivePolicy); } }
/** * This method sets the policy as the default of this AxisDescription instance. Further more * this method does the followings. <p/> (1) Engage whatever modules necessary to execute new * the effective policy of this AxisDescription instance. (2) Disengage whatever modules that * are not necessary to execute the new effective policy of this AxisDescription instance. (3) * Check whether each module can execute the new effective policy of this AxisDescription * instance. (4) If not throw an AxisFault to notify the user. (5) Else notify each module about * the new effective policy. * * @param policy the new policy of this AxisDescription instance. The effective policy is the * merge of this argument with effective policy of parent of this * AxisDescription. * @throws AxisFault if any module is unable to execute the effective policy of this * AxisDescription instance successfully or no module to execute some portion * (one or more PrimtiveAssertions ) of that effective policy. */ public void applyPolicy(Policy policy) throws AxisFault { // sets AxisDescription policy getPolicySubject().clear(); getPolicySubject().attachPolicy(policy); /* * now we try to engage appropriate modules based on the merged policy * of axis description object and the corresponding axis binding * description object. */ applyPolicy(); }
/** * This method sets the policy as the default of this AxisDescription instance. Further more * this method does the followings. <p/> (1) Engage whatever modules necessary to execute new * the effective policy of this AxisDescription instance. (2) Disengage whatever modules that * are not necessary to execute the new effective policy of this AxisDescription instance. (3) * Check whether each module can execute the new effective policy of this AxisDescription * instance. (4) If not throw an AxisFault to notify the user. (5) Else notify each module about * the new effective policy. * * @param policy the new policy of this AxisDescription instance. The effective policy is the * merge of this argument with effective policy of parent of this * AxisDescription. * @throws AxisFault if any module is unable to execute the effective policy of this * AxisDescription instance successfully or no module to execute some portion * (one or more PrimtiveAssertions ) of that effective policy. */ public void applyPolicy(Policy policy) throws AxisFault { // sets AxisDescription policy getPolicySubject().clear(); getPolicySubject().attachPolicy(policy); /* * now we try to engage appropriate modules based on the merged policy * of axis description object and the corresponding axis binding * description object. */ applyPolicy(); }
PolicySubject subject = description.getPolicySubject();
PolicySubject subject = description.getPolicySubject();
/** * @deprecated As of 1.4 release. If you need to calculate merged policy of * all policies that are in the policy cache of * {@link AxisDescription}, use * {@link PolicySubject #getAttachedPolicyComponents() and {@link org.PolicyUtil #getMergedPolicy(List, AxisDescription)}} */ public Policy getPolicy() { if (description != null) { ArrayList<PolicyComponent> policyList = new ArrayList<PolicyComponent>(description.getPolicySubject() .getAttachedPolicyComponents()); return PolicyUtil.getMergedPolicy(policyList, description); } calculatePolicy(); return policy; }
/** * @deprecated As of 1.4 release. If you need to calculate merged policy of * all policies that are in the policy cache of * {@link AxisDescription}, use * {@link PolicySubject #getAttachedPolicyComponents() and {@link org.PolicyUtil #getMergedPolicy(List, AxisDescription)}} */ public Policy getPolicy() { if (description != null) { ArrayList<PolicyComponent> policyList = new ArrayList<PolicyComponent>(description.getPolicySubject() .getAttachedPolicyComponents()); return PolicyUtil.getMergedPolicy(policyList, description); } calculatePolicy(); return policy; }
private Policy findPolicy(String id, AxisDescription des) { Collection<PolicyComponent> policyElements = des.getPolicySubject().getAttachedPolicyComponents(); PolicyRegistry registry = new PolicyRegistryImpl(); Object policyComponent; Policy policy = registry.lookup(id); if (policy != null) { return policy; } for (Iterator<PolicyComponent> iterator = policyElements.iterator(); iterator.hasNext();) { policyComponent = iterator.next(); if (policyComponent instanceof Policy) { // policy found for the id if (id.equals(((Policy) policyComponent).getId())) { return (Policy) policyComponent; } } } AxisDescription child; for (Iterator<? extends AxisDescription> iterator = des.getChildren(); iterator.hasNext();) { child = (AxisDescription) iterator.next(); policy = findPolicy(id, child); if (policy != null) { return policy; } } return null; }
private Policy findPolicy(String id, AxisDescription des) { Collection<PolicyComponent> policyElements = des.getPolicySubject().getAttachedPolicyComponents(); PolicyRegistry registry = new PolicyRegistryImpl(); Object policyComponent; Policy policy = registry.lookup(id); if (policy != null) { return policy; } for (Iterator<PolicyComponent> iterator = policyElements.iterator(); iterator.hasNext();) { policyComponent = iterator.next(); if (policyComponent instanceof Policy) { // policy found for the id if (id.equals(((Policy) policyComponent).getId())) { return (Policy) policyComponent; } } } AxisDescription child; for (Iterator<? extends AxisDescription> iterator = des.getChildren(); iterator.hasNext();) { child = (AxisDescription) iterator.next(); policy = findPolicy(id, child); if (policy != null) { return policy; } } return null; }
/** * @param policy * @see org.apache.axis2.description.PolicySubject#attachPolicy(Policy) * @see org.apache.axis2.description.PolicySubject#clear() * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #attachPolicy(Policy)} Use * {@link PolicySubject #clear()} beforehand effective policy of * {@link AxisDescription} has to be set as the argument. * */ public void setPolicy(Policy policy) { wrapperElements.clear(); if (policy.getName() == null && policy.getId() == null) { policy.setId(UIDGenerator.generateUID()); } Wrapper wrapper = new Wrapper(PolicyInclude.ANON_POLICY, policy); if (policy.getName() != null) { wrapperElements.put(policy.getName(), wrapper); } else { wrapperElements.put(policy.getId(), wrapper); } if (description != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(policy); } }
public static void addPoliciesAsExtensibleElement( AxisDescription description, OMElement descriptionElement) { PolicySubject policySubject = description.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents();
/** * @param policy * @see org.apache.axis2.description.PolicySubject#attachPolicy(Policy) * @see org.apache.axis2.description.PolicySubject#clear() * @deprecated As of 1.4 release, replaced by * {@link PolicySubject #attachPolicy(Policy)} Use * {@link PolicySubject #clear()} beforehand effective policy of * {@link AxisDescription} has to be set as the argument. * */ public void setPolicy(Policy policy) { wrapperElements.clear(); if (policy.getName() == null && policy.getId() == null) { policy.setId(UIDGenerator.generateUID()); } Wrapper wrapper = new Wrapper(PolicyInclude.ANON_POLICY, policy); if (policy.getName() != null) { wrapperElements.put(policy.getName(), wrapper); } else { wrapperElements.put(policy.getId(), wrapper); } if (description != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(policy); } }
private void addPolicyAsExtensibleElement(AxisDescription axisDescription, OMElement descriptionElement) throws XMLStreamException, FactoryConfigurationError, AxisFault { PolicySubject policySubject = axisDescription.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents();
public static String generateId(AxisDescription description) { PolicySubject policySubject = description.getPolicySubject(); String identifier = "-policy-1"; if (description instanceof AxisMessage) { identifier = "msg-" + ((AxisMessage) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisOperation) { identifier = "op-" + ((AxisOperation) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisService) { identifier = "service-" + ((AxisService) description).getName() + identifier; } /* * Int 49 is the value of the Character '1'. Here we want to change '1' * to '2' or '2' to '3' .. etc. to construct a unique identifier. */ for (int index = 49; policySubject.getAttachedPolicyComponent(identifier) != null; index++) { identifier = identifier.replace((char) index, (char) (index + 1)); } return identifier; }
public static String generateId(AxisDescription description) { PolicySubject policySubject = description.getPolicySubject(); String identifier = "-policy-1"; if (description instanceof AxisMessage) { identifier = "msg-" + ((AxisMessage) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisOperation) { identifier = "op-" + ((AxisOperation) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisService) { identifier = "service-" + ((AxisService) description).getName() + identifier; } /* * Int 49 is the value of the Character '1'. Here we want to change '1' * to '2' or '2' to '3' .. etc. to construct a unique identifier. */ for (int index = 49; policySubject.getAttachedPolicyComponent(identifier) != null; index++) { identifier = identifier.replace((char) index, (char) (index + 1)); } return identifier; }
private void addPolicyAsExtElement(AxisDescription axisDescription, OMElement wsdlElement) throws Exception { PolicySubject policySubject = axisDescription.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents();
private void addPolicyAsExtElement(AxisDescription axisDescription, OMElement wsdlElement) throws Exception { PolicySubject policySubject = axisDescription.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents();
PolicySubject policySubject = subject.getPolicySubject(); PolicyComponent attachedPolicyComponent = policySubject .getAttachedPolicyComponent(key);
PolicySubject policySubject = subject.getPolicySubject(); PolicyComponent attachedPolicyComponent = policySubject .getAttachedPolicyComponent(key);