Examples of PropertiesPersister


Examples of org.netbeans.gradle.project.persistent.PropertiesPersister

    private static CachedProperties loadPropertiesAlways(
            final NbGradleProject project,
            File propertiesFile) {

        final CachedProperties result = new CachedProperties(new MemProjectProperties());
        final PropertiesPersister persister = new XmlPropertiesPersister(propertiesFile);
        PropertiesPersister.PERSISTER_PROCESSOR.execute(Cancellation.UNCANCELABLE_TOKEN, new CancelableTask() {
                @Override
                public void execute(CancellationToken cancelToken) {
                persister.load(result, false, new Runnable() {
                    @Override
                    public void run() {
                        try {
                            result.signalPropertiesLoaded();
                        } finally {
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

    return new File(dataDirectory, sequenceFormatter.getFormattedName(sequenceNumber, ".osc.gz"));
  }


  private ReplicationState getReplicationState(long sequenceNumber) {
    PropertiesPersister persister = new PropertiesPersister(getStateFile(sequenceNumber));
    ReplicationState state = new ReplicationState();
    state.load(persister.loadMap());

    return state;
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

   *
   * @param configFile
   *            The configuration file to read from.
   */
  public IntervalDownloaderConfiguration(File configFile) {
    properties = new PropertiesPersister(configFile).load();
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

   *
   * @param configFile
   *            The configuration file to read from.
   */
  public ReplicationFileMergerConfiguration(File configFile) {
    properties = new PropertiesPersister(configFile).load();
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

   *
   * @param configFile
   *            The configuration file to read from.
   */
  public ReplicationDownloaderConfiguration(File configFile) {
    properties = new PropertiesPersister(configFile).load();
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

  private void runImpl() {
    try {
      ReplicationDownloaderConfiguration configuration;
      ReplicationState serverState;
      ReplicationState localState;
      PropertiesPersister localStatePersistor;
     
      // Instantiate utility objects.
      configuration = new ReplicationDownloaderConfiguration(new File(workingDirectory, CONFIG_FILE));
     
      // Obtain the server state.
      LOG.fine("Reading current server state.");
      serverState = serverStateReader.getServerState(configuration.getBaseUrl());
     
      // Build the local state persister which is used for both loading and storing local state.
      localStatePersistor = new PropertiesPersister(new File(workingDirectory, LOCAL_STATE_FILE));
     
      // Begin processing.
      processInitialize(Collections.<String, Object>emptyMap());
     
      // If local state isn't available we need to copy server state to be the initial local state
      // then exit.
      if (localStatePersistor.exists()) {
        localState = new ReplicationState(localStatePersistor.loadMap());
       
        // Download and process the replication files.
        localState = download(configuration, serverState, localState);
       
      } else {
        localState = serverState;
       
        processInitializeState(localState);
      }
     
      // Commit downstream changes.
      processComplete();
     
      // Persist the local state.
      localStatePersistor.store(localState.store());
     
    } finally {
      processRelease();
    }
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

    // Create the lock object used to ensure only a single process attempts
    // to write to the data directory.
    fileLock = new FileBasedLock(new File(workingDirectory, LOCK_FILE));

    // Create the object used to persist current state.
    statePersistor = new PropertiesPersister(new File(workingDirectory, STATE_FILE));
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

    return pathPrefix + "/replicationData/" + requestSequenceNumber + "/tail";
  }


  private ReplicationState loadState(File stateFile) {
    PropertiesPersister persister = new PropertiesPersister(stateFile);
    ReplicationState state = new ReplicationState();
    state.load(persister.loadMap());

    return state;
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

   */
  private void getLag() {
    ReplicationDownloaderConfiguration configuration;
    ReplicationState serverState;
    ReplicationState localState;
    PropertiesPersister localStatePersistor;
   
    // Instantiate utility objects.
    configuration = new ReplicationDownloaderConfiguration(new File(workingDirectory, CONFIG_FILE));
   
    // Obtain the server state.
    LOG.fine("Reading current server state.");
    serverState = serverStateReader.getServerState(configuration.getBaseUrl());
   
    // Build the local state persister which is used for both loading and storing local state.
    localStatePersistor = new PropertiesPersister(new File(workingDirectory, LOCAL_STATE_FILE));
   
    // If local state isn't available we need to fail because no lag can be calculated.
    if (!localStatePersistor.exists()) {
      throw new OsmosisRuntimeException("Can't read local state.");
    }
   
    // fetch the local state from the file
    localState = new ReplicationState(localStatePersistor.loadMap());
   
    // extract the time of the local and the remote state files
    long local = localState.getTimestamp().getTime();
    long server = serverState.getTimestamp().getTime();
   
View Full Code Here

Examples of org.openstreetmap.osmosis.core.util.PropertiesPersister

   *            If true, the current state will be updated by the
   *            {@link #saveState(ReplicationState)} operation as well as the
   *            sequenced state.
   */
  public FileReplicationStore(File storeDirectory, boolean saveCurrentState) {
    currentStatePersister = new PropertiesPersister(new File(storeDirectory, STATE_FILE));
    sequenceFormatter = new ReplicationFileSequenceFormatter(storeDirectory);
    this.saveCurrentState = saveCurrentState;
  }
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.