-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stub graph updater status web service. #1722
- Loading branch information
Showing
3 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/main/java/org/opentripplanner/api/resource/UpdaterStatusResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.opentripplanner.api.resource; | ||
|
||
import com.oracle.deploy.update.Updater; | ||
import org.opentripplanner.common.geometry.DistanceLibrary; | ||
import org.opentripplanner.common.geometry.SphericalDistanceLibrary; | ||
import org.opentripplanner.routing.graph.GraphIndex; | ||
import org.opentripplanner.routing.services.StreetVertexIndexService; | ||
import org.opentripplanner.standalone.OTPServer; | ||
import org.opentripplanner.standalone.Router; | ||
import org.opentripplanner.updater.GraphUpdaterManager; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.*; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Report the status of the graph updaters via a web service. | ||
*/ | ||
@Path("/routers/{routerId}/updaters") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public class UpdaterStatusResource { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(UpdaterStatusResource.class); | ||
|
||
/** Choose short or long form of results. */ | ||
@QueryParam("detail") private boolean detail = false; | ||
|
||
Router router; | ||
|
||
public UpdaterStatusResource (@Context OTPServer otpServer, @PathParam("routerId") String routerId) { | ||
router = otpServer.getRouter(routerId); | ||
} | ||
|
||
/** Return a list of all agencies in the graph. */ | ||
@GET | ||
public Response getUpdaters () { | ||
GraphUpdaterManager updaterManager = router.graph.updaterManager; | ||
if (updaterManager == null) { | ||
return Response.status(Response.Status.NOT_FOUND).entity("No updaters running.").build(); | ||
} | ||
return Response.status(Response.Status.OK).entity(updaterManager.getUpdaterClasses()).build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters