Package org.jbpm.pvm.internal.wire

Examples of org.jbpm.pvm.internal.wire.WireContext


          "</objects>"
        )
        .execute()
        .getDocumentObject();
 
      WireContext wireContext = new WireContext(wireDefinition);
      defaultScriptManager = wireContext.get(ScriptManager.class);
    }
    return defaultScriptManager;
  }
View Full Code Here


        if (txWireObjects != null) {
            usedWireDefinition = new WireDefinition(transactionWireDefinition,
                    txWireObjects);
        }

        WireContext transactionContext = new WireContext(usedWireDefinition,
                Context.CONTEXTNAME_TRANSACTION, environment, true);
        // add the environment block context to the environment
        environment.setContext(transactionContext);

        Environment.pushEnvironment(environment);
        try {
            // finish the creation of the environment wire context
            transactionContext.create();

        } catch (RuntimeException e) {
            Environment.popEnvironment();
            throw e;
        }
View Full Code Here

    WireDefinition usedWireDefinition = transactionWireDefinition;
    if (txWireObjects!=null) {
      usedWireDefinition = new WireDefinition(transactionWireDefinition, txWireObjects);
    }
   
    WireContext transactionContext = new WireContext(usedWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
    // add the environment block context to the environment
    environment.setContext(transactionContext);

    Environment.pushEnvironment(environment);
    try {
      // finish the creation of the environment wire context
      transactionContext.create();

    } catch (RuntimeException e) {
      Environment.popEnvironment();
      throw e;
    }
View Full Code Here

    return wireContext.keys();
  }
 
  public void add(Descriptor descriptor) {
    if (wireContext==null) {
      wireContext = new WireContext(new WireDefinition());
    }
    wireContext.getWireDefinition().addDescriptor(descriptor);
  }
View Full Code Here

       ) {
      listener = new FilterListener(listener, eventNames);
    }

    // identify the wireContext
    WireContext wireContext = null;
    if (contextName!=null) {
      Environment environment = Environment.getCurrent();
      if (environment!=null) {
        try {
          wireContext = (WireContext) environment.getContext(contextName);
          if (wireContext==null) {
            throw new WireException("couldn't subscribe because context "+contextName+" doesn't exist");
          }
        } catch (ClassCastException e) {
          throw new WireException("couldn't subscribe because context "+contextName+" is not a WireContext", e);
        }
      } else {
        throw new WireException("couldn't get context "+contextName+" for subscribe because no environment available in context "+targetWireContext);
      }
    } else {
      wireContext = targetWireContext;
    }

    if (wireEvents) {
      WireDefinition wireDefinition = wireContext.getWireDefinition();
     
      // if there are objectNames specified
      if (objectNames!=null) {
        // subscribe to the descriptors for the all objectNames
        for (String objectName: objectNames) {
          Descriptor descriptor = wireDefinition.getDescriptor(objectName);
          subscribe(listener, descriptor);
        }
       
      // if no objectNames are specified, subscribe to all the descriptors
      } else {
        Set<Descriptor> descriptors = new HashSet<Descriptor>(wireDefinition.getDescriptors().values());
        for(Descriptor descriptor: descriptors) {
          subscribe(listener, descriptor);
        }
      }

    } else if ( (objectNames!=null)
                && (!objectNames.isEmpty())
              ) {
      // for every objectName
      for (String objectName: objectNames) {
        // subscribe to the objects themselves
        Object object = wireContext.get(objectName);
        if (object==null) {
          throw new WireException("couldn't subscribe to object in context "+wireContext.getName()+": object "+objectName+" unavailable");
        }
        if (! (object instanceof Observable)) {
          throw new WireException("couldn't subscribe to object in context "+wireContext.getName()+": object "+objectName+" ("+object.getClass().getName()+") isn't "+Observable.class.getName());
        }
        subscribe(listener, (Observable)object);
      }

    } else {
View Full Code Here

      authenticatedUserIdThreadLocal.set(null);
    }
  }

  protected void installTransactionContext(PvmEnvironment environment) {
    WireContext transactionContext = new WireContext(transactionWireDefinition, Context.CONTEXTNAME_TRANSACTION, true);
    // add the environment block context to the environment
    environment.setContext(transactionContext);

    EnvironmentImpl.pushEnvironment(environment);
    try {
      // finish the creation of the environment wire context
      transactionContext.create();

    } catch (RuntimeException e) {
      EnvironmentImpl.popEnvironment();
      throw e;
    }
View Full Code Here

 
  public void perform(OpenExecution execution) throws Exception {
   
    Object invocationTarget = null;

    WireContext wireContext = new WireContext();

    if (target!=null) {
      invocationTarget = target;

    } else if (targetExpression!=null) {
View Full Code Here

       ) {
      listener = new FilterListener(listener, eventNames);
    }

    // identify the wireContext
    WireContext wireContext = null;
    if (contextName!=null) {
      EnvironmentImpl environment = EnvironmentImpl.getCurrent();
      if (environment!=null) {
        try {
          wireContext = (WireContext) environment.getContext(contextName);
          if (wireContext==null) {
            throw new WireException("couldn't subscribe because context "+contextName+" doesn't exist");
          }
        } catch (ClassCastException e) {
          throw new WireException("couldn't subscribe because context "+contextName+" is not a WireContext", e);
        }
      } else {
        throw new WireException("couldn't get context "+contextName+" for subscribe because no environment available in context "+targetWireContext);
      }
    } else {
      wireContext = targetWireContext;
    }

    if (wireEvents) {
      WireDefinition wireDefinition = wireContext.getWireDefinition();
     
      // if there are objectNames specified
      if (objectNames!=null) {
        // subscribe to the descriptors for the all objectNames
        for (String objectName: objectNames) {
          Descriptor descriptor = wireDefinition.getDescriptor(objectName);
          subscribe(listener, descriptor);
        }
       
      // if no objectNames are specified, subscribe to all the descriptors
      } else {
        Set<Descriptor> descriptors = new HashSet<Descriptor>(wireDefinition.getDescriptors().values());
        for(Descriptor descriptor: descriptors) {
          subscribe(listener, descriptor);
        }
      }

    } else if ( (objectNames!=null)
                && (!objectNames.isEmpty())
              ) {
      // for every objectName
      for (String objectName: objectNames) {
        // subscribe to the objects themselves
        Object object = wireContext.get(objectName);
        if (object==null) {
          throw new WireException("couldn't subscribe to object in context "+wireContext.getName()+": object "+objectName+" unavailable");
        }
        if (! (object instanceof Observable)) {
          throw new WireException("couldn't subscribe to object in context "+wireContext.getName()+": object "+objectName+" ("+object.getClass().getName()+") isn't "+Observable.class.getName());
        }
        subscribe(listener, (Observable)object);
      }

    } else {
View Full Code Here

          "</objects>"
        )
        .execute()
        .getDocumentObject();
 
      WireContext wireContext = new WireContext(wireDefinition);
      defaultScriptManager = wireContext.get(ScriptManager.class);
    }
    return defaultScriptManager;
  }
View Full Code Here

      String className = objectDescriptor.getClassName();
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      clazz = Class.forName(className, true, classLoader)
    }
   
    WireContext wireContext = new WireContext(new WireDefinition());
    Object returnValue = ObjectDescriptor.invokeMethod(methodName, argDescriptors, wireContext, target, clazz);
   
    if (variableName!=null) {
      execution.setVariable(variableName, returnValue);
    }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.wire.WireContext

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.