Package org.serviceconnector.server

Examples of org.serviceconnector.server.Server


   * @return the stateful server by name
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  public StatefulServer getStatefulServerByName(String key) throws SCMPCommandException {
    Server server = this.serverRegistry.getServer(key);
    if (server == null) {
      // server not found in registry
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVER_NOT_FOUND, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    if (server.getType().equals(ServerType.STATEFUL_SERVER) == false) {
      // server is wrong type
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVER_TYPE, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
View Full Code Here


            writer.writeEndElement();
            continue;
          }
          if (value instanceof Server) {
            writer.writeStartElement(name);
            Server server = (Server) value;
            writer.writeStartElement("serverKey");
            writer.writeCData(server.getServerKey());
            writer.writeEndElement();
            writer.writeStartElement("serviceName");
            if (value instanceof StatefulServer) {
              writer.writeCData(((StatefulServer) server).getServiceName());
            } else {
              writer.writeCData("unknown");
            }
            writer.writeEndElement();
            writer.writeStartElement("host");
            writer.writeCData(server.getHost());
            writer.writeEndElement();
            writer.writeStartElement("port");
            writer.writeCData(String.valueOf(server.getPortNr()));
            writer.writeEndElement();
            writer.writeStartElement("socketAddress");
            writer.writeCData(String.valueOf(server.getSocketAddress()));
            writer.writeEndElement();
            writer.writeEndElement();
            continue;
          }
          if (value instanceof IRequester) {
View Full Code Here

  @Override
  public final void loadBody(XMLStreamWriter writer, IWebRequest request) throws Exception {
    String serverParameter = request.getParameter("server");
    if (serverParameter != null) {
      ServerRegistry serverRegistry = AppContext.getServerRegistry();
      Server server = serverRegistry.getServer(serverParameter);
      if (server != null) {
        writer.writeStartElement("server");
        this.writeBean(writer, server);
        writer.writeEndElement();
      }
View Full Code Here

    SCMPMessage message = request.getMessage();
    String serviceName = message.getServiceName();
    String serverKey = serviceName + "_" + socketAddress.getHostName() + Constants.SLASH + socketAddress.getPort();

    // Check the presence of the server
    Server server = this.serverRegistry.getServer(serverKey);
    if (server == null) {
      // server does not exist =>
      SCMPCommandException cmdExc = new SCMPCommandException(SCMPError.NO_SERVER, "server=" + serverKey);
      cmdExc.setMessageType(getKey());
      throw cmdExc;
    }
    // reset server timeout
    LOGGER.debug("refresh server timeout in CRG server=" + server.getServerKey() + " timeout(ms)=" + server.getServerTimeoutMillis());
    serverRegistry.resetServerTimeout(server, server.getServerTimeoutMillis());

    // send back positive response - SCMP Version request
    SCMPMessage scmpReply = new SCMPMessage(message.getSCMPVersion());
    scmpReply.setIsReply(true);
    scmpReply.setMessageType(getKey());
View Full Code Here

   * @return the stateful server by name
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  public StatefulServer getStatefulServerByName(String key) throws SCMPCommandException {
    Server server = this.serverRegistry.getServer(key);
    if (server == null) {
      // server not found in registry
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVER_NOT_FOUND, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    if (server.getType().equals(ServerType.STATEFUL_SERVER) == false) {
      // server is wrong type
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVER_TYPE, key);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
View Full Code Here

   * @return the server by key and validate not registered
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  private Server getServerByKeyAndValidateNotRegistered(String key) throws SCMPCommandException {
    Server server = this.serverRegistry.getServer(key);
    if (server != null) {
      // server registered two times for this service
      SCMPCommandException cmdExc = new SCMPCommandException(SCMPError.SERVER_ALREADY_REGISTERED, "server=" + key);
      cmdExc.setMessageType(getKey());
      throw cmdExc;
View Full Code Here

   *            the socket address
   */
  public void resetServerTimeout(String serviceName, InetSocketAddress socketAddress) {
    String serverKey = serviceName + "_" + socketAddress.getHostName() + Constants.SLASH + socketAddress.getPort();

    Server server = this.serverRegistry.getServer(serverKey);
    if (server instanceof StatefulServer) {
      // reset server timeout for stateful servers.
      LOGGER.debug("refresh server timeout server=" + server.getServerKey() + " timeout(ms)="
          + server.getServerTimeoutMillis());
      serverRegistry.resetServerTimeout(server, server.getServerTimeoutMillis());
    }
  }
View Full Code Here

    Set<String> keySet = serverRegistry.keySet();

    for (String key : keySet) {
      try {
        if (key.endsWith(wildKey)) {
          Server server = serverRegistry.getServer(key);
          if ((server instanceof StatefulServer) == false) {
            continue;
          }
          LOGGER.debug("clean up dead server with wild key " + wildKey);
          StatefulServer statefulServer = (StatefulServer) server;
View Full Code Here

      // instantiate right type of service
      Service service = null;
      switch (serviceType) {
      case CASCADED_SESSION_SERVICE:
        Server server = AppContext.getServerRegistry().getServer(remotNodeName);
        if (server == null) {
          throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, " host=" + remotNodeName
              + " configured for service=" + serviceName + " is not configured");
        }
        service = new CascadedSessionService(serviceName, (CascadedSC) server);
View Full Code Here

TOP

Related Classes of org.serviceconnector.server.Server

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.