Examples of SortedProperties


Examples of org.h2.util.SortedProperties

     */
    synchronized void saveProperties(Properties prop) {
        try {
            if (prop == null) {
                Properties old = loadProperties();
                prop = new SortedProperties();
                prop.setProperty("webPort", "" + SortedProperties.getIntProperty(old, "webPort", port));
                prop.setProperty("webAllowOthers", "" + SortedProperties.getBooleanProperty(old, "webAllowOthers", allowOthers));
                prop.setProperty("webSSL", "" + SortedProperties.getBooleanProperty(old, "webSSL", ssl));
            }
            ArrayList<ConnectionInfo> settings = getSettings();
View Full Code Here

Examples of org.h2.util.SortedProperties

        }

        public void run() {
            while (!stopNow) {
                try {
                    SortedProperties sp = new SortedProperties();
                    if (file.exists()) {
                        InputStream in = FileUtils.newInputStream(file.getName());
                        sp.load(in);
                        translation.putAll(sp);
                    } else {
                        OutputStream out = FileUtils.newOutputStream(file.getName(), false);
                        sp.putAll(translation);
                        sp.store(out, "Translation");
                    }
                    Thread.sleep(1000);
                } catch (Exception e) {
                    traceError(e);
                }
View Full Code Here

Examples of org.h2.util.SortedProperties

    private void lockSerialized() {
        method = SERIALIZED;
        fs.createDirs(fileName);
        if (fs.createNewFile(fileName)) {
            properties = new SortedProperties();
            properties.setProperty("method", String.valueOf(method));
            setUniqueId();
            save();
        } else {
            while (true) {
View Full Code Here

Examples of org.h2.util.SortedProperties

        }
    }

    private void lockFile() {
        method = FILE;
        properties = new SortedProperties();
        properties.setProperty("method", String.valueOf(method));
        setUniqueId();
        fs.createDirs(fileName);
        if (!fs.createNewFile(fileName)) {
            waitUntilOld();
View Full Code Here

Examples of org.h2.util.SortedProperties

        watchdog.start();
    }

    private void lockSocket() {
        method = SOCKET;
        properties = new SortedProperties();
        properties.setProperty("method", String.valueOf(method));
        setUniqueId();
        // if this returns 127.0.0.1,
        // the computer is probably not networked
        ipAddress = NetUtils.getLocalAddress();
View Full Code Here

Examples of org.h2.util.SortedProperties

     */
    synchronized void saveSettings(Properties prop) {
        try {
            if (prop == null) {
                Properties old = loadProperties();
                prop = new SortedProperties();
                prop.setProperty("webPort", "" + SortedProperties.getIntProperty(old, "webPort", port));
                prop.setProperty("webAllowOthers", "" + SortedProperties.getBooleanProperty(old, "webAllowOthers", ssl));
                prop.setProperty("webSSL", "" + SortedProperties.getBooleanProperty(old, "webSSL", allowOthers));
            }
            ArrayList<ConnectionInfo> settings = getSettings();
View Full Code Here

Examples of org.h2.util.SortedProperties

        }

        public void run() {
            while (!stopNow) {
                try {
                    SortedProperties sp = new SortedProperties();
                    if (file.exists()) {
                        InputStream in = IOUtils.openFileInputStream(file.getName());
                        sp.load(in);
                        translation.putAll(sp);
                    } else {
                        OutputStream out = IOUtils.openFileOutputStream(file.getName(), false);
                        sp.putAll(translation);
                        sp.store(out, "Translation");
                    }
                    Thread.sleep(1000);
                } catch (Exception e) {
                    traceError(e);
                }
View Full Code Here

Examples of org.h2.util.SortedProperties

        return "admin.jsp";
    }

    private String adminSave() {
        try {
            Properties prop = new SortedProperties();
            int port = Integer.decode((String) attributes.get("port"));
            prop.setProperty("webPort", String.valueOf(port));
            server.setPort(port);
            boolean allowOthers = Boolean.valueOf((String) attributes.get("allowOthers")).booleanValue();
            prop.setProperty("webAllowOthers", String.valueOf(allowOthers));
            server.setAllowOthers(allowOthers);
            boolean ssl = Boolean.valueOf((String) attributes.get("ssl")).booleanValue();
            prop.setProperty("webSSL", String.valueOf(ssl));
            server.setSSL(ssl);
            server.saveSettings(prop);
        } catch (Exception e) {
            trace(e.toString());
        }
View Full Code Here

Examples of org.jamwiki.utils.SortedProperties

  /**
   *
   */
  private void translate(HttpServletRequest request, WikiPageInfo pageInfo) throws Exception {
    // first load existing translations
    SortedProperties translations = new SortedProperties();
    String language = this.retrieveLanguage(request);
    if (!StringUtils.isBlank(language)) {
      String filename = filename(language);
      translations.putAll(Environment.loadProperties(filename));
    }
    // now update with translations from the request
    Enumeration names = request.getParameterNames();
    String name;
    while (names.hasMoreElements()) {
      name = (String)names.nextElement();
      if (!name.startsWith("translations[") || !name.endsWith("]")) {
        continue;
      }
      String key = name.substring("translations[".length(), name.length() - "]".length());
      String value = request.getParameter(name);
      translations.setProperty(key, value);
    }
    Environment.saveProperties(filename(language), translations, null);
    this.writeTopic(request, pageInfo);
  }
View Full Code Here

Examples of org.jamwiki.utils.SortedProperties

  /**
   *
   */
  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String language = this.retrieveLanguage(request);
    SortedProperties translations = new SortedProperties(Environment.loadProperties("ApplicationResources.properties"));
    if (!StringUtils.isBlank(language)) {
      String filename = filename(language);
      // add all translated keys to the base translation list
      translations.putAll(Environment.loadProperties(filename));
      // if the user wants to see only untranslated values, return the intersection of the base
      // translation list and the translated file list
      if (BooleanUtils.toBoolean(request.getParameter("hideTranslated"))) {
        Map tmp = Utilities.intersect(translations, Environment.loadProperties("ApplicationResources.properties"));
        translations = new SortedProperties();
        translations.putAll(tmp);
        next.addObject("hideTranslated", true);
      }
    }
    pageInfo.setContentJsp(JSP_ADMIN_TRANSLATION);
    pageInfo.setAdmin(true);
    pageInfo.setPageTitle(new WikiMessage("translation.title"));
    next.addObject("translations", new TreeMap(translations));
    next.addObject("codes", this.retrieveTranslationCodes());
    next.addObject("language", language);
    SortedProperties defaultTranslations = new SortedProperties(Environment.loadProperties("ApplicationResources.properties"));
    next.addObject("defaultTranslations", new TreeMap(defaultTranslations));
  }
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.