Package org.serviceconnector.cmd

Examples of org.serviceconnector.cmd.SCMPValidatorException


      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);
        break;
      case CASCADED_PUBLISH_SERVICE:
        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 CascadedPublishService(serviceName, (CascadedSC) server, serviceConfiguration
            .getNoDataIntervalSeconds());
        break;
      case CASCADED_FILE_SERVICE:
        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 CascadedFileService(serviceName, (CascadedSC) server);
        break;
      case SESSION_SERVICE:
        service = new SessionService(serviceName);
        break;
      case PUBLISH_SERVICE:
        service = new PublishService(serviceName);
        break;
      case FILE_SERVICE:
        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 FileService(serviceName, (FileServer) server, serviceConfiguration.getPath(), serviceConfiguration
            .getUploadScript(), serviceConfiguration.getListScript());
        break;
      case UNDEFINED:
      default:
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE,
            "wrong serviceType, serviceName/serviceType=" + serviceName + Constants.SLASH + serviceTypeString);
      }
      service.setEnabled(serviceConfiguration.getEnabled());
      serviceRegistry.addService(service.getName(), service);
    }
View Full Code Here


      // needs to set message type at this point
      ex.setMessageType(getKey());
      throw ex;
    } catch (Throwable th) {
      LOGGER.error("validation error", th);
      SCMPValidatorException validatorException = new SCMPValidatorException();
      validatorException.setMessageType(getKey());
      throw validatorException;
    }
  }
View Full Code Here

    this.scDownloadService = compositeConfiguration.getString(Constants.WEB_SC_DOWNLOAD_SERVICE, null);
    LOGGER.info(Constants.WEB_SC_DOWNLOAD_SERVICE + "=" + this.scDownloadService);
    if (this.scDownloadService != null) {
      // service must exist if it was speciffied
      if (AppContext.getServiceRegistry().getService(this.scDownloadService) == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, Constants.WEB_SC_DOWNLOAD_SERVICE + "="
            + this.scDownloadService + " service not found");
      }
    }

    this.scUploadService = compositeConfiguration.getString(Constants.WEB_SC_UPLOAD_SERVICE, null);
    LOGGER.info(Constants.WEB_SC_UPLOAD_SERVICE + "=" + this.scUploadService);
    if (this.scUploadService != null) {
      // service must exist if it was speciffied
      if (AppContext.getServiceRegistry().getService(this.scUploadService) == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, Constants.WEB_SC_UPLOAD_SERVICE + "="
            + this.scUploadService + " service not found");
      }
    }
    Boolean scTerminateAllowedConf = compositeConfiguration.getBoolean(Constants.WEB_SC_TERMINATE_ALLOWED, null);
    if (scTerminateAllowedConf != null) {
View Full Code Here

    LOGGER.info("writePID=" + this.writePID);

    // pidPath
    String localPidPath = compositeConfiguration.getString(Constants.ROOT_PID_PATH, null);
    if (localPidPath == null && this.writePID) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + Constants.ROOT_PID_PATH
          + " is missing");
    }
    if (localPidPath != null && localPidPath.equals(this.pidPath) == false) {
      File configFile = new File(localPidPath);
      if (configFile.exists() == true && configFile.isDirectory() == false) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
            + Constants.ROOT_PID_PATH + " is not a directory");
      }
      this.pidPath = configFile.getAbsolutePath();
    }
    LOGGER.info("pidPath=" + this.pidPath);

    // dumpPath
    String localdumpPath = compositeConfiguration.getString(Constants.ROOT_DUMP_PATH, null);
    if (localdumpPath == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + Constants.ROOT_DUMP_PATH
          + " is missing");
    }
    if (localdumpPath.equals(this.dumpPath) == false) {
      File dumpFile = new File(localdumpPath);
      if (dumpFile.exists() == true && dumpFile.isDirectory() == false) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
            + Constants.ROOT_DUMP_PATH + " is not a directory");
      }
      this.dumpPath = dumpFile.getAbsolutePath();
    }
    LOGGER.info("dumpPath=" + this.dumpPath);

    // maxIOThreads
    Integer localMaxIOThreads = compositeConfiguration.getInteger(Constants.ROOT_MAX_IO_THREADS, null);
    if (localMaxIOThreads == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
          + Constants.ROOT_MAX_IO_THREADS + " is missing");
    }
    this.maxIOThreads = localMaxIOThreads;
    LOGGER.info("maxIOThreads=" + this.maxIOThreads);
View Full Code Here

      // needs to set message type at this point
      ex.setMessageType(getKey());
      throw ex;
    } catch (Throwable th) {
      LOGGER.error("validation error", th);
      SCMPValidatorException validatorException = new SCMPValidatorException();
      validatorException.setMessageType(getKey());
      throw validatorException;
    }
  }
View Full Code Here

    // 1. checking preconditions and initialize
    if (this.sessionActive) {
      throw new SCServiceException("Session already created - delete session first.");
    }
    if (messageCallback == null) {
      throw new SCMPValidatorException("Message callback must be set.");
    }
    if (scMessage == null) {
      throw new SCMPValidatorException("Message (scMessage) must be set.");
    }
    // reset pendingRequest - necessary if service instances reused
    this.pendingRequest = false;
    this.messageCallback = messageCallback;
    this.requester.getSCMPMsgSequenceNr().reset();
View Full Code Here

    if (this.pendingRequest) {
      // pending Request - reply still outstanding
      throw new SCServiceException("Execute not possible, there is a pending request - two pending request are not allowed.");
    }
    if (scMessage == null) {
      throw new SCMPValidatorException("Message (scMessage) must be set.");
    }
    this.requester.getSCMPMsgSequenceNr().incrementAndGetMsgSequenceNr();
    // 2. initialize call & invoke
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, this.serviceName, this.sessionId);
    clnExecuteCall.setMessageInfo(scMessage.getMessageInfo());
View Full Code Here

    if (this.pendingRequest) {
      // already executed before - reply still outstanding
      throw new SCServiceException("Send not possible, there is a pending request - two pending request are not allowed.");
    }
    if (scMessage == null) {
      throw new SCMPValidatorException("Message (scMessage) must be set.");
    }
    this.requester.getSCMPMsgSequenceNr().incrementAndGetMsgSequenceNr();
    // important to set pendingRequest true in case of asynchronous communication
    this.pendingRequest = true;
    // 2. initialize call & invoke
View Full Code Here

   */
  public void load(CompositeConfiguration compositeConfig) throws SCMPValidatorException {
    // get host
    this.host = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_HOST);
    if (this.host == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
          + Constants.PROPERTY_QUALIFIER_HOST + " is missing");
    }

    // get port
    Integer localPort = compositeConfig.getInteger(this.name + Constants.PROPERTY_QUALIFIER_PORT, null);
    if (localPort == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
          + Constants.PROPERTY_QUALIFIER_PORT + " is missing");
    }
    this.port = localPort;
    ValidatorUtility.validateInt(1, this.port, SCMPError.HV_WRONG_PORTNR);

    // get connectionType
    this.connectionType = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_CONNECTION_TYPE);
    if (this.connectionType == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
          + Constants.PROPERTY_QUALIFIER_CONNECTION_TYPE + " is missing");
    }
    ConnectionType connectionTypeConf = ConnectionType.getType(this.connectionType);
    if (connectionTypeConf == ConnectionType.UNDEFINED) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown connectionType=" + this.name
          + this.connectionType);
    }

    // get serverType
    String serverTypeValue = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_TYPE);
    if (serverTypeValue == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
          + Constants.PROPERTY_QUALIFIER_TYPE + " is missing");
    }
    this.serverType = ServerType.getType(serverTypeValue);
    if (this.serverType == ServerType.UNDEFINED) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown type=" + this.name + this.serverType);
    }
    if (serverType == ServerType.STATEFUL_SERVER) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "stateful server=" + this.name + this.serverType
          + "must not be configured");
    }

    if ((serverType == ServerType.FILE_SERVER) || (serverType == ServerType.WEB_SERVER)
        || (serverType == ServerType.CASCADED_SC)) {
View Full Code Here

      // needs to set message type at this point
      ex.setMessageType(getKey());
      throw ex;
    } catch (Throwable th) {
      LOGGER.error("validation error", th);
      SCMPValidatorException validatorException = new SCMPValidatorException();
      validatorException.setMessageType(getKey());
      throw validatorException;
    }
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.cmd.SCMPValidatorException

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.