/** Get root url for a given weblog. Optionally for a certain locale. */
  public String getPlanetURL(String planet) {

    if (planet == null) {
      return null;
    }

    StringBuffer url = new StringBuffer();

    PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();

    url.append(PlanetRuntimeConfig.getProperty("site.absoluteurl"));
    url.append("/").append(planet).append("/");

    return url.toString();
  }
  /**
   * This method compares the property definitions in the RuntimeConfigDefs file with the properties
   * in the given Map and initializes any properties that were not found in the Map.
   *
   * <p>If the Map of props is empty/null then we will initialize all properties.
   */
  private Map initializeMissingProps(Map props) {

    if (props == null) props = new HashMap();

    // start by getting our runtimeConfigDefs
    RuntimeConfigDefs runtimeConfigDefs = PlanetRuntimeConfig.getRuntimeConfigDefs();

    // can't do initialization without our config defs
    if (runtimeConfigDefs == null) return props;

    // iterator through all the definitions and add properties
    // that are not already in our props map
    ConfigDef configDef = null;
    DisplayGroup dGroup = null;
    PropertyDef propDef = null;
    Iterator defs = runtimeConfigDefs.getConfigDefs().iterator();
    while (defs.hasNext()) {
      configDef = (ConfigDef) defs.next();

      Iterator groups = configDef.getDisplayGroups().iterator();
      while (groups.hasNext()) {
        dGroup = (DisplayGroup) groups.next();

        Iterator propdefs = dGroup.getPropertyDefs().iterator();
        while (propdefs.hasNext()) {
          propDef = (PropertyDef) propdefs.next();

          // do we already have this prop?  if not then add it
          if (!props.containsKey(propDef.getName())) {
            RuntimeConfigProperty newprop =
                new RuntimeConfigProperty(propDef.getName(), propDef.getDefaultValue());

            props.put(propDef.getName(), newprop);

            log.info(
                "Found uninitialized property "
                    + propDef.getName()
                    + " ... setting value to ["
                    + propDef.getDefaultValue()
                    + "]");
          }
        }
      }
    }

    return props;
  }