Package com.almende.eve.transport

Examples of com.almende.eve.transport.TransportService


      //local shortcut
      RequestParams requestParams = new RequestParams();
      requestParams.put(Sender.class, senderUrl);
      return receive(receiverId,request,requestParams);
    } else {
      TransportService service = null;
      String protocol = null;
      int separator = receiverUrl.indexOf(":");
      if (separator != -1) {
        protocol = receiverUrl.substring(0, separator);
        service = getTransportService(protocol);
      }
      if (service != null) {
        JSONResponse response = service.send(
            senderUrl,
            receiverUrl,
            request);
        return response;
      } else {
View Full Code Here


            callback.onFailure(e);
          }
        }
      }).start();
    } else {
      TransportService service = null;
      String protocol = null;
      String senderUrl = null;
      if (sender != null) {
        senderUrl = getSenderUrl(sender.getId(), receiverUrl);
      }
      int separator = receiverUrl.indexOf(":");
      if (separator != -1) {
        protocol = receiverUrl.substring(0, separator);
        service = getTransportService(protocol);
      }
      if (service != null) {
        service.sendAsync(senderUrl, receiverUrl, request,
            callback);
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
                + protocol + "'.");
View Full Code Here

                      + " must implement "
                      + TransportService.class.getName());
            }
           
            // initialize the transport service
            TransportService transport = (TransportService) transportClass
                .getConstructor(AgentFactory.class, Map.class)
                .newInstance(this, transportParams);
           
            // register the service with the agent factory
            addTransportService(transport);
View Full Code Here

      // local shortcut
      RequestParams requestParams = new RequestParams();
      requestParams.put(Sender.class, senderUrl);
      return receive(receiverId, request, requestParams);
    } else {
      TransportService service = null;
      service = getTransportService(protocol);
     
      if (service != null) {
        JSONResponse response = service.send(senderUrl,
            receiverUrl.toASCIIString(), request);
        return response;
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
View Full Code Here

            callback.onFailure(e);
          }
        }
      }).start();
    } else {
      TransportService service = null;
      String protocol = null;
      String senderUrl = null;
      if (sender != null) {
        senderUrl = getSenderUrl(sender.getId(),
            receiverUrl.toASCIIString());
      }
      protocol = receiverUrl.getScheme();
      service = getTransportService(protocol);
      if (service != null) {
        service.sendAsync(senderUrl, receiverUrl.toASCIIString(),
            request, callback);
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
                + protocol + "'.");
View Full Code Here

                      + " must implement "
                      + TransportService.class.getName());
            }
           
            // initialize the transport service
            TransportService transport = (TransportService) transportClass
                .getConstructor(AgentHost.class, Map.class)
                .newInstance(this, transportParams);
           
            // register the service with the agent factory
            addTransportService(transport);
View Full Code Here

      delete();
    } else if ("setSchedulerFactory".equals(event.getEvent())) {
      // init scheduler tasks
      agentHost.getScheduler(this);
    } else if ("addTransportService".equals(event.getEvent())) {
      TransportService service = (TransportService) event.getService();
      service.reconnect(getId());
    }
  }
View Full Code Here

       
        // TODO: getting an arbitrary http service which knows this agent
        //       is not safe
        //       -> Scheduler should be configured with the servlet_url
        //          that it should use specified?
        TransportService service = null;
        for (TransportService s : agentFactory.getTransportServices("http")) {
          if (s.getAgentUrl(agentId) != null) {
            service = s;
            break;
          }
        }
        String url = null;
        if (service != null) {
          url = service.getAgentUrl(agentId);
        }
       
        URL uri = new URL(url);
        String path = uri.getPath();   
        Queue queue = QueueFactory.getDefaultQueue();
View Full Code Here

      onDestroy();
    } else if (AgentSignal.SETSCHEDULERFACTORY.equals(event.getEvent())) {
      // init scheduler tasks
      scheduler = host.getScheduler(this);
    } else if (AgentSignal.ADDTRANSPORTSERVICE.equals(event.getEvent())) {
      final TransportService service = (TransportService) event.getData();
      final String myId = getId();
      host.getPool().submit(new Runnable(){
        @Override
        public void run() {
          try {
            service.reconnect(myId);
          } catch (final IOException e) {
            LOG.log(Level.WARNING,
                "Failed to reconnect agent on new transport.", e);
          }
        }
View Full Code Here

      if (sender != null) {
        senderUri = getSenderUrl(sender.getId(), receiverUrl);
      }
      receive(receiverId, message, senderUri, tag);
    } else {
      TransportService service = null;
      URI senderUri = null;
      if (sender != null) {
        senderUri = getSenderUrl(sender.getId(), receiverUrl);
      }
      service = getTransportService(protocol);
      if (service != null) {
        // TODO: message should already be a String?
        service.sendAsync(senderUri, receiverUrl, message.toString(),
            tag);
      } else {
        throw new ProtocolException(
            "No transport service configured for protocol '"
                + protocol + "'.");
View Full Code Here

TOP

Related Classes of com.almende.eve.transport.TransportService

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.