Exemple #1
0
  /**
   * This method loads properties in virtual machine.
   *
   * @param key - Ket value of persistentproperty.
   * @param type - Type value of persistentproperty.
   * @exception - ProcessingException - this exception is thrown by super class for any problem with
   *     initialization .
   */
  public void initialize(String key, String type) throws ProcessingException {
    Debug.log(this, Debug.DB_STATUS, "Loading properties for RTF generator.");
    super.initialize(key, type);

    nextProcessor = (String) adapterProperties.get(NEXT_PROCESSOR_NAME);
    startDelimiter = (String) adapterProperties.get(START_DELIMITER);
    endDelimiter = (String) adapterProperties.get(END_DELIMITER);
    rtfTemplate = (String) adapterProperties.get(RTF_TEMPLATE);

    if (nextProcessor == null
        || startDelimiter == null
        || endDelimiter == null
        || rtfTemplate == null
        || nextProcessor.equals("")
        || startDelimiter.equals("")
        || endDelimiter.equals("")
        || rtfTemplate.equals("")) {
      Debug.log(
          this,
          Debug.ALL_ERRORS,
          "ERROR: RTFGenerator: One or more RTF generator properties are missing.");
      throw new ProcessingException(
          "ERROR: RTFGenerator: One or more properties from persistentproperty"
              + " could not be loaded or are null");
    }
  }
  /**
   * Initializes this object.
   *
   * @param key Property-key to use for locating initialization properties.
   * @param type Property-type to use for locating initialization properties.
   * @exception ProcessingException when initialization fails
   */
  public void initialize(String key, String type) throws ProcessingException {
    super.initialize(key, type);

    StringBuffer errorBuf = new StringBuffer();

    // serverName = getRequiredProperty(SERVER_NAME_PROP, errorBuf);

    headerLocation = getPropertyValue(NF_HEADER_LOCATION_PROP);

    isAsyncLocation = getPropertyValue(IS_ASYNCHRONOUS_LOCATION_PROP);

    orbAgentAddr = getPropertyValue(ORB_AGENT_ADDR_PROP);

    orbAgentPort = getPropertyValue(ORB_AGENT_PORT_PROP);

    orbAgentAddrLocation = getPropertyValue(ORB_AGENT_ADDR_PROP_LOCATION);

    orbAgentPortLocation = getPropertyValue(ORB_AGENT_PORT_PROP_LOCATION);

    if (!StringUtils.hasValue(isAsyncLocation)) {
      try {
        isAsync =
            StringUtils.getBoolean(
                (String) getRequiredPropertyValue(DEFAULT_IS_ASYNCHRONOUS_PROP, errorBuf));
      } catch (FrameworkException fe) {
        errorBuf.append(
            "No value is specified for either "
                + IS_ASYNCHRONOUS_LOCATION_PROP
                + "or"
                + DEFAULT_IS_ASYNCHRONOUS_PROP
                + ". One of the values should be present"
                + fe.getMessage());
      }
    }

    if (!StringUtils.hasValue(headerLocation)) {
      try {
        header = getRequiredPropertyValue(DEFAULT_HEADER_PROP, errorBuf);
      } catch (Exception e) {
        errorBuf.append(
            "No value is specified for "
                + NF_HEADER_LOCATION_PROP
                + "or"
                + DEFAULT_HEADER_PROP
                + ". One of the values should be present"
                + e.getMessage());
      }
    }

    if (errorBuf.length() > 0) throw new ProcessingException(errorBuf.toString());
  }