public <T> T getServerEndpointPolicy(Message m, EndpointInfo ei, Destination d, PolicyCalculator<T> policyCalculator) { Collection<Assertion> alternative = getPolicyEngine() .getServerEndpointPolicy(ei, d, m).getChosenAlternative(); List<T> filteredPolicies = new ArrayList<>(); for (Assertion a : alternative) { if (policyCalculator.getDataClassName().equals(a.getName())) { T p = JaxbAssertion.cast(a, policyCalculator.getDataClass()).getData(); filteredPolicies.add(p); } } return getPolicy(filteredPolicies, policyCalculator); }
public <T> T getServerEndpointPolicy(Message m, EndpointInfo ei, Destination d, PolicyCalculator<T> policyCalculator) { Collection<Assertion> alternative = getPolicyEngine() .getServerEndpointPolicy(ei, d, m).getChosenAlternative(); List<T> filteredPolicies = new ArrayList<>(); for (Assertion a : alternative) { if (policyCalculator.getDataClassName().equals(a.getName())) { T p = JaxbAssertion.cast(a, policyCalculator.getDataClass()).getData(); filteredPolicies.add(p); } } return getPolicy(filteredPolicies, policyCalculator); }
void initialisePolicy(EndpointInfo ei, BindingOperationInfo boi, BindingFaultInfo bfi, PolicyEngine engine, Message m) { policy = engine.getServerEndpointPolicy(ei, (Destination)null, m).getPolicy(); policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi, m)); if (bfi != null) { policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedFaultPolicy(bfi, m)); } policy = policy.normalize(engine.getRegistry(), true); }
void initialisePolicy(EndpointInfo ei, BindingOperationInfo boi, BindingFaultInfo bfi, PolicyEngine engine, Message m) { policy = engine.getServerEndpointPolicy(ei, (Destination)null, m).getPolicy(); policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi, m)); if (bfi != null) { policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedFaultPolicy(bfi, m)); } policy = policy.normalize(engine.getRegistry(), true); }
protected List<PolicyAssertion> getAssertions(PolicyEngine pe, org.apache.cxf.endpoint.Server s) { Policy p1 = pe.getServerEndpointPolicy( s.getEndpoint().getEndpointInfo(), null, null).getPolicy(); List<ExactlyOne> pops = CastUtils.cast(p1.getPolicyComponents(), ExactlyOne.class); assertEquals("New policy must have 1 top level policy operator", 1, pops.size()); List<All> alts = CastUtils.cast(pops.get(0).getPolicyComponents(), All.class); assertEquals("1 alternatives should be available", 1, alts.size()); return CastUtils.cast(alts.get(0).getAssertions(), PolicyAssertion.class); } }
EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, msg); if (ep != null) { interceptors.addAll(ep.getInterceptors(msg));
EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, msg); if (ep != null) { interceptors.addAll(ep.getInterceptors(msg));
EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, null); Collection<Assertion> assertions = ep.getChosenAlternative(); for (Assertion a : assertions) {
EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, null); Collection<Assertion> assertions = ep.getChosenAlternative(); for (Assertion a : assertions) {
@Override public void initialize(Server server, Bus bus) { Endpoint endpoint = server.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null, null); pe.setServerEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); // Add policy to the service model (and consequently to the WSDL) // FIXME - ideally this should probably be moved up to where the policies are applied to the // endpoint, rather than this late. As a consequence of its location, you have to declare a // ws policy feature on every endpoint in order to get any policy attachments into the // wsdl. Alternatively add to the WSDLServiceBuilder somehow. ServiceModelPolicyUpdater pu = new ServiceModelPolicyUpdater(ei); for (PolicyProvider pp : ((PolicyEngineImpl) pe).getPolicyProviders()) { if (pp instanceof ExternalAttachmentProvider) { pu.addPolicyAttachments(((ExternalAttachmentProvider) pp).getAttachments()); } } }
@Override public void initialize(Server server, Bus bus) { Endpoint endpoint = server.getEndpoint(); Policy p = initializeEndpointPolicy(endpoint, bus); PolicyEngine pe = bus.getExtension(PolicyEngine.class); EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy ep = pe.getServerEndpointPolicy(ei, null, null); pe.setServerEndpointPolicy(ei, ep.updatePolicy(p, createMessage(endpoint, bus))); // Add policy to the service model (and consequently to the WSDL) // FIXME - ideally this should probably be moved up to where the policies are applied to the // endpoint, rather than this late. As a consequence of its location, you have to declare a // ws policy feature on every endpoint in order to get any policy attachments into the // wsdl. Alternatively add to the WSDLServiceBuilder somehow. ServiceModelPolicyUpdater pu = new ServiceModelPolicyUpdater(ei); for (PolicyProvider pp : ((PolicyEngineImpl) pe).getPolicyProviders()) { if (pp instanceof ExternalAttachmentProvider) { pu.addPolicyAttachments(((ExternalAttachmentProvider) pp).getAttachments()); } } }
EndpointInfo ei = endpoint.getEndpointInfo(); EndpointPolicy epi = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint.getEndpointInfo(), null, message) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(), conduit, message);
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; }
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; }
message.getExchange().put(TokenStore.class.getName(), store); EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination, message); List<Interceptor<? extends Message>> interceptors = ep.getInterceptors(message); message.getInterceptorChain().add(interceptors);
message.getExchange().put(TokenStore.class.getName(), store); EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination, message); List<Interceptor<? extends Message>> interceptors = ep.getInterceptors(message); message.getInterceptorChain().add(interceptors);