Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
bdd3f5a5
Commit
bdd3f5a5
authored
Apr 26, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved data types to separate project
parent
1574a94b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
MessageParsing.java
...l/uva/sne/drip/drip/provisioner/utils/MessageParsing.java
+17
-10
No files found.
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/utils/MessageParsing.java
View file @
bdd3f5a5
...
@@ -46,8 +46,6 @@ import provisioning.credential.EGICredential;
...
@@ -46,8 +46,6 @@ import provisioning.credential.EGICredential;
*/
*/
public
class
MessageParsing
{
public
class
MessageParsing
{
private
static
ObjectMapper
mapper
;
public
static
List
<
File
>
getTopologies
(
JSONArray
parameters
,
String
tempInputDirPath
,
int
level
)
throws
JSONException
,
IOException
{
public
static
List
<
File
>
getTopologies
(
JSONArray
parameters
,
String
tempInputDirPath
,
int
level
)
throws
JSONException
,
IOException
{
List
<
File
>
topologyFiles
=
new
ArrayList
<>();
List
<
File
>
topologyFiles
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
parameters
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
parameters
.
length
();
i
++)
{
...
@@ -117,10 +115,12 @@ public class MessageParsing {
...
@@ -117,10 +115,12 @@ public class MessageParsing {
String
name
=
(
String
)
param
.
get
(
"name"
);
String
name
=
(
String
)
param
.
get
(
"name"
);
if
(
name
.
equals
(
"cloud_credential"
))
{
if
(
name
.
equals
(
"cloud_credential"
))
{
Credential
credential
=
null
;
Credential
credential
=
null
;
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
mapper
.
configure
(
JsonParser
.
Feature
.
ALLOW_SINGLE_QUOTES
,
true
);
mapper
.
configure
(
JsonParser
.
Feature
.
ALLOW_SINGLE_QUOTES
,
true
);
String
credentialString
=
(
String
)
param
.
get
(
"value"
);
String
credentialString
=
(
String
)
param
.
get
(
"value"
);
credentialString
=
credentialString
.
substring
(
1
,
credentialString
.
length
()
-
2
);
System
.
err
.
println
(
credentialString
);
credentialString
=
credentialString
.
substring
(
1
,
credentialString
.
length
()
-
1
);
System
.
err
.
println
(
credentialString
);
CloudCredentials
cred
=
mapper
.
readValue
(
credentialString
,
CloudCredentials
.
class
);
CloudCredentials
cred
=
mapper
.
readValue
(
credentialString
,
CloudCredentials
.
class
);
if
(
cred
.
getCloudProviderName
().
toLowerCase
().
equals
(
"ec2"
))
{
if
(
cred
.
getCloudProviderName
().
toLowerCase
().
equals
(
"ec2"
))
{
EC2Credential
ec2
=
new
EC2Credential
();
EC2Credential
ec2
=
new
EC2Credential
();
...
@@ -136,12 +136,19 @@ public class MessageParsing {
...
@@ -136,12 +136,19 @@ public class MessageParsing {
}
}
for
(
KeyPair
pair
:
cred
.
getKeyPairs
())
{
for
(
KeyPair
pair
:
cred
.
getKeyPairs
())
{
File
dir
=
new
File
(
tempInputDirPath
+
File
.
separator
+
pair
.
getId
());
if
(
pair
!=
null
)
{
dir
.
mkdir
();
File
dir
=
new
File
(
tempInputDirPath
+
File
.
separator
+
pair
.
getId
());
Key
privateKey
=
pair
.
getPrivateKey
();
dir
.
mkdir
();
writeValueToFile
(
privateKey
.
getKey
(),
new
File
(
dir
.
getAbsolutePath
()
+
File
.
separator
+
privateKey
.
getName
()));
Key
privateKey
=
pair
.
getPrivateKey
();
Key
publicKey
=
pair
.
getPublicKey
();
if
(
privateKey
!=
null
)
{
writeValueToFile
(
publicKey
.
getKey
(),
new
File
(
dir
.
getAbsolutePath
()
+
File
.
separator
+
publicKey
.
getName
()));
writeValueToFile
(
privateKey
.
getKey
(),
new
File
(
dir
.
getAbsolutePath
()
+
File
.
separator
+
privateKey
.
getName
()));
}
Key
publicKey
=
pair
.
getPublicKey
();
if
(
publicKey
!=
null
)
{
writeValueToFile
(
publicKey
.
getKey
(),
new
File
(
dir
.
getAbsolutePath
()
+
File
.
separator
+
publicKey
.
getName
()));
}
}
}
}
credentials
.
add
(
credential
);
credentials
.
add
(
credential
);
}
}
...
...
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