Package org.jbpm.wire

Examples of org.jbpm.wire.WireContext$PendingInitialization


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


  // object builders //////////////////////////////////////////////////////////

  protected T constructFromDescriptor() {
    WireDefinition wireDefinition = new WireDefinition();
    wireDefinition.addDescriptor("o", descriptor);
    WireContext wireContext = new WireContext(wireDefinition);
    return (T) wireContext.get("o");
  }
View Full Code Here

    // add the application context
    environment.addContext(applicationWireContext);

    // add the environment block context
    WireContext blockContext = new WireContext(blockWireDefinition, DefaultEnvironment.CONTEXTNAME_BLOCK, environment, true);
    // add the environment block context to the environment
    environment.addContext(blockContext);
    // finish the creation of the environment wire context
    blockContext.create();

    // fire an open environment event
    applicationWireContext.fire(DefaultEnvironment.EVENT_OPENENVIRONMENT, environment);
   
    // if all went well, only then push the created environment
View Full Code Here

  public void handleException(DefaultEnvironment defaultEnvironment, Throwable exception) {
    if (mustBeLogged(exception)) {
      log.log(Level.SEVERE, "exception in environment block:"+exception.getMessage(), exception);
    }

    WireContext wireContext = (WireContext) defaultEnvironment.getBlockContext();
    wireContext.fire(DefaultEnvironment.EVENT_EXCEPTION, this);
  }
View Full Code Here

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

    // identify the wireContext
    WireContext wireContext = null;
    if (contextName!=null) {
      Environment environment = targetWireContext.getEnvironment();
      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

    WireDefinition applicationWireDefinition = getApplicationWireDefinition(documentElement, parse);
    WireDefinition blockWireDefinition = getBlockWireDefinition(documentElement, parse);

    // create the application wire context from the definition
    WireContext applicationWireContext = new WireContext(applicationWireDefinition, DefaultEnvironment.CONTEXTNAME_APPLICATION);
    // propagate the parser classloader to the application context
    applicationWireContext.setClassLoader(classLoader);

    // configure the default environment factory
    defaultEnvironmentFactory.setApplicationWireContext(applicationWireContext);
    defaultEnvironmentFactory.setBlockWireDefinition(blockWireDefinition);
   
View Full Code Here

TOP

Related Classes of org.jbpm.wire.WireContext$PendingInitialization

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.