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

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


   */
  private List getAllHTTPReceivers() throws XException {
    List returnSet = new Vector();
    if (mIsServletEngine) {
      List systems;
      Configuration config;
      try {
        config = Configuration.getInstance();
        systems = config.getSections(Constants.CHAPTER_SYSTEM);
      } catch (XException e) {
        return null;
      }

      String system = null;
View Full Code Here


   *            the name of the receiver class
   */
  public static int getStopAfterErrors(String system, String receiverClassName) {
    int stopAfterErrors = DEFAULT_STOP_AFTER_ERRORS;
    try {
      Configuration config = Configuration.getInstance();
      stopAfterErrors = config.getValueAsIntOptional("System", system,
          "StopAfterErrors");
      if (stopAfterErrors == 0) {
        stopAfterErrors = config.getValueAsInt("Base",
            receiverClassName, "StopAfterErrors");
      }
    } catch (XException e) {
      Trace.warn("Using default for StopAfterErrors: "
          + DEFAULT_STOP_AFTER_ERRORS);
View Full Code Here

    return response;
  }

  private boolean isSOAPMessage() throws XException
  {
    Configuration config = Configuration.getInstance();

    String message = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
        .getName(), "Message");
    boolean isSOAPMessage = ("SOAPMessage".equals(message));

    return isSOAPMessage;
  }
View Full Code Here

    return isSOAPMessage;
  }

  private void setKeystore(String urlName) throws XException
  {
    Configuration config = Configuration.getInstance();

    try
    {
      URL url = new URL(urlName);

      if ("https".equals(url.getProtocol())
          && (System.getProperty("javax.net.ssl.trustStore") == null))
      {
        System.setProperty("javax.net.ssl.trustStore",
            Constants.XBUS_ETC
                + config.getValue("Connection", "HTTP",
                    "Keystore"));
      }
    }
    catch (MalformedURLException e)
    {
View Full Code Here

  }

  private void setAuthentication(HttpClient client, HttpMethod method)
      throws XException
  {
    Configuration config = Configuration.getInstance();
    String user = config.getValueOptional(Constants.CHAPTER_SYSTEM,
        mDestination.getName(), "User");
    if (user != null)
    {
      String realm = config.getValueOptional(Constants.CHAPTER_SYSTEM,
          mDestination.getName(), "Realm");
      String password = config.getValueOptional(Constants.CHAPTER_SYSTEM,
          mDestination.getName(), "Password");
      HttpState state = client.getState();
      state.setCredentials(
          new AuthScope(client.getHostConfiguration().getHost(),
              client.getHostConfiguration().getPort(), realm),
          new UsernamePasswordCredentials(user, password));
      HttpClientParams params = new HttpClientParams();
      params.setAuthenticationPreemptive(config.getValueAsBooleanOptional(
          Constants.CHAPTER_SYSTEM, mDestination.getName(),
          "AuthenticationPreemptive"));
      client.setParams(params);
    }
  }
View Full Code Here

   */
  public Object execute(String function, Object callData) throws XException
  {
    Object retObject = null;

    Configuration config = Configuration.getInstance();
    int timeout = config.getValueAsIntOptional(Constants.CHAPTER_SYSTEM,
        mDestination.getName(), "Timeout") * 1000;
    if (timeout == 0)
    {
      timeout = Integer.MAX_VALUE;
    }
View Full Code Here

      callData = "";

    /*
     * Getting some parameters from the configuration
     */
    Configuration config = Configuration.getInstance();

    String host = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
        .getName(), "Host");
    String subject = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
        .getName(), "Subject");

    Address fromAddress;
    Address[] toAddresses;
    try
    {
      String address = null;
      Vector addressList = new Vector();
      address = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
          .getName(), "ToAddress1");
      int i = 1;
      while (address != null)
      {
        i++;
        addressList.add(address);
        address = config.getValueOptional(Constants.CHAPTER_SYSTEM,
            mDestination.getName(), "ToAddress" + i);
      }

      int amountAddresses = addressList.size();
      toAddresses = new Address[amountAddresses];
      for (int k = 0; k < amountAddresses; k++)
      {
        toAddresses[k] = new InternetAddress((String) addressList
            .elementAt(k));
      }

      String fromAddressString = config.getValue(
          Constants.CHAPTER_SYSTEM, mDestination.getName(),
          "FromAddress");
      String fromName = config.getValueOptional(Constants.CHAPTER_SYSTEM,
          mDestination.getName(), "FromName");
      if (fromName != null)
      {
        fromAddress = new InternetAddress(fromAddressString, fromName);
      }
      else
      {
        fromAddress = new InternetAddress(fromAddressString);
      }
    }
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
    }

    mUser = config.getValueOptional(Constants.CHAPTER_SYSTEM, mDestination
        .getName(), "User");
    if (mUser != null)
    {
      mPassword = config.getValue(Constants.CHAPTER_SYSTEM, mDestination
          .getName(), "Password");
    }

    /*
     * Setting the session
View Full Code Here

   *         from the system property
   * @exception XException if any errors occurs.
   */
  private String getEncoding() throws XException
  {
    Configuration config = Configuration.getInstance();

    String configEncoding = config.getValueOptional(
        Constants.CHAPTER_SYSTEM, mDestination.getName(),
        Constants.KEY_ENCODING);

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

  }

  static private String getInterfaceDescriptionFilename(String system)
      throws XException
  {
    Configuration config = Configuration.getInstance();
    String interfaceDescriptionFilename = config.getValue(
        Constants.CHAPTER_SYSTEM, system, "DescriptionFile");

    return new StringBuffer(Constants.XBUS_ETC).append(
        "InterfaceDescriptions").append(Constants.FILE_SEPERATOR)
        .append(interfaceDescriptionFilename).toString();
View Full Code Here

    {
      mConfigChapter = "DBConnection";
      mConfigSection = mName;
    }

    Configuration config = Configuration.getInstance();
    String driver = config.getValue(mConfigChapter, mConfigSection,
        "Driver");
    String url = config.getValueOptional(mConfigChapter, mConfigSection,
        "URL");

    mDBUrl = new StringBuffer();

    if (url != null)
    {
      mDBUrl.append(url);
    }
    else
    {
      String prefix = config.getValue(mConfigChapter, mConfigSection,
          "URLPrefix");
      String host = config.getValueOptional(mConfigChapter,
          mConfigSection, "Host");
      String port = config.getValueOptional(mConfigChapter,
          mConfigSection, "Port");
      String database = config.getValueOptional(mConfigChapter,
          mConfigSection, "Database");

      mDBUrl.append(prefix);

      if (host != null)
      {
        mDBUrl.append("://").append(host);
      }
      if (port != null)
      {
        mDBUrl.append(":").append(port);
      }
      if (database != null)
      {
        mDBUrl.append("/").append(database);
      }
    }

    ReflectionSupport.classForName(driver);

    open();

    mDBConnections.put(getFullName(mName), this);

    /*
     * DBConnection will only be registered in TAManager when AutoCommit =
     * false
     */
    if (!config.getValueAsBoolean(mConfigChapter, mConfigSection,
        "AutoCommit"))
    {
      TAManager.getInstance().registerResource(this);
    }
  }
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.