Package de.myfoo.commonj.work

Examples of de.myfoo.commonj.work.FooRemoteWorkItem


   *
   * @throws Exception the exception
   */
  public FooRemoteWorkItem runWithReturn(Work job, WorkListener listener) throws Exception {
    logger.debug("IN");
    FooRemoteWorkItem fooRemoteWorkItem=null;
    try {
      fooRemoteWorkItem=new FooRemoteWorkItem(job, listener, wm);
      WorkItem wi = wm.schedule(job, listener);

    } catch (Exception e) {
      logger.error("Exception", e);
      throw e;
View Full Code Here


    return fooRemoteWorkItem;
  }


  public FooRemoteWorkItem buildFooRemoteWorkItem(Work job, WorkListener listener) throws Exception{
    FooRemoteWorkItem fooRemoteWorkItem=null;
    fooRemoteWorkItem=new FooRemoteWorkItem(job, listener, wm);
    return fooRemoteWorkItem;
  }
View Full Code Here

      Object o=processesStatusContainer.getPidContainerMap().get(pid);

      // if process still in session stop the process and delete the attribute, otherwise it could have been finished
      if(o!=null){
        CommonjWorkContainer container=(CommonjWorkContainer)o;
        FooRemoteWorkItem fooRwi=container.getFooRemoteWorkItem();
        // release the resource
        fooRwi.release();
        // Use it to give time to set the status
        Thread.sleep(1000);
        statusWI=container.getWorkItem().getStatus();
        //session.removeAttribute("SBI_PROCESS_"+document_id);
        processesStatusContainer.getPidContainerMap().remove(pid);
View Full Code Here

      CommonjWorkContainer container=(CommonjWorkContainer)o;

      WorkManager wm=container.getWm();
      Work workToDo=container.getWork();
      CommonjWorkListener listener=container.getListener();
      FooRemoteWorkItem fooRemoteWorkItem=wm.buildFooRemoteWorkItem(workToDo, listener);

      int statusWI;

      // Check if work was accepted
      if(fooRemoteWorkItem.getStatus()==WorkEvent.WORK_ACCEPTED){
        container.setFooRemoteWorkItem(fooRemoteWorkItem);
        // run work!
        WorkItem workItem=(WorkItem)wm.runWithReturnWI(workToDo, listener);
        container.setWorkItem(workItem);
        statusWI=workItem.getStatus();
        // put new Object in singleton!!!

        processesStatusContainer.getPidContainerMap().put(pId, container);
        //session.setAttribute("SBI_PROCESS_"+document_id, container);

        // if not in action mode don't send the response
        if(actionMode){
          try {
            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);
View Full Code Here

      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();
View Full Code Here

TOP

Related Classes of de.myfoo.commonj.work.FooRemoteWorkItem

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.