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
4ae22a0e
Commit
4ae22a0e
authored
Feb 17, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
successfully provisioned topology
parent
7e2c4eef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
13 deletions
+32
-13
CloudConfigurationController.java
...l/uva/sne/drip/api/rest/CloudConfigurationController.java
+2
-1
PlannerController.java
...main/java/nl/uva/sne/drip/api/rest/PlannerController.java
+1
-1
ToscaController.java
...c/main/java/nl/uva/sne/drip/api/rest/ToscaController.java
+18
-0
Consumer.java
.../src/main/java/nl/uva/sne/drip/drip/planner/Consumer.java
+6
-9
Planner.java
...r/src/main/java/nl/uva/sne/drip/drip/planner/Planner.java
+5
-2
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/rest/CloudConfigurationController.java
View file @
4ae22a0e
...
...
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
import
nl.uva.sne.drip.api.dao.CloudCredentialsDao
;
import
nl.uva.sne.drip.api.service.UserService
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
/**
*
...
...
@@ -46,7 +47,7 @@ public class CloudConfigurationController {
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
postConf
(
CloudCredentials
cc
)
{
String
postConf
(
@RequestBody
CloudCredentials
cc
)
{
cloudCredentialsDao
.
save
(
cc
);
return
cc
.
getId
();
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/rest/PlannerController.java
View file @
4ae22a0e
...
...
@@ -88,7 +88,7 @@ public class PlannerController {
dripComponetens
.
add
(
planner
);
Message
plannerReturnedMessage
=
planner
.
call
(
plannerInvokationMessage
);
Message
provisionerInvokationMessage
=
buildProvisionerMessage
(
plannerReturnedMessage
,
"58a
1f0a963d42f004b1d63ad
"
);
Message
provisionerInvokationMessage
=
buildProvisionerMessage
(
plannerReturnedMessage
,
"58a
7281c55363e65b3c9eb82
"
);
provisioner
=
new
ProvisionerCaller
(
messageBrokerHost
);
dripComponetens
.
add
(
provisioner
);
provisioner
.
call
(
provisionerInvokationMessage
);
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/rest/ToscaController.java
View file @
4ae22a0e
...
...
@@ -116,6 +116,24 @@ public class ToscaController {
return
null
;
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
ToscaRepresentation
getToscaRepresentation
(
@PathVariable
(
"id"
)
String
id
)
{
ToscaRepresentation
tosca
=
dao
.
findOne
(
id
);
return
tosca
;
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
dao
.
delete
(
id
);
return
"Deleted tosca :"
+
id
;
}
// http://localhost:8080/drip-api/tosca/ids
@RequestMapping
(
value
=
"/ids"
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
...
...
drip-simple_planner/src/main/java/nl/uva/sne/drip/drip/planner/Consumer.java
View file @
4ae22a0e
...
...
@@ -82,19 +82,16 @@ public class Consumer extends DefaultConsumer {
List
<
File
>
files
=
panner
.
plan
(
inputFiles
[
0
].
getAbsolutePath
(),
inputFiles
[
1
].
getAbsolutePath
(),
tempDir
.
getAbsolutePath
());
//Here we do the same as above with a different API
inputFiles
=
simpleJsonUnmarshalExample
(
message
);
//
inputFiles = simpleJsonUnmarshalExample(message);
//Call the method with the extracted parameters
files
=
panner
.
plan
(
inputFiles
[
0
].
getAbsolutePath
(),
inputFiles
[
1
].
getAbsolutePath
(),
tempDir
.
getAbsolutePath
());
// files = panner.plan(inputFiles[0].getAbsolutePath(), inputFiles[1].getAbsolutePath(), tempDir.getAbsolutePath());
//Now we need to put the result of the call to a message and respond
//Example 1
response
=
jacksonMarshalExample
(
files
);
//Example 2
response
=
simpleJsonMarshalExample
(
files
);
}
catch
(
IOException
|
JSONException
ex
)
{
// response = simpleJsonMarshalExample(files);
}
catch
(
Exception
ex
)
{
response
=
ex
.
getMessage
();
Logger
.
getLogger
(
Consumer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
finally
{
...
...
@@ -136,7 +133,7 @@ public class Consumer extends DefaultConsumer {
}
private
File
[]
simpleJsonUnmarshalExample
(
String
message
)
throws
JSONException
,
FileNotFoundException
,
IOException
{
//Use the JSONObject API to convert json to Object (Message)
//Use the JSONObject API to convert json to Object (Message)
File
[]
files
=
new
File
[
2
];
JSONObject
jo
=
new
JSONObject
(
message
);
JSONArray
parameters
=
jo
.
getJSONArray
(
"parameters"
);
...
...
@@ -183,7 +180,7 @@ public class Consumer extends DefaultConsumer {
}
private
String
simpleJsonMarshalExample
(
List
<
File
>
files
)
throws
JSONException
,
IOException
{
//Use the JSONObject API to convert Object (Message) to json
//Use the JSONObject API to convert Object (Message) to json
JSONObject
jo
=
new
JSONObject
();
jo
.
put
(
"creationDate"
,
(
System
.
currentTimeMillis
()));
List
parameters
=
new
ArrayList
();
...
...
drip-simple_planner/src/main/java/nl/uva/sne/drip/drip/planner/Planner.java
View file @
4ae22a0e
...
...
@@ -24,6 +24,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
nl.uva.sne.drip.commons.utils.Converter
;
/**
*
...
...
@@ -45,9 +46,12 @@ public class Planner {
}
if
(
check
)
{
if
(
line
.
contains
(
"file"
))
{
String
content
=
line
.
trim
().
replace
(
'\"'
,
' '
);
String
content
=
line
.
trim
().
replace
(
'\
''
,
' '
).
replace
(
'\
"'
,
' '
);
String
[]
cs
=
content
.
split
(
":"
);
String
docker_name
=
cs
[
1
].
trim
();
if
(
docker_name
.
equals
(
"{file"
))
{
docker_name
=
cs
[
2
].
trim
();
}
dockerNames
.
add
(
docker_name
);
}
}
...
...
@@ -111,7 +115,6 @@ public class Planner {
outputFiles
.
add
(
new
File
(
outfPath
));
outputFiles
.
add
(
new
File
(
allFilePath
));
return
outputFiles
;
}
private
String
generateVM
(
String
block
,
String
nodeName
,
String
dockerName
,
String
privateAddress
,
String
role
)
{
...
...
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