use of org.onebusaway.container.refresh.Refreshable in project onebusaway-application-modules by camsys.
the class StopSearchServiceImpl method initialize.
@PostConstruct
@Refreshable(dependsOn = RefreshableResources.STOP_SEARCH_DATA)
public void initialize() throws IOException {
File path = _bundle.getStopSearchIndexPath();
if (path.exists()) {
IndexReader reader = IndexReader.open(path);
_searcher = new IndexSearcher(reader);
} else {
_searcher = null;
}
}
use of org.onebusaway.container.refresh.Refreshable in project onebusaway-application-modules by camsys.
the class WhereGeospatialServiceImpl method initialize.
@PostConstruct
@Refreshable(dependsOn = RefreshableResources.STOP_GEOSPATIAL_INDEX)
public void initialize() {
List<StopEntry> stops = _transitGraphDao.getAllStops();
if (stops.size() == 0) {
_tree = null;
return;
}
_tree = new STRtree(stops.size());
for (StopEntry stop : stops) {
float x = (float) stop.getStopLon();
float y = (float) stop.getStopLat();
Envelope env = new Envelope(x, x, y, y);
_tree.insert(env, stop.getId());
}
_tree.build();
}
use of org.onebusaway.container.refresh.Refreshable in project onebusaway-application-modules by camsys.
the class RoutesBeanServiceImpl method setup.
@Refreshable(dependsOn = { RefreshableResources.NARRATIVE_DATA })
@PostConstruct
public void setup() {
_stopTreesByRouteId.clear();
for (StopEntry stop : _graphDao.getAllStops()) {
Set<AgencyAndId> routeIds = _routeService.getRouteCollectionIdsForStop(stop.getId());
for (AgencyAndId routeId : routeIds) {
STRtree tree = _stopTreesByRouteId.get(routeId);
if (tree == null) {
tree = new STRtree();
_stopTreesByRouteId.put(routeId, tree);
}
double x = stop.getStopLon();
double y = stop.getStopLat();
Envelope env = new Envelope(x, x, y, y);
tree.insert(env, routeId);
}
}
for (STRtree tree : _stopTreesByRouteId.values()) tree.build();
}
use of org.onebusaway.container.refresh.Refreshable in project onebusaway-application-modules by camsys.
the class BlockRunServiceImpl method setup.
@PostConstruct
@Refreshable(dependsOn = RefreshableResources.TRANSIT_GRAPH)
public void setup() throws IOException, ClassNotFoundException {
_log.info("bundle path=" + _bundle.getPath());
File path = _bundle.getBlockRunDataPath();
if (path.exists()) {
_log.info("loading BlockRunIndex...");
_map = ObjectSerializationLibrary.readObject(path);
_log.info("loading BlockRunIndex...done");
} else {
// this index is optional, do not fail if not found
_log.info("failed BlockRunIndex load, path not found of " + path);
_map = new HashMap<String, List<BlockRunIndex>>();
}
}
Aggregations