Package org.wso2.carbon.discovery

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


    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

    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

    public void Bye(OMElement byeElement) throws DiscoveryException {
        Notification bye = DiscoveryOMUtils.getByeFromOM(byeElement);
        try {
            DiscoveryServiceUtils.removeServiceEndpoints(bye.getTargetService());
        } catch (Exception e) {
            throw new DiscoveryException("Error while persisting the " +
                    "service description", e);
        }
    }
View Full Code Here

            TargetService[] services = DiscoveryServiceUtils.findServices(probe);
            QueryMatch match = new QueryMatch(DiscoveryConstants.RESULT_TYPE_PROBE_MATCH,
                    services);
            return DiscoveryOMUtils.toOM(match, OMAbstractFactory.getSOAP11Factory());
        } catch (Exception e) {
            throw new DiscoveryException("Error while searching for services", e);
        }
    }
View Full Code Here

            TargetService service = DiscoveryServiceUtils.getService(resolve.getEpr());
            QueryMatch match = new QueryMatch(DiscoveryConstants.RESULT_TYPE_RESOLVE_MATCH,
                    new TargetService[] { service });
            return DiscoveryOMUtils.toOM(match, OMAbstractFactory.getSOAP11Factory());
        } catch (Exception e) {
            throw new DiscoveryException("Error while resolving the service with ID: " +
                resolve.getEpr().getAddress());
        }
    }
View Full Code Here

            serviceClient.fireAndForget(DiscoveryOMUtils.toOM(notification,
                    OMAbstractFactory.getOMFactory()));
            serviceClient.cleanup();

        } catch (Exception e) {
            throw new DiscoveryException("Error while sending the WS-Discovery notification " +
                    "for the service " + service.getName(), e);
        }
    }
View Full Code Here

    public static void removeServiceEndpoints(TargetService service) throws Exception {
        TargetService oldService = getService(service.getEpr());

        if (oldService == null) {
            throw new DiscoveryException("Error while updating discovery metadata. No service " +
                    "exists with the ID: " + service.getEpr().getAddress());
        }

        // When marking an existing service as inactive try to hold on to
        // the old metadata of the service
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.discovery.DiscoveryException

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.