Commit 2bc0411f by Adi Amir

adjust to new predix domains

parent 77faff9a
...@@ -40,11 +40,6 @@ dependencies { ...@@ -40,11 +40,6 @@ dependencies {
testCompile 'com.google.http-client:google-http-client-jackson:1.15.0-rc' testCompile 'com.google.http-client:google-http-client-jackson:1.15.0-rc'
testCompile 'com.google.api.client:google-api-client:1.4.1-beta' testCompile 'com.google.api.client:google-api-client:1.4.1-beta'
} }
jar { jar {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"authentication": { "authentication": {
"type": "oauth2", "type": "oauth2",
"credential": { "credential": {
"uaa": "9deacc64-7c53-4790-9a6c-c9de0fdebcdf.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token", "uaa": "890407d7-e617-4d70-985f-01792d693387.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token",
"clientId": "ipgallery", "clientId": "ipgallery",
"clientSecret": "1PGall3ry" "clientSecret": "1PGall3ry"
} }
......
mde: mde:
environment: environment:
IPG_ENV_PARAMS: "-Dds.IpAddress=172.16.1.151:8012#\ IPG_ENV_PARAMS: "-Dds.IpAddress=172.16.1.72:8012#\
-Dredis.host=172.16.1.151#\ -Dredis.host=172.16.1.151#\
-Dmde.cisco.username=devoperator11@cdp.com#\ -Dmde.cisco.username=devoperator11@cdp.com#\
-Dmde.cisco.password=ejlFK0g9OSRK#\ -Dmde.cisco.password=ejlFK0g9OSRK#\
......
...@@ -39,17 +39,27 @@ public class GEManager { ...@@ -39,17 +39,27 @@ public class GEManager {
private static final Long ONE_DAY_IN_MILLI_SECS = 1L * 24 * 60 * 60 * 1000; private static final Long ONE_DAY_IN_MILLI_SECS = 1L * 24 * 60 * 60 * 1000;
public static String AUTH = "Basic aXBnYWxsZXJ5OjFQR2FsbDNyeQ=="; public static String AUTH = "Basic aXBnYWxsZXJ5OjFQR2FsbDNyeQ==";
public static String AUTH_URL = "8553482c-1d32-4d38-8597-2e56ab642dd3.predix-uaa.run.asv-pr.ice.predix.io";
//public static String AUTH_URL = "8553482c-1d32-4d38-8597-2e56ab642dd3.predix-uaa.run.asv-pr.ice.predix.io";
public static String AUTH_URL = System.getProperty("mde.ge.uaaUrl", "890407d7-e617-4d70-985f-01792d693387.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token");
//public static String METADATA_URL = "ie-cities-metadata.run.asv-pr-pub.ice.predix.io";
public static String METADATA_URL = System.getProperty("mde.ge.metadataUrl", "ic-metadata-service.run.aws-usw02-pr.ice.predix.io/v2/metadata");
//public static String MEDIA_URL = "ie-cities-media.run.asv-pr-pub.ice.predix.io";
public static String MEDIA_URL = System.getProperty("mde.ge.mediaUrl", "ic-media-service.run.aws-usw02-pr.ice.predix.io/v2/mediastore");
//public static String EVENT_URL = "ie-cities-events.run.asv-pr-pub.ice.predix.io";
public static String EVENT_URL = System.getProperty("mde.ge.eventUrl", "ic-event-service.run.aws-usw02-pr.ice.predix.io/v2");
// parameter consts
public static String AUTH_PATH = "oauth/token"; public static String AUTH_PATH = "oauth/token";
public static String AUTH_PARAMS = "grant_type=client_credentials&client_id=ipgallery"; public static String AUTH_PARAMS = "grant_type=client_credentials&client_id=ipgallery";
public static String METADATA_URL = "ie-cities-metadata.run.asv-pr-pub.ice.predix.io"; public static String ASSET_LIST_URL = "/assets/search";
public static String MEDIA_URL = "ie-cities-media.run.asv-pr-pub.ice.predix.io"; public static String ASSETS_URL = "/assets";
public static String EVENT_URL = "ie-cities-events.run.asv-pr-pub.ice.predix.io"; public static String PARKING_ZONE_ID = "SDSIM-IE-PARKING";
public static String ASSET_LIST_URL = "/v2/assets/search"; public static String PS_ZONE_ID = "SDSIM-IE-PUBLIC-SAFETY";
public static String ASSETS_URL = "/v2/assets"; public static String ENV_ZONE_ID = "SDSIM-IE-ENVIRONMENTAL";
public static String PARKING_ZONE_ID = "ics-IE-PARKING";
public static String PS_ZONE_ID = "ics-IE-PUBLIC-SAFETY";
public static String ENV_ZONE_ID = "ics-IE-ENVIRONMENTAL";
public static String TOKEN = "NOT_VALID"; public static String TOKEN = "NOT_VALID";
...@@ -277,7 +287,7 @@ public class GEManager { ...@@ -277,7 +287,7 @@ public class GEManager {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(EVENT_URL); request.setDomain(EVENT_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
// path // path
String path = ASSETS_URL + "/" + sensdorId + "/" + "events"; String path = ASSETS_URL + "/" + sensdorId + "/" + "events";
...@@ -375,9 +385,9 @@ public class GEManager { ...@@ -375,9 +385,9 @@ public class GEManager {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(MEDIA_URL); request.setDomain(MEDIA_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
String path = "/v2/assets/" + camId + "/media/latest"; String path = "/assets/" + camId + "/media/latest";
request.setQueryString("mediaType=" + mediaType); request.setQueryString("mediaType=" + mediaType);
request.setPath(path); request.setPath(path);
request.addHeader("Authorization", "Bearer " + TOKEN); request.addHeader("Authorization", "Bearer " + TOKEN);
...@@ -420,13 +430,13 @@ public class GEManager { ...@@ -420,13 +430,13 @@ public class GEManager {
private SimpleHttpRequest buildDownloadLatestMediaFileRequest(String url) { private SimpleHttpRequest buildDownloadLatestMediaFileRequest(String url) {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
String[] domainFileUrl = extractDomainFile(url); String[] domainFileUrl = extractDomainAndFile(url);
if(domainFileUrl != null) { if(domainFileUrl != null) {
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(domainFileUrl[0]); request.setDomain(domainFileUrl[0]);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
String path = "/v2/file/" + domainFileUrl[1]; String path = "/v2/mediastore/file/" + domainFileUrl[1];
request.setPath(path); request.setPath(path);
request.addHeader("Authorization", "Bearer " + TOKEN); request.addHeader("Authorization", "Bearer " + TOKEN);
request.addHeader("Predix-Zone-Id", PS_ZONE_ID); request.addHeader("Predix-Zone-Id", PS_ZONE_ID);
...@@ -437,9 +447,8 @@ public class GEManager { ...@@ -437,9 +447,8 @@ public class GEManager {
private SimpleHttpRequest buildCameraListRequest(RequestContext requestContext) { private SimpleHttpRequest buildCameraListRequest(RequestContext requestContext) {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(METADATA_URL); request.setDomain(METADATA_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
request.setPath(ASSET_LIST_URL); request.setPath(ASSET_LIST_URL);
request.addHeader("Authorization", "Bearer " + TOKEN); request.addHeader("Authorization", "Bearer " + TOKEN);
...@@ -488,7 +497,7 @@ public class GEManager { ...@@ -488,7 +497,7 @@ public class GEManager {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(METADATA_URL); request.setDomain(METADATA_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
String path = ASSETS_URL + "/" + camId; String path = ASSETS_URL + "/" + camId;
request.setPath(path); request.setPath(path);
...@@ -520,7 +529,7 @@ public class GEManager { ...@@ -520,7 +529,7 @@ public class GEManager {
SimpleHttpRequest request = new SimpleHttpRequest(); SimpleHttpRequest request = new SimpleHttpRequest();
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(AUTH_URL); request.setDomain(AUTH_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
request.setPath(AUTH_PATH); request.setPath(AUTH_PATH);
request.setQueryString(AUTH_PARAMS); request.setQueryString(AUTH_PARAMS);
...@@ -533,7 +542,7 @@ public class GEManager { ...@@ -533,7 +542,7 @@ public class GEManager {
request.setProtocol("https"); request.setProtocol("https");
request.setDomain(METADATA_URL); request.setDomain(METADATA_URL);
request.setPort(443); //request.setPort(443);
request.setMethod(SimpleHttpRequest.Method.GET); request.setMethod(SimpleHttpRequest.Method.GET);
request.setPath(ASSET_LIST_URL); request.setPath(ASSET_LIST_URL);
request.addHeader("Authorization", "Bearer " + TOKEN); request.addHeader("Authorization", "Bearer " + TOKEN);
...@@ -583,13 +592,13 @@ public class GEManager { ...@@ -583,13 +592,13 @@ public class GEManager {
/*** H E L P E R S ***/ /*** H E L P E R S ***/
private String[] extractDomainFile(String link) { private String[] extractDomainAndFile(String link) {
String[] array = null; String[] array = null;
String[] newArray = new String[2]; String[] newArray = new String[2];
array = link.split("/"); array = link.split("/");
if(array != null) { if(array != null) {
newArray[0] = array[2]; newArray[0] = array[2];
newArray[1] = array[5]; newArray[1] = array[array.length - 1];
} }
return newArray; return newArray;
} }
...@@ -714,10 +723,11 @@ public class GEManager { ...@@ -714,10 +723,11 @@ public class GEManager {
return errResp; return errResp;
} }
// aXBnYWxsZXJ5OjFQR2FsbDNyeQ==
private Boolean isAccessDenied(BaseRestResponse brr) { private Boolean isAccessDenied(BaseRestResponse brr) {
if (brr.success == false && brr.objectNode != null) { if (brr.success == false && brr.objectNode != null) {
int statusCode = brr.objectNode.get("statusCode").asInt(); int statusCode = brr.objectNode.get("statusCode").asInt();
Boolean bAccessDenied = (statusCode == 403 ||statusCode == 401); Boolean bAccessDenied = (statusCode == 403 || statusCode == 401);
return bAccessDenied; return bAccessDenied;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment