Package org.jbpm

Examples of org.jbpm.JbpmContext


    }
  }

  void resumeJobs()
  {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    JobSession jobSession = (jbpmContext != null ? jbpmContext.getJobSession() : null);
    if (jobSession != null)
    {
      jobSession.resumeJobs(this);
    }
  }
View Full Code Here


  JobSession jobSession = null;
  JobExecutor jobExecutor = null;
  boolean hasProducedJobs = false;

  public DbSchedulerService() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (jbpmContext==null) {
      throw new JbpmException("instantiation of the DbSchedulerService requires a current JbpmContext");
    }
    this.jobSession = jbpmContext.getJobSession();
    this.jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
  }
View Full Code Here

            final ProcessDefinition processDefinition;
            try {
                ZipInputStream zis = new ZipInputStream(inputStream);
                try {
                    processDefinition = ProcessDefinition.parseParZipInputStream(zis);
                    final JbpmContext jbpmContext = context.getJbpmContext();
                    jbpmContext.deployProcessDefinition(processDefinition);
                } finally {
                    try {
                        zis.close();
                    } catch (IOException e) {
                        log.warning("Error closing zip Ninput stream after deploy: " + e.getMessage());
View Full Code Here

      // the token arrived in the join and can only reactivate the parent once
      token.setAbleToReactivateParent(false);

      Token parentToken = token.getParent();
      if (parentToken != null) {
        JbpmContext jbpmContext = executionContext.getJbpmContext();
        Session session = jbpmContext != null ? jbpmContext.getSession() : null;
        if (session != null) {
          // obtain update lock by default (LockMode.UPGRADE)
          LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode)
              : LockMode.UPGRADE;
          log.debug("acquiring " + lockMode + " lock on " + parentToken);
View Full Code Here

        superProcessToken.signal(superExecutionContext);
      }

      // make sure jobs for this process instance are canceled
      // after the process end updates are posted to the database
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      if (jbpmContext != null)
      {
        Services services = jbpmContext.getServices();
        MessageService messageService = services.getMessageService();
        PersistenceService persistenceService = services.getPersistenceService();
        if (messageService != null
            && persistenceService != null
            && persistenceService.getJobSession().countDeletableJobsForProcessInstance(this) > 0)
View Full Code Here

      processStream.close();
    }
  }

  private void deployProcessDefinition(ProcessDefinition processDefinition, JbpmConfiguration jbpmConfiguration) {
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      jbpmContext.deployProcessDefinition(processDefinition);
      log("deployed process " + processDefinition.getName() + " successfully");
    }
    catch (RuntimeException e) {
      jbpmContext.setRollbackOnly();
      log("failed to deploy process " + processDefinition.getName(), e, Project.MSG_ERR);
      throw e;
    }
    finally {
      jbpmContext.close();
    }
  }
View Full Code Here

   private void installProcessDefinitions()
   {
      if ( isProcessDeploymentEnabled() )
      {
         JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
         try
         {
            if (processDefinitions!=null)
            {
               for ( String definitionResource : processDefinitions )
               {
                  deployProcess(jbpmContext, definitionResource);
               }
            }
         }
         catch (RuntimeException e)
         {
            throw new RuntimeException("could not deploy a process definition", e);
         }
         finally
         {
            jbpmContext.close();
         }
      }
   }
View Full Code Here

      return pageflowConfiguration.createJbpmContext();
   }

   public static ProcessDefinition parseInputSource(InputSource inputSource)
   {
      JbpmContext jbpmContext = createPageflowContext();
      try
      {
         return new PageflowParser(inputSource).readProcessDefinition();
      }
      finally
      {
         jbpmContext.close();
      }
   }
View Full Code Here

      super(name);
    }
    public void run() {
      try {
        while(true) {
          JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
          try {
            DbMessageService dbMessageService = (DbMessageService) jbpmContext.getServices().getMessageService();

            log.trace("receiver '"+getName()+"' is going to wait for a message");
            if (!dbMessageService.hasMessages(DESTINATION_TEST)) {
              StaticNotifier.waitForNotification(DESTINATION_TEST);
            }

            log.trace("receiver '"+getName()+"' is going to get a message");
            TextMessage textMessage = (TextMessage) dbMessageService.receiveNoWait(DESTINATION_TEST);
            if (textMessage!=null) {
              String text = textMessage.getText();
              log.trace("receiver '"+getName()+"' received message '"+text+"'");
              receivedMsgs.add(text);
            }

          } finally {
            jbpmContext.close();
          }
        }
      } catch (InterruptedException e) {
        log.trace("thread '"+getName()+"' got interrupted");
      } finally {
View Full Code Here

      this.nbrOfMessages = nbrOfMessages;
      this.startIndex = startIndex;
    }
    public void run() {
      for (int i=0; i<nbrOfMessages; i++) {
        JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
        try {
          DbMessageService dbMessageService = (DbMessageService) jbpmContext.getServices().getMessageService();

          String msg = Integer.toString(startIndex+i);
          TextMessage textMessage = new TextMessage(msg);
          textMessage.setDestination(DESTINATION_TEST);
          dbMessageService.send(textMessage);
          sendedMsgs.add( msg );
        } finally {
          jbpmContext.close();
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.JbpmContext

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.