Package org.serviceconnector.service

Examples of org.serviceconnector.service.Service


   * @return the service
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  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;
View Full Code Here


   * @return the publish service
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  protected PublishService validatePublishService(String serviceName) throws SCMPCommandException {
    Service service = this.getService(serviceName);
    return this.validatePublishService(service);
  }
View Full Code Here

   * @return the publish service
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  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;
View Full Code Here

   * @return the stateful service
   * @throws SCMPCommandException
   *             the SCMP command exception
   */
  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;
View Full Code Here

  public void run(IRequest request, IResponse response, IResponderCallback responderCallback) throws Exception {
    SCMPMessage reqMessage = request.getMessage();
    String serviceName = reqMessage.getServiceName();
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
    // check service is present
    Service abstractService = this.getService(serviceName);

    SCCacheManager cacheManager = AppContext.getCacheManager();

    switch (abstractService.getType()) {
    case CASCADED_SESSION_SERVICE:
      if (cacheManager.isCacheEnabled()) {
        // try to load response from cache
        SCMPMessage message = cacheManager.tryGetMessageFromCacheOrLoad(reqMessage);
        if (message != null) {
View Full Code Here

  private void executeCascadedService(IRequest request, IResponse response, IResponderCallback responderCallback)
      throws Exception {
    SCMPMessage reqMessage = request.getMessage();
    String serviceName = reqMessage.getServiceName();
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
    Service abstractService = this.getService(serviceName);
    CascadedSC cascadedSC = ((CascadedSessionService) abstractService).getCascadedSC();
    ClnExecuteCommandCascCallback callback = new ClnExecuteCommandCascCallback(request, response, responderCallback);
    cascadedSC.execute(reqMessage, callback, oti);
    return;
  }
View Full Code Here

    String serviceName = request.getParameter("service");
    if (serviceName == null) {
      throw new WebCommandException("service is missing");
    }
    ServiceRegistry serviceRegistry = AppContext.getServiceRegistry();
    Service service = serviceRegistry.getService(serviceName);
    if (service == null) {
      throw new WebCommandException("service " + serviceName + " not found");
    }
    if (service instanceof FileService == false && service instanceof CascadedFileService == false) {
      throw new WebCommandException("service " + serviceName + " is not a file or cascaded file service");
View Full Code Here

    Date date = DateTimeUtility.getCurrentDate();
    if (sdate != null && sdate.isEmpty() == false) {
      date = WebUtil.getXMLDateFromString(sdate);
    }
    ServiceRegistry serviceRegistry = AppContext.getServiceRegistry();
    Service service = serviceRegistry.getService(serviceName);
    if (service == null) {
      throw new WebCommandException("service " + serviceName + " not found");
    }
    if (service instanceof FileService == false && service instanceof CascadedFileService == false) {
      throw new WebCommandException("service " + serviceName + " is not a file or cascaded file service");
View Full Code Here

    if (serviceName == null) {
      this.writeFailure(writer, "Missing service name!");
      return;
    }
    ServiceRegistry serviceRegistry = AppContext.getServiceRegistry();
    Service service = serviceRegistry.getService(serviceName);
    if (service == null) {
      this.writeFailure(writer, "Can not enable service " + serviceName + ", not found!");
      return;
    }
    service.setEnabled(true);
    this.writeSuccess(writer, "Service " + serviceName + " has been enabled!");
    return;
  }
View Full Code Here

    if (serviceName == null) {
      this.writeFailure(writer, "Missing service name!");
      return;
    }
    ServiceRegistry serviceRegistry = AppContext.getServiceRegistry();
    Service service = serviceRegistry.getService(serviceName);
    if (service == null) {
      this.writeFailure(writer, "Can not disable service " + serviceName + ", not found!");
      return;
    }
    service.setEnabled(false);
    this.writeSuccess(writer, "Service " + serviceName + " has been disabled!");
    return;
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.service.Service

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.