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
09b05117
Commit
09b05117
authored
Feb 14, 2017
by
zh9314
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a consumer to invoke provisioner.
parent
5a5e0fe5
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
469 additions
and
0 deletions
+469
-0
nb-configuration.xml
drip-provisioner/nb-configuration.xml
+19
-0
pom.xml
drip-provisioner/pom.xml
+41
-0
.DS_Store
.../src/main/java/nl/uva/sne/drip/drip/provisioner/.DS_Store
+0
-0
Consumer.java
.../main/java/nl/uva/sne/drip/drip/provisioner/Consumer.java
+340
-0
RPCServer.java
...main/java/nl/uva/sne/drip/drip/provisioner/RPCServer.java
+69
-0
No files found.
drip-provisioner/nb-configuration.xml
0 → 100644
View file @
09b05117
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties
xmlns=
"http://www.netbeans.org/ns/maven-properties-data/1"
>
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<netbeans.hint.licensePath>
${project.basedir}/../licenseheader.txt
</netbeans.hint.licensePath>
<org-netbeans-modules-whitelist.whitelist-oracle>
false
</org-netbeans-modules-whitelist.whitelist-oracle>
</properties>
</project-shared-configuration>
drip-provisioner/pom.xml
0 → 100644
View file @
09b05117
<?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>
drip-simple_provisioner
</artifactId>
<packaging>
jar
</packaging>
<properties>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
nl.uva.sne.drip
</groupId>
<artifactId>
drip-commons
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.rabbitmq
</groupId>
<artifactId>
amqp-client
</artifactId>
<version>
4.0.2
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.8.6
</version>
</dependency>
<dependency>
<groupId>
org.json
</groupId>
<artifactId>
json
</artifactId>
<version>
20090211
</version>
<type>
jar
</type>
</dependency>
</dependencies>
</project>
\ No newline at end of file
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/.DS_Store
0 → 100644
View file @
09b05117
File added
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/Consumer.java
0 → 100644
View file @
09b05117
This diff is collapsed.
Click to expand it.
drip-provisioner/src/main/java/nl/uva/sne/drip/drip/provisioner/RPCServer.java
0 → 100644
View file @
09b05117
/*
* 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
.
provisioner
;
import
com.rabbitmq.client.AMQP
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
java.io.IOException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
*
* @author H. Zhou
*/
public
class
RPCServer
{
private
static
final
String
RPC_QUEUE_NAME
=
"provisioner_queue"
;
private
static
final
String
HOST
=
"172.17.0.3"
;
public
static
void
main
(
String
[]
argv
)
{
start
();
}
private
static
void
start
()
{
ConnectionFactory
factory
=
new
ConnectionFactory
();
factory
.
setHost
(
HOST
);
factory
.
setPassword
(
"guest"
);
factory
.
setUsername
(
"guest"
);
factory
.
setPort
(
AMQP
.
PROTOCOL
.
PORT
);
try
(
Connection
connection
=
factory
.
newConnection
())
{
Channel
channel
=
connection
.
createChannel
();
//We define the queue name
channel
.
queueDeclare
(
RPC_QUEUE_NAME
,
false
,
false
,
false
,
null
);
//Set our own customized consummer
Consumer
c
=
new
Consumer
(
channel
);
//Start listening for messages
channel
.
basicConsume
(
RPC_QUEUE_NAME
,
false
,
c
);
//Block so we don't close the channel
while
(
true
)
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
_ignore
)
{
}
}
}
catch
(
IOException
|
TimeoutException
ex
)
{
Logger
.
getLogger
(
RPCServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
}
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