Package org.apache.cxf.ws.policy

Examples of org.apache.cxf.ws.policy.PolicyEngine


    private void initializeConfig() {
   
        // wsdl extensors are superseded by policies which in       
        // turn are superseded by injection                         

        PolicyEngine pe = bus.getExtension(PolicyEngine.class);     
        if (null != pe && pe.isEnabled() && endpointInfo.getService() != null) {                         
            clientSidePolicy =                                      
                PolicyUtils.getClient(pe, endpointInfo, this);             
        }                                                           

    }
View Full Code Here


    protected boolean isPartialResponse(Message m) {
        return Boolean.TRUE.equals(m.get(PARTIAL_RESPONSE));
    }

    private void initConfig() {
        PolicyEngine engine = bus.getExtension(PolicyEngine.class);
        // for a decoupled endpoint there is no service info
        if (null != engine && engine.isEnabled()
            && null != endpointInfo.getService()) {
            server = PolicyUtils.getServer(engine, endpointInfo, this);
        }
        if (null == server) {
            server = endpointInfo.getTraversedExtensor(
View Full Code Here

    private void recalcEffectivePolicy(SoapMessage message,
                                       String namespace,
                                       Policy policy) {
        Exchange ex = message.getExchange();
        Bus bus = ex.get(Bus.class);
        PolicyEngine pe = bus.getExtension(PolicyEngine.class);
        if (null == pe) {
            return;
        }
        Destination destination = ex.getDestination();
        try {
            Endpoint endpoint = message.getExchange().get(Endpoint.class);
           
            TokenStore store = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
            if (store == null) {
                store = new MemoryTokenStore();
                endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
            }
            endpoint = STSUtils.createSTSEndpoint(bus,
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(),
                                                  policy,
                                                  null);
            endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
            message.getExchange().put(TokenStore.class.getName(), store);
       
            EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
            List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
            for (Interceptor<? extends Message> i : interceptors) {
                message.getInterceptorChain().add(i);
            }
           
View Full Code Here

    @Test
    public void testSetPoliciesEngineDisabled() {
        Bus bus = control.createMock(Bus.class);
        EasyMock.expect(manager.getBus()).andReturn(bus);
        PolicyEngine pe = control.createMock(PolicyEngine.class);
        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(pe);
        EasyMock.expect(pe.isEnabled()).andReturn(false);
        control.replay();
        rme.setPolicies();
    }
View Full Code Here

        service.setEndpoint(endpoint);
    }

    void setPolicies() {
        // use same WS-policies as for application endpoint
        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
        if (null == engine || !engine.isEnabled()) {
            return;
        }

        EndpointInfo ei = getEndpoint().getEndpointInfo();

        PolicyInterceptorProviderRegistry reg = manager.getBus()
            .getExtension(PolicyInterceptorProviderRegistry.class);
        EndpointPolicy ep = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint
            .getEndpointInfo(), null) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(),
                                                                       conduit);

        if (conduit != null) {
            engine.setClientEndpointPolicy(ei, ep);
        } else {
            engine.setServerEndpointPolicy(ei, ep);
        }

        EffectivePolicy effectiveOutbound = new EffectivePolicyImpl(ep, reg, true, false);
        EffectivePolicy effectiveInbound = new EffectivePolicyImpl(ep, reg, false, false);

        BindingInfo bi = ei.getBinding();
        Collection<BindingOperationInfo> bois = bi.getOperations();

        for (BindingOperationInfo boi : bois) {
            engine.setEffectiveServerRequestPolicy(ei, boi, effectiveInbound);
            engine.setEffectiveServerResponsePolicy(ei, boi, effectiveOutbound);

            engine.setEffectiveClientRequestPolicy(ei, boi, effectiveOutbound);
            engine.setEffectiveClientResponsePolicy(ei, boi, effectiveInbound);
        }

        // TODO: FaultPolicy (SequenceFault)
    }
View Full Code Here

    private BindingOperationInfo findOperation(String suffix) {
        BindingInfo bi = client.getEndpoint().getBinding().getBindingInfo();
        for (BindingOperationInfo boi : bi.getOperations()) {
            SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
            if (soi != null && soi.getAction() != null && soi.getAction().endsWith(suffix)) {
                PolicyEngine pe = bus.getExtension(PolicyEngine.class);
                Conduit conduit = client.getConduit();
                EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(client.getEndpoint()
                    .getEndpointInfo(), boi, conduit);
                setPolicyInternal(effectivePolicy.getPolicy());
                return boi;
            }
        }
View Full Code Here

   
    public final void setBus(Bus b) {
        bus = b;
        if (null != bus) {
            setBuilder(bus.getExtension(PolicyBuilder.class));
            PolicyEngine pe = (PolicyEngine)bus.getExtension(PolicyEngine.class);
            if (pe != null) {
                setRegistry(pe.getRegistry());
                ((PolicyEngineImpl)pe).getPolicyProviders().add(this);
            }
        }
    }
View Full Code Here

    private void initializeConfig() {
   
        // wsdl extensors are superseded by policies which in       
        // turn are superseded by injection                         

        PolicyEngine pe = bus.getExtension(PolicyEngine.class);     
        if (null != pe && pe.isEnabled() && endpointInfo.getService() != null) {                         
            clientSidePolicy =                                      
                PolicyUtils.getClient(pe, endpointInfo, this);             
        }                                                           

    }
View Full Code Here

        partialResponse.getExchange().put(EndpointReferenceType.class, decoupledTarget);
        return true;
    }

    private void initConfig() {
        PolicyEngine engine = bus.getExtension(PolicyEngine.class);
        // for a decoupled endpoint there is no service info
        if (null != engine && engine.isEnabled()
            && null != endpointInfo.getService()) {
            server = PolicyUtils.getServer(engine, endpointInfo, this);
        }
        if (null == server) {
            server = endpointInfo.getTraversedExtensor(
View Full Code Here

        connectionFactory = new HttpsURLConnectionFactory();
        cookies = new Cookies();
       
        // wsdl extensors are superseded by policies which in       
        // turn are superseded by injection                         
        PolicyEngine pe = bus.getExtension(PolicyEngine.class);     
        if (null != pe && pe.isEnabled() && endpointInfo.getService() != null) {                         
            clientSidePolicy =                                      
                PolicyUtils.getClient(pe, endpointInfo, this);             
        }
        CXFAuthenticator.addAuthenticator();
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.policy.PolicyEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.