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
5f58dcce
Commit
5f58dcce
authored
Feb 10, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added yml / json converters
parent
acb0dfb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
7 deletions
+53
-7
UploadToscaController.java
.../java/nl/uva/sne/drip/api/rest/UploadToscaController.java
+1
-2
pom.xml
drip-commons/pom.xml
+6
-4
Converter.java
...rc/main/java/nl/uva/sne/drip/commons/utils/Converter.java
+46
-0
Consumer.java
.../src/main/java/nl/uva/sne/drip/drip/planner/Consumer.java
+0
-1
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/rest/UploadToscaController.java
View file @
5f58dcce
...
...
@@ -22,7 +22,6 @@ import java.io.IOException;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
...
...
@@ -59,7 +58,7 @@ public class UploadToscaController {
PlannerCaller
planner
=
null
;
if
(!
file
.
isEmpty
())
{
try
{
String
originalFileName
=
file
.
getOriginalFilename
();
String
name
=
System
.
currentTimeMillis
()
+
"_"
+
originalFileName
;
...
...
drip-commons/pom.xml
View file @
5f58dcce
...
...
@@ -31,7 +31,6 @@
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.8.6
</version>
<scope>
test
</scope>
</dependency>
<dependency>
...
...
@@ -39,10 +38,13 @@
<artifactId>
json
</artifactId>
<version>
20090211
</version>
<type>
jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
<version>
1.17
</version>
<type>
jar
</type>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>
1.8
</maven.compiler.source>
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/Converter.java
0 → 100644
View file @
5f58dcce
/*
* 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
.
utils
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Map
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.yaml.snakeyaml.Yaml
;
/**
*
* @author S. Koulouzis
*/
public
class
Converter
{
public
static
String
yml2Json
(
String
yamlString
)
{
Yaml
yaml
=
new
Yaml
();
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
yaml
.
load
(
yamlString
);
JSONObject
jsonObject
=
new
JSONObject
(
map
);
return
jsonObject
.
toString
();
}
public
static
String
json2Yml2
(
String
jsonString
)
throws
JSONException
{
Yaml
yaml
=
new
Yaml
();
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
yaml
.
load
(
jsonString
);
return
yaml
.
dump
(
map
);
}
}
drip-planner/src/main/java/nl/uva/sne/drip/drip/planner/Consumer.java
View file @
5f58dcce
...
...
@@ -28,7 +28,6 @@ import java.io.UnsupportedEncodingException;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
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