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
07b2988e
Commit
07b2988e
authored
Feb 05, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return correct errors
parent
630f2716
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
23 deletions
+33
-23
CredentialApiController.java
...ain/java/nl/uva/sne/drip/api/CredentialApiController.java
+3
-1
DeployerApiController.java
.../main/java/nl/uva/sne/drip/api/DeployerApiController.java
+3
-1
PlannerApiController.java
...c/main/java/nl/uva/sne/drip/api/PlannerApiController.java
+8
-5
ProvisionerApiController.java
...in/java/nl/uva/sne/drip/api/ProvisionerApiController.java
+2
-2
ToscaTemplateApiController.java
.../java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
+14
-11
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+2
-2
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+1
-1
No files found.
manager/src/main/java/nl/uva/sne/drip/api/CredentialApiController.java
View file @
07b2988e
...
@@ -47,8 +47,10 @@ public class CredentialApiController implements CredentialApi {
...
@@ -47,8 +47,10 @@ public class CredentialApiController implements CredentialApi {
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
String
id
=
credentialService
.
save
(
body
);
String
id
=
credentialService
.
save
(
body
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
}
}
@Override
@Override
...
...
manager/src/main/java/nl/uva/sne/drip/api/DeployerApiController.java
View file @
07b2988e
...
@@ -52,7 +52,9 @@ public class DeployerApiController implements DeployerApi {
...
@@ -52,7 +52,9 @@ public class DeployerApiController implements DeployerApi {
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
}
}
}
}
manager/src/main/java/nl/uva/sne/drip/api/PlannerApiController.java
View file @
07b2988e
...
@@ -2,6 +2,8 @@ package nl.uva.sne.drip.api;
...
@@ -2,6 +2,8 @@ package nl.uva.sne.drip.api;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.*
;
import
java.io.IOException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -41,19 +43,20 @@ public class PlannerApiController implements PlannerApi {
...
@@ -41,19 +43,20 @@ public class PlannerApiController implements PlannerApi {
@PathVariable
(
"id"
)
String
id
)
{
@PathVariable
(
"id"
)
String
id
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
try
{
try
{
dripService
.
setRequestQeueName
(
queueName
);
dripService
.
setRequestQeueName
(
queueName
);
String
planedYemplateId
=
dripService
.
plan
(
id
);
String
planedYemplateId
=
dripService
.
plan
(
id
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
}
catch
(
ApiException
ex
)
{
}
catch
(
ApiException
|
NotFoundException
|
IOException
|
TimeoutException
|
InterruptedException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
PlannerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
catch
(
Exception
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
PlannerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
java
.
util
.
logging
.
Logger
.
getLogger
(
PlannerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
}
manager/src/main/java/nl/uva/sne/drip/api/ProvisionerApiController.java
View file @
07b2988e
...
@@ -56,9 +56,9 @@ public class ProvisionerApiController implements ProvisionerApi {
...
@@ -56,9 +56,9 @@ public class ProvisionerApiController implements ProvisionerApi {
java
.
util
.
logging
.
Logger
.
getLogger
(
ProvisionerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
java
.
util
.
logging
.
Logger
.
getLogger
(
ProvisionerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
}
manager/src/main/java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
View file @
07b2988e
...
@@ -43,28 +43,28 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -43,28 +43,28 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
if
(
accept
!=
null
&&
accept
.
contains
(
"*/*"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"*/*"
))
{
toscaTemplateService
.
deleteByID
(
id
);
toscaTemplateService
.
deleteByID
(
id
);
return
new
ResponseEntity
<>(
""
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
""
,
HttpStatus
.
OK
);
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
@Override
@Override
public
ResponseEntity
<
String
>
getToscaTemplateByID
(
@ApiParam
(
value
=
"ID of topolog template to return"
,
required
=
true
)
@PathVariable
(
"id"
)
String
id
)
{
public
ResponseEntity
<
String
>
getToscaTemplateByID
(
@ApiParam
(
value
=
"ID of topolog template to return"
,
required
=
true
)
@PathVariable
(
"id"
)
String
id
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
try
{
try
{
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
return
new
ResponseEntity
<>(
ymlStr
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
ymlStr
,
HttpStatus
.
OK
);
}
catch
(
IOException
e
)
{
}
catch
(
JsonProcessingException
|
NotFoundException
ex
)
{
log
.
error
(
"Couldn't serialize response for content type "
,
e
);
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
catch
(
NotFoundException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
@Override
@Override
...
@@ -82,9 +82,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -82,9 +82,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
@Override
@Override
...
@@ -99,9 +100,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -99,9 +100,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
log
.
error
(
"Couldn't serialize response for content type application/json"
,
e
);
log
.
error
(
"Couldn't serialize response for content type application/json"
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
@Override
@Override
...
@@ -110,9 +112,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -110,9 +112,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
List
<
String
>
ids
=
toscaTemplateService
.
getAllIds
();
List
<
String
>
ids
=
toscaTemplateService
.
getAllIds
();
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
NOT_IMPLEMENTED
);
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
NOT_IMPLEMENTED
);
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
}
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
}
}
}
}
manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
07b2988e
...
@@ -107,7 +107,7 @@ public class DRIPService {
...
@@ -107,7 +107,7 @@ public class DRIPService {
return
toscaTemplate
;
return
toscaTemplate
;
}
}
public
String
plan
(
String
id
)
throws
ApiException
,
Exception
{
public
String
plan
(
String
id
)
throws
ApiException
,
NotFoundException
,
IOException
,
JsonProcessingException
,
TimeoutException
,
Interrupted
Exception
{
ToscaTemplate
toscaTemplate
=
initExecution
(
id
);
ToscaTemplate
toscaTemplate
=
initExecution
(
id
);
return
execute
(
toscaTemplate
);
return
execute
(
toscaTemplate
);
}
}
...
...
provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
07b2988e
...
@@ -141,7 +141,7 @@ class CloudStormService {
...
@@ -141,7 +141,7 @@ class CloudStormService {
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
),
topTopology
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
),
topTopology
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote CloudStorm topology files in: "
+
tempInputDirPath
+
File
.
separator
+
TOP_TOPOLOGY_FILE_NAME
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Wrote CloudStorm topology files in: "
+
TOP_TOPOLOGY_FILE_NAME
,
new
Object
[]{
tempInputDirPath
,
File
.
separator
}
);
return
subTopologiesAndVMs
;
return
subTopologiesAndVMs
;
}
}
...
...
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