Examples of DiscoveryException


Examples of org.wso2.carbon.discovery.DiscoveryException

     */
    public void engageModule(String module) throws DiscoveryException {
        try {
            serviceClient.engageModule(module);
        } catch (AxisFault axisFault) {
            throw new DiscoveryException("Error while engaging the module : " + module, axisFault);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

                    OMAbstractFactory.getSOAP11Factory()));
            QueryMatch match = DiscoveryOMUtils.getProbeMatchFromOM(probeMatch);
            serviceClient.cleanupTransport();
            return match.getTargetServices();
        } catch (AxisFault axisFault) {
            throw new DiscoveryException("Error while executing the WS-Discovery probe", axisFault);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

     * @return a TargetService object or null if the ID cannot be resolved
     * @throws DiscoveryException if an error occured while contacting the WS-D proxy
     */
    public TargetService resolve(String epr) throws DiscoveryException {
        if (epr == null) {
            throw new DiscoveryException("Cannot perform the Resolve operation with a null EPR");
        }

        Resolve resolve = new Resolve(new EndpointReference(epr));

        serviceClient.getOptions().setAction(DiscoveryConstants.WS_DISCOVERY_RESOLVE_ACTION);

        try {
            OMElement resolveMatch = serviceClient.sendReceive(DiscoveryOMUtils.toOM(resolve,
                    OMAbstractFactory.getSOAP11Factory()));
            QueryMatch match = DiscoveryOMUtils.getResolveMatchFromOM(resolveMatch);
            serviceClient.cleanupTransport();
            if (match.getTargetServices() != null && match.getTargetServices().length == 1) {
                return match.getTargetServices()[0];
            }
        } catch (AxisFault axisFault) {
            throw new DiscoveryException("Error while executing the WS-Discovery resolve", axisFault);
        }
        return null;
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

     */
    public void cleanup() throws DiscoveryException {
        try {
            serviceClient.cleanup();
        } catch (AxisFault axisFault) {
            throw new DiscoveryException("Error while cleaning up the WS-Discovery client", axisFault);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

     */
    public static void addDiscoveryProxy(DiscoveryProxyDetails pd, Registry registry)
            throws DiscoveryException, RegistryException {

        if (pd.getName() == null || "".equals(pd.getName())) {
            throw new DiscoveryException("No name specified for the discovery proxy");
        }

        String path = DISCOVERY_PROXY_ROOT + pd.getName();
        if (registry.resourceExists(path)) {
            throw new DiscoveryException("The discovery proxy named " + pd.getName() +
                    " already exists");
        }

        if (pd.getUrl() == null || "".equals(pd.getUrl())) {
            throw new DiscoveryException("No URL specified for the discovery proxy");
        }

        if (pd.getPolicy() != null && !registry.resourceExists(pd.getPolicy())) {
            throw new DiscoveryException("The policy resource: " + pd.getPolicy() +
                    " does not exist");
        }

        URL url;
        try {
            url = new URL(pd.getUrl());
        } catch (MalformedURLException e) {
            throw new DiscoveryException("Invalid URL specified for the discovery proxy", e);
        }

        Resource proxy = registry.newResource();
        proxy.setContent(url.toString());
        proxy.setProperty(DISCOVERY_PROXY_NAME, pd.getName());
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

                            DISCOVERY_CLIENT_POLICY);
                }
            }
            registry.delete(path);
        } else {
            throw new DiscoveryException("The discovery proxy named " + name + " does not exist");
        }
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

        QName[] types = null;
        URI[] scopes = null;

        DiscoveryProxyDetails proxy = getDiscoveryProxy(name, registry);
        if (proxy == null) {
            throw new DiscoveryException("No discovery proxy exists by the name " + name);
        }

        if (pd.getTypes() != null) {
            types = Util.toQNameArray(pd.getTypes());
        }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

    public static TargetService resolveService(String name, String id, Registry registry)
            throws DiscoveryException, RegistryException {

        DiscoveryProxyDetails proxy = getDiscoveryProxy(name, registry);
        if (proxy == null) {
            throw new DiscoveryException("No discovery proxy exists by the name " + name);
        }

        DiscoveryClient client = new DiscoveryClient(
                ConfigHolder.getInstance().getClientConfigurationContext(), proxy.getUrl());
        if (proxy.getPolicy() != null) {
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

    private static Policy getPolicy(String key, Registry registry)
            throws DiscoveryException, RegistryException {

        if (!registry.resourceExists(key)) {
            throw new DiscoveryException("Policy resource " + key + " does not exist");
        }

        Resource policy = registry.get(key);
        ByteArrayInputStream in = new ByteArrayInputStream((byte[]) policy.getContent());
        try {
            StAXOMBuilder builder = new StAXOMBuilder(in);
            Policy secPolicy = PolicyEngine.getPolicy(builder.getDocumentElement());
            policy.discard();
            return secPolicy;
        } catch (XMLStreamException e) {
            policy.discard();
            throw new DiscoveryException("Error while loading the policy from resource " + key, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.discovery.DiscoveryException

    public void Hello(OMElement helloElement) throws DiscoveryException {
        Notification hello = DiscoveryOMUtils.getHelloFromOM(helloElement);
        try {
            DiscoveryServiceUtils.addService(hello.getTargetService());
        } catch (Exception e) {
            throw new DiscoveryException("Error while persisting the " +
                    "service description", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.