Package org.apache.neethi

Examples of org.apache.neethi.PolicyRegistry


    }  
   
    Policy resolveLocal(PolicyReference ref, Element e, final Bus bus) {
        String uri = ref.getURI().substring(1);
        String absoluteURI = e.getBaseURI() + uri;
        PolicyRegistry registry = bus.getExtension(PolicyEngine.class).getRegistry();
        Policy resolved = registry.lookup(absoluteURI);
        if (null != resolved) {
            return resolved;
        }
        ReferenceResolver resolver = new ReferenceResolver() {
            public Policy resolveReference(String uri) {
                PolicyBean pb = (PolicyBean)context.getBean(uri);
                if (null != pb) {
                    PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
                    return builder.getPolicy(pb.getElement());
                }
                return null;
            }
        };
        resolved = resolver.resolveReference(uri);
        if (null != resolved) {
            ref.setURI(absoluteURI);
            registry.register(absoluteURI, resolved);
        }
        return resolved;
    }
View Full Code Here


   
    protected Policy resolveExternal(PolicyReference ref,  String baseURI, Bus bus) {
        PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
        ReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder,
            bus.getExtension(PolicyConstants.class));
        PolicyRegistry registry = bus.getExtension(PolicyEngine.class).getRegistry();
        Policy resolved = registry.lookup(ref.getURI());
        if (null != resolved) {
            return resolved;
        }
        return resolver.resolveReference(ref.getURI());
    }
View Full Code Here

        Bus bus = new CXFBusImpl();
       
        engine.setBus(bus);
        List<PolicyProvider> providers = CastUtils.cast(Collections.EMPTY_LIST, PolicyProvider.class);
        engine.setPolicyProviders(providers);
        PolicyRegistry reg = control.createMock(PolicyRegistry.class);
        engine.setRegistry(reg);
        engine.setEnabled(true);
        AlternativeSelector selector = control.createMock(AlternativeSelector.class);
        engine.setAlternativeSelector(selector);
        assertSame(bus, engine.getBus());
View Full Code Here

    }

    private Policy findPolicy(String id, AxisDescription des) {

        List policyElements = des.getPolicyInclude().getPolicyElements();
        PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry();

        Object policyComponent;

        Policy policy = registry.lookup(id);

        if (policy != null) {
            return policy;
        }
View Full Code Here

                    parentElement.addChild(child);
                } else {
                    firstChildElem.insertSiblingBefore(child);
                }

                PolicyRegistry reg = new PolicyRegistryImpl();
                String key = ((PolicyReference)policyElement).getURI();

                if (key.startsWith("#")) {
                    key = key.substring(key.indexOf("#") + 1);
                }

                Policy p = reg.lookup(key);

                if (p == null) {
                    throw new Exception("Policy not found for uri : " + key);
                }
View Full Code Here

        while (iterator.hasNext()) {
            Object policyElement = ((Wrapper) iterator.next()).getValue();
            Policy p;

            if (policyElement instanceof PolicyReference) {
                PolicyRegistry r = getPolicyRegistry();
                p = (Policy) ((PolicyReference) policyElement)
                        .normalize(getPolicyRegistry(), false);

            } else if (policyElement instanceof Policy) {
                p = (Policy) policyElement;
View Full Code Here

        if (subject == null) {
            return null;
        }
       
        PolicyInclude policyInclude = subject.getPolicyInclude();
        PolicyRegistry policyRegistry = policyInclude.getPolicyRegistry();
        Policy policy = policyRegistry.lookup(key);
       
        if (policy != null) {
            return policy;
        }
       
View Full Code Here

    }

    private Policy findPolicy(String id, AxisDescription des) {

        List policyElements = des.getPolicyInclude().getPolicyElements();
        PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry();

        Object policyComponent;

        Policy policy = registry.lookup(id);

        if (policy != null) {
            return policy;
        }
View Full Code Here

            } else if (policyElement instanceof PolicyReference) {
                element
                        .addChild(PolicyUtil
                                .getPolicyComponentAsOMElement((PolicyComponent) policyElement));

                PolicyRegistry reg = policyInclude.getPolicyRegistry();
                String key = ((PolicyReference) policyElement).getURI();

                if (key.startsWith("#")) {
                    key = key.substring(key.indexOf("#") + 1);
                }

                Policy p = reg.lookup(key);

                if (p == null) {
                    throw new Exception("Policy not found for uri : " + key);
                }
View Full Code Here

                policyURIs.add(key);
                addPolicyToDefinitionElement(key, p);

            } else {
                String uri = ((PolicyReference) policyElement).getURI();
                PolicyRegistry registry = policyInclude.getPolicyRegistry();

                if (uri.startsWith("#")) {
                    key = uri.substring(uri.indexOf('#') + 1);
                } else {
                    key = uri;
                }

                Policy p = registry.lookup(key);

                if (p == null) {
                    throw new RuntimeException("Cannot resolve " + uri
                            + " to a Policy");
                }
View Full Code Here

TOP

Related Classes of org.apache.neethi.PolicyRegistry

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.