Java Code Examples for org.apache.cxf.service.model.BindingOperationInfo#getProperty()

The following examples show how to use org.apache.cxf.service.model.BindingOperationInfo#getProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyEngineImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
public EffectivePolicy getEffectiveClientRequestPolicy(EndpointInfo ei, BindingOperationInfo boi,
                                                       Conduit c, Message m) {
    EffectivePolicy effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
    if (effectivePolicy == null) {
        synchronized (ei) {
            effectivePolicy = (EffectivePolicy)boi.getProperty(POLICY_INFO_REQUEST_CLIENT);
            if (null == effectivePolicy) {
                EffectivePolicyImpl epi = createOutPolicyInfo();
                Assertor assertor = PolicyUtils.createAsserter(c);
                epi.initialise(ei, boi, this, assertor, true, true, m);
                if (m != null) {
                    boi.setProperty(POLICY_INFO_REQUEST_CLIENT, epi);
                }
                effectivePolicy = epi;
            }
        }
    }
    return effectivePolicy;
}
 
Example 2
Source File: PolicyEngineImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: PolicyEngineImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: AbstractMetricsInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Object createMetricsContextForOperation(Message message, BindingOperationInfo boi) {
    Object o = boi.getProperty(MetricsContext.class.getName());
    if (o == null) {
        List<MetricsContext> contexts = new ArrayList<>();
        for (MetricsProvider p : getMetricProviders(message.getExchange().getBus())) {
            MetricsContext c = p.createOperationContext(message.getExchange().getEndpoint(),
                                     boi, MessageUtils.isRequestor(message),
                                     (String)message.getContextualProperty(MetricsProvider.CLIENT_ID));
            if (c != null) {
                contexts.add(c);
            }
            if (c instanceof Closeable) {
                message.getExchange().getEndpoint().addCleanupHook((Closeable)c);
            }
        }
        if (contexts.size() == 1) {
            o = contexts.get(0);
        } else {
            o = contexts;
        }
        boi.setProperty(MetricsContext.class.getName(), o);
    }
    return o;
}
 
Example 5
Source File: AbstractMetricsInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void addOperationMetrics(ExchangeMetrics ctx, Message m, BindingOperationInfo boi) {
    Object metrics = null;
    if (boi == null) {
        //likely a REST service, let's see if we have a resource name
        Object nameProperty = m.getExchange().get("org.apache.cxf.resource.operation.name");
        if (nameProperty != null) {
            Map<String, Object> restMap = getRestMetricsMap(m.getExchange().getEndpoint());
            metrics = restMap.get(nameProperty.toString());
            if (metrics == null) {
                metrics = createMetricsContextForRestResource(m, nameProperty.toString());
            }
        }
    } else {
        if (boi.isUnwrapped()) {
            boi = boi.getWrappedOperation();
        }
        metrics = boi.getProperty(MetricsContext.class.getName());
        if (metrics == null) {
            synchronized (boi) {
                metrics = createMetricsContextForOperation(m, boi);
            }
        }
    }
    if (metrics instanceof List) {
        List<MetricsContext> list = CastUtils.cast((List<?>)metrics);
        for (MetricsContext c : list) {
            ctx.addContext(c);
        }
    } else if (metrics instanceof MetricsContext) {
        ctx.addContext((MetricsContext)metrics);
    }
}