Skip to content

Commit

Permalink
Sending data to Deployer. #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Conway committed Aug 27, 2012
1 parent 3b101fa commit bfbea81
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/controllers/Mapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,13 @@ public static void fetchGtfs () {
renderJSON("{\"status\":\"running\"}");
}

public static void createDeploymentPlan (MetroArea metroArea) {
public static void createDeploymentPlan (MetroArea metroArea, String send) {
DeploymentPlan dp = new DeploymentPlan(metroArea);

if (send != null) {
dp.sendTo(send);
}

renderJSON(dp.toJson());
}

Expand Down
11 changes: 11 additions & 0 deletions app/updaters/DeploymentPlan.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import java.net.URL;

import com.google.gson.Gson;

import play.Play;
import play.libs.WS;

import models.BikeRentalSystem;
import models.BikeRentalSystemType;
Expand Down Expand Up @@ -101,6 +103,15 @@ private void addFeeds(GtfsFeed feed, Set<FeedDescriptor> toInclude) {
addFeeds(feed, toInclude, 0);
}

/**
* Send this to the given URL.
*
* @param url
*/
public void sendTo(String url) {
WS.url(url).setParameter("data", this.toJson()).get();
}

private void addFeeds(GtfsFeed feed, Set<FeedDescriptor> toInclude, int iteration) {
FeedDescriptor fd;
GtfsFeed olderFeed;
Expand Down

0 comments on commit bfbea81

Please sign in to comment.