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
aece94f7
Commit
aece94f7
authored
Feb 22, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added user script service
parent
bd76cf20
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
4 deletions
+63
-4
ProvisionController.java
...in/java/nl/uva/sne/drip/api/rest/ProvisionController.java
+10
-3
PlannerService.java
...main/java/nl/uva/sne/drip/api/service/PlannerService.java
+0
-1
ToscaService.java
...c/main/java/nl/uva/sne/drip/api/service/ToscaService.java
+8
-0
UserScriptService.java
...n/java/nl/uva/sne/drip/api/service/UserScriptService.java
+45
-0
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/rest/ProvisionController.java
View file @
aece94f7
...
@@ -47,6 +47,7 @@ import nl.uva.sne.drip.api.exception.BadRequestException;
...
@@ -47,6 +47,7 @@ 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.rpc.DRIPCaller
;
import
nl.uva.sne.drip.api.rpc.DRIPCaller
;
import
nl.uva.sne.drip.api.rpc.ProvisionerCaller
;
import
nl.uva.sne.drip.api.rpc.ProvisionerCaller
;
import
nl.uva.sne.drip.api.service.ToscaService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.types.CloudCredentials
;
import
nl.uva.sne.drip.commons.types.CloudCredentials
;
import
nl.uva.sne.drip.commons.types.LoginKey
;
import
nl.uva.sne.drip.commons.types.LoginKey
;
...
@@ -64,8 +65,10 @@ public class ProvisionController {
...
@@ -64,8 +65,10 @@ public class ProvisionController {
@Value
(
"${message.broker.host}"
)
@Value
(
"${message.broker.host}"
)
private
String
messageBrokerHost
;
private
String
messageBrokerHost
;
@Autowired
@Autowired
private
ToscaDao
toscaDao
;
private
ToscaService
toscaService
;
@Autowired
@Autowired
private
CloudCredentialsDao
cloudCredentialsDao
;
private
CloudCredentialsDao
cloudCredentialsDao
;
...
@@ -140,6 +143,9 @@ public class ProvisionController {
...
@@ -140,6 +143,9 @@ public class ProvisionController {
private
List
<
Parameter
>
buildCertificatesParam
(
CloudCredentials
cred
)
{
private
List
<
Parameter
>
buildCertificatesParam
(
CloudCredentials
cred
)
{
List
<
LoginKey
>
loginKeys
=
cred
.
getLoginKeys
();
List
<
LoginKey
>
loginKeys
=
cred
.
getLoginKeys
();
if
(
loginKeys
==
null
||
loginKeys
.
isEmpty
())
{
throw
new
BadRequestException
(
"Log in keys can't be empty"
);
}
List
<
Parameter
>
parameters
=
new
ArrayList
<>();
List
<
Parameter
>
parameters
=
new
ArrayList
<>();
for
(
LoginKey
lk
:
loginKeys
)
{
for
(
LoginKey
lk
:
loginKeys
)
{
String
domainName
=
lk
.
getAttributes
().
get
(
"domain_name"
);
String
domainName
=
lk
.
getAttributes
().
get
(
"domain_name"
);
...
@@ -158,7 +164,7 @@ public class ProvisionController {
...
@@ -158,7 +164,7 @@ public class ProvisionController {
}
}
private
List
<
Parameter
>
buildTopologyParams
(
String
planID
)
throws
JSONException
{
private
List
<
Parameter
>
buildTopologyParams
(
String
planID
)
throws
JSONException
{
ToscaRepresentation
plan
=
tosca
Dao
.
findOne
(
planID
);
ToscaRepresentation
plan
=
tosca
Service
.
get
(
planID
,
ToscaRepresentation
.
Type
.
PLAN
);
if
(
plan
==
null
)
{
if
(
plan
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
...
@@ -174,7 +180,7 @@ public class ProvisionController {
...
@@ -174,7 +180,7 @@ public class ProvisionController {
Set
<
String
>
ids
=
plan
.
getLowerLevelIDs
();
Set
<
String
>
ids
=
plan
.
getLowerLevelIDs
();
for
(
String
lowID
:
ids
)
{
for
(
String
lowID
:
ids
)
{
plan
=
tosca
Dao
.
findOne
(
lowID
);
plan
=
tosca
Service
.
get
(
lowID
,
ToscaRepresentation
.
Type
.
PLAN
);
topology
=
new
Parameter
();
topology
=
new
Parameter
();
topology
.
setName
(
"topology"
);
topology
.
setName
(
"topology"
);
topology
.
setValue
(
Converter
.
map2YmlString
(
plan
.
getKvMap
()));
topology
.
setValue
(
Converter
.
map2YmlString
(
plan
.
getKvMap
()));
...
@@ -202,6 +208,7 @@ public class ProvisionController {
...
@@ -202,6 +208,7 @@ public class ProvisionController {
}
}
private
List
<
Parameter
>
buildScriptParams
(
String
userScriptID
)
{
private
List
<
Parameter
>
buildScriptParams
(
String
userScriptID
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
}
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/PlannerService.java
View file @
aece94f7
...
@@ -22,7 +22,6 @@ import java.util.List;
...
@@ -22,7 +22,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
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.rpc.PlannerCaller
;
import
nl.uva.sne.drip.api.rpc.PlannerCaller
;
import
nl.uva.sne.drip.commons.types.Message
;
import
nl.uva.sne.drip.commons.types.Message
;
import
nl.uva.sne.drip.commons.types.Parameter
;
import
nl.uva.sne.drip.commons.types.Parameter
;
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/ToscaService.java
View file @
aece94f7
...
@@ -110,4 +110,12 @@ public class ToscaService {
...
@@ -110,4 +110,12 @@ public class ToscaService {
public
ToscaDao
getDao
()
{
public
ToscaDao
getDao
()
{
return
dao
;
return
dao
;
}
}
public
ToscaRepresentation
get
(
String
planID
,
ToscaRepresentation
.
Type
type
)
{
ToscaRepresentation
tosca
=
dao
.
findOne
(
planID
);
if
(
tosca
==
null
||
!
tosca
.
getType
().
equals
(
type
))
{
throw
new
NotFoundException
();
}
return
tosca
;
}
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/service/UserScriptService.java
0 → 100644
View file @
aece94f7
/*
* 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.Collection
;
import
java.util.HashSet
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.api.dao.UserDao
;
import
nl.uva.sne.drip.api.dao.UserScriptDao
;
import
nl.uva.sne.drip.commons.types.User
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Service
;
/**
*
* @author S. Koulouzis
*/
@Service
public
class
UserScriptService
{
@Autowired
UserScriptDao
dao
;
public
UserScriptDao
getDao
()
{
return
dao
;
}
}
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