-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update frontend for multiple subgraphs
- Loading branch information
Showing
19 changed files
with
353 additions
and
95 deletions.
There are no files selected for viewing
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
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
58 changes: 58 additions & 0 deletions
58
grebi_api/src/main/java/uk/ac/ebi/grebi/db/SummaryClient.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,58 @@ | ||
|
||
package uk.ac.ebi.grebi.db; | ||
|
||
import java.io.IOException; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.google.gson.JsonElement; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.google.gson.Gson; | ||
import com.google.gson.internal.LinkedTreeMap; | ||
import org.apache.http.HttpEntity; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.ClientProtocolException; | ||
import org.apache.http.client.HttpClient; | ||
import org.apache.http.client.methods.HttpPost; | ||
import org.apache.http.client.methods.HttpGet; | ||
import org.apache.http.impl.client.HttpClientBuilder; | ||
import org.apache.http.util.EntityUtils; | ||
import org.apache.http.entity.StringEntity; | ||
import org.apache.http.entity.ContentType; | ||
import com.google.common.base.Stopwatch; | ||
|
||
public class SummaryClient { | ||
|
||
static final String SUMMARY_HOST = System.getenv("GREBI_SUMMARY_HOST"); | ||
|
||
|
||
public static String getSummaryHost() { | ||
if (SUMMARY_HOST != null) | ||
return SUMMARY_HOST; | ||
return "http://localhost:8081/"; | ||
} | ||
|
||
public Map<String,JsonElement> getSummaries() { | ||
HttpClient client = HttpClientBuilder.create().build(); | ||
HttpGet request = new HttpGet(getSummaryHost()); | ||
HttpResponse response; | ||
try { | ||
response = client.execute(request); | ||
HttpEntity entity = response.getEntity(); | ||
String json = EntityUtils.toString(entity); | ||
return new Gson().fromJson(json, JsonElement.class).getAsJsonObject().asMap(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
|
||
|
||
} |
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
Oops, something went wrong.