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
bcffffd4
Commit
bcffffd4
authored
8 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Planning API v0
parent
2f8b45bf
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
27 deletions
+159
-27
ToscaService.java
...c/main/java/nl/uva/sne/drip/api/service/ToscaService.java
+13
-0
PlannerController0.java
.../java/nl/uva/sne/drip/api/v0/rest/PlannerController0.java
+62
-16
UserScriptController.java
...ava/nl/uva/sne/drip/api/v1/rest/UserScriptController.java
+1
-1
File.java
.../src/main/java/nl/uva/sne/drip/commons/v0/types/File.java
+35
-0
Plan.java
.../src/main/java/nl/uva/sne/drip/commons/v0/types/Plan.java
+0
-1
Result.java
...rc/main/java/nl/uva/sne/drip/commons/v0/types/Result.java
+40
-0
UserScript.java
...ain/java/nl/uva/sne/drip/commons/v1/types/UserScript.java
+8
-9
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/ToscaService.java
View file @
bcffffd4
...
...
@@ -75,6 +75,19 @@ public class ToscaService {
return
t
.
getId
();
}
public
String
save
(
String
yamlString
,
String
name
)
throws
IOException
{
if
(
name
==
null
)
{
name
=
System
.
currentTimeMillis
()
+
"_"
+
"tosca.yaml"
;
}
yamlString
=
yamlString
.
replaceAll
(
"\\."
,
"\uff0E"
);
Map
<
String
,
Object
>
map
=
Converter
.
ymlString2Map
(
yamlString
);
ToscaRepresentation
t
=
new
ToscaRepresentation
();
t
.
setName
(
name
);
t
.
setKvMap
(
map
);
dao
.
save
(
t
);
return
t
.
getId
();
}
public
void
delete
(
String
id
)
{
dao
.
delete
(
id
);
}
...
...
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/PlannerController0.java
View file @
bcffffd4
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/UserScriptController.java
View file @
bcffffd4
...
...
@@ -105,7 +105,7 @@ public class UserScriptController {
*
* @return a list of all the IDs
*/
@RequestMapping
(
value
=
"/ids"
)
@RequestMapping
(
value
=
"/ids"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
List
<
String
>
getIds
()
{
List
<
UserScript
>
all
=
dao
.
findAll
();
...
...
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/File.java
0 → 100644
View file @
bcffffd4
/*
* 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
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlValue
;
/**
*
* @author S. Koulouzis
*/
public
class
File
{
@XmlAttribute
public
String
name
;
@XmlAttribute
public
String
level
;
@XmlValue
public
String
content
;
}
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Plan.java
View file @
bcffffd4
...
...
@@ -17,7 +17,6 @@ package nl.uva.sne.drip.commons.v0.types;
import
com.webcohesion.enunciate.metadata.DocumentationExample
;
import
java.io.Serializable
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
...
...
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Result.java
View file @
bcffffd4
...
...
@@ -15,6 +15,10 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
...
...
@@ -24,4 +28,40 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public
class
Result
{
private
status
status
;
private
String
info
;
public
List
<
File
>
file
;
/**
* @return the type
*/
public
status
getStatus
()
{
return
status
;
}
public
void
setStatus
(
status
status
)
{
this
.
status
=
status
;
}
public
static
enum
status
{
Success
,
Fail
}
/**
* @return the info
*/
public
String
getInfo
()
{
return
info
;
}
/**
* @param info the info to set
*/
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
;
}
}
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/UserScript.java
View file @
bcffffd4
...
...
@@ -53,7 +53,7 @@ public class UserScript {
*
* @return the name
*/
@DocumentationExample
(
"c
lient.py
"
)
@DocumentationExample
(
"c
onfig.sh
"
)
public
String
getName
()
{
return
name
;
}
...
...
@@ -70,14 +70,6 @@ public class UserScript {
*
* @return the contents
*/
@DocumentationExample
(
"config.sh"
)
public
String
getContents
()
{
return
contents
;
}
/**
* @param contents the contents to set
*/
@DocumentationExample
(
" #!/bin/bash\n"
+
"echo \"Reading system-wide config....\" >&2\\n"
+
". /etc/cool.cfg\n"
...
...
@@ -85,6 +77,13 @@ public class UserScript {
+
" echo \"Reading user config....\" >&2\\n"
+
" . ~/.coolrc\\n"
+
"fi"
)
public
String
getContents
()
{
return
contents
;
}
/**
* @param contents the contents to set
*/
public
void
setContents
(
String
contents
)
{
this
.
contents
=
contents
;
}
...
...
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