Package org.jbpm.configuration

Examples of org.jbpm.configuration.ObjectFactory


    catch (Exception e) {
      // okay
    }

    MockControl factoryControl = MockControl.createControl(ObjectFactory.class);
    ObjectFactory mockFactory = (ObjectFactory) factoryControl.getMock();
    configuration.setObjectFactory(mockFactory);

    MockControl beanFactoryControl = MockControl.createNiceControl(BeanFactory.class);
    BeanFactory beanFactory = (BeanFactory) beanFactoryControl.getMock();

    JbpmContext context = new JbpmContext(null, mockFactory);
    factoryControl.expectAndReturn(mockFactory.createObject(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME), context, 3);
    beanFactoryControl.replay();
    factoryControl.replay();

    // configuration.setBeanFactory(beanFactory);
    configuration.afterPropertiesSet();
View Full Code Here


  public void testNoSpringObjectFactory() throws Exception {
    // configuration.setUseSpringObjectFactory(false);

    MockControl factoryControl = MockControl.createControl(ObjectFactory.class);
    ObjectFactory mockFactory = (ObjectFactory) factoryControl.getMock();

    factoryControl.expectAndReturn(mockFactory.createObject(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME),
        new JbpmContext(null, mockFactory), 2);
    factoryControl.replay();
    configuration.setObjectFactory(mockFactory);
    configuration.afterPropertiesSet();
View Full Code Here

   */
  public void afterPropertiesSet() throws Exception {
    if (configuration == null && objectFactory == null)
      throw new IllegalArgumentException("configuration or objectFactory property need to be not null");

    ObjectFactory jbpmObjectFactory;

    // 1. create the configuration from the file
    if (configuration != null) {
      logger.info("creating JbpmConfiguration from resource " + configuration.getDescription());
      InputStream stream = configuration.getInputStream();
View Full Code Here

    return variableInstance;
  }

  public static List<JbpmType> getJbpmTypes() {
    List<JbpmType> jbpmTypes = null;
    ObjectFactory objectFactory = JbpmConfiguration.Configs.getObjectFactory();
    synchronized (jbpmTypesCache) {
      jbpmTypes = jbpmTypesCache.get(objectFactory);

      if (jbpmTypes == null) {
        if (objectFactory.hasObject("jbpm.types")) {
          jbpmTypes = CollectionUtil.checkList((List<?>) objectFactory.createObject("jbpm.types"),
              JbpmType.class);
        }
        else {
          jbpmTypes = getDefaultJbpmTypes();
        }
View Full Code Here

  }

  private static List<JbpmType> getDefaultJbpmTypes() {
    String resource = JbpmConfiguration.Configs.getString("resource.varmapping");
    InputStream is = ClassLoaderUtil.getStream(resource);
    ObjectFactory objectFactory = ObjectFactoryParser.parseInputStream(is);
    return CollectionUtil.checkList((List<?>) objectFactory.createObject("jbpm.types"),
        JbpmType.class);
  }
View Full Code Here

           */
          if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource))
          {
            log.warn("configuration resource '" + resource + "' could not be found");
          }
          ObjectFactory objectFactory = parseObjectFactory(jbpmCfgXmlStream);
          instance = createJbpmConfiguration(objectFactory);
        }
        // put configuration in cache
        instances.put(resource, instance);
      }
View Full Code Here

    InputStream inputStream = null;
    if (xml != null)
    {
      inputStream = new ByteArrayInputStream(xml.getBytes());
    }
    ObjectFactory objectFactory = parseObjectFactory(inputStream);
    return createJbpmConfiguration(objectFactory);
  }
View Full Code Here

  }

  public static JbpmConfiguration parseInputStream(InputStream inputStream)
  {
    log.debug("creating jbpm configuration from input stream");
    ObjectFactory objectFactory = parseObjectFactory(inputStream);
    return createJbpmConfiguration(objectFactory);
  }
View Full Code Here

    InputStream inputStream = null;
    if (resource != null)
    {
      inputStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
    }
    ObjectFactory objectFactory = parseObjectFactory(inputStream);
    return createJbpmConfiguration(objectFactory);
  }
View Full Code Here

      // hide default constructor to prevent instantiation
    }

    public static ObjectFactory getObjectFactory()
    {
      ObjectFactory objectFactory = null;
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      if (jbpmContext != null)
      {
        objectFactory = jbpmContext.objectFactory;
      }
View Full Code Here

TOP

Related Classes of org.jbpm.configuration.ObjectFactory

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.