Package net.sf.xbus.base.core.config

Examples of net.sf.xbus.base.core.config.Configuration


    taManager.close();
  }

  private void initialize(HttpServletRequest req) throws XException
  {
    Configuration config = Configuration.getInstance();

    /*
     * Get the name of the source from the last part of the URL.
     */
    String servletName = null;
    ASCIITokenizer tokenizer = new ASCIITokenizer(req.getRequestURL()
        .toString(), "/");
    while (tokenizer.hasMoreTokens())
    {
      servletName = tokenizer.nextToken();
    }
    mSource = new XBUSSystem(servletName);

    /*
     * Check, it this is a normal HTTPReceiver or a HTTPLineReaderReceiver
     */
    String receiverType = config.getValue(Constants.CHAPTER_SYSTEM, mSource
        .getName(), "Receiver");

    if ((HTTP_RECEIVER.equals(receiverType))
        || (HTTP_STREAM_RECEIVER.equals(receiverType))
        || (HTTP_PARAMETER_RECEIVER.equals(receiverType)))
View Full Code Here


   */
  public Object transform(Object inObject, XBUSSystem source,
      XBUSSystem destination, Message destinationMessage)
      throws XException
  {
    Configuration config = Configuration.getInstance();
    // For the linebreak
    String platform = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        destination.getName(), "Platform");
    // Standard linebreak from the operating system
    String lineBreak = Constants.LINE_SEPERATOR;
    // Using another platform's linebreak in the output?
    if (platform != null)
      lineBreak = Constants.getLineSeperator(platform);

    // For the result.
    StringBuffer buffer = new StringBuffer();
    // Read the string line by line form the configuration.
    String line = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        destination.getName(), "TextLine1");
    int i = 1;
    while (line != null)
    {
      i++;
      line = destination.replaceAllMarkers(line)[0];
      buffer.append(line);
      buffer.append(lineBreak);
      line = config.getValueOptional(Constants.CHAPTER_SYSTEM,
          destination.getName(), "TextLine" + i);
    } // while (line != null)

    return buffer.toString();
  } // transform(Object inObject, XBUSSystem source, XBUSSystem destination,
View Full Code Here

   *         from the system property
   * @exception XException if any errors occurs.
   */
  private String retrieveEncoding(String system) throws XException
  {
    Configuration config = Configuration.getInstance();
    String configEncoding = config.getValueOptional(
        Constants.CHAPTER_SYSTEM, system, Constants.KEY_ENCODING);

    return (configEncoding == null)
        ? Constants.SYS_ENCODING
        : configEncoding;
View Full Code Here

    if (callData == null)
      callData = "";

    try
    {
      Configuration config = Configuration.getInstance();
      mHost = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
          .getName(), "Host");
      mPort = config.getValueAsInt(Constants.CHAPTER_SYSTEM, mDestination
          .getName(), "Port");

      outSocket = new Socket(mHost, mPort);
      out = new PrintWriter(outSocket.getOutputStream(), true);
      out.print(callData);
View Full Code Here

  {
    if (mErrorTimeout == 0)
    {
      try
      {
        Configuration config = Configuration.getInstance();
        mErrorTimeout = config.getValueAsIntOptional("System", mSource
            .getName(), "WaitAfterError") * 1000;
        if (mErrorTimeout == 0)
        {
          mErrorTimeout = config.getValueAsInt("Base", "Receiver",
              "WaitAfterError") * 1000;
        }
      }
      catch (XException e)
      {
View Full Code Here

  {
    if (mTimeout == 0)
    {
      try
      {
        Configuration config = Configuration.getInstance();
        mTimeout = config.getValueAsIntOptional("System", mSource
            .getName(), "Timeout") * 1000;
        if (mTimeout == 0)
        {
          mTimeout = config.getValueAsInt("Base",
              getReceiverClassName(), "Timeout") * 1000;
        }
      }
      catch (XException e)
      {
View Full Code Here

   *         from the system property
   * @exception XException if any error occurs.
   */
  static public String getEncoding(String system) throws XException
  {
    Configuration config = Configuration.getInstance();
    String configEncoding = config.getValueOptional(
        Constants.CHAPTER_SYSTEM, system, Constants.KEY_ENCODING);

    return (configEncoding == null)
        ? Constants.SYS_ENCODING
        : configEncoding;
View Full Code Here

  public Object execute(String function, Object callData) throws XException
  {
    // for result
    Document response = null;

    Configuration config = Configuration.getInstance();

    AS400Connection as400Connection = AS400Connection.getInstance(config
        .getValue(Constants.CHAPTER_SYSTEM, mDestination.getName(),
            "AS400Name"));

    int timeout = config.getValueAsIntOptional(Constants.CHAPTER_SYSTEM,
        mDestination.getName(), "ProgramTimeout") * 1000;
    if (timeout == 0)
    {
      timeout = Integer.MAX_VALUE;
    }

    /*
     * If there is no real AS400 available, then testdata will be used.
     */
    if (as400Connection.isTestSystem())
    {
      return XMLHelper.parseXML(getTestData(function), null, null);
    }

    // Conect to the iSeries
    AS400 as400 = as400Connection.getSystem();

    // Character converter
    try
    {
      mConverter = new CharConverter(as400.getCcsid());
    }
    catch (UnsupportedEncodingException e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", e);
    }

    // Determine how to operate
    String callType = config.getValue("AS400Program", function, "CallType");

    if (!CALLTYPE_SINGLE.equals(callType)
        && !CALLTYPE_MULTI.equals(callType))
    {
      List params = new Vector();
      params.add(callType);
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "39", params);
    } // if (!CALLTYPE_SINGLE.equals(callType) &&
      // !CALLTYPE_MULTI.equals(callType))

    if (CALLTYPE_SINGLE.equals(callType))
    { // Only one calling step, only one record wil be returned as result
      // Read the name of the programm from the configuration
      String programName = config.getValue("AS400Program", function,
          "Program");

      // Structure for input an (still empty) output parameters
      ProgramParameter[] parameters = getParametersFromDocument(
          (Document) callData, callType, function, 1, 1);

      // the program call itself
      callAS400Program(as400, programName, parameters, timeout);

      // Get the output values.
      List outputList = makeOutputFields(as400, parameters, 1);
      // Place output values in specified XML structure.
      response = getResponseDocument(function, outputList);
    } // then (CALLTYPE_SINGLE.equals(callType))
    else if (CALLTYPE_MULTI.equals(callType))
    { // Call multiple times to get entire list of output data
      // First call will determine amount of returned records.
      // Next phase is to call (another program) to get each time one
      // record.

      // Read the name of the output count determining program from the
      // configuration
      String programNameAmount = config.getValue("AS400Program",
          function, "ProgramAmount");

      // Read the e
      String programNameData = config.getValue("AS400Program", function,
          "ProgramData");

      /*
       * First call of the AS400 program to get the amount of rows to be
       * retrieved.
 
View Full Code Here

      }
      mOutputFields = getFields(output.item(0).getChildNodes());
    }
    if ((CALLTYPE_MULTI.equals(callType)) && callNumber == 1)
    {
      Configuration config = Configuration.getInstance();
      mCountLength = config.getValueAsInt("AS400Program", function,
          "CounterLength");
      parameters[1] = new ProgramParameter(mCountLength);
    }
    else
    {
View Full Code Here

   *            configuration file from.
   * @throws XException
   */
  private void initialize(String sectionName) throws XException
  {
    Configuration config = Configuration.getInstance();
    Configuration xBusConfig = Configuration.getInstance("xbus");
    String tempVariable = null;

    // get Field Separator
    if ((fieldSeparator = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        sectionName, Constants.KEY_CSV_FIELD_SEPARATOR)) == null)
    {
      fieldSeparator = xBusConfig.getValue("MessageDefaults",
          "CSVMessage", Constants.KEY_CSV_FIELD_SEPARATOR);
    }

    // get Quote Character
    if ((quoteChar = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        sectionName, Constants.KEY_CSV_QUOTE_CHAR)) == null)
    {
      quoteChar = xBusConfig.getValue("MessageDefaults", "CSVMessage",
          Constants.KEY_CSV_QUOTE_CHAR);
    }

    // get configuration entry if containing header
    if ((tempVariable = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        sectionName, Constants.KEY_CSV_HAS_HEADER)) == null)
    {
      hasHeader = xBusConfig.getValueAsBoolean("MessageDefaults",
          "CSVMessage", Constants.KEY_CSV_HAS_HEADER);
    }
    else if (tempVariable.equalsIgnoreCase(Constants.CONFIGURATION_TRUE))
    {
      hasHeader = true;
View Full Code Here

TOP

Related Classes of net.sf.xbus.base.core.config.Configuration

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.