Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
mde
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2bc0411f
authored
Jun 07, 2017
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adjust to new predix domains
parent
77faff9a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
30 deletions
build.gradle
cfg/adapter.v2.ge.parking.json
docker-compose.yml
src/main/java/logic/GEManager.java
build.gradle
View file @
2bc0411f
...
...
@@ -40,11 +40,6 @@ dependencies {
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'
}
jar
{
...
...
cfg/adapter.v2.ge.parking.json
View file @
2bc0411f
...
...
@@ -12,7 +12,7 @@
"authentication"
:
{
"type"
:
"oauth2"
,
"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"
,
"clientSecret"
:
"1PGall3ry"
}
...
...
docker-compose.yml
View file @
2bc0411f
mde
:
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#
\
-Dmde.cisco.username=devoperator11@cdp.com#
\
-Dmde.cisco.password=ejlFK0g9OSRK#
\
...
...
src/main/java/logic/GEManager.java
View file @
2bc0411f
...
...
@@ -39,17 +39,27 @@ public class GEManager {
private
static
final
Long
ONE_DAY_IN_MILLI_SECS
=
1L
*
24
*
60
*
60
*
1000
;
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_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
MEDIA_URL
=
"ie-cities-media.run.asv-pr-pub.ice.predix.io"
;
public
static
String
EVENT_URL
=
"ie-cities-events.run.asv-pr-pub.ice.predix.io"
;
public
static
String
ASSET_LIST_URL
=
"/v2/assets/search"
;
public
static
String
ASSETS_URL
=
"/v2/assets"
;
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
ASSET_LIST_URL
=
"/assets/search"
;
public
static
String
ASSETS_URL
=
"/assets"
;
public
static
String
PARKING_ZONE_ID
=
"SDSIM-IE-PARKING"
;
public
static
String
PS_ZONE_ID
=
"SDSIM-IE-PUBLIC-SAFETY"
;
public
static
String
ENV_ZONE_ID
=
"SDSIM-IE-ENVIRONMENTAL"
;
public
static
String
TOKEN
=
"NOT_VALID"
;
...
...
@@ -277,7 +287,7 @@ public class GEManager {
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
EVENT_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
// path
String
path
=
ASSETS_URL
+
"/"
+
sensdorId
+
"/"
+
"events"
;
...
...
@@ -375,9 +385,9 @@ public class GEManager {
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
MEDIA_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
String
path
=
"/
v2/
assets/"
+
camId
+
"/media/latest"
;
String
path
=
"/assets/"
+
camId
+
"/media/latest"
;
request
.
setQueryString
(
"mediaType="
+
mediaType
);
request
.
setPath
(
path
);
request
.
addHeader
(
"Authorization"
,
"Bearer "
+
TOKEN
);
...
...
@@ -420,13 +430,13 @@ public class GEManager {
private
SimpleHttpRequest
buildDownloadLatestMediaFileRequest
(
String
url
)
{
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
String
[]
domainFileUrl
=
extractDomainFile
(
url
);
String
[]
domainFileUrl
=
extractDomain
And
File
(
url
);
if
(
domainFileUrl
!=
null
)
{
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
domainFileUrl
[
0
]);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
String
path
=
"/v2/file/"
+
domainFileUrl
[
1
];
String
path
=
"/v2/
mediastore/
file/"
+
domainFileUrl
[
1
];
request
.
setPath
(
path
);
request
.
addHeader
(
"Authorization"
,
"Bearer "
+
TOKEN
);
request
.
addHeader
(
"Predix-Zone-Id"
,
PS_ZONE_ID
);
...
...
@@ -437,9 +447,8 @@ public class GEManager {
private
SimpleHttpRequest
buildCameraListRequest
(
RequestContext
requestContext
)
{
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
METADATA_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
request
.
setPath
(
ASSET_LIST_URL
);
request
.
addHeader
(
"Authorization"
,
"Bearer "
+
TOKEN
);
...
...
@@ -488,7 +497,7 @@ public class GEManager {
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
METADATA_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
String
path
=
ASSETS_URL
+
"/"
+
camId
;
request
.
setPath
(
path
);
...
...
@@ -520,7 +529,7 @@ public class GEManager {
SimpleHttpRequest
request
=
new
SimpleHttpRequest
();
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
AUTH_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
request
.
setPath
(
AUTH_PATH
);
request
.
setQueryString
(
AUTH_PARAMS
);
...
...
@@ -533,7 +542,7 @@ public class GEManager {
request
.
setProtocol
(
"https"
);
request
.
setDomain
(
METADATA_URL
);
request
.
setPort
(
443
);
//
request.setPort(443);
request
.
setMethod
(
SimpleHttpRequest
.
Method
.
GET
);
request
.
setPath
(
ASSET_LIST_URL
);
request
.
addHeader
(
"Authorization"
,
"Bearer "
+
TOKEN
);
...
...
@@ -583,13 +592,13 @@ public class GEManager {
/*** H E L P E R S ***/
private
String
[]
extractDomainFile
(
String
link
)
{
private
String
[]
extractDomain
And
File
(
String
link
)
{
String
[]
array
=
null
;
String
[]
newArray
=
new
String
[
2
];
array
=
link
.
split
(
"/"
);
if
(
array
!=
null
)
{
newArray
[
0
]
=
array
[
2
];
newArray
[
1
]
=
array
[
5
];
newArray
[
1
]
=
array
[
array
.
length
-
1
];
}
return
newArray
;
}
...
...
@@ -714,10 +723,11 @@ public class GEManager {
return
errResp
;
}
// aXBnYWxsZXJ5OjFQR2FsbDNyeQ==
private
Boolean
isAccessDenied
(
BaseRestResponse
brr
)
{
if
(
brr
.
success
==
false
&&
brr
.
objectNode
!=
null
)
{
int
statusCode
=
brr
.
objectNode
.
get
(
"statusCode"
).
asInt
();
Boolean
bAccessDenied
=
(
statusCode
==
403
||
statusCode
==
401
);
Boolean
bAccessDenied
=
(
statusCode
==
403
||
statusCode
==
401
);
return
bAccessDenied
;
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment