protected void writeWorkflowDeployerBean(
      OutputStream out, String processId, String processFileName, String contentModelFileName)
      throws IOException {
    // Create root "beans" element
    Beans beans = new Beans();
    Bean workflowDeployer =
        new Bean(processId + WORKFLOW_DEPLOYER_NAME_SUFFIX, WORKFLOW_DEPLOYER_PARENT);
    beans.getBeans().add(workflowDeployer);

    // Add pointer to model
    BeanProperty modelsProperty = new BeanProperty(PROPERTY_MODELS);
    modelsProperty.addListItem(EXTENSIONS_PATH_PREFIX + contentModelFileName);
    workflowDeployer.getProperties().add(modelsProperty);

    // Add pointer to process definition
    BeanProperty workflowProperty = new BeanProperty(PROPERTY_WORKFLOW_DEFINITIONS);
    workflowProperty.addProp(new BeanPropertyProp(PROP_KEY_ENGINE_ID, PROP_ENGINE_ID));
    workflowProperty.addProp(new BeanPropertyProp(PROP_KEY_MIME_TYPE, PROP_MIME_TYPE));
    workflowProperty.addProp(
        new BeanPropertyProp(PROP_KEY_LOCATION, EXTENSIONS_PATH_PREFIX + processFileName));
    // TODO: set back to false or make configurable
    workflowProperty.addProp(new BeanPropertyProp(PROP_KEY_REDEPLOY, Boolean.TRUE.toString()));
    workflowDeployer.getProperties().add(workflowProperty);

    writeBeans(out, beans);
  }
  protected void writeShareCustomConfigBean(
      OutputStream out, String processId, String configFileName) throws IOException {
    Beans beans = new Beans();
    Bean shareCustomConfigBean = new Bean(processId + WORKFLOW_DEPLOYER_NAME_SUFFIX, null);
    shareCustomConfigBean.setBeanClass(SHARE_CONFIG_BOOTSTRAP_BEAN_CLASS);
    shareCustomConfigBean.setInitMethod(SHARE_CONFIG_BOOTSTRAP_BEAN_INIT_METHOD);
    BeanProperty configsProperty = new BeanProperty(PROPERTY_CONFIGS);
    configsProperty.addListItem(WEB_EXTENSIONS_PATH_PREFIX + configFileName);

    BeanProperty configServiceProperty = new BeanProperty(PROPERTY_CONFIG_SERVICE);
    configServiceProperty.setRef(PROPERTY_CONFIG_SERVICE_REF);
    shareCustomConfigBean.getProperties().add(configServiceProperty);

    shareCustomConfigBean.getProperties().add(configsProperty);
    beans.getBeans().add(shareCustomConfigBean);

    writeBeans(out, beans);
  }