Examples of SortedProperties


Examples of de.innovationgate.eclipse.utils.wga.SortedProperties

    msgBox.setMessage("Are you really sure that you want to sort the labelfile: \n" + _file.getFullPath());
    int response = msgBox.open();

    if (response == SWT.YES) {

      SortedProperties sortedProperties = new SortedProperties();
      sortedProperties.putAll(_props);
      FileOutputStream labelFileStream = null;
      try {
        labelFileStream = new FileOutputStream(_file.getLocation().toString());
        sortedProperties.store(labelFileStream, null);
        _file.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
      } catch (IOException e) {
        WGADesignerPlugin.getDefault().logInfo("Unable to store file: " + _file.getLocation(), e);
      } catch (CoreException e) {
        WGADesignerPlugin.getDefault().logInfo("Unable to refresh resource on: " + _file.getLocation(), e);
View Full Code Here

Examples of net.bnubot.util.SortedProperties

      if(is == null) {
        // Failed to determine the bot version
        Out.fatalException(new FileNotFoundException(vpPath));
      }

      Properties versionprops = new SortedProperties();
      versionprops.load(is);
      is.close();

      Integer VER_SVN_REVISION_FILE = null;
      if(versionprops.containsKey(sReleaseType))
        RELEASE_TYPE = ReleaseType.valueOf((String)versionprops.get(sReleaseType));
      if(versionprops.containsKey(sVerMajor))
        VER_MAJOR = Integer.parseInt((String)versionprops.get(sVerMajor));
      if(versionprops.containsKey(sVerMinor))
        VER_MINOR = Integer.parseInt((String)versionprops.get(sVerMinor));
      if(versionprops.containsKey(sVerRevision))
        VER_REVISION = Integer.parseInt((String)versionprops.get(sVerRevision));
      if(versionprops.containsKey(sVerRelease))
        VER_RELEASE = Integer.parseInt((String)versionprops.get(sVerRelease));
      if(versionprops.containsKey(sVerSVNRevision))
        VER_SVN_REVISION_FILE = Integer.parseInt((String)versionprops.get(sVerSVNRevision));

      // From a JAR has no src folder; from Eclipse has no JAR
      if(fromJar != (revision() == null))
        throw new IllegalStateException();

      if(fromJar) {
        BUILD_DATE = new Date(Long.parseLong(versionprops.getProperty(sBuildDate)));
        VER_SVN_REVISION = VER_SVN_REVISION_FILE;
      } else {
        BUILD_DATE = new Date();
        versionprops.setProperty(sBuildDate, Long.toString(BUILD_DATE.getTime()));

        if((VER_SVN_REVISION_FILE == null) || (VER_SVN_REVISION > VER_SVN_REVISION_FILE)) {
          Out.info(CurrentVersion.class, "File version (" + VER_SVN_REVISION_FILE + ") does not match calculated (" + VER_SVN_REVISION + ").");

          RELEASE_TYPE = ReleaseType.Development;
          versionprops.setProperty(sReleaseType, RELEASE_TYPE.name());
          versionprops.setProperty(sVerSVNRevision, Integer.toString(VER_SVN_REVISION));
        }
      }

      VER = new VersionNumber(RELEASE_TYPE, VER_MAJOR, VER_MINOR, VER_REVISION, VER_RELEASE, VER_SVN_REVISION, BUILD_DATE);
      if(!fromJar)
        versionprops.store(new FileOutputStream(f), VER.toString());
      return VER;
    } catch(Exception e) {
      Out.exception(e);
      throw new IllegalStateException(e.getMessage(), e);
    }
View Full Code Here

Examples of net.bnubot.util.SortedProperties

    }
  }

  public static void setVersion(VersionNumber vnCurrent) {
    try {
      Properties versionprops = new SortedProperties();

      versionprops.setProperty(sReleaseType, vnCurrent.getReleaseType().name());
      versionprops.setProperty(sVerMajor, vnCurrent.getMajor().toString());
      versionprops.setProperty(sVerMinor, vnCurrent.getMinor().toString());
      versionprops.setProperty(sVerRevision, vnCurrent.getRevision().toString());
      versionprops.setProperty(sVerRelease, vnCurrent.getRelease().toString());
      versionprops.setProperty(sVerSVNRevision, vnCurrent.getSvnRevision().toString());
      versionprops.setProperty(sBuildDate, Long.toString(vnCurrent.getBuildDate().getTime()));

      File file = new File("src/net/bnubot/version.properties");
      versionprops.store(new FileOutputStream(file), VER.toString());
    } catch (Exception e) {
      Out.exception(e);
      throw new IllegalStateException(e.getMessage(), e);
    }
  }
View Full Code Here

Examples of org.h2.util.SortedProperties

        Connection conn = DriverManager.getConnection(writeUrl, "sa", "sa");
        Statement stat = conn.createStatement();
        stat.execute("create table test(id int primary key)");
        Thread.sleep(100);
        String propFile = getBaseDir() + "/fileLockSerialized.lock.db";
        SortedProperties p = SortedProperties.loadProperties(propFile);
        p.setProperty("changePending", "true");
        p.setProperty("modificationDataId", "1000");
        OutputStream out = IOUtils.openFileOutputStream(propFile, false);
        try {
            p.store(out, "test");
        } finally {
            out.close();
        }
        Thread.sleep(100);
        stat.execute("select * from test");
View Full Code Here

Examples of org.h2.util.SortedProperties

        Connection connServer = getConnection(url + ";OPEN_NEW=TRUE", user, password);

        int i = ITERATIONS;
        for (; i > 0; i--) {
            Thread.sleep(100);
            SortedProperties prop = SortedProperties.loadProperties(getBaseDir() + "/autoServer.lock.db");
            String key = prop.getProperty("id");
            String server = prop.getProperty("server");
            if (server != null) {
                String u2 = url.substring(url.indexOf(";"));
                u2 = "jdbc:h2:tcp://" + server + "/" + key + u2;
                Connection conn = DriverManager.getConnection(u2, user, password);
                conn.close();
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

        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.saveProperties(prop);
        } catch (Exception e) {
            trace(e.toString());
        }
View Full Code Here

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
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.