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
7d846333
Commit
7d846333
authored
Mar 22, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created example code for component
parent
712a0c14
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
294 additions
and
116 deletions
+294
-116
.gitignore
.gitignore
+2
-1
pom.xml
deleteme/pom.xml
+15
-0
Main.java
deleteme/src/main/java/nl/uva/sne/drip/deleteme/Main.java
+34
-0
messageExample.json
docs/json_samples/messageExample.json
+15
-4
Component.java
...ava/nl/uva/sne/drip/drip/component_example/Component.java
+21
-1
Consumer.java
...java/nl/uva/sne/drip/drip/component_example/Consumer.java
+140
-108
ExamplePOJO.java
...a/nl/uva/sne/drip/drip/component_example/ExamplePOJO.java
+63
-0
RPCServer.java
...ava/nl/uva/sne/drip/drip/component_example/RPCServer.java
+3
-2
pom.xml
pom.xml
+1
-0
No files found.
.gitignore
View file @
7d846333
...
...
@@ -6,4 +6,5 @@
/drip-provisioner/target/
/target/
/drip-planner2provisioner/target/
/drip-component_example/target/
\ No newline at end of file
/drip-component_example/target/
/deleteme/target/
\ No newline at end of file
deleteme/pom.xml
0 → 100644
View file @
7d846333
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
nl.uva.sne.drip
</groupId>
<artifactId>
drip
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<artifactId>
deleteme
</artifactId>
<packaging>
jar
</packaging>
<properties>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
</project>
\ No newline at end of file
deleteme/src/main/java/nl/uva/sne/drip/deleteme/Main.java
0 → 100644
View file @
7d846333
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
nl
.
uva
.
sne
.
drip
.
deleteme
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.OpenOption
;
import
java.nio.file.Paths
;
import
java.nio.file.StandardOpenOption
;
import
java.util.Base64
;
/**
*
* @author alogo
*/
public
class
Main
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
byte
[]
bytes
=
Files
.
readAllBytes
(
Paths
.
get
(
"/home/alogo/workspace/DRIP/docs/images/DRIP_arch.png"
));
byte
[]
encoded
=
Base64
.
getEncoder
().
encode
(
bytes
);
String
cont
=
new
String
(
encoded
,
"US-ASCII"
);
System
.
out
.
println
(
cont
);
byte
[]
decoded
=
Base64
.
getDecoder
().
decode
(
cont
);
OpenOption
[]
options
=
new
OpenOption
[
1
];
options
[
0
]
=
StandardOpenOption
.
CREATE_NEW
;
Files
.
write
(
Paths
.
get
(
"/home/alogo/Downloads/DRIP_arch.png"
),
decoded
,
options
);
}
}
docs/json_samples/messageExample.json
View file @
7d846333
This diff is collapsed.
Click to expand it.
drip-component_example/src/main/java/nl/uva/sne/drip/drip/component_example/Component.java
View file @
7d846333
...
...
@@ -15,10 +15,30 @@
*/
package
nl
.
uva
.
sne
.
drip
.
drip
.
component_example
;
import
java.io.File
;
/**
* This is an example components. It is a dumy components to demonstrate a
* simple application logic
*
* @author S. Koulouzis
* @author S. Koulouzis
s
*/
public
class
Component
{
private
final
int
input
;
private
final
File
inputTextFile
;
private
final
File
inputBinFile
;
private
final
ExamplePOJO
book
;
public
Component
(
int
input
,
File
inputTextFile
,
File
inputBinFile
,
ExamplePOJO
book
)
{
this
.
input
=
input
;
this
.
inputTextFile
=
inputTextFile
;
this
.
inputBinFile
=
inputBinFile
;
this
.
book
=
book
;
}
String
run
()
throws
Exception
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
}
drip-component_example/src/main/java/nl/uva/sne/drip/drip/component_example/Consumer.java
View file @
7d846333
This diff is collapsed.
Click to expand it.
drip-component_example/src/main/java/nl/uva/sne/drip/drip/component_example/ExamplePOJO.java
0 → 100644
View file @
7d846333
/*
* 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
.
drip
.
component_example
;
/**
*
* @author S. Koulouzis
*/
public
class
ExamplePOJO
{
private
final
String
author
;
private
final
String
content
;
private
final
String
translator
;
private
final
String
language
;
public
ExamplePOJO
(
String
author
,
String
content
,
String
translator
,
String
language
)
{
this
.
author
=
author
;
this
.
content
=
content
;
this
.
translator
=
translator
;
this
.
language
=
language
;
}
/**
* @return the author
*/
public
String
getAuthor
()
{
return
author
;
}
/**
* @return the content
*/
public
String
getContent
()
{
return
content
;
}
/**
* @return the translator
*/
public
String
getTranslator
()
{
return
translator
;
}
/**
* @return the language
*/
public
String
getLanguage
()
{
return
language
;
}
}
drip-component_example/src/main/java/nl/uva/sne/drip/drip/component_example/RPCServer.java
View file @
7d846333
...
...
@@ -29,6 +29,7 @@ import java.util.Properties;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.json.JSONException
;
/**
* This class is responsible for receiving and sending message to the DRIP
...
...
@@ -52,9 +53,9 @@ public class RPCServer {
try
{
Consumer
c
=
new
Consumer
();
byte
[]
encoded
=
Files
.
readAllBytes
(
Paths
.
get
(
args
[
1
]));
String
response
=
c
.
handleDelivery
(
new
String
(
encoded
,
"UTF-8"
));
String
response
=
c
.
invokeComponent
(
new
String
(
encoded
,
"UTF-8"
));
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
INFO
,
MessageFormat
.
format
(
"Response: {0}"
,
response
));
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
|
JSONException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
else
{
...
...
pom.xml
View file @
7d846333
...
...
@@ -12,5 +12,6 @@
<modules>
<module>
drip-api
</module>
<module>
drip-planner2provisioner
</module>
<module>
deleteme
</module>
</modules>
</project>
\ No newline at end of file
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