protected EndpointPolicyImpl createEndpointPolicy() { return new EndpointPolicyImpl(this.ei, this.engine, this.requestor, this.assertor); }
public EndpointPolicy updatePolicy(Policy p, Message msg) { EndpointPolicyImpl epi = createEndpointPolicy(); if (!PolicyUtils.isEmptyPolicy(p)) { Policy normalizedPolicy = p.normalize(engine == null ? null : engine.getRegistry(), true); epi.setPolicy(getPolicy().merge(normalizedPolicy)); } else { Policy clonedPolicy = new Policy(); clonedPolicy.addPolicyComponents(getPolicy().getPolicyComponents()); epi.setPolicy(clonedPolicy); } epi.checkExactlyOnes(); epi.finalizeConfig(msg); return epi; }
void finalizeConfig(Message m) { chooseAlternative(m); }
public void initialize(Message m) { initializePolicy(m); checkExactlyOnes(); finalizeConfig(m); }
void initializeInterceptors(PolicyInterceptorProviderRegistry reg, Set<Interceptor<? extends Message>> out, Assertion a, boolean fault, Message msg) { QName qn = a.getName(); List<Interceptor<? extends org.apache.cxf.message.Message>> i = fault ? reg.getInFaultInterceptorsForAssertion(qn) : reg.getInInterceptorsForAssertion(qn); out.addAll(i); if (a instanceof PolicyContainingAssertion) { Policy p = ((PolicyContainingAssertion)a).getPolicy(); if (p != null) { for (Assertion a2 : getSupportedAlternatives(p, msg)) { initializeInterceptors(reg, out, a2, fault, msg); } } } }
void chooseAlternative(Message m) { Collection<Assertion> alternative = null; if (requestor) { if (engine.isEnabled()) { alternative = engine.getAlternativeSelector().selectAlternative(policy, engine, assertor, null, m); } else { // use an empty list to avoid getting NPE alternative = Collections.emptyList(); } } else { alternative = getSupportedAlternatives(m); } if (null == alternative) { throw new PolicyException(new org.apache.cxf.common.i18n.Message("NO_ALTERNATIVE_EXC", BUNDLE)); } setChosenAlternative(alternative); }
EndpointPolicy createEndpointPolicyInfo(EndpointInfo ei, boolean isRequestor, Assertor assertor, Message m) { EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER); if (ep == null) { synchronized (ei) { ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER); if (ep == null) { EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor); epi.initialize(m); if (m != null) { ei.setProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER, epi); } ep = epi; } } } return ep; }
if (getChosenAlternative() != null) { for (Assertion a : getChosenAlternative()) { initializeInterceptors(reg, out, a, false, m); tmp = new ArrayList<>(out); out.clear(); for (Assertion a : getChosenAlternative()) { initializeInterceptors(reg, out, a, true, m); if (c != null) { for (Assertion a : c) { initializeInterceptors(reg, out, a, false, m); initializeInterceptors(reg, out, a, true, m);
if (getChosenAlternative() != null) { for (Assertion a : getChosenAlternative()) { if (a.isOptional()) { continue; Collection<Assertion> c = engine.getAssertions(p, false); if (c != null) { addAll(v, c); Collection<Assertion> c = engine.getAssertions(p, false); if (c != null) { addAll(v, c); if (null != fv) { addAll(fv, c); c = engine.getAssertions(p, false); if (c != null) { addAll(fv, c);
Assertor initialisePolicy(EndpointInfo ei, BindingOperationInfo boi, PolicyEngine engine, boolean requestor, boolean request, Assertor assertor, Message m) { if (boi.isUnwrapped()) { boi = boi.getUnwrappedOperation(); } BindingMessageInfo bmi = request ? boi.getInput() : boi.getOutput(); EndpointPolicy ep; if (requestor) { ep = engine.getClientEndpointPolicy(ei, getAssertorAs(assertor, Conduit.class), m); } else { ep = engine.getServerEndpointPolicy(ei, getAssertorAs(assertor, Destination.class), m); } policy = ep.getPolicy(); if (ep instanceof EndpointPolicyImpl) { assertor = ((EndpointPolicyImpl)ep).getAssertor(); } policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi, m)); if (null != bmi) { policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedMessagePolicy(bmi, m)); } policy = policy.normalize(engine.getRegistry(), true); return assertor; }
public void initialize(Message m) { initializePolicy(m); checkExactlyOnes(); finalizeConfig(m); }
void initializeInterceptors(PolicyInterceptorProviderRegistry reg, Set<Interceptor<? extends Message>> out, Assertion a, boolean fault, Message msg) { QName qn = a.getName(); List<Interceptor<? extends org.apache.cxf.message.Message>> i = fault ? reg.getInFaultInterceptorsForAssertion(qn) : reg.getInInterceptorsForAssertion(qn); out.addAll(i); if (a instanceof PolicyContainingAssertion) { Policy p = ((PolicyContainingAssertion)a).getPolicy(); if (p != null) { for (Assertion a2 : getSupportedAlternatives(p, msg)) { initializeInterceptors(reg, out, a2, fault, msg); } } } }
void chooseAlternative(Message m) { Collection<Assertion> alternative = null; if (requestor) { if (engine.isEnabled()) { alternative = engine.getAlternativeSelector().selectAlternative(policy, engine, assertor, null, m); } else { // use an empty list to avoid getting NPE alternative = Collections.emptyList(); } } else { alternative = getSupportedAlternatives(m); } if (null == alternative) { throw new PolicyException(new org.apache.cxf.common.i18n.Message("NO_ALTERNATIVE_EXC", BUNDLE)); } setChosenAlternative(alternative); }
EndpointPolicy createEndpointPolicyInfo(EndpointInfo ei, boolean isRequestor, Assertor assertor, Message m) { EndpointPolicy ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER); if (ep == null) { synchronized (ei) { ep = (EndpointPolicy)ei.getProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER); if (ep == null) { EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, this, isRequestor, assertor); epi.initialize(m); if (m != null) { ei.setProperty(isRequestor ? POLICY_INFO_ENDPOINT_CLIENT : POLICY_INFO_ENDPOINT_SERVER, epi); } ep = epi; } } } return ep; }
if (getChosenAlternative() != null) { for (Assertion a : getChosenAlternative()) { initializeInterceptors(reg, out, a, false, m); tmp = new ArrayList<>(out); out.clear(); for (Assertion a : getChosenAlternative()) { initializeInterceptors(reg, out, a, true, m); if (c != null) { for (Assertion a : c) { initializeInterceptors(reg, out, a, false, m); initializeInterceptors(reg, out, a, true, m);
if (getChosenAlternative() != null) { for (Assertion a : getChosenAlternative()) { if (a.isOptional()) { continue; Collection<Assertion> c = engine.getAssertions(p, false); if (c != null) { addAll(v, c); Collection<Assertion> c = engine.getAssertions(p, false); if (c != null) { addAll(v, c); if (null != fv) { addAll(fv, c); c = engine.getAssertions(p, false); if (c != null) { addAll(fv, c);
Assertor initialisePolicy(EndpointInfo ei, BindingOperationInfo boi, PolicyEngine engine, boolean requestor, boolean request, Assertor assertor, Message m) { if (boi.isUnwrapped()) { boi = boi.getUnwrappedOperation(); } BindingMessageInfo bmi = request ? boi.getInput() : boi.getOutput(); EndpointPolicy ep; if (requestor) { ep = engine.getClientEndpointPolicy(ei, getAssertorAs(assertor, Conduit.class), m); } else { ep = engine.getServerEndpointPolicy(ei, getAssertorAs(assertor, Destination.class), m); } policy = ep.getPolicy(); if (ep instanceof EndpointPolicyImpl) { assertor = ((EndpointPolicyImpl)ep).getAssertor(); } policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi, m)); if (null != bmi) { policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedMessagePolicy(bmi, m)); } policy = policy.normalize(engine.getRegistry(), true); return assertor; }
public EndpointPolicy updatePolicy(Policy p, Message msg) { EndpointPolicyImpl epi = createEndpointPolicy(); if (!PolicyUtils.isEmptyPolicy(p)) { Policy normalizedPolicy = p.normalize(engine == null ? null : engine.getRegistry(), true); epi.setPolicy(getPolicy().merge(normalizedPolicy)); } else { Policy clonedPolicy = new Policy(); clonedPolicy.addPolicyComponents(getPolicy().getPolicyComponents()); epi.setPolicy(clonedPolicy); } epi.checkExactlyOnes(); epi.finalizeConfig(msg); return epi; }
protected EndpointPolicyImpl createEndpointPolicy() { return new EndpointPolicyImpl(this.ei, this.engine, this.requestor, this.assertor); }
void finalizeConfig(Message m) { chooseAlternative(m); }