Package org.serviceconnector.net.res

Examples of org.serviceconnector.net.res.ResponderRegistry


   * @return the sC mgmt client
   * @throws WebCommandException
   *             the web command exception
   */
  protected SCClient connectClientToService(Service service) throws WebCommandException {
    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    if (service instanceof FileService) {
      // get local service connector listener using sc-tcp
      IResponder responder = responderRegistry.getFirstResponderForConnectionType(ConnectionType.NETTY_TCP);
      if (responder != null) {
        ListenerConfiguration myLocalListenerConfiguration = responder.getListenerConfig();
        List<String> networkInterfaces = myLocalListenerConfiguration.getNetworkInterfaces();
        for (String networkInterface : networkInterfaces) {
          String host = networkInterface;
          int port = myLocalListenerConfiguration.getPort();
          try {
            SCClient localClient = new SCClient(host, port, ConnectionType.NETTY_TCP);
            localClient.attach();
            return localClient;
          } catch (Exception e) {
            LOGGER.warn("upload current log files, connect to network interface " + host + " failed. " + e.toString());
          }
        }
      }
      responder = responderRegistry.getFirstResponderForConnectionType(ConnectionType.NETTY_HTTP);
      if (responder != null) {
        ListenerConfiguration myLocalListenerConfiguration = responder.getListenerConfig();
        List<String> networkInterfaces = myLocalListenerConfiguration.getNetworkInterfaces();
        // no netty tcp endpoint is available, try to get netty http
        for (String networkInterface : networkInterfaces) {
View Full Code Here


public class RespondersXMLLoader extends AbstractXMLLoader {

  /** {@inheritDoc} */
  @Override
  public final void loadBody(XMLStreamWriter writer, IWebRequest request) throws Exception {
    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    writer.writeStartElement("responders");
    IResponder[] responders = responderRegistry.getResponders();
    int simulation = this.getParameterInt(request, "sim", 0);
    if (simulation > 0 && responders.length > 0) {
      IResponder[] sim = new IResponder[simulation + responders.length];
      System.arraycopy(responders, 0, sim, 0, responders.length);
      for (int i = responders.length; i < simulation; i++) {
View Full Code Here

    if (httpUrlFileQualifier == null) {
      // httpUrlFileQualifier is an optional attribute
      httpUrlFileQualifier = Constants.SLASH;
    }

    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    IResponder responder = responderRegistry.getCurrentResponder();
    ListenerConfiguration listenerConfig = responder.getListenerConfig();
    String connectionType = listenerConfig.getConnectionType();

    RemoteNodeConfiguration remoteNodeConfiguration = new RemoteNodeConfiguration(ServerType.STATEFUL_SERVER, serverKey,
        socketAddress.getHostName(), portNr, connectionType, keepAliveIntervalSeconds, checkRegistrationIntervalSeconds,
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throws Exception {
    // needs to set a key in thread local to identify thread later and get access to the responder
    Channel channel = ctx.getChannel();
    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    InetSocketAddress localAddress = (InetSocketAddress) channel.getLocalAddress();
    InetSocketAddress remoteAddress = (InetSocketAddress) channel.getRemoteAddress();
    int port = ((InetSocketAddress) channel.getLocalAddress()).getPort();
    responderRegistry.setThreadLocal(port);

    IResponder responder = AppContext.getResponderRegistry().getCurrentResponder();
    ListenerConfiguration respConfig = responder.getListenerConfig();
    String contextUserid = respConfig.getUsername();
    String contextPassword = respConfig.getPassword();
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throws Exception {
    // needs to set a key in thread local to identify thread later and get access to the responder
    Channel channel = ctx.getChannel();
    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    InetSocketAddress localAddress = (InetSocketAddress) channel.getLocalAddress();
    InetSocketAddress remoteAddress = (InetSocketAddress) channel.getRemoteAddress();
    int port = ((InetSocketAddress) channel.getLocalAddress()).getPort();
    responderRegistry.setThreadLocal(port);

    IResponder responder = AppContext.getResponderRegistry().getCurrentResponder();
    ListenerConfiguration respConfig = responder.getListenerConfig();
    String contextUserid = respConfig.getUsername();
    String contextPassword = respConfig.getPassword();
View Full Code Here

        NettyResponderRequestHandlerTask.compositeRegistry.removeSCMPLargeRequest(sessionId);
        return;
      }

      // needs to set a key in thread local to identify thread later and get access to the responder
      ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
      int port = request.getLocalSocketAddress().getPort();
      responderRegistry.setThreadLocal(port);

      ICommand command = AppContext.getCommandFactory().getCommand(request.getKey());
      // gets the command
      if (command == null) {
        this.sendBadRequestError(response, scmpReq);
View Full Code Here

   * @return the sC mgmt client
   * @throws WebCommandException
   *             the web command exception
   */
  protected SCClient connectClientToService(Service service) throws WebCommandException {
    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    if (service instanceof FileService) {
      // get local service connector listener using sc-tcp
      IResponder responder = responderRegistry.getFirstResponderForConnectionType(ConnectionType.NETTY_TCP);
      if (responder != null) {
        ListenerConfiguration myLocalListenerConfiguration = responder.getListenerConfig();
        List<String> networkInterfaces = myLocalListenerConfiguration.getNetworkInterfaces();
        for (String networkInterface : networkInterfaces) {
          String host = networkInterface;
          int port = myLocalListenerConfiguration.getPort();
          try {
            SCClient localClient = new SCClient(host, port, ConnectionType.NETTY_TCP);
            localClient.attach();
            return localClient;
          } catch (Exception e) {
            LOGGER.warn("upload current log files, connect to network interface " + host + " failed. " + e.toString());
          }
        }
      }
      responder = responderRegistry.getFirstResponderForConnectionType(ConnectionType.NETTY_HTTP);
      if (responder != null) {
        ListenerConfiguration myLocalListenerConfiguration = responder.getListenerConfig();
        List<String> networkInterfaces = myLocalListenerConfiguration.getNetworkInterfaces();
        // no netty tcp endpoint is available, try to get netty http
        for (String networkInterface : networkInterfaces) {
View Full Code Here

    if (httpUrlFileQualifier == null) {
      // httpUrlFileQualifier is an optional attribute
      httpUrlFileQualifier = Constants.SLASH;
    }

    ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
    IResponder responder = responderRegistry.getCurrentResponder();
    ListenerConfiguration listenerConfig = responder.getListenerConfig();
    String connectionType = listenerConfig.getConnectionType();

    RemoteNodeConfiguration remoteNodeConfiguration = new RemoteNodeConfiguration(ServerType.STATEFUL_SERVER, serverKey,
        socketAddress.getHostName(), portNr, connectionType, keepAliveIntervalSeconds, checkRegistrationIntervalSeconds,
View Full Code Here

        NettyResponderRequestHandlerTask.compositeRegistry.removeSCMPLargeRequest(sessionId);
        return;
      }

      // needs to set a key in thread local to identify thread later and get access to the responder
      ResponderRegistry responderRegistry = AppContext.getResponderRegistry();
      int port = request.getLocalSocketAddress().getPort();
      responderRegistry.setThreadLocal(port);

      ICommand command = AppContext.getCommandFactory().getCommand(request.getKey());
      // gets the command
      if (command == null) {
        this.sendBadRequestError(response, scmpReq);
View Full Code Here

TOP

Related Classes of org.serviceconnector.net.res.ResponderRegistry

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.