Package org.serviceconnector.cmd

Examples of org.serviceconnector.cmd.SCMPValidatorException


      SCMPValidatorException {
    if (this.registered == false) {
      throw new SCServiceException("Server is not registered for a service.");
    }
    if (publishMessage == null) {
      throw new SCMPValidatorException("Publish message is missing.");
    }
    synchronized (this) {
      this.requester.getSCMPMsgSequenceNr().incrementAndGetMsgSequenceNr();
      // get lock on scServer - only one server is allowed to communicate over the initial connection
      SCMPPublishCall publishCall = new SCMPPublishCall(this.requester, serviceName);
View Full Code Here


            networkInterfaces.add(inetAddress.getHostAddress());
          }
        }
      } catch (Exception e) {
        LOGGER.fatal("unable to detect network interface", e);
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "wrong interface");
      }
    }

    // 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 username & password for netty.web
    if (connectionTypeConf == ConnectionType.NETTY_WEB) {
      this.username = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_USERNAME, null);
      if (this.username == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_USERNAME + " is missing");
      }
      this.password = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_PASSWORD, null);
      if (this.password == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_PASSWORD + " is missing");
      }
    }

    // get remote host config for http-proxy
    if (connectionTypeConf == ConnectionType.NETTY_PROXY_HTTP) {
      String remoteNode = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_REMOTE_NODE);
      if (remoteNode == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_REMOTE_NODE + " is missing");
      }
      RemoteNodeConfiguration remoteNodeConfig = remoteNodeListConfiguration.getRequesterConfigurations().get(remoteNode);

      // remote node must be a web server or a cascaded SC
      if ((remoteNodeConfig.getServerType() == ServerType.WEB_SERVER || remoteNodeConfig.getServerType() == ServerType.CASCADED_SC) == false) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "remote node=" + remoteNode
            + " is not a web server");
      }

      // set remote host configuration into the listener configuration
      this.remoteNodeConfiguration = remoteNodeConfig;
View Full Code Here

  public void load(CompositeConfiguration compositeConfig) throws SCMPValidatorException {

    // get type
    this.type = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_TYPE);
    if (type == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
          + Constants.PROPERTY_QUALIFIER_TYPE + " is missing");
    }
    ServiceType serviceType = ServiceType.getType(this.type);
    if (serviceType == ServiceType.UNDEFINED) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown serviceType=" + this.name + this.type);
    }
    String remoteNode = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_REMOTE_NODE);
    if (remoteNode != null) {
      RemoteNodeConfiguration remoteNodeConfigurationLocal = AppContext.getRequesterConfiguration().getRequesterConfigurations()
          .get(remoteNode);
      if (remoteNodeConfigurationLocal == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown remoteNode=" + remoteNode);
      }
      serviceType = ServiceConfiguration.adaptServiceTypeIfCascService(serviceType, remoteNode);
    }

    // get enabled
    this.enabled = compositeConfig.getBoolean(this.name + Constants.PROPERTY_QUALIFIER_ENABLED,
        Constants.DEFAULT_SERVICE_ENABLED);

    // get path & uploadScript & listScript for file service
    if (serviceType == ServiceType.FILE_SERVICE) {
      this.path = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_PATH, null);
      if (this.path == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_PATH + " is missing");
      }
      this.uploadScript = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_UPLOAD_SCRIPT, null);
      if (this.uploadScript == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_UPLOAD_SCRIPT + " is missing");
      }
      this.listScript = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_LIST_SCRIPT, null);
      if (this.listScript == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_LIST_SCRIPT + " is missing");
      }
    }

    // get remote host for file services or cascaded services
    if ((serviceType == ServiceType.FILE_SERVICE) || (serviceType == ServiceType.CASCADED_SESSION_SERVICE)
        || (serviceType == ServiceType.CASCADED_PUBLISH_SERVICE) || (serviceType == ServiceType.CASCADED_FILE_SERVICE)) {
      if (remoteNode == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_REMOTE_NODE + " is missing");
      }
      // create configuration for remote host
      RemoteNodeConfiguration remoteNodeConfig = new RemoteNodeConfiguration(remoteNode);
      // load it with the configurated items
      remoteNodeConfig.load(compositeConfig);
      // remote node must be a web server
      if (remoteNodeConfig.getServerType().equals(ServerType.WEB_SERVER.getValue())) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, this.name
            + Constants.PROPERTY_QUALIFIER_REMOTE_NODE + " is not a web server");
      }
      // set remote host configuration into the listener configuration
      this.remoteNodeConfiguration = remoteNodeConfig;
    }

    if (serviceType == ServiceType.CASCADED_PUBLISH_SERVICE) {
      Integer noDataIntervalSecondsInteger = compositeConfig.getInteger(this.name + Constants.PROPERTY_QUALIFIER_NOI, null);
      if (noDataIntervalSecondsInteger == null) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
            + Constants.PROPERTY_QUALIFIER_NOI + " is missing");
      }
      this.nodDataIntervalSeconds = noDataIntervalSecondsInteger;
    }
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

   */
  public void load(CompositeConfiguration compositeConfig) throws SCMPValidatorException {
    @SuppressWarnings("unchecked")
    List<String> requesterList = compositeConfig.getList(Constants.PROPERTY_REMOTE_NODES);
    if (requesterList == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
          + Constants.PROPERTY_REMOTE_NODES + " is missing");
    }

    // load all remote nodes into the list
    this.remoteNodeConfigurations = new HashMap<String, RemoteNodeConfiguration>();
    for (String requesterName : requesterList) {
      requesterName = requesterName.trim(); // remove blanks in name
      RemoteNodeConfiguration remoteNodeConfig = new RemoteNodeConfiguration(requesterName);
      // load it with the configurated items
      remoteNodeConfig.load(compositeConfig);
      if (this.remoteNodeConfigurations.containsKey(requesterName) == true) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE,
            "requester already in registry name must be unique requesterName=" + requesterName);
      }
      // adding requester to list
      this.remoteNodeConfigurations.put(requesterName, remoteNodeConfig);
      // show it
View Full Code Here

   *             callback is not set<br />
   */
  public synchronized void register(int operationTimeoutSeconds, int maxSessions, int maxConnections,
      SCSessionServerCallback scCallback) throws SCServiceException, SCMPValidatorException {
    if (scCallback == null) {
      throw new SCMPValidatorException("Callback is missing.");
    }
    SrvServiceRegistry srvServiceRegistry = AppContext.getSrvServiceRegistry();
    this.doRegister(operationTimeoutSeconds, maxSessions, maxConnections);
    // creating srvService & adding to registry
    SrvService srvService = new SrvSessionService(this.serviceName, maxSessions, maxConnections, this.requester, scCallback);
View Full Code Here

  public void load(CompositeConfiguration compositeConfig, RemoteNodeListConfiguration remoteNodeListConfiguration)
      throws SCMPValidatorException {
    @SuppressWarnings("unchecked")
    List<String> listeners = compositeConfig.getList(Constants.PROPERTY_LISTENERS, null);
    if (listeners == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
          + Constants.PROPERTY_LISTENERS + " is missing");
    }

    // load all communicators in the list into the array
    this.listenerConfigurations = new HashMap<String, ListenerConfiguration>();
    for (String listenerName : listeners) {
      listenerName = listenerName.trim(); // remove blanks in name
      ListenerConfiguration listenerConfig = new ListenerConfiguration(listenerName);
      // load it with the configurated items
      listenerConfig.load(compositeConfig, remoteNodeListConfiguration);
      if (this.listenerConfigurations.containsKey(listenerName) == true) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE,
            "listener already in registry name must be unique listenerName=" + listenerName);
      }
      // adding listener to the list
      this.listenerConfigurations.put(listenerName, listenerConfig);
      // show it
View Full Code Here

   */
  public void load(CompositeConfiguration config) throws SCMPValidatorException {
    @SuppressWarnings("unchecked")
    List<String> serviceNames = config.getList(Constants.PROPERTY_SERVICE_NAMES);
    if (serviceNames == null) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property="
          + Constants.PROPERTY_SERVICE_NAMES + " is missing");
    }

    // load all remote nodes into the list
    this.serviceConfigurations = new HashMap<String, ServiceConfiguration>();
    for (String serviceName : serviceNames) {
      serviceName = serviceName.trim(); // remove blanks in name
      ServiceConfiguration serviceConfig = new ServiceConfiguration(serviceName);
      // load it with the configured items
      serviceConfig.load(config);
      if (this.serviceConfigurations.containsKey(serviceName) == true) {
        throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE,
            "service already in registry name must be unique serviceName=" + serviceName);
      }
      // adding service to list
      this.serviceConfigurations.put(serviceName, serviceConfig);
      // show it
View Full Code Here

    LOGGER.info(Constants.CACHE_DISK_PATH + "cacheEnabled=" + this.cacheEnabled);

    // diskPath
    String sDiskPath = compositeConfiguration.getString(Constants.CACHE_DISK_PATH, null);
    if (sDiskPath == null && this.cacheEnabled) {
      throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + Constants.CACHE_DISK_PATH
          + " is missing");
    }
    if (sDiskPath != null && sDiskPath.equals(this.diskPath) == false) {
      this.diskPath = sDiskPath;
    }
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.