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
3793b78f
Commit
3793b78f
authored
8 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor data types: Each agent has its own data type
parent
1611ae99
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
10 deletions
+62
-10
ProvisionInfoDao.java
...c/main/java/nl/uva/sne/drip/api/dao/ProvisionInfoDao.java
+2
-2
ProvisionController.java
...in/java/nl/uva/sne/drip/api/rest/ProvisionController.java
+17
-4
ProvisionService.java
...in/java/nl/uva/sne/drip/api/service/ProvisionService.java
+3
-3
ProvisionInfo.java
...ain/java/nl/uva/sne/drip/commons/types/ProvisionInfo.java
+40
-1
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/dao/ProvisionDao.java
→
drip-api/src/main/java/nl/uva/sne/drip/api/dao/Provision
Info
Dao.java
View file @
3793b78f
...
...
@@ -15,13 +15,13 @@
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
dao
;
import
nl.uva.sne.drip.commons.types.Provision
;
import
nl.uva.sne.drip.commons.types.Provision
Info
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
*
* @author S. Koulouzis
*/
public
interface
Provision
Dao
extends
MongoRepository
<
Provision
,
String
>
{
public
interface
Provision
InfoDao
extends
MongoRepository
<
ProvisionInfo
,
String
>
{
}
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/rest/ProvisionController.java
View file @
3793b78f
...
...
@@ -16,7 +16,7 @@
package
nl
.
uva
.
sne
.
drip
.
api
.
rest
;
import
com.fasterxml.jackson.core.JsonParser
;
import
nl.uva.sne.drip.commons.types.Provision
;
import
nl.uva.sne.drip.commons.types.Provision
Info
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -90,14 +90,14 @@ public class ProvisionController {
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
Provision
get
(
@PathVariable
(
"id"
)
String
id
)
{
Provision
Info
get
(
@PathVariable
(
"id"
)
String
id
)
{
return
provisionService
.
getDao
().
findOne
(
id
);
}
@RequestMapping
(
value
=
"/provision"
,
method
=
RequestMethod
.
POST
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
plann
(
@RequestBody
Provision
req
)
{
String
plann
(
@RequestBody
Provision
Info
req
)
{
try
(
DRIPCaller
provisioner
=
new
ProvisionerCaller
(
messageBrokerHost
);)
{
Message
provisionerInvokationMessage
=
buildProvisionerMessage
(
req
);
...
...
@@ -113,6 +113,19 @@ public class ProvisionController {
req
.
setKvMap
(
kvMap
);
req
.
setPlanID
(
req
.
getPlanID
());
provisionService
.
getDao
().
save
(
req
);
}
else
{
String
value
=
p
.
getValue
();
String
[]
lines
=
value
.
split
(
"\n"
);
for
(
String
line
:
lines
)
{
String
[]
parts
=
line
.
split
(
" "
);
String
deployIP
=
parts
[
0
];
String
deployUser
=
parts
[
1
];
String
deployCertPath
=
parts
[
2
];
String
deployRole
=
parts
[
3
];
req
.
setDeployIP
(
deployIP
);
req
.
setDeployUser
(
deployUser
);
req
.
setDeployRole
(
deployRole
);
}
}
}
return
req
.
getId
();
...
...
@@ -122,7 +135,7 @@ public class ProvisionController {
return
null
;
}
private
Message
buildProvisionerMessage
(
Provision
pReq
)
throws
JSONException
,
IOException
{
private
Message
buildProvisionerMessage
(
Provision
Info
pReq
)
throws
JSONException
,
IOException
{
Message
invokationMessage
=
new
Message
();
List
<
Parameter
>
parameters
=
new
ArrayList
();
CloudCredentials
cred
=
cloudCredentialsDao
.
findOne
(
pReq
.
getCloudConfID
());
...
...
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/service/ProvisionService.java
View file @
3793b78f
...
...
@@ -18,7 +18,6 @@ package nl.uva.sne.drip.api.service;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
nl.uva.sne.drip.api.dao.ProvisionDao
;
import
nl.uva.sne.drip.api.dao.ToscaDao
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.commons.types.ToscaRepresentation
;
...
...
@@ -27,6 +26,7 @@ import org.json.JSONException;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
nl.uva.sne.drip.api.dao.ProvisionInfoDao
;
/**
*
...
...
@@ -36,9 +36,9 @@ import org.springframework.web.multipart.MultipartFile;
public
class
ProvisionService
{
@Autowired
private
ProvisionDao
dao
;
private
Provision
Info
Dao
dao
;
public
ProvisionDao
getDao
()
{
public
Provision
Info
Dao
getDao
()
{
return
dao
;
}
...
...
This diff is collapsed.
Click to expand it.
drip-commons/src/main/java/nl/uva/sne/drip/commons/types/Provision.java
→
drip-commons/src/main/java/nl/uva/sne/drip/commons/types/Provision
Info
.java
View file @
3793b78f
...
...
@@ -22,7 +22,7 @@ import org.springframework.data.annotation.Id;
*
* @author S. Koulouzis
*/
public
class
Provision
{
public
class
Provision
Info
{
@Id
private
String
id
;
...
...
@@ -36,6 +36,9 @@ public class Provision {
private
String
userKeyID
;
private
Map
<
String
,
Object
>
kvMap
;
private
String
deployIP
;
private
String
deployUser
;
private
String
deployRole
;
/**
* @return the cloudConfID
...
...
@@ -121,4 +124,40 @@ public class Provision {
this
.
kvMap
=
kvMap
;
}
public
void
setDeployIP
(
String
deployIP
)
{
this
.
deployIP
=
deployIP
;
}
public
void
setDeployRole
(
String
deployRole
)
{
this
.
deployRole
=
deployRole
;
}
/**
* @return the deployIP
*/
public
String
getDeployIP
()
{
return
deployIP
;
}
/**
* @return the deployRole
*/
public
String
getDeployRole
()
{
return
deployRole
;
}
/**
* @return the deployUser
*/
public
String
getDeployUser
()
{
return
deployUser
;
}
/**
* @param deployUser the deployUser to set
*/
public
void
setDeployUser
(
String
deployUser
)
{
this
.
deployUser
=
deployUser
;
}
}
This diff is collapsed.
Click to expand it.
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