示例#1
0
  /**
   * Loads the configuration
   *
   * @throws ConfigurationException
   */
  public void load() throws ConfigurationException {
    System.out.println("Loading configuration..."); // $NON-NLS-1$
    properties.clear();
    fixedProperties.clear();

    System.out.println("-> loading default properties");
    loadDefaultCfg();
    System.out.println("-> loading fixed properties");
    loadFixedCfg();
    System.out.println("-> loading system properties");
    loadSystemCfgFile();
    System.out.println("-> loading local properties");
    loadLocalCfgFile();
    // Try to define userHome from the config file
    System.out.println("-> setting user home");
    userHome = new File(System.getProperty("user.home"));
    String confHome = getProperty(USER_HOME_P);
    if ((confHome != null) && !confHome.equals("")) userHome = new File(confHome);
    String myDocString = getProperty(USER_DIRNAME_P);
    if ((myDocString != null) && (!myDocString.equals(""))) {
      File myDocDir = new File(userHome, myDocString);
      if (myDocDir.exists()) userHome = myDocDir;
    }
    // Check if we are in execution mode
    System.out.println("-> checking execution mode");
    testExecutionMode();
    System.out.println("-> loading scripting languages");
    loadScriptingLanguages(fixedProperties);
    System.out.println("-> langage " + getLanguage() + " is used");
    defaultLanguage = (getLanguage().compareTo(getDefaultLanguage()) == 0);
    System.out.println("-> loading localized messages");
    // Load localized messages
    try {
      // loads the language
      Messages.loadLocalizedResource(getLanguage());
      org.colombbus.tangara.net.Messages.loadLocalizedResource(getLanguage());
    } catch (Throwable th) {
      System.err.println("error while loading language configuration: " + th);
    }
    System.out.println("-> loading package info");
    loadPackageInfo(fixedProperties);
    System.out.println("-> loading engine");
    loadEngine(defaultEngineName);
    System.out.println("-> loading objects");
    loadObjects();
    System.out.println("Configuration loaded"); // $NON-NLS-1$
  }
示例#2
0
 public void clear() {
   if (super.size() > 0) super.clear();
   // if (comment_blocks.size() > 0)
   //    comment_blocks.clear();
   keys.setSize(0);
 }