Package smilehouse.opensyncro.pipes

Examples of smilehouse.opensyncro.pipes.Pipe


          {
              return value != null ? value.toString() : "";
          }
      }
   private Pipe getPipe(ParameterManager parameters, HttpSession session, Persister pers) {
          Pipe pipe = null;
          // Was it given as a parameters?
          if(parameters.wasGiven(PIPE_ID) && !parameters.wasIllegal(PIPE_ID)) {
              Long pipeId = new Long(parameters.getLong(PIPE_ID));
              pipe = pers.loadPipe(pipeId);
          }
          // How about the session?
          if(pipe == null) {
              Long pipeId = (Long) session.getAttribute(PIPE_ID_SESSION_KEY);
              if(pipeId != null)
                  pipe = pers.loadPipe(pipeId);
          }
          // Well... ANY PIPE will do!
          if(pipe == null) {
              pipe = pers.loadFirstPipeYouFind();
          }

          if(pipe != null)
              session.setAttribute(PIPE_ID_SESSION_KEY, pipe.getId());

          return pipe;
      }
View Full Code Here


       
        //Try to get pipe id from the request.
        Long pipeId=new Long(parameters.getLong(PIPE_ID));
        if(pipeId!=0){
          //If the start button of one of the pipes was pressed, execute the pipe
          Pipe startedPipe=pers.loadPipe(pipeId);
          startedPipe.transfer(new TransferInfo(pers.getDatabaseName(),(String)session.getAttribute("syncro.user")));
          pers.update(startedPipe);
        }
        if(requestType == POST_REQUEST) {
            if(parameters.getInt(ACTION) == 1) {

                listField.commit();

                for(Iterator added = pipes.getList().addedIterator(); added.hasNext();) {
                    Pipe pipe = (Pipe) added.next();
                    pers.save(pipe);
                    //System.out.println("Saved pipe #" + pipe.getId().toString());
                    //environment.log("Saved pipe #" + pipe.getId().toString());
                }
                /*for(Iterator cloned = pipes.getList().clonedIterator(); cloned.hasNext();) {
                    Pipe pipe = (Pipe) cloned.next();
                    pers.save(pipe);
                }*/
                for(Iterator current = pipes.getList().iterator(); current.hasNext();) {
                    Pipe pipe = (Pipe) current.next();
                    pers.update(pipe);
                    //System.out.println("Updated pipe #" + pipe.getId().toString());
                    //environment.log("Updated pipe #" + pipe.getId().toString());
                }

                for(Iterator removed = pipes.getList().removedIterator(); removed.hasNext();) {
                    Pipe pipe = (Pipe) removed.next();
                    //System.out.println("Removing pipe #" + pipe.getId().toString());
                    //environment.log("Removing pipe #" + pipe.getId().toString());
                    pers.delete(pipe);
                }
               
View Full Code Here

            Iterator pipeIt=pers.loadAllPipes().iterator();
           
            //Iterate through all the pipes found in the database
            while (pipeIt.hasNext()) {
              Persister perPipePersister = new Persister(database);
          Pipe p = perPipePersister.findPipeByName(((Pipe) pipeIt.next()).getName());
          String dbase = perPipePersister.getDatabaseName();
          PipeWrapper pw = new PipeWrapper(p, dbase, dbase + p.getName());
          PipeExecutionThread pet = new PipeExecutionThread(pipesAndThreads,
              p.getId(),perPipePersister);
          //PipeExecutionQueue peq = new PipeExecutionQueue(perPipePersister,
            //  p.getId());
          //If the there are PipeExecutionRequests in the database for this pipe,
          //execute them.
          if (!pet.getPipeExecutionQueue().isQueueEmpty()) {
View Full Code Here

     * @param pers Persister for accessing the OpenSyncro database
     *
     * @return The pipe in question or null if no pipe is found
     */
    private Pipe getPipe(ParameterManager parameters, HttpSession session, Persister pers) {
        Pipe pipe = null;
        // Was it given as a parameters?
        if(parameters.wasGiven(PIPE_ID) && !parameters.wasIllegal(PIPE_ID)) {
            Long pipeId = new Long(parameters.getLong(PIPE_ID));
            pipe = pers.loadPipe(pipeId);
        }
        // How about the session?
        if(pipe == null) {
            Long pipeId = (Long) session.getAttribute(PIPE_ID_SESSION_KEY);
            if(pipeId != null)
                pipe = pers.loadPipe(pipeId);
        }
        // Well... ANY PIPE will do!
        if(pipe == null) {
            pipe = pers.loadFirstPipeYouFind();
        }

        if(pipe != null)
            session.setAttribute(PIPE_ID_SESSION_KEY, pipe.getId());
       
        return pipe;
    }
View Full Code Here

    this.pipesThreads=pt;
  }

  public void run() {
    Environment en = Environment.getInstance();
    Pipe pipe=null;
    try {
      // Is queue empty?
      while (!this.peq.isQueueEmpty()) {
        // Get first PipeExecutionRequest in queue
        PipeExecutionRequest per = peq.getFirst();
        en.log("Getting pipe from request queue");
        pipe=per.getPipe();
        en.log("Got pipe: "+pipe.getName());
        // Set PipeExecutionRequest start timestamp
        per.setStartedDate(new Date());
        en.log("Set execution start time and updating pipe: "+pipe.getName());
        // Update PipeExecutionRequst
        peq.updatePERequest(per);
        en.log("Starting execution of pipe: "+pipe.getName());
        // Start pipe transfer with request creation date
        pipe.transfer(this.ti, per.getCreatedDate());
        en.log("Finished execution of pipe: "+pipe.getName());
        // Update pipe after execution
        peq.updatePipe();
        en.log("Updated pipe "+pipe.getName());
        // Remove completed PipeExecutionRequest from queue
        peq.deleteRequest(per.getId());
        en.log("Removed pipe "+ pipe.getName()+" from execution queue");
       
       
      }
     
    }
    catch(Exception e){
     
      en.log(e.getMessage(), e);
    }
    finally {
      // Remove persister from persisters, otherwise repeated execution of pipe may fail
      SyncroHttpStart.persisters.remove(pers.getDatabaseName()+pipe.getName());

            // Remove pipe and thread from webapp context (because queue is empty now)
            LinkedList<PipeWrapper> pipesThreadsToRemove = new LinkedList<PipeWrapper>();
      Iterator pipeWrapperIt = pipesThreads.keySet().iterator();
      while (pipeWrapperIt.hasNext()){
        PipeWrapper pw = (PipeWrapper)pipeWrapperIt.next();
        Pipe p = pw.getPipe();
        if(p.equals(pipe) && pw.getDatabase().equals(pers.getDatabaseName())){
          pipesThreadsToRemove.add(pw);
        }
      }
            Iterator ptRemoveIt = pipesThreadsToRemove.iterator();           
            while (ptRemoveIt.hasNext()){
View Full Code Here

          Template row = template.getBlock("row");
          Template rowColumn = row.getBlock("column");
          while(allFields.hasNext()) {
              FieldImpl column = (FieldImpl) allFields.next();
              if (this.pipeSet != null && pipeList != null) {
          Pipe p = ( Pipe ) pipeList.get( rowNum );
          if (this.pipeSet.contains( p ))
            rowClass = "ttrow3";
            }
              // set css zeebra-class
              rowColumn.setVariable("rowClass", rowClass);
View Full Code Here

TOP

Related Classes of smilehouse.opensyncro.pipes.Pipe

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.