Package javax.jbi.servicedesc

Examples of javax.jbi.servicedesc.ServiceEndpoint


    public void start() throws JBIException {
        super.start();
        for (Iterator iter = services.iterator(); iter.hasNext();) {
            EndpointSpec es = (EndpointSpec) iter.next();
            ServiceEndpoint ep = this.context.activateEndpoint(es.getServiceName(), es.getEndpointName());
            endpoints.put(getKey(es), ep);
        }
    }
View Full Code Here


            for (int i = 0; i < messageCount; i++) {
                InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
                NormalizedMessage message = exchange.createMessage();

                ServiceEndpoint destination = null;
                if (resolver != null) {
                    destination = resolver.resolveEndpoint(getContext(), exchange, NullEndpointFilter.getInstance());
                }
                if (destination != null) {
                    // lets explicitly specify the destination - otherwise
View Full Code Here

    public void sendMessages(int messageCount, boolean sync) throws MessagingException {
        System.out.println("Looking for services for interface: " + interfaceName);

        ServiceEndpoint[] endpoints = context.getEndpointsForService(interfaceName);
        if (endpoints.length > 0) {
            ServiceEndpoint endpoint = endpoints[0];
            System.out.println("Sending to endpoint: " + endpoint);
           
            for (int i = 0; i < messageCount; i++) {
                InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
                NormalizedMessage message = exchange.createMessage();
View Full Code Here

    public void onMessageExchange(ComponentContext context, MessageExchange exchange) throws JBIException {
        if (predicate.evaluate(context, exchange)) {

            // lets forward the message on to the endpoint
            ServiceEndpoint endpoint = resolver.resolveEndpoint(context, exchange, filter);
            exchange.setEndpoint(endpoint);
        }
    }
View Full Code Here

     * @param service
     * @param name
     * @return the activated ServiceEndpoint or null
     */
    public ServiceEndpoint getEndpoint(QName service, String name) {
        ServiceEndpoint result = null;
        for (Iterator i = getInternalEndpoints().iterator();i.hasNext();) {
            ServiceEndpoint endpoint = (ServiceEndpoint) i.next();
            if (endpoint.getServiceName().equals(service) && endpoint.getEndpointName().equals(name)) {
                result = endpoint;
                break;
            }
        }
        return result;
View Full Code Here

     */
    public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
        Collection connectors = componentRegistry.getLocalComponentConnectors();
        for (Iterator iter = connectors.iterator(); iter.hasNext();) {
            LocalComponentConnector connector = (LocalComponentConnector) iter.next();
            ServiceEndpoint se = connector.getComponent().resolveEndpointReference(epr);
            if (se != null) {
                return new DynamicEndpoint(connector.getComponentNameSpace(), se, epr)
            }
        }
        return null;
View Full Code Here

        if (interfaceName == null) {
            return endpoints;
        }
        Set answer = new HashSet();
        for (Iterator i = endpoints.iterator(); i.hasNext();) {
            ServiceEndpoint endpoint = (ServiceEndpoint) i.next();
            QName[] interfaces = endpoint.getInterfaces();
            if (interfaces != null) {
                for (int k = 0;k < interfaces.length;k++) {
                    QName qn = interfaces[k];
                    if (qn != null && qn.equals(interfaceName)) {
                        answer.add(endpoint);
View Full Code Here

    protected abstract JBIException createServiceUnavailableException();

    protected ServiceEndpoint[] filterEndpoints(ServiceEndpoint[] endpoints, MessageExchange exchange, EndpointFilter filter) {
        int matches = 0;
        for (int i = 0; i < endpoints.length; i++) {
            ServiceEndpoint endpoint = endpoints[i];
            if (filter.evaluate(endpoint, exchange)) {
                matches++;
            }
            else {
                endpoints[i] = null;
            }
        }
        if (matches == endpoints.length) {
            return endpoints;
        }
        else {
            ServiceEndpoint[] answer = new ServiceEndpoint[matches];
            for (int i = 0, j = 0; i < endpoints.length; i++) {
                ServiceEndpoint endpoint = endpoints[i];
                if (endpoint != null) {
                    answer[j++] = endpoints[i];
                }
            }
            return answer;
View Full Code Here

            }
        }
    }
   
    protected void resolveAddress(MessageExchangeImpl exchange) throws JBIException {
        ServiceEndpoint theEndpoint = exchange.getEndpoint();
        if (theEndpoint != null) {
            if (theEndpoint instanceof ExternalEndpoint) {
                throw new JBIException("External endpoints can not be used for routing: should be an internal or dynamic endpoint.");
            }
            if (theEndpoint instanceof AbstractServiceEndpoint == false) {
View Full Code Here

        this.serviceName = serviceName;
        this.endpointName = endpointName;
    }

    public ServiceEndpoint resolveEndpoint(ComponentContext context, MessageExchange exchange, EndpointFilter filter) throws JBIException {
        ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName);
        if (!filter.evaluate(endpoint, exchange)) {
            endpoint = null;
        }
        if (endpoint == null && failIfUnavailable) {
            throw new NoServiceEndpointAvailableException(serviceName, endpointName);
View Full Code Here

TOP

Related Classes of javax.jbi.servicedesc.ServiceEndpoint

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.