Package org.jbpm.env

Examples of org.jbpm.env.Environment


  }

  // asynchronous continuations //////////////////////////////////////////////// 

  public void sendContinuationMessage(AtomicOperation operation) {
    Environment environment = Environment.getCurrent();
    MessageSession messageSession = environment.get(MessageSession.class);
    Message asyncMessage = operation.createAsyncMessage(this);
    lock("async continuation message "+asyncMessage);
    messageSession.send(asyncMessage);
  }
View Full Code Here


    @Override
    public void run() {
      try {
        Activity activity = timer.getActivityReference().get();
        if (activity != null) {
          Environment tmpEnvironment = null;
          try {
            if (Environment.getCurrent() == null) {
              tmpEnvironment =
                environmentFactory.openEnvironment();
            }
            activity.execute(timer.getExecution());
          } finally {
            if (tmpEnvironment != null)
              tmpEnvironment.close();
          }
        } else {
          throw new PvmException("Unable to get the activity for the task");
        }
      } catch (Exception e) {
View Full Code Here

    return false;
  }
 
  public void handle(ExecutionImpl execution, Exception exception) {
    if (isTransactional) {
      Environment environment = Environment.getCurrent();
      Transaction transaction = (environment!=null ? environment.getTransaction() : null);
      if (transaction!=null) {
        log.finest("registering exception handler to "+transaction);
        AfterTxCompletionListener afterTxCompletionListener = new AfterTxCompletionListener(
                execution,
                exception,
                environment.getEnvironmentFactory()
        );
        transaction.addListener(afterTxCompletionListener, Transaction.EVENT_AFTERCOMPLETION);
        log.finest("registering exception handler to "+transaction);
        throw new PvmException("transaction exception handler registered handler after transaction completed.  make sure this transaction is rolled back", exception);
      } else {
View Full Code Here

    if (contextClass!=null) {
      log.finest("looking up "+contextClass.getName()+" by type in "+wireContext);
      return wireContext.get(contextClass);

    } else if (environmentClass!=null) {
      Environment environment = wireContext.getEnvironment();
      if (environment==null) {
        throw new WireException("no environment to search an object of type "+environmentClass.getName());
      }
      log.finest("looking up "+environmentClass.getName()+" by type in environment");
      return environment.get(environmentClass);
    }
    return null;
  }
View Full Code Here

    WireContext wireContext = new WireContext(wireDefinition);
    return (T) wireContext.get("o");
  }

  protected T resolveValueExpression() {
    Environment environment = Environment.getCurrent();
    return null;
  }
View Full Code Here

    // get the hibernate-session-factory
    SessionFactory sessionFactory = null;
    if (factoryName!=null) {
      sessionFactory = (SessionFactory) wireContext.get(factoryName);
    } else {
      Environment environment = wireContext.getEnvironment();
      if (environment!=null) {
        sessionFactory = environment.get(SessionFactory.class);
      } else {
        sessionFactory = wireContext.get(SessionFactory.class);
      }
    }
    if (sessionFactory==null) {
View Full Code Here

  private static final long serialVersionUID = 1L;

  public Object construct(WireContext wireContext) {
    StandardTransaction standardTransaction = new StandardTransaction();
    Environment environment = wireContext.getEnvironment();
    if (environment==null) {
      throw new WireException("standard transaction requires environment");
    }
    standardTransaction.setEnvironment(environment);
    wireContext.addListener(standardTransaction);
View Full Code Here

  private static final long serialVersionUID = 1L;

  public boolean matches(String name, Object value) {
    boolean matches = false;
   
    Environment environment = Environment.getCurrent();
    if (environment!=null) {
      SessionFactory sessionFactory = (SessionFactory) environment.get("hibernate.session.factory");
      if (sessionFactory!=null) {
        ClassMetadata classMetadata = sessionFactory.getClassMetadata(value.getClass());
        matches = ( (classMetadata!=null)
                    && (classMetadata.getIdentifierType().getClass()==StringType.class)
                   );
View Full Code Here

  private static final long serialVersionUID = 1L;

  public boolean matches(String name, Object value) {
    boolean matches = false;
   
    Environment environment = Environment.getCurrent();
    if (environment!=null) {
      SessionFactory sessionFactory = (SessionFactory) environment.get("hibernate.session.factory");
      if (sessionFactory!=null) {
        ClassMetadata classMetadata = sessionFactory.getClassMetadata(value.getClass());
        matches =  ( (classMetadata!=null)
                     && (classMetadata.getIdentifierType().getClass()==LongType.class)
                   );
View Full Code Here

      "</environment>"
  );

  public void testEnvironment() {
   
    Environment environment = environmentFactory.openEnvironment();
    try {
     
      Book book = environment.get(Book.class);
      assertNotNull(book);
     
      assertSame(book, environment.get("book"));
     
    } finally {
      environment.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.env.Environment

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.