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
a66267cb
Commit
a66267cb
authored
Mar 08, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added permissions
parent
4927b5ba
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
801 additions
and
176 deletions
+801
-176
PermissionChecker.java
...main/java/nl/uva/sne/drip/api/auth/PermissionChecker.java
+37
-0
SecurityConfig.java
...rc/main/java/nl/uva/sne/drip/api/conf/SecurityConfig.java
+2
-1
CloudCredentialsDao.java
...ain/java/nl/uva/sne/drip/api/dao/CloudCredentialsDao.java
+11
-0
UserScriptDao.java
.../src/main/java/nl/uva/sne/drip/api/dao/UserScriptDao.java
+2
-2
UnauthorizedExeption.java
...a/nl/uva/sne/drip/api/exception/UnauthorizedExeption.java
+35
-0
CloudCredentialsService.java
.../nl/uva/sne/drip/api/service/CloudCredentialsService.java
+71
-0
PlannerService.java
...main/java/nl/uva/sne/drip/api/service/PlannerService.java
+3
-3
SimplePlannerService.java
...ava/nl/uva/sne/drip/api/service/SimplePlannerService.java
+3
-3
ToscaService.java
...c/main/java/nl/uva/sne/drip/api/service/ToscaService.java
+1
-1
UserService.java
...rc/main/java/nl/uva/sne/drip/api/service/UserService.java
+1
-4
CloudConfigurationController0.java
...a/sne/drip/api/v0/rest/CloudConfigurationController0.java
+2
-1
PlannerController0.java
.../java/nl/uva/sne/drip/api/v0/rest/PlannerController0.java
+2
-2
ProvisionController0.java
...ava/nl/uva/sne/drip/api/v0/rest/ProvisionController0.java
+279
-0
CloudCredentialsController.java
.../uva/sne/drip/api/v1/rest/CloudCredentialsController.java
+28
-22
DeployController.java
...in/java/nl/uva/sne/drip/api/v1/rest/DeployController.java
+3
-2
PlannerController.java
...n/java/nl/uva/sne/drip/api/v1/rest/PlannerController.java
+2
-1
ProvisionController.java
...java/nl/uva/sne/drip/api/v1/rest/ProvisionController.java
+6
-6
UserScriptController.java
...ava/nl/uva/sne/drip/api/v1/rest/UserScriptController.java
+6
-6
Execute.java
...c/main/java/nl/uva/sne/drip/commons/v0/types/Execute.java
+28
-0
Upload.java
...rc/main/java/nl/uva/sne/drip/commons/v0/types/Upload.java
+31
-0
CloudCredentials.java
...va/nl/uva/sne/drip/commons/v1/types/CloudCredentials.java
+1
-1
ClusterCredentials.java
.../nl/uva/sne/drip/commons/v1/types/ClusterCredentials.java
+7
-7
KeyValueHolder.java
...java/nl/uva/sne/drip/commons/v1/types/KeyValueHolder.java
+62
-0
OwnedObject.java
...in/java/nl/uva/sne/drip/commons/v1/types/OwnedObject.java
+63
-0
Permissions.java
...in/java/nl/uva/sne/drip/commons/v1/types/Permissions.java
+61
-0
Plan.java
.../src/main/java/nl/uva/sne/drip/commons/v1/types/Plan.java
+3
-36
ProvisionInfo.java
.../java/nl/uva/sne/drip/commons/v1/types/ProvisionInfo.java
+19
-49
Script.java
...rc/main/java/nl/uva/sne/drip/commons/v1/types/Script.java
+1
-1
TestBean.java
.../main/java/nl/uva/sne/drip/commons/v1/types/TestBean.java
+30
-0
ToscaRepresentation.java
...nl/uva/sne/drip/commons/v1/types/ToscaRepresentation.java
+1
-28
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/auth/PermissionChecker.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
auth
;
import
nl.uva.sne.drip.commons.v1.types.OwnedObject
;
import
nl.uva.sne.drip.commons.v1.types.User
;
import
org.springframework.stereotype.Component
;
/**
*
* @author S. Koulouzis
*/
@Component
(
"PermissionChecker"
)
public
class
PermissionChecker
{
public
boolean
canRead
(
OwnedObject
obj
,
User
user
)
{
return
false
;
}
public
boolean
isOwner
(
OwnedObject
obj
,
User
user
)
{
String
ownerid
=
obj
.
getOwner
();
return
user
.
getId
().
equals
(
ownerid
);
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/conf/SecurityConfig.java
View file @
a66267cb
...
@@ -36,7 +36,8 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
...
@@ -36,7 +36,8 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
*/
*/
@Configuration
@Configuration
@EnableWebSecurity
@EnableWebSecurity
@EnableGlobalMethodSecurity
(
jsr250Enabled
=
true
)
//@EnableGlobalMethodSecurity(jsr250Enabled = true, prePostEnabled = true)
@EnableGlobalMethodSecurity
(
prePostEnabled
=
true
)
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Autowired
@Autowired
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/dao/CloudCredentialsDao.java
View file @
a66267cb
...
@@ -24,4 +24,15 @@ import org.springframework.data.mongodb.repository.MongoRepository;
...
@@ -24,4 +24,15 @@ import org.springframework.data.mongodb.repository.MongoRepository;
*/
*/
public
interface
CloudCredentialsDao
extends
MongoRepository
<
CloudCredentials
,
String
>
{
public
interface
CloudCredentialsDao
extends
MongoRepository
<
CloudCredentials
,
String
>
{
@Override
CloudCredentials
findOne
(
String
id
);
//
// @PreAuthorize(ALLOWED_FOR_ADMINISTRATOR)
// @Override
// void delete(String id);
//
// @PreAuthorize(ALLOWED_FOR_OWNER + " or " + ALLOWED_FOR_ADMINISTRATOR)
// @Override
// List<CloudCredentials> findAll();
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/dao/UserScriptDao.java
View file @
a66267cb
...
@@ -15,13 +15,13 @@
...
@@ -15,13 +15,13 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
dao
;
package
nl
.
uva
.
sne
.
drip
.
api
.
dao
;
import
nl.uva.sne.drip.commons.v1.types.
User
Script
;
import
nl.uva.sne.drip.commons.v1.types.Script
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
/**
*
*
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
public
interface
UserScriptDao
extends
MongoRepository
<
User
Script
,
String
>
{
public
interface
UserScriptDao
extends
MongoRepository
<
Script
,
String
>
{
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/exception/UnauthorizedExeption.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
exception
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
/**
*
* @author S. Koulouzis
*/
@ResponseStatus
(
value
=
HttpStatus
.
UNAUTHORIZED
)
public
class
UnauthorizedExeption
extends
RuntimeException
{
public
UnauthorizedExeption
(
String
string
)
{
super
(
string
);
}
public
UnauthorizedExeption
()
{
super
();
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/CloudCredentialsService.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
service
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
nl.uva.sne.drip.api.dao.CloudCredentialsDao
;
import
nl.uva.sne.drip.commons.v1.types.CloudCredentials
;
import
nl.uva.sne.drip.commons.v1.types.Permissions
;
import
nl.uva.sne.drip.commons.v1.types.User
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PostAuthorize
;
import
org.springframework.security.access.prepost.PostFilter
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreFilter
;
import
org.springframework.stereotype.Service
;
/**
*
* @author S. Koulouzis
*/
@Service
public
class
CloudCredentialsService
{
@Autowired
private
CloudCredentialsDao
dao
;
@PreFilter
(
"(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
CloudCredentials
save
(
CloudCredentials
cloudCredentials
)
{
Permissions
permissions
=
new
Permissions
();
// String owner = user.getUsername();
// cloudCredentials.setOwner(owner);
System
.
err
.
println
(
cloudCredentials
.
getOwner
());
Set
<
String
>
read
=
new
HashSet
<>();
permissions
.
setRead
(
read
);
Set
<
String
>
write
=
new
HashSet
<>();
permissions
.
setWrite
(
write
);
cloudCredentials
.
setPermissions
(
permissions
);
return
dao
.
save
(
cloudCredentials
);
}
@PreAuthorize
(
"(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))"
)
public
CloudCredentials
findOne
(
String
id
)
{
CloudCredentials
creds
=
dao
.
findOne
(
id
);
return
creds
;
}
public
void
delete
(
String
id
)
{
dao
.
delete
(
id
);
}
@PreAuthorize
(
" (hasRole('ROLE_ADMIN')) or (hasRole('ROLE_USER'))"
)
@PostFilter
(
"(filterObject.owner == authentication.name)"
)
public
List
<
CloudCredentials
>
findAll
()
{
return
dao
.
findAll
();
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/PlannerService.java
View file @
a66267cb
...
@@ -107,7 +107,7 @@ public class PlannerService {
...
@@ -107,7 +107,7 @@ public class PlannerService {
if
(
t2
==
null
)
{
if
(
t2
==
null
)
{
throw
new
BadRequestException
();
throw
new
BadRequestException
();
}
}
Map
<
String
,
Object
>
map
=
t2
.
getK
vMap
();
Map
<
String
,
Object
>
map
=
t2
.
getK
eyValue
();
String
json
=
Converter
.
map2JsonString
(
map
);
String
json
=
Converter
.
map2JsonString
(
map
);
json
=
json
.
replaceAll
(
"\\uff0E"
,
"\\."
);
json
=
json
.
replaceAll
(
"\\uff0E"
,
"\\."
);
byte
[]
bytes
=
json
.
getBytes
();
byte
[]
bytes
=
json
.
getBytes
();
...
@@ -132,10 +132,10 @@ public class PlannerService {
...
@@ -132,10 +132,10 @@ public class PlannerService {
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
Map
<
String
,
Object
>
map
=
plan
.
getK
vMap
();
Map
<
String
,
Object
>
map
=
plan
.
getK
eyValue
();
Set
<
String
>
ids
=
plan
.
getLoweLevelPlanIDs
();
Set
<
String
>
ids
=
plan
.
getLoweLevelPlanIDs
();
for
(
String
lowID
:
ids
)
{
for
(
String
lowID
:
ids
)
{
Map
<
String
,
Object
>
lowLevelMap
=
planDao
.
findOne
(
lowID
).
getK
vMap
();
Map
<
String
,
Object
>
lowLevelMap
=
planDao
.
findOne
(
lowID
).
getK
eyValue
();
map
.
putAll
(
lowLevelMap
);
map
.
putAll
(
lowLevelMap
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/SimplePlannerService.java
View file @
a66267cb
...
@@ -101,7 +101,7 @@ public class SimplePlannerService {
...
@@ -101,7 +101,7 @@ public class SimplePlannerService {
if
(
t2
==
null
)
{
if
(
t2
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
Map
<
String
,
Object
>
map
=
t2
.
getK
vMap
();
Map
<
String
,
Object
>
map
=
t2
.
getK
eyValue
();
String
ymlStr
=
Converter
.
map2YmlString
(
map
);
String
ymlStr
=
Converter
.
map2YmlString
(
map
);
ymlStr
=
ymlStr
.
replaceAll
(
"\\uff0E"
,
"\\."
);
ymlStr
=
ymlStr
.
replaceAll
(
"\\uff0E"
,
"\\."
);
byte
[]
bytes
=
ymlStr
.
getBytes
();
byte
[]
bytes
=
ymlStr
.
getBytes
();
...
@@ -134,10 +134,10 @@ public class SimplePlannerService {
...
@@ -134,10 +134,10 @@ public class SimplePlannerService {
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
Map
<
String
,
Object
>
map
=
plan
.
getK
vMap
();
Map
<
String
,
Object
>
map
=
plan
.
getK
eyValue
();
Set
<
String
>
ids
=
plan
.
getLoweLevelPlanIDs
();
Set
<
String
>
ids
=
plan
.
getLoweLevelPlanIDs
();
for
(
String
lowID
:
ids
)
{
for
(
String
lowID
:
ids
)
{
Map
<
String
,
Object
>
lowLevelMap
=
planDao
.
findOne
(
lowID
).
getK
vMap
();
Map
<
String
,
Object
>
lowLevelMap
=
planDao
.
findOne
(
lowID
).
getK
eyValue
();
map
.
putAll
(
lowLevelMap
);
map
.
putAll
(
lowLevelMap
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/ToscaService.java
View file @
a66267cb
...
@@ -43,7 +43,7 @@ public class ToscaService {
...
@@ -43,7 +43,7 @@ public class ToscaService {
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
Map
<
String
,
Object
>
map
=
tosca
.
getK
vMap
();
Map
<
String
,
Object
>
map
=
tosca
.
getK
eyValue
();
if
(
fromat
!=
null
&&
fromat
.
equals
(
"yml"
))
{
if
(
fromat
!=
null
&&
fromat
.
equals
(
"yml"
))
{
String
ymlStr
=
Converter
.
map2YmlString
(
map
);
String
ymlStr
=
Converter
.
map2YmlString
(
map
);
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/UserService.java
View file @
a66267cb
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
service
;
package
nl
.
uva
.
sne
.
drip
.
api
.
service
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.api.dao.UserDao
;
import
nl.uva.sne.drip.api.dao.UserDao
;
...
@@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
/**
/**
...
@@ -39,7 +36,7 @@ public class UserService implements UserDetailsService {
...
@@ -39,7 +36,7 @@ public class UserService implements UserDetailsService {
public
static
final
String
USER
=
"USER"
;
public
static
final
String
USER
=
"USER"
;
@Autowired
@Autowired
UserDao
dao
;
private
UserDao
dao
;
@Override
@Override
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/CloudConfigurationController0.java
View file @
a66267cb
...
@@ -77,7 +77,8 @@ public class CloudConfigurationController0 {
...
@@ -77,7 +77,8 @@ public class CloudConfigurationController0 {
}
}
cloudCredentials
.
setLogineKeys
(
loginKeys
);
cloudCredentials
.
setLogineKeys
(
loginKeys
);
cloudCredentials
.
setCloudProviderName
(
"ec2"
);
cloudCredentials
.
setCloudProviderName
(
"ec2"
);
cloudCredentialsDao
.
save
(
cloudCredentials
);
cloudCredentials
=
cloudCredentialsDao
.
save
(
cloudCredentials
);
return
"Success: "
+
cloudCredentials
.
getId
();
return
"Success: "
+
cloudCredentials
.
getId
();
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/PlannerController0.java
View file @
a66267cb
...
@@ -82,7 +82,7 @@ public class PlannerController0 {
...
@@ -82,7 +82,7 @@ public class PlannerController0 {
}
}
e
.
name
=
p1Name
;
e
.
name
=
p1Name
;
e
.
content
=
Converter
.
map2YmlString
(
plan1
.
getK
vMap
()).
replaceAll
(
"\n"
,
"\\n"
);
e
.
content
=
Converter
.
map2YmlString
(
plan1
.
getK
eyValue
()).
replaceAll
(
"\n"
,
"\\n"
);
files
.
add
(
e
);
files
.
add
(
e
);
for
(
String
lowiID
:
plan1
.
getLoweLevelPlanIDs
())
{
for
(
String
lowiID
:
plan1
.
getLoweLevelPlanIDs
())
{
...
@@ -97,7 +97,7 @@ public class PlannerController0 {
...
@@ -97,7 +97,7 @@ public class PlannerController0 {
}
}
e
.
name
=
p1Name
;
e
.
name
=
p1Name
;
e
.
content
=
Converter
.
map2YmlString
(
lowPlan1
.
getK
vMap
()).
replaceAll
(
"\n"
,
"\\n"
);;
e
.
content
=
Converter
.
map2YmlString
(
lowPlan1
.
getK
eyValue
()).
replaceAll
(
"\n"
,
"\\n"
);;
files
.
add
(
e
);
files
.
add
(
e
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/ProvisionController0.java
0 → 100644
View file @
a66267cb
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/CloudC
onfiguration
Controller.java
→
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/CloudC
redentials
Controller.java
View file @
a66267cb
...
@@ -32,14 +32,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -32,14 +32,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
nl.uva.sne.drip.api.dao.CloudCredentialsDao
;
import
nl.uva.sne.drip.api.exception.BadRequestException
;
import
nl.uva.sne.drip.api.exception.BadRequestException
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.exception.NullKeyException
;
import
nl.uva.sne.drip.api.exception.NullKeyException
;
import
nl.uva.sne.drip.api.exception.NullKeyIDException
;
import
nl.uva.sne.drip.api.exception.NullKeyIDException
;
import
nl.uva.sne.drip.api.service.CloudCredentialsService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.User
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
@@ -47,19 +49,19 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -47,19 +49,19 @@ import org.springframework.web.multipart.MultipartFile;
/**
/**
*
*
* This controller is responsible for handling CloudCredentials.
* This controller is responsible for handling CloudCredentials.
* CloudCredentials are a represntation of the credentials that are used by the
* CloudCredentials are a represntation of the credentials that are used by the
* provisoner to request for resources (VMs)
* provisoner to request for resources (VMs)
*
*
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@RestController
@RestController
@RequestMapping
(
"/user/v1.0/c
onfiguration
/cloud"
)
@RequestMapping
(
"/user/v1.0/c
redentials
/cloud"
)
@Component
@Component
public
class
CloudC
onfiguration
Controller
{
public
class
CloudC
redentials
Controller
{
@Autowired
@Autowired
private
CloudCredentials
Dao
cloudCredentialsDao
;
private
CloudCredentials
Service
cloudCredentialsService
;
/**
/**
* Post the cloud credentials.
* Post the cloud credentials.
...
@@ -69,7 +71,7 @@ public class CloudConfigurationController {
...
@@ -69,7 +71,7 @@ public class CloudConfigurationController {
*/
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@StatusCodes
({
@StatusCodes
({
@ResponseCode
(
code
=
400
,
condition
=
"Key or KeyIdAlias can't be empty"
)
@ResponseCode
(
code
=
400
,
condition
=
"Key or KeyIdAlias can't be empty"
)
})
})
public
@ResponseBody
public
@ResponseBody
...
@@ -80,7 +82,8 @@ public class CloudConfigurationController {
...
@@ -80,7 +82,8 @@ public class CloudConfigurationController {
if
(
cloudCredentials
.
getKeyIdAlias
()
==
null
)
{
if
(
cloudCredentials
.
getKeyIdAlias
()
==
null
)
{
throw
new
NullKeyIDException
();
throw
new
NullKeyIDException
();
}
}
cloudCredentialsDao
.
save
(
cloudCredentials
);
// User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
cloudCredentials
=
cloudCredentialsService
.
save
(
cloudCredentials
);
return
cloudCredentials
.
getId
();
return
cloudCredentials
.
getId
();
}
}
...
@@ -97,8 +100,9 @@ public class CloudConfigurationController {
...
@@ -97,8 +100,9 @@ public class CloudConfigurationController {
public
@ResponseBody
public
@ResponseBody
String
addLogineKey
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@PathVariable
(
"id"
)
String
id
)
{
String
addLogineKey
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@PathVariable
(
"id"
)
String
id
)
{
try
{
try
{
CloudCredentials
cc
=
cloudCredentialsDao
.
findOne
(
id
);
if
(
cc
==
null
)
{
CloudCredentials
cloudCredentials
=
cloudCredentialsService
.
findOne
(
id
);
if
(
cloudCredentials
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
if
(
file
.
isEmpty
())
{
if
(
file
.
isEmpty
())
{
...
@@ -106,23 +110,24 @@ public class CloudConfigurationController {
...
@@ -106,23 +110,24 @@ public class CloudConfigurationController {
}
}
String
originalFileName
=
file
.
getOriginalFilename
();
String
originalFileName
=
file
.
getOriginalFilename
();
byte
[]
bytes
=
file
.
getBytes
();
byte
[]
bytes
=
file
.
getBytes
();
List
<
LoginKey
>
logInKeys
=
c
c
.
getLoginKeys
();
List
<
LoginKey
>
logInKeys
=
c
loudCredentials
.
getLoginKeys
();
if
(
logInKeys
==
null
)
{
if
(
logInKeys
==
null
)
{
logInKeys
=
new
ArrayList
<>();
logInKeys
=
new
ArrayList
<>();
}
}
LoginKey
key
=
new
LoginKey
();
LoginKey
key
=
new
LoginKey
();
key
.
setKey
(
new
String
(
bytes
,
"UTF-8"
));
key
.
setKey
(
new
String
(
bytes
,
"UTF-8"
));
if
(
c
c
.
getCloudProviderName
().
toLowerCase
().
equals
(
"ec2"
))
{
if
(
c
loudCredentials
.
getCloudProviderName
().
toLowerCase
().
equals
(
"ec2"
))
{
Map
<
String
,
String
>
attributes
=
new
HashMap
<>();
Map
<
String
,
String
>
attributes
=
new
HashMap
<>();
attributes
.
put
(
"domain_name"
,
FilenameUtils
.
removeExtension
(
originalFileName
));
attributes
.
put
(
"domain_name"
,
FilenameUtils
.
removeExtension
(
originalFileName
));
key
.
setAttributes
(
attributes
);
key
.
setAttributes
(
attributes
);
}
}
logInKeys
.
add
(
key
);
logInKeys
.
add
(
key
);
cc
.
setLogineKeys
(
logInKeys
);
cloudCredentials
.
setLogineKeys
(
logInKeys
);
cloudCredentialsDao
.
save
(
cc
);
// User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return
cloudCredentialsDao
.
findOne
(
id
).
getId
();
cloudCredentials
=
cloudCredentialsService
.
save
(
cloudCredentials
);
return
cloudCredentials
.
getId
();
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
CloudC
onfiguration
Controller
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
Logger
.
getLogger
(
CloudC
redentials
Controller
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
return
null
;
return
null
;
}
}
...
@@ -137,7 +142,8 @@ public class CloudConfigurationController {
...
@@ -137,7 +142,8 @@ public class CloudConfigurationController {
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
public
@ResponseBody
CloudCredentials
get
(
@PathVariable
(
"id"
)
String
id
)
{
CloudCredentials
get
(
@PathVariable
(
"id"
)
String
id
)
{
CloudCredentials
cc
=
cloudCredentialsDao
.
findOne
(
id
);
// User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
CloudCredentials
cc
=
cloudCredentialsService
.
findOne
(
id
);
if
(
cc
==
null
)
{
if
(
cc
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
...
@@ -154,20 +160,20 @@ public class CloudConfigurationController {
...
@@ -154,20 +160,20 @@ public class CloudConfigurationController {
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
public
@ResponseBody
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
cloudCredentials
Dao
.
delete
(
id
);
cloudCredentials
Service
.
delete
(
id
);
return
"Deleted :"
+
id
;
return
"Deleted :"
+
id
;
}
}
/**
/**
* Gets all the IDs of the stored cloud credentials
* Gets all the IDs of the stored cloud credentials
*
*
* @return a list of stored IDs
* @return a list of stored IDs
*/
*/
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
public
@ResponseBody
List
<
String
>
getIds
()
{
List
<
String
>
getIds
()
{
List
<
CloudCredentials
>
all
=
cloudCredentials
Dao
.
findAll
();
List
<
CloudCredentials
>
all
=
cloudCredentials
Service
.
findAll
();
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
for
(
CloudCredentials
tr
:
all
)
{
for
(
CloudCredentials
tr
:
all
)
{
ids
.
add
(
tr
.
getId
());
ids
.
add
(
tr
.
getId
());
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/DeployController.java
View file @
a66267cb
...
@@ -49,6 +49,7 @@ import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
...
@@ -49,6 +49,7 @@ import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
import
nl.uva.sne.drip.commons.v1.types.DeployParameter
;
import
nl.uva.sne.drip.commons.v1.types.DeployParameter
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.ProvisionInfo
;
import
nl.uva.sne.drip.commons.v1.types.ProvisionInfo
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
@@ -59,7 +60,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -59,7 +60,7 @@ import org.springframework.web.bind.annotation.RequestParam;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/user/v1.0/deployer"
)
@RequestMapping
(
"/user/v1.0/deployer"
)
@Co
mponent
@Co
ntroller
public
class
DeployController
{
public
class
DeployController
{
@Value
(
"${message.broker.host}"
)
@Value
(
"${message.broker.host}"
)
...
@@ -162,7 +163,7 @@ public class DeployController {
...
@@ -162,7 +163,7 @@ public class DeployController {
if
(
pro
==
null
)
{
if
(
pro
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
String
cloudConfID
=
pro
.
getCloud
Conf
ID
();
String
cloudConfID
=
pro
.
getCloud
cloudCredentials
ID
();
CloudCredentials
cCred
=
cloudCredentialsDao
.
findOne
(
cloudConfID
);
CloudCredentials
cCred
=
cloudCredentialsDao
.
findOne
(
cloudConfID
);
List
<
LoginKey
>
loginKeys
=
cCred
.
getLoginKeys
();
List
<
LoginKey
>
loginKeys
=
cCred
.
getLoginKeys
();
List
<
DeployParameter
>
deployParams
=
pro
.
getDeployParameters
();
List
<
DeployParameter
>
deployParams
=
pro
.
getDeployParameters
();
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/PlannerController.java
View file @
a66267cb
...
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
import
nl.uva.sne.drip.api.service.PlannerService
;
import
nl.uva.sne.drip.api.service.PlannerService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.v1.types.Plan
;
import
nl.uva.sne.drip.commons.v1.types.Plan
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
/**
...
@@ -44,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -44,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestParam;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/user/v1.0/planner"
)
@RequestMapping
(
"/user/v1.0/planner"
)
@Co
mponent
@Co
ntroller
public
class
PlannerController
{
public
class
PlannerController
{
// @Autowired
// @Autowired
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/ProvisionController.java
View file @
a66267cb
...
@@ -59,7 +59,7 @@ import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
...
@@ -59,7 +59,7 @@ import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import
nl.uva.sne.drip.commons.v1.types.DeployParameter
;
import
nl.uva.sne.drip.commons.v1.types.DeployParameter
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.Plan
;
import
nl.uva.sne.drip.commons.v1.types.Plan
;
import
nl.uva.sne.drip.commons.v1.types.
User
Script
;
import
nl.uva.sne.drip.commons.v1.types.Script
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.json.JSONException
;
import
org.json.JSONException
;
...
@@ -207,7 +207,7 @@ public class ProvisionController {
...
@@ -207,7 +207,7 @@ public class ProvisionController {
private
Message
buildProvisionerMessage
(
ProvisionInfo
pReq
)
throws
JSONException
,
IOException
{
private
Message
buildProvisionerMessage
(
ProvisionInfo
pReq
)
throws
JSONException
,
IOException
{
Message
invokationMessage
=
new
Message
();
Message
invokationMessage
=
new
Message
();
List
<
MessageParameter
>
parameters
=
new
ArrayList
();
List
<
MessageParameter
>
parameters
=
new
ArrayList
();
CloudCredentials
cred
=
cloudCredentialsDao
.
findOne
(
pReq
.
getCloud
Conf
ID
());
CloudCredentials
cred
=
cloudCredentialsDao
.
findOne
(
pReq
.
getCloud
cloudCredentials
ID
());
if
(
cred
==
null
)
{
if
(
cred
==
null
)
{
throw
new
CloudCredentialsNotFoundException
();
throw
new
CloudCredentialsNotFoundException
();
}
}
...
@@ -220,7 +220,7 @@ public class ProvisionController {
...
@@ -220,7 +220,7 @@ public class ProvisionController {
List
<
MessageParameter
>
topologies
=
buildTopologyParams
(
pReq
.
getPlanID
());
List
<
MessageParameter
>
topologies
=
buildTopologyParams
(
pReq
.
getPlanID
());
parameters
.
addAll
(
topologies
);
parameters
.
addAll
(
topologies
);
String
scriptID
=
pReq
.
get
UserS
criptID
();
String
scriptID
=
pReq
.
get
s
criptID
();
if
(
scriptID
!=
null
)
{
if
(
scriptID
!=
null
)
{
List
<
MessageParameter
>
userScripts
=
buildScriptParams
(
scriptID
);
List
<
MessageParameter
>
userScripts
=
buildScriptParams
(
scriptID
);
parameters
.
addAll
(
userScripts
);
parameters
.
addAll
(
userScripts
);
...
@@ -281,7 +281,7 @@ public class ProvisionController {
...
@@ -281,7 +281,7 @@ public class ProvisionController {
List
<
MessageParameter
>
parameters
=
new
ArrayList
();
List
<
MessageParameter
>
parameters
=
new
ArrayList
();
MessageParameter
topology
=
new
MessageParameter
();
MessageParameter
topology
=
new
MessageParameter
();
topology
.
setName
(
"topology"
);
topology
.
setName
(
"topology"
);
topology
.
setValue
(
Converter
.
map2YmlString
(
plan
.
getK
vMap
()));
topology
.
setValue
(
Converter
.
map2YmlString
(
plan
.
getK
eyValue
()));
Map
<
String
,
String
>
attributes
=
new
HashMap
<>();
Map
<
String
,
String
>
attributes
=
new
HashMap
<>();
attributes
.
put
(
"level"
,
String
.
valueOf
(
plan
.
getLevel
()));
attributes
.
put
(
"level"
,
String
.
valueOf
(
plan
.
getLevel
()));
attributes
.
put
(
"filename"
,
FilenameUtils
.
removeExtension
(
plan
.
getName
()));
attributes
.
put
(
"filename"
,
FilenameUtils
.
removeExtension
(
plan
.
getName
()));
...
@@ -293,7 +293,7 @@ public class ProvisionController {
...
@@ -293,7 +293,7 @@ public class ProvisionController {
Plan
lowPlan
=
planService
.
getDao
().
findOne
(
lowID
);
Plan
lowPlan
=
planService
.
getDao
().
findOne
(
lowID
);
topology
=
new
MessageParameter
();
topology
=
new
MessageParameter
();
topology
.
setName
(
"topology"
);
topology
.
setName
(
"topology"
);
topology
.
setValue
(
Converter
.
map2YmlString
(
lowPlan
.
getK
vMap
()));
topology
.
setValue
(
Converter
.
map2YmlString
(
lowPlan
.
getK
eyValue
()));
attributes
=
new
HashMap
<>();
attributes
=
new
HashMap
<>();
attributes
.
put
(
"level"
,
String
.
valueOf
(
lowPlan
.
getLevel
()));
attributes
.
put
(
"level"
,
String
.
valueOf
(
lowPlan
.
getLevel
()));
attributes
.
put
(
"filename"
,
FilenameUtils
.
removeExtension
(
lowPlan
.
getName
()));
attributes
.
put
(
"filename"
,
FilenameUtils
.
removeExtension
(
lowPlan
.
getName
()));
...
@@ -318,7 +318,7 @@ public class ProvisionController {
...
@@ -318,7 +318,7 @@ public class ProvisionController {
}
}
private
List
<
MessageParameter
>
buildScriptParams
(
String
userScriptID
)
{
private
List
<
MessageParameter
>
buildScriptParams
(
String
userScriptID
)
{
User
Script
script
=
userScriptService
.
getDao
().
findOne
(
userScriptID
);
Script
script
=
userScriptService
.
getDao
().
findOne
(
userScriptID
);
if
(
script
==
null
)
{
if
(
script
==
null
)
{
throw
new
BadRequestException
(
"User script: "
+
userScriptID
+
" was not found"
);
throw
new
BadRequestException
(
"User script: "
+
userScriptID
+
" was not found"
);
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/UserScriptController.java
View file @
a66267cb
...
@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
nl.uva.sne.drip.api.dao.UserScriptDao
;
import
nl.uva.sne.drip.api.dao.UserScriptDao
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.commons.v1.types.
User
Script
;
import
nl.uva.sne.drip.commons.v1.types.Script
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
/**
/**
...
@@ -64,7 +64,7 @@ public class UserScriptController {
...
@@ -64,7 +64,7 @@ public class UserScriptController {
byte
[]
bytes
=
file
.
getBytes
();
byte
[]
bytes
=
file
.
getBytes
();
String
conents
=
new
String
(
bytes
,
"UTF-8"
);
String
conents
=
new
String
(
bytes
,
"UTF-8"
);
UserScript
us
=
new
User
Script
();
Script
us
=
new
Script
();
us
.
setContents
(
conents
);
us
.
setContents
(
conents
);
us
.
setName
(
name
);
us
.
setName
(
name
);
...
@@ -86,13 +86,13 @@ public class UserScriptController {
...
@@ -86,13 +86,13 @@ public class UserScriptController {
*/
*/
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
public
@ResponseBody
User
Script
get
(
@PathVariable
(
"id"
)
String
id
)
{
Script
get
(
@PathVariable
(
"id"
)
String
id
)
{
return
dao
.
findOne
(
id
);
return
dao
.
findOne
(
id
);
}
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
public
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
public
String
delete
(
@PathVariable
(
"id"
)
String
id
)
{
User
Script
script
=
dao
.
findOne
(
id
);
Script
script
=
dao
.
findOne
(
id
);
if
(
script
==
null
)
{
if
(
script
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
...
@@ -108,9 +108,9 @@ public class UserScriptController {
...
@@ -108,9 +108,9 @@ public class UserScriptController {
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
public
@ResponseBody
List
<
String
>
getIds
()
{
List
<
String
>
getIds
()
{
List
<
User
Script
>
all
=
dao
.
findAll
();
List
<
Script
>
all
=
dao
.
findAll
();
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
for
(
User
Script
us
:
all
)
{
for
(
Script
us
:
all
)
{
ids
.
add
(
us
.
getId
());
ids
.
add
(
us
.
getId
());
}
}
return
ids
;
return
ids
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Execute.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
;
/**
*
* @author S. Koulouzis
*/
public
class
Execute
{
public
String
user
;
public
String
pwd
;
public
String
action
;
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Upload.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
;
import
java.util.List
;
/**
*
* @author S. Koulouzis
*/
public
class
Upload
{
public
String
user
;
public
String
pwd
;
List
<
File
>
file
;
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/CloudCredentials.java
View file @
a66267cb
...
@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
...
@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@Document
@Document
public
class
CloudCredentials
{
public
class
CloudCredentials
extends
OwnedObject
{
@Id
@Id
private
String
id
;
private
String
id
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/ClusterCredentials.java
View file @
a66267cb
...
@@ -29,7 +29,7 @@ public class ClusterCredentials {
...
@@ -29,7 +29,7 @@ public class ClusterCredentials {
@Id
@Id
private
String
id
;
private
String
id
;
private
String
contents
;
private
String
key
;
public
String
getId
()
{
public
String
getId
()
{
return
id
;
return
id
;
...
@@ -43,19 +43,19 @@ public class ClusterCredentials {
...
@@ -43,19 +43,19 @@ public class ClusterCredentials {
}
}
/**
/**
* The
contents
of the login key.
* The
key
of the login key.
* @return the
contents
* @return the
key
*/
*/
@DocumentationExample
(
"BEGINRSAPRIVATEKEY-----\\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3fVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm\\neNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY\\nRx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri\\nd4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6\\nD3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr\\nN1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk\\nnLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq\\nKQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH\\ngG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC\\nycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBmOdzcHeedJQw\\nack2SAv65WBI9S9MEQ7J/vFuyw5HNk3C/mcWgzDQXSNIhHLvl/Z9sux/Qpm3SQWLz0RBxKV3dJ4r\\nwcAxzVA93+/L1Nee+VOKnlyRumvVa6+XLsLagpap2AVcTqlerMcCgYEAx3T2pXtqkCE9eU/ov22r\\npdaKjgHoGOUg1CMEfWi/Ch6sYIIRyrHz6dhy+yR1pXNgPbLWdrn8l88F3+IsmbaMupMgRmqwEC3G\\n9Y2FglGIVvRdZaagvRxLzRCcvcN4v6OYs9ST4o1xlv7Qxphld+0XDKv7VSCv/rASuK8BqlFL3E8C\\ngYArMXJRnRjG7qh6g9TRIjZphdI3XxX9s5Rt2D8iZvuhAhqmBZjzY4PR7kxYmO2+EpCjzNnEl0XW\\n/GHaWbiIjhnAykx4N9KP7gGom3O5lzwHUme1XnFKcO2wDjQwJbufRmba8iQF1srN577mF+Z7ha4V\\nJ1duCTzvWF1KFX6sk/uhKQKBgAcDFai7rgNjJ8YcCRKxyFcMM9LKPl6hr4XFtWKzTAQPEABUkkuN\\n9gVClsg9f+VRKRECOIf0Ae1UWeCFEwxUXp4wjfHrzkTDVztKvmbWdvSXorDwKrZ7SC7tZpVFSfly\\nxuuLjadpUZT9YFmbAfY1X5oSccOMYqORjRbxEB3svb4BAoGAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ\\nhLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mPJxY9ICaY\\n55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48howjUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=\\n-----ENDRSAPRIVATEKEY-----\\n"
)
@DocumentationExample
(
"BEGINRSAPRIVATEKEY-----\\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3fVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm\\neNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY\\nRx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri\\nd4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6\\nD3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr\\nN1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk\\nnLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq\\nKQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH\\ngG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC\\nycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBmOdzcHeedJQw\\nack2SAv65WBI9S9MEQ7J/vFuyw5HNk3C/mcWgzDQXSNIhHLvl/Z9sux/Qpm3SQWLz0RBxKV3dJ4r\\nwcAxzVA93+/L1Nee+VOKnlyRumvVa6+XLsLagpap2AVcTqlerMcCgYEAx3T2pXtqkCE9eU/ov22r\\npdaKjgHoGOUg1CMEfWi/Ch6sYIIRyrHz6dhy+yR1pXNgPbLWdrn8l88F3+IsmbaMupMgRmqwEC3G\\n9Y2FglGIVvRdZaagvRxLzRCcvcN4v6OYs9ST4o1xlv7Qxphld+0XDKv7VSCv/rASuK8BqlFL3E8C\\ngYArMXJRnRjG7qh6g9TRIjZphdI3XxX9s5Rt2D8iZvuhAhqmBZjzY4PR7kxYmO2+EpCjzNnEl0XW\\n/GHaWbiIjhnAykx4N9KP7gGom3O5lzwHUme1XnFKcO2wDjQwJbufRmba8iQF1srN577mF+Z7ha4V\\nJ1duCTzvWF1KFX6sk/uhKQKBgAcDFai7rgNjJ8YcCRKxyFcMM9LKPl6hr4XFtWKzTAQPEABUkkuN\\n9gVClsg9f+VRKRECOIf0Ae1UWeCFEwxUXp4wjfHrzkTDVztKvmbWdvSXorDwKrZ7SC7tZpVFSfly\\nxuuLjadpUZT9YFmbAfY1X5oSccOMYqORjRbxEB3svb4BAoGAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ\\nhLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mPJxY9ICaY\\n55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48howjUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=\\n-----ENDRSAPRIVATEKEY-----\\n"
)
public
String
get
Contents
()
{
public
String
get
Key
()
{
return
contents
;
return
key
;
}
}
/**
/**
* @param contents the
contents
to set
* @param contents the
key
to set
*/
*/
public
void
setContents
(
String
contents
)
{
public
void
setContents
(
String
contents
)
{
this
.
contents
=
contents
;
this
.
key
=
contents
;
}
}
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/KeyValueHolder.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
java.util.Map
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
*
* @author S. Koulouzis
*/
@Document
public
class
KeyValueHolder
{
@Id
private
String
id
;
private
Map
<
String
,
Object
>
keyValue
;
/**
* @return the keyValue
*/
public
Map
<
String
,
Object
>
getKeyValue
()
{
return
keyValue
;
}
/**
* @param keyValue the keyValue to set
*/
public
void
setKvMap
(
Map
<
String
,
Object
>
keyValue
)
{
this
.
keyValue
=
keyValue
;
}
/**
* @return the id
*/
public
String
getId
()
{
return
id
;
}
/**
* @param id the id to set
*/
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/OwnedObject.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
javax.validation.constraints.NotNull
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.stereotype.Component
;
/**
*
* @author S. Koulouzis
*/
@Document
public
class
OwnedObject
{
@NotNull
private
String
owner
;
@NotNull
private
Permissions
permissions
;
/**
* @return the permissions
*/
public
Permissions
getPermissions
()
{
return
permissions
;
}
/**
* @param permissions the permissions to set
*/
public
void
setPermissions
(
Permissions
permissions
)
{
this
.
permissions
=
permissions
;
}
/**
* @return the owner
*/
public
String
getOwner
()
{
return
owner
;
}
/**
* @param owner the ownerID to set
*/
public
void
setOwner
(
String
owner
)
{
this
.
owner
=
owner
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/Permissions.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
java.util.Set
;
import
javax.validation.constraints.NotNull
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
*
* @author S. Koulouzis
*/
@Document
public
class
Permissions
{
private
Set
<
String
>
read
;
private
Set
<
String
>
write
;
/**
* @return the read
*/
public
Set
<
String
>
getRead
()
{
return
read
;
}
/**
* @param read the read to set
*/
public
void
setRead
(
Set
<
String
>
read
)
{
this
.
read
=
read
;
}
/**
* @return the write
*/
public
Set
<
String
>
getWrite
()
{
return
write
;
}
/**
* @param write the write to set
*/
public
void
setWrite
(
Set
<
String
>
write
)
{
this
.
write
=
write
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/Plan.java
View file @
a66267cb
...
@@ -15,22 +15,17 @@
...
@@ -15,22 +15,17 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
/**
*
*
* This class represents a plan generated by the planner.
* This class represents a plan generated by the planner.
*
*
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@Document
@Document
public
class
Plan
{
public
class
Plan
extends
KeyValueHolder
{
@Id
private
String
id
;
private
String
toscaID
;
private
String
toscaID
;
...
@@ -40,31 +35,6 @@ public class Plan {
...
@@ -40,31 +35,6 @@ public class Plan {
private
Set
<
String
>
loweLevelPlansIDs
;
private
Set
<
String
>
loweLevelPlansIDs
;
private
Map
<
String
,
Object
>
kvMap
;
public
final
String
getId
()
{
return
id
;
}
public
final
void
setId
(
final
String
id
)
{
this
.
id
=
id
;
}
/**
*
* @return the kvMap
*/
public
Map
<
String
,
Object
>
getKvMap
()
{
return
kvMap
;
}
/**
* @param kvMap the kvMap to set
*/
public
void
setKvMap
(
Map
<
String
,
Object
>
kvMap
)
{
this
.
kvMap
=
kvMap
;
}
/**
/**
* @return the name
* @return the name
*/
*/
...
@@ -114,9 +84,6 @@ public class Plan {
...
@@ -114,9 +84,6 @@ public class Plan {
return
loweLevelPlansIDs
;
return
loweLevelPlansIDs
;
}
}
/**
* @param loweLevelPlans the loweLevelPlansIDs to set
*/
public
void
setLoweLevelPlansIDs
(
Set
<
String
>
loweLevelPlansIDs
)
{
public
void
setLoweLevelPlansIDs
(
Set
<
String
>
loweLevelPlansIDs
)
{
this
.
loweLevelPlansIDs
=
loweLevelPlansIDs
;
this
.
loweLevelPlansIDs
=
loweLevelPlansIDs
;
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/ProvisionInfo.java
View file @
a66267cb
...
@@ -16,41 +16,37 @@
...
@@ -16,41 +16,37 @@
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.annotation.Id
;
/**
/**
*
*
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
public
class
ProvisionInfo
{
@Document
public
class
ProvisionInfo
extends
KeyValueHolder
{
@Id
private
String
id
;
private
String
cloudCredentialsID
;
private
String
cloudConfID
;
private
String
planID
;
private
String
planID
;
private
String
userS
criptID
;
private
String
s
criptID
;
private
String
userKeyID
;
private
String
userKeyID
;
private
Map
<
String
,
Object
>
kvMap
;
private
List
<
DeployParameter
>
deployParameters
;
private
List
<
DeployParameter
>
deployParameters
;
/**
/**
* @return the cloudC
onf
ID
* @return the cloudC
redentials
ID
*/
*/
public
String
getCloud
Conf
ID
()
{
public
String
getCloud
cloudCredentials
ID
()
{
return
cloudC
onf
ID
;
return
cloudC
redentials
ID
;
}
}
/**
/**
* @param cloudConfID the cloudC
onf
ID to set
* @param cloudConfID the cloudC
redentials
ID to set
*/
*/
public
void
setCloud
Conf
ID
(
String
cloudConfID
)
{
public
void
setCloud
cloudCredentials
ID
(
String
cloudConfID
)
{
this
.
cloudC
onf
ID
=
cloudConfID
;
this
.
cloudC
redentials
ID
=
cloudConfID
;
}
}
/**
/**
...
@@ -68,17 +64,17 @@ public class ProvisionInfo {
...
@@ -68,17 +64,17 @@ public class ProvisionInfo {
}
}
/**
/**
* @return the
userS
criptID
* @return the
s
criptID
*/
*/
public
String
get
UserS
criptID
()
{
public
String
get
s
criptID
()
{
return
userS
criptID
;
return
s
criptID
;
}
}
/**
/**
* @param
userScriptID the userS
criptID to set
* @param
scriptID the s
criptID to set
*/
*/
public
void
set
UserScriptID
(
String
userS
criptID
)
{
public
void
set
ScriptID
(
String
s
criptID
)
{
this
.
userScriptID
=
userS
criptID
;
this
.
scriptID
=
s
criptID
;
}
}
/**
/**
...
@@ -95,33 +91,7 @@ public class ProvisionInfo {
...
@@ -95,33 +91,7 @@ public class ProvisionInfo {
this
.
userKeyID
=
userKeyID
;
this
.
userKeyID
=
userKeyID
;
}
}
/**
* @return the id
*/
public
String
getId
()
{
return
id
;
}
/**
* @param id the id to set
*/
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* @return the kvMap
*/
public
Map
<
String
,
Object
>
getKvMap
()
{
return
kvMap
;
}
/**
* @param kvMap the kvMap to set
*/
public
void
setKvMap
(
Map
<
String
,
Object
>
kvMap
)
{
this
.
kvMap
=
kvMap
;
}
public
void
setDeployParameters
(
List
<
DeployParameter
>
deployParameters
)
{
public
void
setDeployParameters
(
List
<
DeployParameter
>
deployParameters
)
{
this
.
deployParameters
=
deployParameters
;
this
.
deployParameters
=
deployParameters
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/
User
Script.java
→
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/Script.java
View file @
a66267cb
...
@@ -25,7 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
...
@@ -25,7 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@Document
@Document
public
class
User
Script
{
public
class
Script
{
@Id
@Id
private
String
id
;
private
String
id
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/TestBean.java
0 → 100644
View file @
a66267cb
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
;
import
org.springframework.stereotype.Component
;
/**
*
* @author S. Koulouzis
*/
@Component
public
class
TestBean
{
public
boolean
getTestBoolean
()
{
return
false
;
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/ToscaRepresentation.java
View file @
a66267cb
...
@@ -24,37 +24,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
...
@@ -24,37 +24,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@Document
@Document
public
class
ToscaRepresentation
{
public
class
ToscaRepresentation
extends
KeyValueHolder
{
@Id
private
String
id
;
private
String
name
;
private
String
name
;
private
Map
<
String
,
Object
>
kvMap
;
public
final
String
getId
()
{
return
id
;
}
public
final
void
setId
(
final
String
id
)
{
this
.
id
=
id
;
}
/**
* @return the kvMap
*/
public
Map
<
String
,
Object
>
getKvMap
()
{
return
kvMap
;
}
/**
* @param kvMap the kvMap to set
*/
public
void
setKvMap
(
Map
<
String
,
Object
>
kvMap
)
{
this
.
kvMap
=
kvMap
;
}
/**
/**
* @return the name
* @return the name
*/
*/
...
...
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