Package org.serviceconnector.cmd

Examples of org.serviceconnector.cmd.SCMPCommandException


      break;
    }

    FileService fileService = this.validateFileService(message.getServiceName());
    if (fileService.isEnabled() == false) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVICE_DISABLED, "service="
          + fileService.getName() + " is disabled");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    SCMPMessage reply = null;
    try {
      FileServer fileServer = fileService.getServer();
      reply = fileServer.serverGetFileList(fileService.getPath(), fileService.getGetFileListScriptName(),
          message.getServiceName(), oti);
    } catch (Exception e) {
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.GET_FILE_LIST_FAILED,
          "Error occured in get file list on SC.");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    reply.setIsReply(true);
    reply.setMessageType(getKey());
    response.setSCMP(reply);
View Full Code Here


            // unsubscribe by cascSC on behalf of his last client, abort subscriptions in relation if there are left
            this.abortCascSubscriptions(cascSubscription);
          }
          // only one loop outstanding - don't continue throw current exception
          LOGGER.debug(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + reqMessage.getServiceName()));
          SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION, "service="
              + reqMessage.getServiceName());
          scmpCommandException.setMessageType(this.getKey());
          throw scmpCommandException;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

      } catch (ConnectionPoolBusyException ex) {
        LOGGER.debug("ConnectionPoolBusyException caught in wait mec of change subscription, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          LOGGER.debug(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + reqMessage.getServiceName()));
          SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION, "service="
              + reqMessage.getServiceName());
          scmpCommandException.setMessageType(this.getKey());
          throw scmpCommandException;
        }
      } // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
    } while (++i < tries);
View Full Code Here

        LOGGER.debug("ConnectionPoolBusyException caught in wait mec of unsubscribe, tries left=" + tries);
        if (i >= (tries - 1)) {
          // only one loop outstanding - don't continue throw current exception
          server.abortSession(subscription, "unsubscribe subscription failed, connection pool to server busy");
          LOGGER.debug(SCMPError.NO_FREE_CONNECTION.getErrorText("service=" + reqMessage.getServiceName()));
          SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.NO_FREE_CONNECTION, "service="
              + reqMessage.getServiceName());
          scmpCommandException.setMessageType(this.getKey());
          throw scmpCommandException;
        }
      }
      // sleep for a while and then try again
      Thread.sleep(Constants.WAIT_FOR_FREE_CONNECTION_INTERVAL_MILLIS);
View Full Code Here

  protected Session getSessionById(String sessionId) throws SCMPCommandException {
    Session session = sessionRegistry.getSession(sessionId);
    if (session == null) {
      // session not found in registry
      LOGGER.info("session not found sid=" + sessionId);
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SESSION_NOT_FOUND, sessionId);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return session;
  }
View Full Code Here

    Subscription subscription = this.subscriptionRegistry.getSubscription(subscriptionId);

    if (subscription == null) {
      // subscription not found in registry
      LOGGER.info("subscription not found sid=" + subscriptionId);
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SUBSCRIPTION_NOT_FOUND, subscriptionId);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return subscription;
  }
View Full Code Here

   */
  protected Service getService(String serviceName) throws SCMPCommandException {
    Service service = this.serviceRegistry.getService(serviceName);
    if (service == null) {
      // service not found in registry
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.SERVICE_NOT_FOUND, serviceName);
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return service;
  }
View Full Code Here

   *             the SCMP command exception
   */
  protected PublishService validatePublishService(Service service) throws SCMPCommandException {
    if (service.getType() != ServiceType.PUBLISH_SERVICE) {
      // service is not publish service
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVICE_TYPE, service.getName()
          + " is not publish service");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return (PublishService) service;
  }
View Full Code Here

   */
  protected FileService validateFileService(String serviceName) throws SCMPCommandException {
    Service service = this.getService(serviceName);
    if (service.getType() != ServiceType.FILE_SERVICE) {
      // service is not file service
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVICE_TYPE, serviceName
          + " is not file service");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return (FileService) service;
  }
View Full Code Here

   */
  protected StatefulService getStatefulService(String serviceName) throws SCMPCommandException {
    Service service = this.getService(serviceName);
    if (service.getType() != ServiceType.PUBLISH_SERVICE && service.getType() != ServiceType.SESSION_SERVICE) {
      // service is not the right type
      SCMPCommandException scmpCommandException = new SCMPCommandException(SCMPError.V_WRONG_SERVICE_TYPE, serviceName
          + " is not session or publish service");
      scmpCommandException.setMessageType(getKey());
      throw scmpCommandException;
    }
    return (StatefulService) service;
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.cmd.SCMPCommandException

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.