Ejemplo n.º 1
0
 /** ** Adds an entry ({@link Entry}) to <code>RTKey</code> */
 public static void addRuntimeEntry(Entry dftEntry) {
   if (dftEntry != null) {
     String rtKey = dftEntry.getKey();
     if (rtKey != null) {
       RTKey.getRuntimeEntryMap().put(rtKey, dftEntry);
       defaultProperties = null;
     }
   }
 }
Ejemplo n.º 2
0
 public static void addRuntimeEntries(Entry dftEntry[]) {
   if (dftEntry != null) {
     Map<String, Entry> gblmap = RTKey.getRuntimeEntryMap();
     for (int i = 0; i < dftEntry.length; i++) {
       String rtKey = dftEntry[i].getKey();
       if (rtKey != null) {
         gblmap.put(rtKey, dftEntry[i]);
       }
     }
     defaultProperties = null;
   }
 }
Ejemplo n.º 3
0
 /**
  * ** Gets all the ddefault properties in <code>RTKey</code> represented ** as an {@link
  * RTProperties} instance ** @return The <code>RTProperties</code> instance
  */
 public static RTProperties getDefaultProperties() {
   if (defaultProperties == null) {
     RTProperties rtp = new RTProperties();
     for (Iterator<Entry> v = RTKey.getRuntimeEntryMap().values().iterator(); v.hasNext(); ) {
       Entry rtk = v.next();
       if (!rtk.isHelp()) {
         String key = rtk.getKey();
         Object val = rtk.getDefault();
         rtp.setProperty(key, val);
       }
     }
     defaultProperties = rtp;
   }
   return defaultProperties;
 }
Ejemplo n.º 4
0
  /**
   * ** Prints all the default values from <code>RTKey</code> and {@link RTConfig} ** to the
   * specified <code>PrintStream</code>. Used for debugging/testing ** @param out The <code>
   * PrintStream</code>
   */
  public static void printDefaults(PrintStream out) {

    /* print standard runtime entries */
    Set<String> keyList = new OrderedSet<String>();
    String keyGrp = null;

    for (Iterator<Entry> v = RTKey.getRuntimeEntryMap().values().iterator(); v.hasNext(); ) {
      Entry rtk = v.next();
      if (rtk.isHelp()) {
        out.println("");
        out.println("# ===== " + rtk.getHelp());
      } else {
        Object dft = rtk.getDefault();
        out.println("# --- " + rtk.getHelp());
        out.println("# " + rtk.toString(dft));
        String key = rtk.getKey();
        keyList.add(key);
        if (!key.equals(CONFIG_FILE) && RTConfig.hasProperty(key)) {
          String val = RTConfig.getString(key, null);
          // if ((val != null) && ((dft == null) || !val.equals(dft.toString()))) {
          out.println(rtk.toString(val));
          // }
        }
      }
    }

    /* orphaned entries */
    RTProperties cmdLineProps = RTConfig.getConfigFileProperties();
    if (cmdLineProps != null) {
      boolean orphanHeader = false;
      for (Iterator i = cmdLineProps.keyIterator(); i.hasNext(); ) {
        Object k = i.next();
        if (!k.equals(COMMAND_LINE_CONF) && !keyList.contains(k)) {
          if (!orphanHeader) {
            out.println("");
            out.println("# ===== Other entries");
            orphanHeader = true;
          }
          Object v = cmdLineProps.getProperty(k, null);
          out.println(k + "=" + ((v != null) ? v : NULL_VALUE));
        }
      }
    }

    /* final blank line */
    out.println("");
  }
Ejemplo n.º 5
0
 /**
  * ** Gets the entry associated with the specified key ** @param key The key of the entry to get
  * ** @return The entry
  */
 protected static Entry getRuntimeEntry(String key) {
   return (key != null) ? RTKey.getRuntimeEntryMap().get(key) : null;
 }
Ejemplo n.º 6
0
 /** ** Gets an iterator over all of the entries ** @return The iterator over the entries */
 public static Iterator<String> getRuntimeKeyIterator() {
   return RTKey.getRuntimeEntryMap().keySet().iterator();
 }