/** * Return a collection of all assertions used in the given policy component, * optionally including optional assertions. * The policy need not be normalised, so any policy references will have to be resolved. * @param pc the policy component * @param includeOptional flag indicating if optional assertions should be included * @return the assertions */ Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) { Collection<Assertion> assertions = new ArrayList<>(); if (Constants.TYPE_ASSERTION == pc.getType()) { Assertion a = (Assertion)pc; if (includeOptional || !a.isOptional()) { assertions.add(a); } } else { addAssertions(pc, includeOptional, assertions); } return assertions; } Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {
public synchronized void setEnabled(boolean e) { enabled = e; if (enabled && !addedBusInterceptors) { addBusInterceptors(); } else if (!enabled && addedBusInterceptors) { removeBusInterceptors(); } }
private EndpointPolicy getEndpointPolicy(//NOPMD EndpointInfo ei, boolean isRequestor, Assertor assertor, Message m) { return createEndpointPolicyInfo(ei, isRequestor, assertor, m); }
void initializePolicy(Message m) { if (engine != null) { policy = engine.getAggregatedServicePolicy(ei.getService(), m); policy = policy.merge(engine.getAggregatedEndpointPolicy(ei, m)); if (!policy.isEmpty()) { policy = policy.normalize(engine.getRegistry(), true); } } }
public EffectivePolicy getEffectiveClientResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, Message m) { EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT); if (effectivePolicy == null) { synchronized (ei) { effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_CLIENT); if (null == effectivePolicy) { EffectivePolicyImpl epi = createOutPolicyInfo(); epi.initialise(ei, boi, this, true, false, m); if (m != null) { boi.setProperty(POLICY_INFO_RESPONSE_CLIENT, epi); } effectivePolicy = epi; } } } return effectivePolicy; }
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); }
public EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei, BindingOperationInfo boi, BindingFaultInfo bfi, Destination d, Message m) { if (bfi == null) { EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, null, this, assertor, m); return epi; } bfi = mapToWrappedBindingFaultInfo(bfi); EffectivePolicy effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER); if (effectivePolicy == null) { synchronized (ei) { effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER); if (null == effectivePolicy) { EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, bfi, this, assertor, m); if (m != null) { bfi.setProperty(POLICY_INFO_FAULT_SERVER, epi); } effectivePolicy = epi; } } } return effectivePolicy; }
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 final void setBus(Bus b) { bus = b; if (null != bus) { setBuilder(bus.getExtension(PolicyBuilder.class)); PolicyEngine pe = bus.getExtension(PolicyEngine.class); if (pe != null) { setRegistry(pe.getRegistry()); ((PolicyEngineImpl)pe).addPolicyProvider(this); } } }
@Resource public final void setBus(Bus b) { if (this.bus == b) { //avoid bus init twice through injection return; } bus = b; addBusInterceptors(); FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class); if (fblm != null) { for (FactoryBeanListener l : fblm.getListeners()) { if (l instanceof PolicyAnnotationListener) { return; } } fblm.addListener(new PolicyAnnotationListener(bus)); } }
void initializePolicy(Message m) { if (engine != null) { policy = engine.getAggregatedServicePolicy(ei.getService(), m); policy = policy.merge(engine.getAggregatedEndpointPolicy(ei, m)); if (!policy.isEmpty()) { policy = policy.normalize(engine.getRegistry(), true); } } }
public EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi, Message m) { EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER); if (effectivePolicy == null) { synchronized (ei) { effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_SERVER); if (null == effectivePolicy) { EffectivePolicyImpl epi = createOutPolicyInfo(); epi.initialise(ei, boi, this, false, true, m); if (m != null) { boi.setProperty(POLICY_INFO_REQUEST_SERVER, epi); } effectivePolicy = epi; } } } return effectivePolicy; }
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); }
public EffectivePolicy getEffectiveServerFaultPolicy(EndpointInfo ei, BindingOperationInfo boi, BindingFaultInfo bfi, Destination d, Message m) { if (bfi == null) { EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, null, this, assertor, m); return epi; } bfi = mapToWrappedBindingFaultInfo(bfi); EffectivePolicy effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER); if (effectivePolicy == null) { synchronized (ei) { effectivePolicy = (EffectivePolicy)bfi.getProperty(POLICY_INFO_FAULT_SERVER); if (null == effectivePolicy) { EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, bfi, this, assertor, m); if (m != null) { bfi.setProperty(POLICY_INFO_FAULT_SERVER, epi); } effectivePolicy = epi; } } } return effectivePolicy; }
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 final void setBus(Bus b) { bus = b; if (null != bus) { setBuilder(bus.getExtension(PolicyBuilder.class)); PolicyEngine pe = bus.getExtension(PolicyEngine.class); if (pe != null) { setRegistry(pe.getRegistry()); ((PolicyEngineImpl)pe).addPolicyProvider(this); } } }
@Resource public final void setBus(Bus b) { if (this.bus == b) { //avoid bus init twice through injection return; } bus = b; addBusInterceptors(); FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class); if (fblm != null) { for (FactoryBeanListener l : fblm.getListeners()) { if (l instanceof PolicyAnnotationListener) { return; } } fblm.addListener(new PolicyAnnotationListener(bus)); } }
public EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, Destination d, List<List<Assertion>> incoming, Message m) { if (incoming == null) { EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER); if (effectivePolicy == null) { synchronized (ei) { effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_RESPONSE_SERVER); if (null == effectivePolicy) { EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, this, assertor, false, false, null); if (m != null) { boi.setProperty(POLICY_INFO_RESPONSE_SERVER, epi); } effectivePolicy = epi; } } } return effectivePolicy; } EffectivePolicyImpl epi = createOutPolicyInfo(); Assertor assertor = PolicyUtils.createAsserter(d); epi.initialise(ei, boi, this, assertor, incoming, m); return epi; }
public synchronized void setEnabled(boolean e) { enabled = e; if (enabled && !addedBusInterceptors) { addBusInterceptors(); } else if (!enabled && addedBusInterceptors) { removeBusInterceptors(); } }
/** * Return a collection of all assertions used in the given policy component, * optionally including optional assertions. * The policy need not be normalised, so any policy references will have to be resolved. * @param pc the policy component * @param includeOptional flag indicating if optional assertions should be included * @return the assertions */ Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) { Collection<Assertion> assertions = new ArrayList<>(); if (Constants.TYPE_ASSERTION == pc.getType()) { Assertion a = (Assertion)pc; if (includeOptional || !a.isOptional()) { assertions.add(a); } } else { addAssertions(pc, includeOptional, assertions); } return assertions; } Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {