Package tools

Class BootstrapLoader

java.lang.Object
tools.BootstrapLoader

public class BootstrapLoader extends Object
This class tries to initialize two parameters: bundle.conf and bundle.home. The initialization process has three main steps to determine this folder:
  • Checks if bundle.conf and bundle.home are provided trough system properties. If they are, search is over.
  • Tries to locate file bundle.properties on classpath. If successful, parameters are loaded from the file or location of bundle.properties is used instead.
  • If nothing of above works, then current folder is used.
Author:
igor@scictrl.com
  • Field Details

    • BUNDLE_CONF

      public static final String BUNDLE_CONF
      Configuration folder of this bundle/installation. Usually should be under bundle.home.
      See Also:
    • BUNDLE_HOME

      public static final String BUNDLE_HOME
      Home (installation) folder of this bundle/installation.
      See Also:
    • BUNDLE_LOG

      public static final String BUNDLE_LOG
      Logging folder of this bundle/installation.
      See Also:
    • BUNDLE_LOG_FILE

      public static final String BUNDLE_LOG_FILE
      Logging file of this bundle/installation.
      See Also:
    • BUNDLE_CONF_FILE_NAME

      public static final String BUNDLE_CONF_FILE_NAME
      File name, which could contain bundle_home and bundle_conf.
      See Also:
  • Constructor Details

    • BootstrapLoader

      public BootstrapLoader(Properties bootstrap)
      Creates instance of bootstrap loader.
      Parameters:
      bootstrap - the bootstrap parameters. System parameters should be used if nothing else is available.
  • Method Details

    • main

      public static void main(String[] args)

      main.

      Parameters:
      args - an array of String objects
    • checkLogging

      public static final void checkLogging()

      checkLogging.

    • getInstance

      public static final BootstrapLoader getInstance()

      getInstance.

      Returns:
      a BootstrapLoader object
    • getBundleConfDir

      public File getBundleConfDir()

      getBundleConfDir.

      Returns:
      a File object
    • getBundleHomeDir

      public File getBundleHomeDir()

      getBundleHomeDir.

      Returns:
      a File object
    • getProperty

      public String getProperty(String key)

      getProperty.

      Parameters:
      key - a String object
      Returns:
      a String object
    • getProperty

      public String getProperty(String key, String def)

      getProperty.

      Parameters:
      key - a String object
      def - a String object
      Returns:
      a String object
    • getApplicationConfigFile

      public File getApplicationConfigFile(String appName, String appConfFile)

      getApplicationConfigFile.

      Parameters:
      appName - a String object
      appConfFile - a String object
      Returns:
      a File object
    • getApplicationConfigFolder

      public File getApplicationConfigFolder(String appName)

      getApplicationConfigFolder.

      Parameters:
      appName - a String object
      Returns:
      a File object
    • getApplicationConfigProperties

      public Properties getApplicationConfigProperties(String appName, String appConfFile) throws IOException

      getApplicationConfigProperties.

      Parameters:
      appName - a String object
      appConfFile - a String object
      Returns:
      a Properties object
      Throws:
      IOException - if any.
    • substitute

      public String substitute(String str)
      Substitutes (replaces) occurrences of property macros (example ${property.name}) with values if they are available in bundle or System properties.
      Parameters:
      str - a String object
      Returns:
      a String object
    • loadIcon

      public ImageIcon loadIcon(String icon)

      loadIcon.

      Parameters:
      icon - a String object
      Returns:
      a ImageIcon object