Examples of SortedProperties


Examples of org.jamwiki.utils.SortedProperties

   *          defaults.
   * @return The loaded SortedProperties object.
   */
  public static SortedProperties loadProperties(String propertyFile,
      Properties def) {
    SortedProperties properties = new SortedProperties();
    if (def != null) {
      properties = new SortedProperties(def);
    }
    File file = null;
    FileInputStream fis = null;
    try {
      file = findProperties(propertyFile);
      if (file == null) {
        logger.warning("Property file " + propertyFile + " does not exist");
      } else if (!file.exists()) {
        logger.warning("Property file " + file.getPath() + " does not exist");
      } else {
        logger.config("Loading properties from " + file.getPath());
        fis = new FileInputStream(file);
        properties.load(fis);
      }
    } catch (IOException e) {
      logger.severe("Failure while trying to load properties file "
          + file.getPath(), e);
    } finally {
      if (fis != null) {
        try {
          fis.close();
        } catch (IOException e) {
          // NOPMD
        }
      }
    }
    properties.loadFromDatastore();
    return properties;
  }
View Full Code Here

Examples of org.lealone.util.SortedProperties

    private static String remapURL(String url) {
        String urlMap = SysProperties.URL_MAP;
        if (urlMap != null && urlMap.length() > 0) {
            try {
                SortedProperties prop;
                prop = SortedProperties.loadProperties(urlMap);
                String url2 = prop.getProperty(url);
                if (url2 == null) {
                    prop.put(url, "");
                    prop.store(urlMap);
                } else {
                    url2 = url2.trim();
                    if (url2.length() > 0) {
                        return url2;
                    }
View Full Code Here

Examples of org.olat.core.util.SortedProperties

      if (props == null || !resolveRecursively) {
        InputStream is = null;
        try {
          // Start with an empty property object
          // Use a sorted properties object that saves the keys sorted alphabetically to disk
          props = new SortedProperties();
          //
          // 1) Try to load the bundle from a configured source path
          // This is also used to load the overlay properties
          File baseDir = I18nModule.getPropertyFilesBaseDir(locale, bundleName);
          if (baseDir != null) {
View Full Code Here

Examples of org.olat.core.util.SortedProperties

    File transToolBrasatoLanguagesDirI18n = new File(transToolBrasatoLanguagesDir, i18nDirRelPath);
    File newPropertiesFile = new File(transToolBrasatoLanguagesDirI18n, I18nModule.LOCAL_STRINGS_FILE_PREFIX + localeKey
        + I18nModule.LOCAL_STRINGS_FILE_POSTFIX);
    // Prepare property file
    // Use a sorted properties object that saves the keys sorted alphabetically to disk
    Properties newProperties = new SortedProperties();
    if (StringHelper.containsNonWhitespace(languageInEnglish)) {
      newProperties.setProperty("this.language.in.english", languageInEnglish);
    }
    if (StringHelper.containsNonWhitespace(languageTranslated)) {
      newProperties.setProperty("this.language.translated", languageTranslated);
    }
    if (StringHelper.containsNonWhitespace(authors)) {
      newProperties.setProperty("this.language.translator.names", authors);
    }

    OutputStream fileStream = null;
    try {
      // create necessary directories
      File directory = newPropertiesFile.getParentFile();
      if (!directory.exists()) directory.mkdirs();
      // write to file file now
      fileStream = new FileOutputStream(newPropertiesFile);
      newProperties.store(fileStream, null);
      fileStream.flush();
    } catch (FileNotFoundException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath(), e);
    } catch (IOException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath()
View Full Code Here

Examples of org.opentides.bean.SortedProperties

          missed.setName(name.getValue());
          // set the class
          Attribute clazz = elem.attribute("class");
          missed.setClazz(clazz.getValue());
          List<Element> props =elem.elements("property");
          Properties property = new SortedProperties();
          for (Element prop:props) {
            String propName = prop.attributeValue("name");
            String propValue = prop.attributeValue("value");
            if ("prompt.type".equals(propName)) {
              missed.setType(propValue);
            } else if ("prompt.query".equals(propName)) {
              // extract the native query to database             
              String queryName = propValue;
              if(!StringUtil.isEmpty(queryName)){
                //try to match :[paramName]
                Matcher matcher = Pattern.compile(":(\\w+)").matcher(queryName);
                while (matcher.find()) {
                  String paramName = matcher.group(0).substring(1);
                  if (!StringUtil.isEmpty(paramName) && requestParams.get(paramName)!=null){
                    String[] paramValueArr = requestParams.get(paramName);
                    String paramValue = StringUtil.explode(',', paramValueArr);
                    queryName = queryName.replaceAll(":" + paramName, paramValue);
                  }
                }
              }
             
              List<Object[]> rs = ((ReportDAO) getDao()).getParamOptionResults(queryName);
              for (Object[] option : rs) {
                property.put(Long.valueOf(option[1].toString()), option[0].toString());
              }
            }else if("prompt.command".equals(propName)){
              missed.setType(propName);
              property.put(propValue, dynamicParameters.get(propValue));
            }else
              property.put(propName, propValue);
          }
          missed.setProperties(property);
          missing.add(missed);
        }
      }
View Full Code Here

Examples of org.opentides.bean.SortedProperties

   * @param header
   */
  public static void saveProperty(String filename, Properties properties, String header) {
    OutputStream out = null;
    try {
      Properties sortedProperties = new SortedProperties(properties);
      File f = new File(filename);
      out = new FileOutputStream(f);
      sortedProperties.store(out, header);
    } catch (Exception e) {
      _log.error(e,e);
    } finally {
      try {
        out.close();
View Full Code Here

Examples of simpleserver.config.SortedProperties

  protected static final String DELIMITER = ",";
  protected final int valueCount;

  public PropertiesExport(String name, int valueCount) {
    filename = name;
    properties = new SortedProperties();
    this.valueCount = valueCount;
    header = null;
  }
View Full Code Here

Examples of simpleserver.config.SortedProperties

  protected String getComment() {
    return null;
  }

  protected void loadDefaults() {
    defaultOptions = new SortedProperties();
    InputStream stream = getClass().getResourceAsStream(resourceLocation + "/"
        + filename);
    try {
      try {
        defaultOptions.load(stream);
View Full Code Here

Examples of simpleserver.config.SortedProperties

    return "Generated by SimpleServer\nDO NOT EDIT THIS FILE!";
  }

  @Override
  protected void loadDefaults() {
    defaultOptions = new SortedProperties();
  }
View Full Code Here

Examples of tcg.common.util.SortedProperties

  }

  public static synchronized boolean saveSnapshot(DataStore datastore, File file)
  {
    //create a sorted properties for all datapoints
    SortedProperties snapshot = new SortedProperties();
    datastore.getDataTable().createSnapshot(snapshot);
   
    //maybe should check if the file exist and what todo if it is
    //TODO
   
    //save it into the file
    try
    {
      snapshot.store(new FileOutputStream(file.getAbsolutePath()), null);
    }
    catch (IOException ioe)
    {
      logger_.error("Can not create snapshot file: " + file.getAbsolutePath());
      logger_.error("Exception: " + ioe.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.