use of org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator in project osmosis by openstreetmap.
the class AllEntityDao method getCurrent.
/**
* Retrieves all current data in the database.
*
* @return An iterator pointing at the current records.
*/
public ReleasableIterator<EntityContainer> getCurrent() {
try (ReleasableContainer releasableContainer = new ReleasableContainer()) {
List<ReleasableIterator<EntityContainer>> sources;
MultipleSourceIterator<EntityContainer> resultIterator;
sources = new ArrayList<ReleasableIterator<EntityContainer>>();
sources.add(releasableContainer.add(nodeDao.getCurrent()));
sources.add(releasableContainer.add(wayDao.getCurrent()));
sources.add(releasableContainer.add(relationDao.getCurrent()));
resultIterator = new MultipleSourceIterator<EntityContainer>(sources);
releasableContainer.clear();
return resultIterator;
}
}
use of org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator in project osmosis by openstreetmap.
the class PostgreSqlDatasetContext method iterate.
/**
* {@inheritDoc}
*/
@Override
public ReleasableIterator<EntityContainer> iterate() {
List<Bound> bounds;
List<ReleasableIterator<EntityContainer>> sources;
if (!initialized) {
initialize();
}
// Build the bounds list.
bounds = new ArrayList<Bound>();
bounds.add(new Bound("Osmosis " + OsmosisConstants.VERSION));
sources = new ArrayList<ReleasableIterator<EntityContainer>>();
sources.add(new UpcastIterator<EntityContainer, BoundContainer>(new BoundContainerIterator(new ReleasableAdaptorForIterator<Bound>(bounds.iterator()))));
sources.add(new UpcastIterator<EntityContainer, NodeContainer>(new NodeContainerIterator(nodeDao.iterate())));
sources.add(new UpcastIterator<EntityContainer, WayContainer>(new WayContainerIterator(wayDao.iterate())));
sources.add(new UpcastIterator<EntityContainer, RelationContainer>(new RelationContainerIterator(relationDao.iterate())));
return new MultipleSourceIterator<EntityContainer>(sources);
}
use of org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator in project osmosis by openstreetmap.
the class AllEntityDao method getHistory.
/**
* Retrieves the changes that have were made by a set of transactions.
*
* @param predicates
* Contains the predicates defining the transactions to be queried.
* @return An iterator pointing at the identified records.
*/
public ReleasableIterator<ChangeContainer> getHistory(ReplicationQueryPredicates predicates) {
try (ReleasableContainer releasableContainer = new ReleasableContainer()) {
List<ReleasableIterator<ChangeContainer>> sources;
MultipleSourceIterator<ChangeContainer> resultIterator;
sources = new ArrayList<ReleasableIterator<ChangeContainer>>();
sources.add(releasableContainer.add(nodeDao.getHistory(predicates)));
sources.add(releasableContainer.add(wayDao.getHistory(predicates)));
sources.add(releasableContainer.add(relationDao.getHistory(predicates)));
resultIterator = new MultipleSourceIterator<ChangeContainer>(sources);
releasableContainer.clear();
return resultIterator;
}
}
use of org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator in project osmosis by openstreetmap.
the class AllEntityDao method getHistory.
/**
* Retrieves the changes that have were made between two points in time.
*
* @param intervalBegin
* Marks the beginning (inclusive) of the time interval to be checked.
* @param intervalEnd
* Marks the end (exclusive) of the time interval to be checked.
* @return An iterator pointing at the identified records.
*/
public ReleasableIterator<ChangeContainer> getHistory(Date intervalBegin, Date intervalEnd) {
try (ReleasableContainer releasableContainer = new ReleasableContainer()) {
List<ReleasableIterator<ChangeContainer>> sources;
MultipleSourceIterator<ChangeContainer> resultIterator;
sources = new ArrayList<ReleasableIterator<ChangeContainer>>();
sources.add(releasableContainer.add(nodeDao.getHistory(intervalBegin, intervalEnd)));
sources.add(releasableContainer.add(wayDao.getHistory(intervalBegin, intervalEnd)));
sources.add(releasableContainer.add(relationDao.getHistory(intervalBegin, intervalEnd)));
resultIterator = new MultipleSourceIterator<ChangeContainer>(sources);
releasableContainer.clear();
return resultIterator;
}
}
use of org.openstreetmap.osmosis.core.lifecycle.ReleasableIterator in project osmosis by openstreetmap.
the class AllEntityDao method getHistory.
/**
* Retrieves all changes in the database.
*
* @return An iterator pointing at the identified records.
*/
public ReleasableIterator<ChangeContainer> getHistory() {
try (ReleasableContainer releasableContainer = new ReleasableContainer()) {
List<ReleasableIterator<ChangeContainer>> sources;
MultipleSourceIterator<ChangeContainer> resultIterator;
sources = new ArrayList<ReleasableIterator<ChangeContainer>>();
sources.add(releasableContainer.add(nodeDao.getHistory()));
sources.add(releasableContainer.add(wayDao.getHistory()));
sources.add(releasableContainer.add(relationDao.getHistory()));
resultIterator = new MultipleSourceIterator<ChangeContainer>(sources);
releasableContainer.clear();
return resultIterator;
}
}
Aggregations