Package org.openstreetmap.osmosis.core.sort.v0_6

Examples of org.openstreetmap.osmosis.core.sort.v0_6.ChangeSorter


      EntityContainer base = null;
      ChangeContainer change = null;
      Map<String, Object> metaData;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // Initialise the pipeline with a combination of the metadata from
      // both inputs. The change stream metadata will be applied second
      // and will override any values with the same key.
      metaData = new HashMap<String, Object>();
View Full Code Here


      EntityContainerComparator comparator;
      EntityContainer entityContainer0 = null;
      EntityContainer entityContainer1 = null;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // We can't get meaningful data from the initialize data on the
      // input streams, so pass empty meta data to the sink and discard
      // the input meta data.
      postbox0.outputInitialize();
View Full Code Here

    FileBasedSort<T> sortingStore;
   
    sortingStore =
      new FileBasedSort<T>(
        new SingleClassObjectSerializationFactory(entityMapper.getEntityClass()),
        new EntitySubClassComparator<T>(new EntityByTypeThenIdComparator()), true);
   
    try {
      String sql;
      SortingStoreRowMapperListener<T> storeListener;
      RowMapperRowCallbackListener<T> rowCallbackListener;
View Full Code Here

      EntityContainer fromEntityContainer = null;
      EntityContainer toEntityContainer = null;
      TimestampSetter timestampSetter;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // Create an object for setting the current timestamp on entities being deleted.
      timestampSetter = new TimestampSetter();
     
      // We can't get meaningful data from the initialize data on the
View Full Code Here

      EntityContainerComparator comparator;
      ChangeContainer changeContainer0 = null;
      ChangeContainer changeContainer1 = null;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdThenVersionComparator());
     
      // We can't get meaningful data from the initialize data on the
      // input streams, so pass empty meta data to the sink and discard
      // the input meta data.
      postbox0.outputInitialize();
View Full Code Here

    factoryMap = new HashMap<String, TaskManagerFactory>();

    // Configure factories that require additional information.
    entitySorterFactory06 = new EntitySorterFactory();
    entitySorterFactory06.registerComparator("TypeThenId", new EntityContainerComparator(
        new EntityByTypeThenIdComparator()), true);
    changeSorterFactory06 = new ChangeSorterFactory();
    changeSorterFactory06.registerComparator("streamable", new ChangeForStreamableApplierComparator(), true);
    changeSorterFactory06.registerComparator("seekable", new ChangeForSeekableApplierComparator(), false);
View Full Code Here

   * Processes the input sources and sends the updated data stream to the
   * sink.
   */
  public void run() {
    try {
      EntityContainerComparator comparator;
      EntityContainer base = null;
      ChangeContainer change = null;
      Map<String, Object> metaData;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // Initialise the pipeline with a combination of the metadata from
      // both inputs. The change stream metadata will be applied second
      // and will override any values with the same key.
      metaData = new HashMap<String, Object>();
      metaData.putAll(basePostbox.outputInitialize());
      metaData.putAll(changePostbox.outputInitialize());
      sink.initialize(metaData);
     
      // We continue in the comparison loop while both sources still have data.
      while ((base != null || basePostbox.hasNext()) && (change != null || changePostbox.hasNext())) {
        int comparisonResult;
       
        // Get the next input data where required.
        if (base == null) {
          base = basePostbox.getNext();
        }
        if (change == null) {
          change = changePostbox.getNext();
        }
       
        // Compare the two sources.
        comparisonResult = comparator.compare(base, change.getEntityContainer());
       
        if (comparisonResult < 0) {
          processBaseOnlyEntity(base);
          base = null;
         
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void run() {
    try {
      EntityContainerComparator comparator;
      EntityContainer entityContainer0 = null;
      EntityContainer entityContainer1 = null;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // We can't get meaningful data from the initialize data on the
      // input streams, so pass empty meta data to the sink and discard
      // the input meta data.
      postbox0.outputInitialize();
      postbox1.outputInitialize();
      sink.initialize(Collections.<String, Object>emptyMap());
     
      // BEGIN bound special handling
     
      // If there is a bound, it's going to be the first object
      // in a properly sorted stream
      entityContainer0 = nextOrNull(postbox0);
      entityContainer1 = nextOrNull(postbox1);
         
      // There's only need for special processing if there actually is some data
      // on both streams - no data implies no bound
      if (entityContainer0 != null && entityContainer1 != null) {
        Bound bound0 = null;
        Bound bound1 = null;
       
        // If there are any bounds upstream, eat them up
        if (entityContainer0.getEntity().getType() == EntityType.Bound) {
          bound0 = (Bound) entityContainer0.getEntity();
          entityContainer0 = nextOrNull(postbox0);
        }
        if (entityContainer1.getEntity().getType() == EntityType.Bound) {
          bound1 = (Bound) entityContainer1.getEntity();
          entityContainer1 = nextOrNull(postbox1);
        }

        // Only post a bound downstream if both upstream sources had a bound.
        // (Otherwise there's either nothing to post or the posted bound is going
        // to be smaller than the actual data, which is bad)
        if (bound0 != null && bound1 != null) {
          sink.process(new BoundContainer(bound0.union(bound1)));
        } else if ((bound0 != null && bound1 == null)
            || (bound0 == null && bound1 != null)) {
          handleBoundRemoved(bound0 == null);
        }
      }
     
      // END bound special handling
     
      // We continue in the comparison loop while both sources still have data.
      while (
          (entityContainer0 != null || postbox0.hasNext())
          && (entityContainer1 != null || postbox1.hasNext())) {
        long comparisonResult;
       
        // Get the next input data where required.
        if (entityContainer0 == null) {
          entityContainer0 = postbox0.getNext();
        }
        if (entityContainer1 == null) {
          entityContainer1 = postbox1.getNext();
        }
       
        // Compare the two entities.
        comparisonResult = comparator.compare(entityContainer0, entityContainer1);
       
        if (comparisonResult < 0) {
          // Entity 0 doesn't exist on the other source and can be
          // sent straight through.
          sink.process(entityContainer0);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void run() {
    try {
      EntityContainerComparator comparator;
      ChangeContainer changeContainer0 = null;
      ChangeContainer changeContainer1 = null;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdThenVersionComparator());
     
      // We can't get meaningful data from the initialize data on the
      // input streams, so pass empty meta data to the sink and discard
      // the input meta data.
      postbox0.outputInitialize();
      postbox1.outputInitialize();
      changeSink.initialize(Collections.<String, Object>emptyMap());
     
      // We continue in the comparison loop while both sources still have data.
      while (
          (changeContainer0 != null || postbox0.hasNext())
          && (changeContainer1 != null || postbox1.hasNext())) {
        long comparisonResult;
       
        // Get the next input data where required.
        if (changeContainer0 == null) {
          changeContainer0 = postbox0.getNext();
        }
        if (changeContainer1 == null) {
          changeContainer1 = postbox1.getNext();
        }
       
        // Compare the two entities.
        comparisonResult =
          comparator.compare(changeContainer0.getEntityContainer(), changeContainer1.getEntityContainer());
       
        if (comparisonResult < 0) {
          // Entity 0 doesn't exist on the other source and can be
          // sent straight through.
          changeSink.process(changeContainer0);
View Full Code Here

  /**
   * Processes the input sources and sends the changes to the change sink.
   */
  public void run() {
    try {
      EntityContainerComparator comparator;
      EntityContainer fromEntityContainer = null;
      EntityContainer toEntityContainer = null;
      TimestampSetter timestampSetter;
     
      // Create a comparator for comparing two entities by type and identifier.
      comparator = new EntityContainerComparator(new EntityByTypeThenIdComparator());
     
      // Create an object for setting the current timestamp on entities being deleted.
      timestampSetter = new TimestampSetter();
     
      // We can't get meaningful data from the initialize data on the
      // input streams, so pass empty meta data to the sink and discard
      // the input meta data.
      fromPostbox.outputInitialize();
      toPostbox.outputInitialize();
      changeSink.initialize(Collections.<String, Object>emptyMap());
     
      // We continue in the comparison loop while both sources still have data.
      while (
          (fromEntityContainer != null || fromPostbox.hasNext())
          && (toEntityContainer != null || toPostbox.hasNext())) {
        int comparisonResult;
       
        // Get the next input data where required.
        if (fromEntityContainer == null) {
          fromEntityContainer = fromPostbox.getNext();
        }
        if (toEntityContainer == null) {
          toEntityContainer = toPostbox.getNext();
        }
       
        // Compare the two sources.
        comparisonResult = comparator.compare(fromEntityContainer, toEntityContainer);
       
        if (comparisonResult < 0) {
          // The from entity doesn't exist on the to source therefore
          // has been deleted. We don't know when the entity was
          // deleted so set the delete time to the current time.
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.sort.v0_6.ChangeSorter

Copyright © 2018 www.massapicom. 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.