Package it.eng.spagobi.utilities.engines

Examples of it.eng.spagobi.utilities.engines.SpagoBIEngineServiceException


        logger.debug("Error type [" + o.getClass().getName()+ "]");
        if(o instanceof EMFInternalError) {
          EMFInternalError error = (EMFInternalError)o;
          Exception e = error.getNativeException();
          if(e instanceof SpagoBIEngineServiceException) {
            SpagoBIEngineServiceException serviceError = (SpagoBIEngineServiceException)e;
            logError(serviceError);
           
            try {
              writeBackToClient( new JSONFailure( serviceError ) );
            } catch (IOException ioe) {
              String message = "Impossible to write back the responce to the client";
              throw new SpagoBIEngineServiceException(getActionName(), message, e);
            } catch (JSONException je) {
              String message = "Error while serializing error into JSON object";
              throw new SpagoBIEngineServiceException(getActionName(), message, je);
            }
          } else {
            logger.error("Unespected exception",e);   
          }
        } else {
View Full Code Here


      info=GeneralUtils.buildJSONObject(pid,statusWI);
      try {
        writeBackToClient( new JSONSuccess(info));
      } catch (IOException e) {
        String message = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }
    }
    catch (Exception e) {
      logger.error("Error in stopping the work");
      try {
        writeBackToClient( new JSONFailure( e) );
      } catch (IOException e1) {
        logger.error("Error in stopping the work and in writing back to client",e);
        throw new SpagoBIEngineServiceException(getActionName(), "Error in stopping the work and in writing back to client", e1);
      } catch (JSONException e1) {
        logger.error("Error in stopping the work and in writing back to client",e);
        throw new SpagoBIEngineServiceException(getActionName(), "Error in stopping the work and in writing back to client", e1);
      }
   
   
    } finally {
      logger.debug("OUT");
View Full Code Here

            info=GeneralUtils.buildJSONObject(pId,statusWI);
            writeBackToClient( new JSONSuccess(info));

          } catch (IOException e) {
            String message = "Impossible to write back the responce to the client";
            throw new SpagoBIEngineServiceException(getActionName(), message, e);
          }
        }
      }
      else{ // WORK is rejected
        if(actionMode){
          try {
            statusWI=fooRemoteWorkItem.getStatus();
            info=GeneralUtils.buildJSONObject(pId,statusWI);
            writeBackToClient( new JSONSuccess(info));
          } catch (IOException e) {
            String message = "Impossible to write back the responce to the client";
            throw new SpagoBIEngineServiceException(getActionName(), message, e);
          }
        }
      }
    }
    catch (Exception e) {

      logger.error("Error in starting the work");
      if(actionMode){
        try {
          writeBackToClient( new JSONFailure( e) );
        } catch (IOException e1) {
          logger.error("Error in starting the work and in writing back to client",e);
          throw new SpagoBIEngineServiceException(getActionName(), "Error in starting the work and in writing back to client", e1);
        } catch (JSONException e1) {
          logger.error("Error in starting the work and in writing back to client",e);
          throw new SpagoBIEngineServiceException(getActionName(), "Error in starting the work and in writing back to client", e1);
        }
      }
    }

    logger.debug("OUT");
View Full Code Here

        info=GeneralUtils.buildJSONObject(pid,0);
        writeBackToClient( new JSONSuccess(info));
      } catch (Exception e) {
        String message = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }

      return;


    }

    super.service(request, response);
    HttpSession session=getHttpSession();

    // Get document id, must find
//    String document_id=null;
//    Object document_idO=null;
//    document_idO=request.getAttribute("DOCUMENT_ID");
//    if(document_idO!=null){
//      document_id=document_idO.toString();
//    }
//    else{
//      document_id="";
//      logger.error("could not retrieve document id");
//      throw new SpagoBIEngineServiceException(getActionName(), "could not find document id");
//    }

    CommonjWorkContainer container=null;
    ProcessesStatusContainer processesStatusContainer = ProcessesStatusContainer.getInstance();
    Object o=processesStatusContainer.getPidContainerMap().get(pid);
    //recover from session, if does not find means work is completed
    //Object o=session.getAttribute("SBI_PROCESS_"+document_id);
    try{
      int statusWI;

      if(o!=null){      // object found in session, work could be not started, running or completed

        container=(CommonjWorkContainer)o;
        FooRemoteWorkItem fooRwi=container.getFooRemoteWorkItem();
        WorkItem wi=container.getWorkItem();

        // if WorkItem is not set means work has never been started
        if(fooRwi!=null && wi!=null){
          statusWI=wi.getStatus();
          // if finds that work is finished delete the attribute from session
          if(statusWI==WorkEvent.WORK_COMPLETED){
            logger.debug("Work is finished - remove from session");
            //session.removeAttribute("SBI_PROCESS_"+document_id);
            processesStatusContainer.getPidContainerMap().remove(pid);
          }
        }
        else{
          // if not workitem is set means that is not started yet or has been cancelled by listener!?!
          statusWI=0;
        }
      }
      else{
        // No more present in session, so it has been deleted
        statusWI=WorkEvent.WORK_COMPLETED;
      }

      info=GeneralUtils.buildJSONObject(pid,statusWI);
      logger.debug(GeneralUtils.getEventMessage(statusWI));
      try {
        writeBackToClient( new JSONSuccess(info));
      } catch (IOException e) {
        String message = "Impossible to write back the responce to the client";
        throw new SpagoBIEngineServiceException(getActionName(), message, e);
      }

    }
    catch (Exception e) {
      logger.error("Error in reading work status");
      try {
        writeBackToClient( new JSONFailure( e) );
      } catch (IOException e1) {
        logger.error("Error in reading work status and in writing back to client",e);
        throw new SpagoBIEngineServiceException(getActionName(), "Error in reading work status and in writing back to client", e1);
      } catch (JSONException e1) {
        logger.error("Error in reading work status and in writing back to client",e);
        throw new SpagoBIEngineServiceException(getActionName(), "Error in reading work status and in writing back to client", e1);
      }
    } 
    logger.debug("OUT");

  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.utilities.engines.SpagoBIEngineServiceException

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.