OW2 Consortium iconnect

Compare Revisions

Ignore whitespace Rev 2 → Rev 3

/trunk/middleman/pom.xml
New file
0,0 → 1,67
<?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>
<groupId>iconnect.middleman</groupId>
<artifactId>Middleman</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>iconnect.middleman.Middleman</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
<dependencies>
<!-- JSON -->
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.1</version>
<type>jar</type>
</dependency>
 
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
 
<!-- REST dependencies -->
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.hermit-reasoner</groupId>
<artifactId>org.semanticweb.hermit</artifactId>
<version>1.3.8.4</version>
</dependency>
</dependencies>
</project>
/trunk/middleman/nbactions.xml
New file
0,0 → 1,46
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath iconnect.middleman.Middleman tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName} tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath ${packageClassName} tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
/trunk/middleman/start_middleman.sh
New file
0,0 → 1,2
#!/bin/bash
mvn exec:java -Dexec.mainClass="iconnect.middleman.Middleman" -Dexec.args="tests/ontology.owl tests/a.lts tests/b.lts 8082 http://localhost:8081"
Property changes:
Added: svn:executable
+ *
/trunk/middleman/tests/rss/server.lts
New file
0,0 → 1,10
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
SUBSCRIBE: <request; 0; 0>
POST: <response; 0; 0>
LOGOFF: <disconnect; 0; 0>
 
t0 -[?SUBSCRIBE<topic>]-> t1
t1 -[!POST<data*>]-> t0
t1 -[?LOGOFF]-> t0
t0 -[?LOGOFF]-> t0
/trunk/middleman/tests/rss/ontology.owl
New file
0,0 → 1,35
<?xml version="1.0"?>
 
 
<!DOCTYPE Ontology [
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
 
 
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="https://www.rocq.inria.fr/mimove/example"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ontologyIRI="https://www.rocq.inria.fr/mimove/example">
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Declaration>
<Class IRI="#request"/>
</Declaration>
<Declaration>
<Class IRI="#response"/>
</Declaration>
</Ontology>
 
 
 
<!-- Generated by the OWL API (version 3.2.3.1824) http://owlapi.sourceforge.net -->
 
/trunk/middleman/tests/rss/instance.xml
New file
0,0 → 1,12
<?xml version="1.0"?>
<instance>
<ontology src="ontology.owl" />
<peer>
<lts src="subscriber.lts" />
<listen port="8080" />
</peer>
<peer>
<lts src="server.lts" />
<listen port="8081" />
</peer>
</instance>
/trunk/middleman/tests/rss/subscriber.lts
New file
0,0 → 1,9
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
SUBSCRIBE: <request; 0; 0>
POST: <response; 0; 0>
UNSUBSCRIBE: <disconnect; 0; 0>
 
s0 -[!SUBSCRIBE<topic>]-> s1
s1 -[?POST<data>]-> s1
s1 -[!UNSUBSCRIBE]-> s0
/trunk/middleman/tests/subscriber_server/automata.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/tests/subscriber_server/instance.xml
New file
0,0 → 1,12
<?xml version="1.0"?>
<instance>
<ontology src="ontology.owl" />
<peer>
<lts src="subscriber.lts" />
<listen port="8080" />
</peer>
<peer>
<lts src="server.lts" />
<listen port="8081" />
</peer>
</instance>
/trunk/middleman/tests/subscriber_server/subscriber.lts
New file
0,0 → 1,9
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
SUBSCRIBE: <request; 0; 0>
POST: <response; 0; 0>
UNSUBSCRIBE: <disconnect; 0; 0>
 
s0 -[!SUBSCRIBE<topic>]-> s1
s1 -[?POST<data>]-> s1
s1 -[!UNSUBSCRIBE]-> s0
/trunk/middleman/tests/subscriber_server/automata.aux
New file
0,0 → 1,0
\relax
/trunk/middleman/tests/subscriber_server/server.lts
New file
0,0 → 1,12
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
GET: <request; 0; 0>
RESPONSE: <response; 0; 0>
LOGOFF: <disconnect; 0; 0>
 
t0 -[?GET<?topic>]-> t1
t1 -[!RESPONSE<data;timestamp>]-> t0'
t0' -[?GET<?topic;timestamp>]-> t1
t1 -[!RESPONSE<data;timestamp>]-> t0'
t1 -[?LOGOFF]-> t0
t0' -[?LOGOFF]-> t0
/trunk/middleman/tests/subscriber_server/automata.tex
New file
0,0 → 1,59
\documentclass{article}
\usepackage{tikz}
\usepackage[landscape,a4paper,top=0.5cm,bottom=0.5cm]{geometry}
\usetikzlibrary{arrows,automata}
\pagestyle{empty}
\begin{document}
\begin{center}
\begin{tikzpicture}[node distance=9cm,auto,->,ultra thick]
\tikzstyle{every state}=[draw=black]
 
\node[initial,state] (s0) {$s_0$};
\node[state] (s1) [right of=s0] {$s_1$};
 
\path (s0) edge [bend left] node{!SUBSCRIBE$<$topic$>$} (s1);
\path (s1) edge [loop below] node{?POST$<$data$>$} (s1);
\path (s1) edge [bend left] node{!UNSUBSCRIBE} (s0);
\end{tikzpicture}
\end{center}
 
\vfill
 
\begin{center}
\begin{tikzpicture}[node distance=9cm,auto,->,ultra thick]
\tikzstyle{every state}=[draw=black]
 
\node[initial,state] (t0) {$t_0$};
\node[state] (t1) [right of=t0] {$t_1$};
\node[state] (t2) [right of=t1] {$t_2$};
 
\path (t0) edge [bend left] node{?SUBSCRIBE$<$topic$>$} (t1);
\path (t1) edge [bend left] node{!POST$<$data${^*}{>}$} (t2);
\path (t1) edge [bend left] node{?LOGOFF} (t0);
\path (t2) edge [bend left] node{?LOGOFF} (t0);
\end{tikzpicture}
\end{center}
 
\vfill
 
\begin{center}
\begin{tikzpicture}[node distance=6cm,auto,->,ultra thick]
\tikzstyle{every state}=[draw=black]
 
\node[initial,state] (s0t0) {$(s_0, t_0)$};
\node[state] (s0SUBSCRIBE) [right of=s0t0] {$s_0$(S)};
\node[state] (s1t1) [right of=s0SUBSCRIBE] {$(s_1, t_1)$};
\node[state] (t1POST) [right of=s1t1] {$t_1$(P)};
\node[state] (UNSUBSCRIBE) [node distance=3cm, below of=s0SUBSCRIBE] {UNSUB};
 
\path (s0t0) edge [bend left] node{?SUBSCRIBE$<$topic$>$} (s0SUBSCRIBE);
\path (s0SUBSCRIBE) edge [bend left] node{!SUBSCRIBE$<$topic${>}$} (s1t1);
\path (s1t1) edge [bend left] node{?POST$<$data${^*}{>}$} (t1POST);
\path (t1POST) edge [loop below] node{!POST$<$data$>$} (t1POST);
\path (s1t1) edge [bend left] node{?UNSUBSCRIBE} (UNSUBSCRIBE);
\path (t1POST) edge [bend left] node{?UNSUBSCRIBE} (UNSUBSCRIBE);
\path (UNSUBSCRIBE) edge [bend left] node{!LOGOFF} (s0t0);
\end{tikzpicture}
\end{center}
 
\end{document}
/trunk/middleman/tests/subscriber_server/ontology.owl
New file
0,0 → 1,35
<?xml version="1.0"?>
 
 
<!DOCTYPE Ontology [
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
 
 
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="https://www.rocq.inria.fr/mimove/example"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ontologyIRI="https://www.rocq.inria.fr/mimove/example">
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Declaration>
<Class IRI="#request"/>
</Declaration>
<Declaration>
<Class IRI="#response"/>
</Declaration>
</Ontology>
 
 
 
<!-- Generated by the OWL API (version 3.2.3.1824) http://owlapi.sourceforge.net -->
 
/trunk/middleman/tests/subscriber_server/automata.log
New file
0,0 → 1,446
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2013.10.11) 28 JUL 2014 16:51
entering extended mode
%&-line parsing enabled.
**\input automata.tex
(./automata.tex (/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texmf/tex/latex/pgf/frontendlayer/tikz.sty
(/usr/share/texmf/tex/latex/pgf/basiclayer/pgf.sty
(/usr/share/texmf/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-common.tex
\pgfutil@everybye=\toks14
)
(/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-latex.def
\pgfutil@abb=\box26
 
(/usr/share/texmf-texlive/tex/latex/ms/everyshi.sty
Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
))
(/usr/share/texmf/tex/generic/pgf/utilities/pgfrcs.code.tex
Package: pgfrcs 2010/10/25 v2.10 (rcs-revision 1.24)
))
Package: pgf 2008/01/15 v2.10 (rcs-revision 1.12)
 
(/usr/share/texmf/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
 
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks15
)
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
 
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/etc/texmf/tex/latex/config/graphics.cfg
File: graphics.cfg 2009/08/28 v1.8 graphics configuration of TeX Live
)
Package graphics Info: Driver file: pdftex.def on input line 91.
 
(/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2010/03/12 v0.04p Graphics/color for pdfTeX
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
(/usr/share/texmf/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys.code.tex
Package: pgfsys 2010/06/30 v2.10 (rcs-revision 1.37)
 
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex
\pgfkeys@pathtoks=\toks16
\pgfkeys@temptoks=\toks17
 
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
\pgfkeys@tmptoks=\toks18
))
\pgf@x=\dimen105
\pgf@y=\dimen106
\pgf@xa=\dimen107
\pgf@ya=\dimen108
\pgf@xb=\dimen109
\pgf@yb=\dimen110
\pgf@xc=\dimen111
\pgf@yc=\dimen112
\w@pgf@writea=\write3
\r@pgf@reada=\read1
\c@pgf@counta=\count88
\c@pgf@countb=\count89
\c@pgf@countc=\count90
\c@pgf@countd=\count91
 
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgf.cfg
File: pgf.cfg 2008/05/14 (rcs-revision 1.7)
)
Package pgfsys Info: Driver file for pgf: pgfsys-pdftex.def on input line 900.
 
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
File: pgfsys-pdftex.def 2009/05/22 (rcs-revision 1.26)
 
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def
File: pgfsys-common-pdf.def 2008/05/19 (rcs-revision 1.10)
)))
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
File: pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
\pgfsyssoftpath@smallbuffer@items=\count92
\pgfsyssoftpath@bigbuffer@items=\count93
)
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex
File: pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
))
(/usr/share/texmf/tex/latex/xcolor/xcolor.sty
Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)
 
(/etc/texmf/tex/latex/config/color.cfg
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341.
Package xcolor Info: Model `RGB' extended on input line 1353.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360.
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcore.code.tex
Package: pgfcore 2010/04/11 v2.10 (rcs-revision 1.7)
 
(/usr/share/texmf/tex/generic/pgf/math/pgfmath.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathparser.code.tex
\pgfmath@dimen=\dimen113
\pgfmath@count=\count94
\pgfmath@box=\box27
\pgfmath@toks=\toks19
\pgfmath@stack@operand=\toks20
\pgfmath@stack@operation=\toks21
)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.random.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.round.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex)))
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfloat.code.tex
\c@pgfmathroundto@lastzeros=\count95
))
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
File: pgfcorepoints.code.tex 2010/04/09 (rcs-revision 1.20)
\pgf@picminx=\dimen114
\pgf@picmaxx=\dimen115
\pgf@picminy=\dimen116
\pgf@picmaxy=\dimen117
\pgf@pathminx=\dimen118
\pgf@pathmaxx=\dimen119
\pgf@pathminy=\dimen120
\pgf@pathmaxy=\dimen121
\pgf@xx=\dimen122
\pgf@xy=\dimen123
\pgf@yx=\dimen124
\pgf@yy=\dimen125
\pgf@zx=\dimen126
\pgf@zy=\dimen127
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex
File: pgfcorepathconstruct.code.tex 2010/08/03 (rcs-revision 1.24)
\pgf@path@lastx=\dimen128
\pgf@path@lasty=\dimen129
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex
File: pgfcorepathusage.code.tex 2008/04/22 (rcs-revision 1.12)
\pgf@shorten@end@additional=\dimen130
\pgf@shorten@start@additional=\dimen131
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
File: pgfcorescopes.code.tex 2010/09/08 (rcs-revision 1.34)
\pgfpic=\box28
\pgf@hbox=\box29
\pgf@layerbox@main=\box30
\pgf@picture@serial@count=\count96
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex
File: pgfcoregraphicstate.code.tex 2008/04/22 (rcs-revision 1.9)
\pgflinewidth=\dimen132
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
File: pgfcoretransformations.code.tex 2009/06/10 (rcs-revision 1.11)
\pgf@pt@x=\dimen133
\pgf@pt@y=\dimen134
\pgf@pt@temp=\dimen135
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorequick.code.tex
File: pgfcorequick.code.tex 2008/10/09 (rcs-revision 1.3)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex
File: pgfcoreobjects.code.tex 2006/10/11 (rcs-revision 1.2)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex
File: pgfcorepathprocessing.code.tex 2008/10/09 (rcs-revision 1.8)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex
File: pgfcorearrows.code.tex 2008/04/23 (rcs-revision 1.11)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex
File: pgfcoreshade.code.tex 2008/11/23 (rcs-revision 1.13)
\pgf@max=\dimen136
\pgf@sys@shading@range@num=\count97
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
File: pgfcoreimage.code.tex 2010/03/25 (rcs-revision 1.16)
 
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
File: pgfcoreexternal.code.tex 2010/09/01 (rcs-revision 1.17)
\pgfexternal@startupbox=\box31
))
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex
File: pgfcorelayers.code.tex 2010/08/27 (rcs-revision 1.2)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex
File: pgfcoretransparency.code.tex 2008/01/17 (rcs-revision 1.2)
)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
File: pgfcorepatterns.code.tex 2009/07/02 (rcs-revision 1.3)
)))
(/usr/share/texmf/tex/generic/pgf/modules/pgfmoduleshapes.code.tex
File: pgfmoduleshapes.code.tex 2010/09/09 (rcs-revision 1.13)
\pgfnodeparttextbox=\box32
)
(/usr/share/texmf/tex/generic/pgf/modules/pgfmoduleplot.code.tex
File: pgfmoduleplot.code.tex 2010/10/22 (rcs-revision 1.8)
)
(/usr/share/texmf/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty
Package: pgfcomp-version-0-65 2007/07/03 v2.10 (rcs-revision 1.7)
\pgf@nodesepstart=\dimen137
\pgf@nodesepend=\dimen138
)
(/usr/share/texmf/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty
Package: pgfcomp-version-1-18 2007/07/23 v2.10 (rcs-revision 1.1)
))
(/usr/share/texmf/tex/latex/pgf/utilities/pgffor.sty
(/usr/share/texmf/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex))
(/usr/share/texmf/tex/generic/pgf/utilities/pgffor.code.tex
Package: pgffor 2010/03/23 v2.10 (rcs-revision 1.18)
\pgffor@iter=\dimen139
\pgffor@skip=\dimen140
\pgffor@stack=\toks22
\pgffor@toks=\toks23
))
(/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
Package: tikz 2010/10/13 v2.10 (rcs-revision 1.76)
 
(/usr/share/texmf/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
File: pgflibraryplothandlers.code.tex 2010/05/31 v2.10 (rcs-revision 1.15)
\pgf@plot@mark@count=\count98
\pgfplotmarksize=\dimen141
)
\tikz@lastx=\dimen142
\tikz@lasty=\dimen143
\tikz@lastxsaved=\dimen144
\tikz@lastysaved=\dimen145
\tikzleveldistance=\dimen146
\tikzsiblingdistance=\dimen147
\tikz@figbox=\box33
\tikz@tempbox=\box34
\tikztreelevel=\count99
\tikznumberofchildren=\count100
\tikznumberofcurrentchild=\count101
\tikz@fig@count=\count102
 
(/usr/share/texmf/tex/generic/pgf/modules/pgfmodulematrix.code.tex
File: pgfmodulematrix.code.tex 2010/08/24 (rcs-revision 1.4)
\pgfmatrixcurrentrow=\count103
\pgfmatrixcurrentcolumn=\count104
\pgf@matrix@numberofcolumns=\count105
)
\tikz@expandcount=\count106
 
(/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopat
hs.code.tex
File: tikzlibrarytopaths.code.tex 2008/06/17 v2.10 (rcs-revision 1.2)
))) (/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
Package: geometry 2008/12/21 v4.2 Page Geometry
 
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2009/04/10 v2.0 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in pdf mode detected.
)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifvtex.sty
Package: ifvtex 2008/11/04 v1.4 Switches for detecting VTeX and its modes (HO)
Package ifvtex Info: VTeX not detected.
)
\Gm@cnth=\count107
\Gm@cntv=\count108
\c@Gm@tempcnt=\count109
\Gm@bindingoffset=\dimen148
\Gm@wd@mp=\dimen149
\Gm@odd@mp=\dimen150
\Gm@even@mp=\dimen151
\Gm@dimlist=\toks24
 
(/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg))
(/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryarrow
s.code.tex
File: tikzlibraryarrows.code.tex 2008/01/09 v2.10 (rcs-revision 1.1)
 
(/usr/share/texmf/tex/generic/pgf/libraries/pgflibraryarrows.code.tex
File: pgflibraryarrows.code.tex 2008/10/27 v2.10 (rcs-revision 1.9)
\arrowsize=\dimen152
))
(/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautom
ata.code.tex
File: tikzlibraryautomata.code.tex 2008/07/14 v2.10 (rcs-revision 1.3)
 
(/usr/share/texmf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshape
s.multipart.code.tex
File: tikzlibraryshapes.multipart.code.tex 2008/01/09 v2.10 (rcs-revision 1.1)
 
(/usr/share/texmf/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.c
ode.tex
File: pgflibraryshapes.multipart.code.tex 2010/01/07 v2.10 (rcs-revision 1.2)
\pgfnodepartlowerbox=\box35
\pgfnodeparttwobox=\box36
\pgfnodepartthreebox=\box37
\pgfnodepartfourbox=\box38
\pgfnodeparttwentybox=\box39
\pgfnodepartnineteenbox=\box40
\pgfnodeparteighteenbox=\box41
\pgfnodepartseventeenbox=\box42
\pgfnodepartsixteenbox=\box43
\pgfnodepartfifteenbox=\box44
\pgfnodepartfourteenbox=\box45
\pgfnodepartthirteenbox=\box46
\pgfnodeparttwelvebox=\box47
\pgfnodepartelevenbox=\box48
\pgfnodeparttenbox=\box49
\pgfnodepartninebox=\box50
\pgfnodeparteightbox=\box51
\pgfnodepartsevenbox=\box52
\pgfnodepartsixbox=\box53
\pgfnodepartfivebox=\box54
))) (./automata.aux)
\openout1 = `automata.aux'.
 
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
ABD: EveryShipout initializing macros
(/usr/share/texmf-texlive/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count110
\scratchdimen=\dimen153
\scratchbox=\box55
\nofMPsegments=\count111
\nofMParguments=\count112
\everyMPshowfont=\toks25
\MPscratchCnt=\count113
\MPscratchDim=\dimen154
\MPnumerator=\count114
\everyMPtoPDFconversion=\toks26
)
*geometry auto-detecting driver*
*geometry detected driver: pdftex*
-------------------- Geometry parameters
paper: a4paper
landscape: true
twocolumn: --
twoside: --
asymmetric: --
h-parts: 126.75832pt, 0.7\paperwidth , 126.75833pt (default)
v-parts: 14.22636pt, 569.05515pt, 14.22636pt
hmarginratio: 1:1
vmarginratio: --
lines: --
heightrounded: --
bindingoffset: 0.0pt
truedimen: --
includehead: --
includefoot: --
includemp: --
driver: pdftex
-------------------- Page layout dimensions and switches
\paperwidth 845.04684pt
\paperheight 597.50787pt
\textwidth 591.5302pt
\textheight 569.05515pt
\oddsidemargin 54.48833pt
\evensidemargin 54.48833pt
\topmargin -95.04362pt
\headheight 12.0pt
\headsep 25.0pt
\footskip 30.0pt
\marginparwidth 65.0pt
\marginparsep 11.0pt
\columnsep 10.0pt
\skip\footins 9.0pt plus 4.0pt minus 2.0pt
\hoffset 0.0pt
\voffset 0.0pt
\mag 1000
 
(1in=72.27pt, 1cm=28.45pt)
-----------------------
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 11.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 11.
 
Overfull \hbox (18.20729pt too wide) in paragraph at lines 56--57
[]
[]
 
[1
 
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./automata.aux) )
Here is how much of TeX's memory you used:
10434 strings out of 493848
208951 string characters out of 1152822
260974 words of memory out of 3000000
13545 multiletter control sequences out of 15000+50000
3640 words of font info for 14 fonts, out of 3000000 for 9000
714 hyphenation exceptions out of 8191
56i,8n,68p,468b,813s stack positions out of 5000i,500n,10000p,200000b,50000s
</usr/sh
are/texmf-texlive/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texmf-t
exlive/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texmf-texlive/fonts
/type1/public/amsfonts/cm/cmr7.pfb></usr/share/texmf-texlive/fonts/type1/public
/amsfonts/cm/cmsy7.pfb>
Output written on automata.pdf (1 page, 42559 bytes).
PDF statistics:
25 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
13 words of extra memory for PDF output out of 10000 (max. 10000000)
 
/trunk/middleman/tests/ontology.owl
New file
0,0 → 1,51
<?xml version="1.0"?>
 
 
<!DOCTYPE Ontology [
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
 
 
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="https://www.rocq.inria.fr/mimove/example"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ontologyIRI="https://www.rocq.inria.fr/mimove/example">
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Declaration>
<Class IRI="#read"/>
</Declaration>
<Declaration>
<Class IRI="#write"/>
</Declaration>
<Declaration>
<Class IRI="#a"/>
</Declaration>
<Declaration>
<Class IRI="#b"/>
</Declaration>
<Declaration>
<Class IRI="#ab"/>
</Declaration>
<EquivalentClasses>
<Class IRI="#ab"/>
<ObjectIntersectionOf>
<Class IRI="#a"/>
<Class IRI="#b"/>
</ObjectIntersectionOf>
</EquivalentClasses>
</Ontology>
 
 
 
<!-- Generated by the OWL API (version 3.2.3.1824) http://owlapi.sourceforge.net -->
 
/trunk/middleman/tests/a.lts
New file
0,0 → 1,6
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
read: <read; 0; 0>
write: <write; 0; ab>
 
s0 -[!write]-> s0
/trunk/middleman/tests/b.lts
New file
0,0 → 1,9
prefix: "https://www.rocq.inria.fr/mimove/example#"
 
read: <read; 0; 0>
writea: <write; 0; a>
writeb: <write; 0; b>
 
s0 -[?read]-> s0
s0 -[?writea]-> s1
s1 -[?writeb]-> s0
/trunk/middleman/nb-configuration.xml
New file
0,0 → 1,14
<?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.
-->
<config-data xmlns="http://www.netbeans.org/ns/maven-config-data/1">
<configurations>
<configuration id="start_middleman" profiles=""/>
</configurations>
</config-data>
</project-shared-configuration>
/trunk/middleman/nbactions-start_middleman.xml
New file
0,0 → 1,46
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath iconnect.middleman.Middleman tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath iconnect.middleman.Middleman tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath iconnect.middleman.Middleman tests/ontology.owl tests/a.lts tests/b.lts 8082</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
/trunk/middleman/target/maven-archiver/pom.properties
New file
0,0 → 1,5
#Generated by Maven
#Mon Jun 30 18:04:18 CEST 2014
version=1.0-SNAPSHOT
groupId=iconnect.middleman
artifactId=Middleman
/trunk/middleman/target/classes/iconnect/middleman/Middleman.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/iconnect/middleman/Peer.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/iconnect/middleman/MiddlemanReceiver.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Automaton.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Automaton$Action.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Data.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Automaton$State$Transition.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Mics.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Automaton$State.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/StatePair.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/classes/mics/Label.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/Middleman-1.0-SNAPSHOT.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/target/Middleman-1.0-SNAPSHOT-jar-with-dependencies.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/middleman/src/main/java/mics/StatePair.java
New file
0,0 → 1,30
package mics;
 
public class StatePair {
public final Automaton.State a;
 
public final Automaton.State b;
 
public StatePair(Automaton.State a, Automaton.State b) {
this.a = a;
this.b = b;
}
 
public int hashCode() {
return a.hashCode() * 1373 + b.hashCode();
}
 
public boolean equals(Object o) {
try {
StatePair p = (StatePair) o;
return a.equals(p.a) && b.equals(p.b);
}
catch (ClassCastException e) {
return false;
}
}
 
public String toString() {
return "(" + a.toString() + "," + b.toString() + ")";
}
}
/trunk/middleman/src/main/java/mics/Label.java
New file
0,0 → 1,34
package mics;
 
public class Label {
public final Automaton.Action action;
 
public final boolean send;
 
public Label(boolean send, Automaton.Action action) {
this.send = send;
this.action = action;
}
 
public int hashCode() {
return action.hashCode() * 2 + (send ? 1 : 0);
}
 
public boolean equals(Object o) {
try {
Label l = (Label) o;
return action.equals(l.action) && send == l.send;
}
catch (ClassCastException e) {
return false;
}
}
 
public String toString() {
return (send ? "!" : "?") + action;
}
 
public Label dual() {
return new Label(!send, action);
}
}
/trunk/middleman/src/main/java/mics/Automaton.java
New file
0,0 → 1,326
package mics;
 
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.PrefixManager;
import org.semanticweb.owlapi.util.DefaultPrefixManager;
 
public class Automaton {
public final OWLOntology ontology;
public final Map<String, State> states = new HashMap<>();
 
public final Map<String, Action> actions = new HashMap<>();
 
public State initial = null;
public class State {
public final String name;
public final Map<Label, Transition> transitions = new HashMap<>();
public class Transition {
public final Vector<Data> datas = new Vector<>();
public final State target;
 
public Transition(Label label, State target) {
this.target = target;
transitions.put(label, this);
}
}
 
public State(String name) {
String fullName = name;
if (states.get(fullName) != null) {
for (int i = 1; ; i++) {
fullName = name + "[" + Integer.toString(i) + "]";
if (states.get(fullName) == null) {
break;
}
}
}
this.name = fullName;
states.put(fullName, this);
}
public String toString() {
return name;
}
}
 
public class Action {
public String name;
public final OWLClass affordance;
 
public final OWLClass input;
 
public final OWLClass output;
 
public Action(String name, OWLClass affordance, OWLClass input, OWLClass output) {
this.name = name;
this.affordance = affordance;
this.input = input;
this.output = output;
actions.put(name, this);
}
 
public String toString() {
return name;
}
 
public int hashCode() {
return name.hashCode();
}
 
public boolean equals(Object o) {
try {
Action a = (Action) o;
return name.equals(a.name);
}
catch (ClassCastException e) {
return false;
}
}
}
 
public Automaton(OWLOntology ontology, String desc) {
this.ontology = ontology;
parse(desc);
}
 
public Automaton(OWLOntology ontology) {
this.ontology = ontology;
}
 
public State getState(String name) {
State result = states.get(name);
if (result == null) {
result = new State(name);
}
return result;
}
private void parse(String desc) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory factory = manager.getOWLDataFactory();
Vector<String> lexems = lex(desc);
PrefixManager pm = null;
for (Iterator<String> i = lexems.iterator(); i.hasNext();) {
String name = i.next();
if (!(i.hasNext())) {
throw new RuntimeException("-[ or : expected");
}
String delimiter = i.next();
if (delimiter.equals("-[")) {
State source = getState(name);
if (initial == null) {
initial = source;
}
String s = expect(i, "transition label");
if (s.equals("")) {
throw new RuntimeException("label cannot be empty");
}
char prefix = s.charAt(0);
boolean send;
if (prefix == '?') {
send = false;
}
else if (prefix == '!') {
send = true;
}
else {
throw new RuntimeException("label should be prefixed either by '?' or '!'");
}
String symbol = s.substring(1);
Action action = actions.get(symbol);
if (action == null) {
throw new RuntimeException("unknown action " + symbol);
}
Label label = new Label(send, action);
String end = expect(i, "data or transition end");
Vector<Data> datas = new Vector<>();
if (end.equals("]->")) {
}
else if (end.equals("<")) {
for (;;) {
String data = expect(i, "data");
datas.add(new Data(data));
String follow = expect(i, "comma or transition end");
if (follow.equals(">]->")) {
break;
}
else if (follow.equals(";")) {
}
else {
throw new RuntimeException("semicolon or transition end excepted but " + follow + " found");
}
}
}
else {
throw new RuntimeException("data or transition end excepted but " + end + " found");
}
State target = getState(expect(i, "target state"));
State.Transition transition = source.new Transition(label, target);
transition.datas.addAll(datas);
}
else if (delimiter.equals(":")) {
if (name.equals("prefix")) {
String prefix = expect(i, "prefix");
pm = new DefaultPrefixManager(prefix);
}
else {
expect_symbol(i, "<");
OWLClass affordance = expect_class(factory, i, "affordance", pm);
expect_symbol(i, ";");
OWLClass input = expect_class(factory, i, "input", pm);
expect_symbol(i, ";");
OWLClass output = expect_class(factory, i, "output", pm);
expect_symbol(i, ">");
new Action(name, affordance, input, output);
}
}
else {
throw new RuntimeException("-[ or : expected");
}
}
if (initial == null) {
throw new RuntimeException("automaton with no state!");
}
}
 
private OWLClass expect_class(OWLDataFactory factory, Iterator<String> i, String desc, PrefixManager pm) {
String name = expect(i, desc);
if (name.equals("0")) {
return factory.getOWLNothing();
}
else if (pm == null) {
return factory.getOWLClass(IRI.create(name));
}
else {
return factory.getOWLClass(name, pm);
}
}
 
private void expect_symbol(Iterator<String> i, String symbol) {
if (!(i.hasNext() && i.next().equals(symbol))) {
throw new RuntimeException("'" + symbol + "' expected");
}
}
 
private String expect(Iterator<String> i, String desc) {
if (!(i.hasNext())) {
throw new RuntimeException(desc + " expected");
}
return i.next();
}
 
private static Vector<String> lex(String desc) {
Vector<String> lexems = new Vector<>();
StringBuilder currentLexem = null;
int lastCharClass = 0;
for (int i = 0; i < desc.length(); i++) {
char c = desc.charAt(i);
int charClass;
if (c == ' ' || c == '\n' || c == '\t') {
charClass = 0;
}
else if (c == '-' || c == '<' || c == '>' || c == '[' || c == ']' || c == ':' || c == ';') {
charClass = 1;
}
else if (c == '"') {
charClass = 2;
}
else {
charClass = 3;
}
if (charClass != lastCharClass) {
if (currentLexem != null) {
lexems.add(currentLexem.toString());
currentLexem = null;
}
lastCharClass = charClass;
}
if (charClass != 0) {
if (currentLexem == null) {
currentLexem = new StringBuilder();
}
if (charClass == 2) {
for (;;) {
i++;
if (i >= desc.length()) {
throw new RuntimeException("unterminated string");
}
c = desc.charAt(i);
if (c == '"') {
break;
}
else if (c == '\\') {
i++;
if (i >= desc.length()) {
throw new RuntimeException("unterminated string");
}
c = desc.charAt(i);
}
currentLexem.append(c);
}
lexems.add(currentLexem.toString());
currentLexem = null;
}
else {
currentLexem.append(c);
}
}
}
if (currentLexem != null) {
lexems.add(currentLexem.toString());
currentLexem = null;
}
return lexems;
}
 
private void appendTransitions(StringBuilder builder, State s) {
for (Label l: s.transitions.keySet()) {
State.Transition t = s.transitions.get(l);
builder.append(String.format("%s-[%s", s, l));
if (!t.datas.isEmpty()) {
builder.append("<");
boolean first = true;
for (Data data: t.datas) {
if (first) {
first = false;
}
else {
builder.append(";");
}
builder.append(data);
}
builder.append(">");
}
builder.append(String.format("]->%s\n", t.target));
}
}
public String toString() {
StringBuilder result = new StringBuilder();
appendTransitions(result, initial);
for (String name: states.keySet()) {
State s = states.get(name);
if (s != initial) {
appendTransitions(result, s);
}
}
return result.toString();
}
}
/trunk/middleman/src/main/java/mics/Data.java
New file
0,0 → 1,53
package mics;
 
public class Data {
public final String label;
 
public final boolean keep;
 
public final boolean sequence;
 
public Data(String fullLabel) {
String reducedLabel = fullLabel;
if (reducedLabel.endsWith("*")) {
reducedLabel = reducedLabel.substring(0, reducedLabel.length() - 1);
this.sequence = true;
}
else {
this.sequence = false;
}
if (reducedLabel.startsWith("?")) {
reducedLabel = reducedLabel.substring(1);
this.keep = true;
}
else {
this.keep = false;
}
this.label = reducedLabel;
}
 
public int hashCode() {
return label.hashCode() * 2 + (sequence ? 1 : 0);
}
 
public boolean equals(Object o) {
try {
Data d = (Data) o;
return label.equals(d.label) && sequence == d.sequence;
}
catch (ClassCastException e) {
return false;
}
}
 
public String toString() {
String fullLabel = label;
if (sequence) {
fullLabel = fullLabel + "*";
}
if (keep) {
fullLabel = "?" + fullLabel;
}
return fullLabel;
}
}
/trunk/middleman/src/main/java/mics/Mics.java
New file
0,0 → 1,272
package mics;
 
import java.nio.file.Paths;
import java.nio.file.Files;
import java.nio.file.Path;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.PrefixManager;
import org.semanticweb.owlapi.reasoner.ConsoleProgressMonitor;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import org.semanticweb.owlapi.reasoner.SimpleConfiguration;
import org.semanticweb.HermiT.Reasoner;
 
public class Mics {
public final OWLOntologyManager manager;
 
public final OWLDataFactory dataFactory;
public final OWLOntology ontology;
 
public final OWLReasoner reasoner;
 
public Mics(File file_ontology) throws OWLOntologyCreationException {
manager = OWLManager.createOWLOntologyManager();
ontology = manager.loadOntologyFromOntologyDocument(file_ontology);
dataFactory = manager.getOWLDataFactory();
OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor();
OWLReasonerConfiguration config = new SimpleConfiguration(progressMonitor);
reasoner = reasonerFactory.createReasoner(ontology);
}
public static void main(String[] args) {
try {
Mics mics = new Mics(new File(args[0]));
Automaton a = mics.readAutomaton(Paths.get(args[1]));
Automaton b = mics.readAutomaton(Paths.get(args[2]));
Automaton s = mics.mediate(a, b);
System.out.println(s.toString());
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
 
public Automaton readAutomaton(Path filename) throws IOException {
byte[] bytes = Files.readAllBytes(filename);
String s = new String(bytes, "UTF-8");
return new Automaton(ontology, s);
}
 
public Automaton mediate(Automaton a, Automaton b) {
Automaton s = new Automaton(ontology);
Map<StatePair, Automaton.State> table = new HashMap<>();
s.initial = mediateState(s, new StatePair(a.initial, b.initial), table, new HashSet<String>(), new HashSet<String>());
return s;
}
 
public boolean isSubClassOf(OWLClassExpression a, OWLClassExpression b) {
return reasoner.isEntailed(dataFactory.getOWLSubClassOfAxiom(a, b));
}
 
public boolean findCover(OWLClassExpression affordance, OWLClassExpression input, OWLClassExpression output_accu, OWLClassExpression output, Automaton.State s, Vector<Label> vector) {
if (affordance.isOWLNothing()) {
return true;
}
for (Label l: s.transitions.keySet()) {
if (!l.send && isSubClassOf(l.action.affordance, affordance) && isSubClassOf(input, l.action.input) && vector.indexOf(l) == -1) {
OWLClassExpression sub_input = dataFactory.getOWLObjectIntersectionOf(input, l.action.output);
OWLClassExpression sub_output = dataFactory.getOWLObjectIntersectionOf(output_accu, l.action.output);
vector.add(l);
if (isSubClassOf(sub_output, output)) {
return true;
}
else {
if (findCover(affordance, sub_input, sub_output, output, s.transitions.get(l).target, vector)) {
return true;
}
else {
vector.remove(vector.size() - 1);
}
}
}
}
return false;
}
 
public void mediatePath(Automaton a, Automaton.State s, Automaton.State s1, Label l, Automaton.State s2, Vector<Label> vector, Map<StatePair, Automaton.State> table, boolean way) {
if (vector.size() == 0) {
StatePair p2;
Automaton.State.Transition t1 = s1.transitions.get(l);
s1 = t1.target;
if (way) {
p2 = new StatePair(s1, s2);
}
else {
p2 = new StatePair(s2, s1);
}
Automaton.State last = mediateState(a, p2, table, new HashSet<String>(), new HashSet<String>());
Automaton.State.Transition td = s.new Transition(l.dual(), last);
return;
}
Automaton.State next = a.new State(s1.toString() + "(" + l.action.name + ")");
Automaton.State.Transition t1 = s1.transitions.get(l);
Automaton.State.Transition td1 = s.new Transition(l.dual(), next);
Set<String> individualDatas = new HashSet<>();
Set<String> sequenceDatas = new HashSet<>();
for (Data data : t1.datas) {
td1.datas.add(data);
if (data.keep) {
throw new RuntimeException("Emitting transition cannot query data");
}
else if (data.sequence) {
sequenceDatas.add(data.label);
}
else {
individualDatas.add(data.label);
}
}
s = next;
int last_label_index = vector.size() - 1;
Label last_label = vector.get(last_label_index);
vector.remove(last_label_index);
StringBuilder accu = new StringBuilder(l.action.name);
for (Label lb: vector) {
accu.append(", " + lb.action.name);
Automaton.State follow = a.new State(s1.toString() + "(" + accu.toString() + ")");
Automaton.State.Transition t2 = s2.transitions.get(lb);
Automaton.State.Transition td2 = s.new Transition(lb.dual(), follow);
for (Data data : t2.datas) {
if (data.sequence) {
throw new RuntimeException("Unsupported target sequence");
}
else {
if (data.keep && individualDatas.contains(data.label)) {
}
else if (!data.keep && individualDatas.remove(data.label)) {
}
else {
throw new RuntimeException("Not provided data: " + data);
}
td2.datas.add(data);
}
}
s = follow;
s2 = t2.target;
}
s1 = t1.target;
Automaton.State.Transition l2 = s2.transitions.get(last_label);
s2 = l2.target;
StatePair p2;
if (way) {
p2 = new StatePair(s1, s2);
}
else {
p2 = new StatePair(s2, s1);
}
Set<Data> target_datas = new HashSet<>();
Automaton.State last = null;
for (Data data : l2.datas) {
if (data.sequence) {
throw new RuntimeException("Unsupported target sequence");
}
else {
if (data.keep && individualDatas.contains(data.label)) {
}
else if (!data.keep && individualDatas.remove(data.label)) {
}
else if (!data.keep && sequenceDatas.remove(data.label)) {
last = s;
}
else {
throw new RuntimeException("Not provided data: " + data);
}
target_datas.add(data);
}
}
if (last == null) {
last = mediateState(a, p2, table, individualDatas, sequenceDatas);
}
else {
mediateTransitions(last, a, p2, table, individualDatas, sequenceDatas);
}
Automaton.State.Transition ld2 = s.new Transition(last_label.dual(), last);
ld2.datas.addAll(target_datas);
}
 
public void mediateTransitions(Automaton.State s, Automaton a, StatePair p, Map<StatePair, Automaton.State> table, Set<String> individualDatas, Set<String> sequenceDatas) {
for (Label la: p.a.transitions.keySet()) {
if (la.send) {
Vector<Label> vector = new Vector<>();
if (findCover(la.action.affordance, la.action.input, dataFactory.getOWLThing(), la.action.output, p.b, vector)) {
mediatePath(a, s, p.a, la, p.b, vector, table, true);
}
else {
throw new RuntimeException("cannot mediate " + la.toString() + " from " + p.toString());
}
}
}
for (Label lb: p.b.transitions.keySet()) {
if (lb.send) {
Vector<Label> vector = new Vector<>();
if (findCover(lb.action.affordance, lb.action.input, dataFactory.getOWLThing(), lb.action.output, p.a, vector)) {
mediatePath(a, s, p.b, lb, p.a, vector, table, false);
}
else {
throw new RuntimeException("cannot mediate " + lb.toString() + " from " + p.toString());
}
}
}
if (!individualDatas.isEmpty()) {
for (Label la: p.a.transitions.keySet()) {
if (!la.send) {
Automaton.State.Transition ta = p.a.transitions.get(la);
if (!ta.datas.isEmpty()) {
boolean valid = true;
for (Data data: ta.datas) {
if (individualDatas.contains(data.label)) {
}
else {
valid = false;
break;
}
}
if (valid) {
Automaton.State follow = a.new State(p.a.toString() + "(" + la.toString() + ")");
Automaton.State.Transition t = p.a.new Transition(la.dual(), follow);
for (Data data: ta.datas) {
if (data.keep && individualDatas.contains(data.label)) {
}
else if (!data.keep && individualDatas.remove(data.label)) {
}
else {
valid = false;
break;
}
t.datas.add(data);
}
}
}
}
}
}
}
public Automaton.State mediateState(Automaton a, StatePair p, Map<StatePair, Automaton.State> table, Set<String> individualDatas, Set<String> sequenceDatas) {
Automaton.State s = table.get(p);
if (s == null) {
s = a.new State(p.toString());
table.put(p, s);
mediateTransitions(s, a, p, table, individualDatas, sequenceDatas);
}
return s;
}
}
/trunk/middleman/src/main/java/iconnect/middleman/MiddlemanReceiver.java
New file
0,0 → 1,97
package iconnect.middleman;
 
import com.eclipsesource.json.JsonObject;
import java.io.IOException;
import java.util.concurrent.ConcurrentMap;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.engine.header.Header;
import org.restlet.engine.header.HeaderConstants;
import org.restlet.representation.Representation;
import org.restlet.util.Series;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
 
public class MiddlemanReceiver extends ServerResource {
public MiddlemanReceiver(){
 
}
 
/**
* Receives a Post request
*
* @param entity Describes the contents of the HTTP post request
* @return
*/
@Post
public synchronized Response receivePost(Representation entity) {
Request request = getRequest();
Middleman.instance.self_url = request.getHostRef().getHostDomain();
String source = request.getClientInfo().getAddress();
System.out.println("Message received from: " + source);
System.out.println("Message size: " + entity.getSize());
String data = "";
try {
data = entity.getText();
}
catch (IOException e) {
System.out.println("IOException: " + e.toString());
}
System.out.println("Data: " + data);
System.out.println("Data length: " + data.length());
 
Middleman.instance.receivePost(data);
 
//Check the interaction paradigm and create the appropriate message
//Alternativelly we could create an abstract message 'Message' if we don't want to specify the details
/*try {
JsonObject msgOBject = JsonObject.readFrom(data);
if (msgOBject.get("_interactionParadigm").asString().equals(Constants.CS)) {
Message_CS msg = new Message_CS();
msg.deserializeFromJson(JsonObject.readFrom(data));
 
//Test that it worked here
System.out.println("Data: " + msg.get_data_string());
}
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}*/
 
return Response.getCurrent();
}
 
@Get
public synchronized Response receiveGet() {
Request request = getRequest();
System.out.println("Receiving...");
Middleman.instance.self_url = request.getHostRef().getHostDomain();
String source = request.getClientInfo().getAddress();
System.out.println("From source:" + source);
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs.get(HeaderConstants.ATTRIBUTE_HEADERS);
if (headers == null) {
headers = new Series<Header>(Header.class);
Series<Header> prev = (Series<Header>) attrs.putIfAbsent(HeaderConstants.ATTRIBUTE_HEADERS, headers);
if (prev != null) {
headers = prev;
}
}
Header messageHeader = headers.getFirst("message");
Header callbackURLHeader = headers.getFirst("callbackURL");
Response response = Response.getCurrent();
if (messageHeader == null) {
System.out.println("No message header!");
}
else if (callbackURLHeader == null) {
System.out.println("No callbackURL header!");
}
else {
String data = messageHeader.getValue();
String callbackURL = callbackURLHeader.getValue();
Middleman.instance.receiveGet(data, callbackURL);
System.out.println("GET received");
}
return response;
}
}
/trunk/middleman/src/main/java/iconnect/middleman/Middleman.java
New file
0,0 → 1,329
package iconnect.middleman;
 
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import com.eclipsesource.json.JsonArray;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.nio.file.Path;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import org.restlet.Client;
import org.restlet.Component;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Server;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.engine.header.Header;
import org.restlet.engine.header.HeaderConstants;
import org.restlet.representation.StringRepresentation;
import org.restlet.util.Series;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
import mics.Mics;
import mics.Automaton;
import mics.Label;
import mics.Data;
 
public class Middleman {
public final Automaton a;
 
private Automaton.State state;
 
static public Middleman instance;
 
public final Client client;
 
//public final GA_Bus_API API = new GA_Bus_API();
 
public String self_url;
 
private final int answerPort;
public Middleman(Automaton a, int answerPort) {
this.a = a;
this.answerPort = answerPort;
instance = this;
client = new Client(Protocol.HTTP);
setState(a.initial);
}
 
public Automaton.State getState() {
return state;
}
 
boolean lastGet;
 
String callbackURL;
 
public void post(String server_uri, JsonObject msgObject) {
if (lastGet) {
String s = msgObject.toString();
Request request = new Request(Method.GET, server_uri);
ConcurrentMap <String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs.get(HeaderConstants.ATTRIBUTE_HEADERS);
if (headers == null) {
headers = new Series<Header>(Header.class);
Series<Header> prev = (Series<Header>) attrs.putIfAbsent(HeaderConstants.ATTRIBUTE_HEADERS, headers);
if (prev != null) {
headers = prev;
}
}
headers.add("callbackURL", "http://" + self_url + ":" + answerPort);
headers.add("message", s);
Response response = client.handle(request);
}
else {
String s = msgObject.toString();
Request request = new Request(Method.POST, callbackURL, new StringRepresentation(s));
Response response = client.handle(request);
}
/*
Message message = new Message();
message.deserializeFromJson(s);
message.set_mediatorAddress("");
if (lastGet) {
API.get_async(message, self_url);
}
else {
message.set_destination(callbackURL);
API.post(message);
}
*/
}
private JsonObject msgObject = null;
 
private Map<String, LinkedList<String>> datas = new HashMap<>();
public void receivePost(String data) {
lastGet = false;
try {
msgObject = JsonObject.readFrom(data);
follow(msgObject.get("_operation").asString());
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}
}
 
public void receiveGet(String data, String callbackURL) {
lastGet = true;
this.callbackURL = callbackURL;
try {
msgObject = JsonObject.readFrom(data);
follow(msgObject.get("_operation").asString());
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
}
}
 
public void emit(String s) {
if (msgObject == null) {
throw new RuntimeException("Should have received a message first");
}
msgObject.set("_operation", s);
String server_uri = msgObject.get("_destinationServiceAddress").asString() + ":" + msgObject.get("_destinationServicePort").asInt();
System.out.println("Send message to: " + server_uri);
post(server_uri, msgObject);
}
 
public void pushData(String data, String item) {
LinkedList<String> target = datas.get(data);
if (target == null) {
target = new LinkedList<String>();
datas.put(data, target);
}
target.add(item);
}
 
public String pollData(String data) {
LinkedList<String> target = datas.get(data);
if (target == null) {
return null;
}
return target.pollFirst();
}
 
public void follow(String s) {
for (Label l: state.transitions.keySet()) {
if (!l.send && l.action.name.equals(s)) {
Automaton.State.Transition t = state.transitions.get(l);
for (Data data : t.datas) {
JsonValue contents = msgObject.get("_" + data.label);
if (data.sequence) {
JsonArray items = JsonArray.readFrom(contents.asString());
for (JsonValue item : items) {
pushData(data.label, item.toString());
}
}
else {
pushData(data.label, contents.asString());
}
}
setState(t.target);
return;
}
}
throw new RuntimeException("Unknown message " + s);
}
 
public void setState(Automaton.State state) {
this.state = state;
System.out.println("In state: " + state);
for (Label l: state.transitions.keySet()) {
if (l.send) {
boolean dataMatch = true;
Automaton.State.Transition t = state.transitions.get(l);
Map<String, String> providedDatas = new HashMap<>();
for (Data data : t.datas) {
String item = pollData(data.label);
if (item == null) {
dataMatch = false;
break;
}
providedDatas.put(data.label, item);
}
if (dataMatch) {
for (String label : providedDatas.keySet()) {
String item = providedDatas.get(label);
msgObject.set("_" + label, item);
}
emit(l.action.name);
setState(t.target);
break;
}
}
}
}
public Server server(int port) {
Server server = new Server(Protocol.HTTP, port);
Component _component;
try {
if (!server.isStarted()) {
_component = new Component();
_component.getServers().add(server);
_component.getDefaultHost().attach("/", MiddlemanReceiver.class);
_component.start();
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
return server;
}
public static void main(String[] args) {
try {
File instance_filename = new File(args[0]);
File instance_baseDirectory = instance_filename.getParentFile();
Document instance = parseXMLFile(instance_filename);
Element instanceRoot = instance.getDocumentElement();
NodeList children = instanceRoot.getChildNodes();
Mics mics = null;
Peer a = null;
Peer b = null;
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) child;
if (element.getLocalName().equals("ontology")) {
if (mics != null) {
throw new RuntimeException("Ontology specified twice");
}
File ontology_filename = new File(instance_baseDirectory, element.getAttribute("src"));
mics = new Mics(ontology_filename);
}
else if (element.getLocalName().equals("peer")) {
NodeList childNodes = element.getChildNodes();
Automaton lts = null;
Integer listenPort = null;
if (mics == null) {
throw new RuntimeException("Peer specification should come after ontology");
}
for (int j = 0; j < childNodes.getLength(); j++) {
Node node = childNodes.item(j);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element elt = (Element) node;
if (elt.getLocalName().equals("lts")) {
File file = new File(instance_baseDirectory, elt.getAttribute("src"));
Path filename = Paths.get(file.getPath());
lts = mics.readAutomaton(filename);
}
else if (elt.getLocalName().equals("listen")) {
listenPort = Integer.parseInt(elt.getAttribute("port"));
}
}
}
if (lts == null) {
throw new RuntimeException("LTS is missing");
}
if (listenPort == null) {
throw new RuntimeException("Listen port is missing");
}
Peer peer = new Peer(lts, listenPort);
if (a == null) {
a = peer;
}
else if (b == null) {
b = peer;
}
else {
throw new RuntimeException("More than two peers specified");
}
}
}
}
if (b == null) {
throw new RuntimeException("Peer missing");
}
System.out.println("Peer A:");
System.out.println(a.lts.toString());
System.out.println("Peer B:");
System.out.println(b.lts.toString());
Automaton s = mics.mediate(a.lts, b.lts);
System.out.println("Mediator:");
System.out.println(s.toString());
Middleman middleman = new Middleman(s, b.listenPort);
Server server_a = middleman.server(a.listenPort);
Server server_b = middleman.server(b.listenPort);
System.in.read();
server_a.stop();
server_b.stop();
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
 
public static Document parseXMLFile(File file)
throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new FileInputStream(file);
Reader reader = new InputStreamReader(inputStream, "UTF-8");
InputSource inputSource = new InputSource(reader);
Document document = documentBuilder.parse(inputSource);
return document;
}
}
/trunk/middleman/src/main/java/iconnect/middleman/Peer.java
New file
0,0 → 1,14
package iconnect.middleman;
 
import mics.Automaton;
 
public class Peer {
public final Automaton lts;
 
public final int listenPort;
 
public Peer(Automaton lts, int listenPort) {
this.lts = lts;
this.listenPort = listenPort;
}
}
/trunk/middleman/start_middleman_rss.sh
New file
0,0 → 1,2
#!/bin/bash
mvn exec:java -Dexec.mainClass="iconnect.middleman.Middleman" -Dexec.args="tests/rss/instance.xml http://128.93.59.54:8081"
Property changes:
Added: svn:executable
+ *
/trunk/middleman/start_middleman_subscriber_server.sh
New file
0,0 → 1,2
#!/bin/bash
mvn exec:java -Dexec.mainClass="iconnect.middleman.Middleman" -Dexec.args="tests/subscriber_server/instance.xml http://128.93.59.54:8081"
Property changes:
Added: svn:executable
+ *
/trunk/LSB/nbactions-PS_1.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_PS_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_PS_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_PS_1.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_PS_1.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_PS_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_PS_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB/nbactions-PS_2.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_PS_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_PS_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_PS_2.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_PS_2.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_PS_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_PS_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB/moquette.log
New file
0,0 → 1,569
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
157 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
353 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
355 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
368 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
368 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
99722 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 0, msg wrote: 0
99723 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
99724 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
134773 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
134779 [pool-3-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
134781 [pool-3-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
134781 [pool-3-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
134785 [pool-3-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
134785 [pool-3-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
185554 [pool-3-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
185554 [pool-3-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
185555 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 2, msg wrote: 2
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
83 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
182 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
183 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
200 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
200 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
113049 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
113072 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
113186 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
116284 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
116348 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
480856 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
480871 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
480899 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
487190 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
487190 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
487192 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
489298 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
489299 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
513035 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
513036 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
513038 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
230 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
550 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
551 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
568 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
569 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
65177 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
65178 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
65351 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
92315 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
92318 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
92347 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
95508 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
95508 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
95509 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 12, msg wrote: 10
1 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
85 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
184 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
186 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
197 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
198 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
5714 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
5714 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
5726 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
109418 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
109421 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
109423 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
112805 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
112805 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
112809 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 14, msg wrote: 12
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
134 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
229 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
231 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
243 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
243 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
3385 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3386 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3396 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
46436 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
46439 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
46443 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
48844 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
48845 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
48846 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 10, msg wrote: 8
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
120 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
220 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
222 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
234 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
234 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
3050 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3050 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3062 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
46897 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
46899 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
46902 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
49521 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
49521 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
49522 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 10, msg wrote: 8
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
123 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
227 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
229 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
240 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
240 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
7448 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
7448 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
7459 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
35241 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
35243 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
35246 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
50296 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
50297 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
50299 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
240825 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
240828 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
240829 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
243429 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
243430 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
243432 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 32, msg wrote: 28
246038 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
246042 [pool-7-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
246048 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
246048 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
246054 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
246054 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
250082 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
250082 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
250084 [pool-7-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
340549 [pool-7-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
340552 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
340553 [pool-7-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
342617 [pool-7-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
342617 [pool-7-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
342635 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 14, msg wrote: 12
348496 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
348501 [pool-11-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
348506 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
348506 [pool-11-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
348510 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
348511 [pool-11-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
352627 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
352627 [pool-11-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
352629 [pool-11-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
499883 [pool-11-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
499886 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
499887 [pool-11-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
506189 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
506190 [pool-11-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
506192 [pool-11-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
640010 [pool-11-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
640012 [pool-11-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
640014 [pool-11-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
642437 [pool-11-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
642437 [pool-11-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
642440 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 34, msg wrote: 30
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
118 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
226 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
228 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
240 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
240 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
74420 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
74421 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
74433 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
107729 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
107734 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
107736 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
112751 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
112751 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
112753 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
205608 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
205609 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
205610 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
210013 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
210013 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
210015 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 26, msg wrote: 22
213608 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
213611 [pool-7-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
213616 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
213617 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
213621 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
213622 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
229060 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
229060 [pool-7-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
229063 [pool-7-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
257071 [pool-7-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
257073 [pool-7-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
257076 [pool-7-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
263330 [pool-7-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
263331 [pool-7-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
263334 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 10, msg wrote: 8
1 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
123 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
221 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
224 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
236 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
237 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
19354 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
19355 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
19365 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
26313 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
26370 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
564847 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
564856 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
564859 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
567918 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
567918 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
567920 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
628618 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
628619 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
631621 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
631624 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
631626 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
633771 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
633771 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
633772 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
763526 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
763528 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
763530 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
767058 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
769478 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
769478 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
769482 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1006214 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
1006218 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1006219 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
1009627 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1009627 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1009630 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1036166 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
1036172 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1036173 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
1068363 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1068364 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1068366 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1488952 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
1488961 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1488962 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
1493064 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1493065 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1493067 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
2909971 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
2909977 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
2909981 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
3015619 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3015619 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3015622 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
3053393 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
3053400 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3053402 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
3060601 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3060602 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3060604 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
3085327 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
3085332 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3085335 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
3088491 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3088491 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3088493 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
3142420 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
3142426 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3142427 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
3142857 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
3142857 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
3142859 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
3316384 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
3316385 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <CLIENT-1>
3316386 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
3316386 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 292, msg wrote: 272
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
71 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
193 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
195 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
210 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
211 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
237872 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
237873 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
237883 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
336309 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
336313 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
336315 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
338808 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
338808 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
338810 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
413052 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
413053 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
413055 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
417168 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
417169 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
417170 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 34, msg wrote: 30
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
86 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
185 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
186 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
197 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
198 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
4065 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4065 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
4077 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
83203 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
83206 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
83208 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
83951 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
83951 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
83953 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
92822 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
92825 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
92827 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
96769 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
96769 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
96770 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 22, msg wrote: 18
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
112 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
219 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
221 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
233 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
233 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
16216 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
16217 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
16230 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
55429 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
55434 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
55436 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
104047 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
104047 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
104049 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
150287 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
150289 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
150290 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
159350 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
159351 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
159352 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
183082 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
183083 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
183085 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
187500 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
187500 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
187502 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
291949 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
291951 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
291953 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
294945 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
294945 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
294947 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
394067 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
394069 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
394070 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
398014 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
398015 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
398016 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
546170 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
546175 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
546176 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
549999 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
550000 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
550001 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
790187 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
790193 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
790194 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
793283 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
793284 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
793285 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1110601 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
1110605 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1110606 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
1113688 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1113688 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1113690 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1175628 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
1175630 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1175631 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
1178604 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1178605 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1178608 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
1183702 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
1183711 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
1183736 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
1183737 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
3786140 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
3788334 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <CLIENT-1>
3788335 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
4583443 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4583444 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
4583446 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
4618167 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
4618170 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4618172 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
4621906 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4621906 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
4621908 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
4980603 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
4980605 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4980607 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
4985714 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
4985715 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
4985717 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
5264184 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
5264188 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
5264190 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
5264988 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
5264989 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
5264991 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
5371744 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <CLIENT-1>
5371746 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 228, msg wrote: 204
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
101 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
17025 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
17027 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
28530 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
28531 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
68072 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
68073 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
68084 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
106773 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
106778 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
106779 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
109747 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
109748 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
109750 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
235090 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
235091 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
235093 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
241524 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
241525 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
241527 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 28, msg wrote: 24
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
138 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
8212 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
8213 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
9265 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
9265 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
27280 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
27281 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
27290 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
29510 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29518 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29545 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29545 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29583 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29584 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29598 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29599 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29612 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29613 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29626 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29627 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29637 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29638 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29649 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29650 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29662 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29663 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29684 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29685 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29696 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29698 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29709 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29710 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29722 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29723 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29748 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29749 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29760 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29761 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29778 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29779 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29791 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29792 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29802 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29802 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29814 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29815 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
29826 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
29827 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
77162 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
77168 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
77171 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
134790 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
134790 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
134792 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 73, msg wrote: 71
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
236 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
109 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
78 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
138 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
414 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
432 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
93 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
1 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
130 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
125998 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 0, msg wrote: 0
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
107 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
256 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
258 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
271 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-1886>
271 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-1886> with clean session true
2292 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 2, msg wrote: 2
2294 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
2294 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-1886>
7400 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
7402 [pool-3-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
110 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
83 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
61 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
224 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-Incoming>
225 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-Incoming> with clean session true
237 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <BC-8061>
238 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <BC-8061> with clean session true
165556 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
165556 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
165626 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
167764 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167800 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167839 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167840 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167864 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167865 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167896 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167897 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167916 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167917 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167931 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167931 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167942 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167943 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167969 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167970 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167986 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167986 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
167998 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
167999 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168027 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168028 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168040 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168040 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168057 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168058 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168067 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168068 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168080 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168081 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168092 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168093 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168106 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168106 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168137 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168138 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168147 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168148 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
168157 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <BC-Incoming> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
168158 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
216272 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
216274 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
216400 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
3166566 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-8061>
3166566 [pool-1-thread-1] INFO ProtocolProcessor - Lost connection with client <BC-Incoming>
14223883 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 101, msg wrote: 99
/trunk/LSB/target/lsb_main-0.0.1.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS_PS_NoBroker.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_PS_STR.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/WS_Server.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/WsServerTest.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR_CS$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/ClientCallback_CS_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/ClientCallback_CS_PS_NoBroker.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/ClientCallback_STR_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS$3.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/ClientCallback.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_CS_STR.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/TestSourceServiceRestletResource.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR_CS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_PS_STR$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/test-classes/fr/arles/inria/lsb/Test_STR_PS$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/GA_Bus_API.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/GA_Bus.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/ConverterPS_GA.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/ConverterParadigm_GA.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/ConverterCS_GA.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/ServiceBusRestletResource.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/converters/ConverterSTR_GA.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Message.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/LsbConfig.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Message_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Message_CS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Constants.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Message_STR.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/commons/Response.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/MQTT_Connector$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/Interface_CS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/MQTT_Connector$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/WebsocketConnector$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/Interface_STR.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/RestConnector.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/ClientCallback.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/LsbConnector.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/RestConnector$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/MQTT_Connector.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/WS_Server.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/WebsocketConnector.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/Interface_PS.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/connectors/RestConnectorRestletResource.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/middleware/WS_Server.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/BindingComponent.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/StandaloneMain.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/App.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$3.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$4.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$5.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$6.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$7.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI$8.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/gui/LSB_GUI.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/lsb/StandaloneMain$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GLog.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GuiLogger$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GuiLogger$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GuiLogger$3.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GuiLogger$4.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/UpdateGUI_Listener.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/Logger.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/JavaLogger.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/classes/fr/inria/arles/logging/GuiLogger.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB/target/maven-archiver/pom.properties
New file
0,0 → 1,5
#Generated by Maven
#Tue Jul 29 09:34:47 CEST 2014
version=0.0.1
groupId=fr.inria.arles.lsb
artifactId=lsb_main
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_PS.java
1,17 → 1,22
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* 14, 2013 Status: Description:
* *****************************************************************
* Test_PS.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Nov 14, 2013
*
* This test is to run a PS to PS demo.
* In detail: A subscriber subscribes to a broker and then publishes a number of
* messages. The broker receives the messages and forwards them to the respective
* subscribers, in which the initial subscriber is included. Thus, the latter will
* receive back its own messages.
*
* A binding component is attached to the subscriber and a second binding component
* is attached to the broker service.
*/
package fr.arles.inria.lsb;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.MQTT_Connector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.util.Properties;
import junit.framework.Assert;
46,18 → 51,19
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("tcp://127.0.0.1", 8061, fr.inria.arles.lsb.commons.Constants.PS,
LsbConfig app1Config = new LsbConfig("tcp://127.0.0.1", 8061, fr.inria.arles.lsb.commons.Constants.PS,
MQTT_Connector.class, "tcp://127.0.0.1", 1884,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8092,
ServiceBusRestletResource.class);
Semantics app2Semantics = new Semantics("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8092);
LsbConfig app2Config = new LsbConfig("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
MQTT_Connector.class, "tcp://127.0.0.1", 1984,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091,
ServiceBusRestletResource2.class);
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
bcApp1.startUp();
bcApp2.startUp();
 
}
 
public void startDestinationBroker(int port) throws IOException {
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_CS.java
8,14 → 8,11
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.connectors.RestConnector;
import fr.inria.arles.lsb.connectors.RestConnectorRestletResource;
import fr.inria.arles.lsb.connectors.RestConnectorRestletResource2;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import fr.inria.arles.lsb.commons.LsbConfig;
import java.io.IOException;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.junit.After;
import org.junit.Before;
44,9 → 41,11
 
private Server _server = null;
private Component _component;
private Semantics app1Semantics;
private Semantics app2Semantics;
private LsbConfig app1Config;
private LsbConfig app2Config;
 
private ScheduledThreadPoolExecutor executor;
 
@Before
public void setUp() throws Exception {
GLog.initLogger();
59,39 → 58,46
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
app1Semantics = new Semantics("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.CS,
RestConnector.class,
"http://127.0.0.1", 8071,
"http://127.0.0.1", 8091,
"http://127.0.0.1", 8092,
ServiceBusRestletResource.class,
RestConnectorRestletResource.class);
app2Semantics = new Semantics("http://127.0.0.1", 8062,
fr.inria.arles.lsb.commons.Constants.CS,
RestConnector.class,
"http://127.0.0.1", 8072,
"http://127.0.0.1", 8092,
"http://127.0.0.1", 8091,
ServiceBusRestletResource2.class,
RestConnectorRestletResource2.class);
app1Config = new LsbConfig("config/config_CS_1.json");
app2Config = new LsbConfig("config/config_CS_2.json");
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
executor = new ScheduledThreadPoolExecutor(4);
executor.schedule(new Runnable() {
@Override
public void run() {
bcApp1 = new BindingComponent(app1Config);
bcApp1.startUp();
}
}, 0, TimeUnit.MILLISECONDS);
 
executor.schedule(new Runnable() {
@Override
public void run() {
bcApp2 = new BindingComponent(app2Config);
bcApp2.startUp();
}
}, 10, TimeUnit.MILLISECONDS);
 
startDestinationServer();
}
 
@After
public void tearDown() throws Exception {
bcApp1.shutDown();
bcApp2.shutDown();
 
stopDestinationServer();
executor.schedule(new Runnable() {
@Override
public void run() {
bcApp1.shutDown();
bcApp2.shutDown();
 
stopDestinationServer();
}
}, 1, TimeUnit.SECONDS);
 
}
 
public void startDestinationServer() {
_server = new Server(Protocol.HTTP, app2Semantics.get_servicePort());
_server = new Server(Protocol.HTTP, app2Config.get_servicePort());
 
try {
if (!_server.isStarted()) {
103,7 → 109,7
} catch (Exception e) {
GLog.log.e(TAG, e.getMessage() + " - Server Started Exception");
}
GLog.log.d(TAG, "Rest CONNECTOR Server started");
GLog.log.d(TAG, "Destination server: Rest CONNECTOR Server started");
}
 
public void stopDestinationServer() {
218,10 → 224,6
/* Consider a successful run if the response is 200 */
GLog.log.d(TAG, "Response: " + response.getEntityAsText() + " Status: "
+ response.getStatus().getCode());
if (response.getStatus().getCode() == 200) {
return true;
} else {
return false;
}
return response.getStatus().getCode() == 200;
}
}
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_CS_PS.java
8,11 → 8,9
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.MQTT_Connector;
import fr.inria.arles.lsb.connectors.RestConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.util.Properties;
import junit.framework.Assert;
52,17 → 50,15
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("http://127.0.0.1", 8061, fr.inria.arles.lsb.commons.Constants.CS,
LsbConfig app1Config = new LsbConfig("http://127.0.0.1", 8061, fr.inria.arles.lsb.commons.Constants.CS,
RestConnector.class, "http://127.0.0.1", 8071,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8191,
ServiceBusRestletResource.class);
Semantics app2Semantics = new Semantics("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8191);
LsbConfig app2Config = new LsbConfig("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
MQTT_Connector.class, "tcp://127.0.0.1", 1984,
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091,
ServiceBusRestletResource2.class);
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
}
 
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_CS_PS_NoBroker.java
New file
0,0 → 1,149
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* 14, 2013 Status: Description:
* *****************************************************************
*/
package fr.arles.inria.lsb;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.LsbConfig;
import junit.framework.Assert;
import org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging;
import org.dna.mqtt.moquette.server.ServerAcceptor;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.restlet.Client;
import org.restlet.Request;
import org.restlet.data.Form;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
 
public class Test_CS_PS_NoBroker {
 
private static String TAG = "CS to Pub/Sub test";
BindingComponent bcApp1;
BindingComponent bcApp2;
 
ServerAcceptor m_acceptor;
SimpleMessaging messaging;
 
@Before
public void setUp() throws Exception {
GLog.initLogger();
 
/*
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
LsbConfig app1Config = new LsbConfig("semantics_CS_1.json");
LsbConfig app2Config = new LsbConfig("semantics_PS_2.json");
 
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
bcApp1.startUp();
bcApp2.startUp();
}
 
 
@After
public void tearDown() throws Exception {
bcApp1.shutDown();
bcApp2.shutDown();
}
 
@Test
public void test() throws InterruptedException {
try {
Assert.assertEquals(true, subscribe());
} catch (InterruptedException e) {
GLog.log.e(TAG, e.getMessage());
}
}
 
private boolean subscribe() throws InterruptedException {
 
try {
MqttClient ps_client = new MqttClient("tcp://127.0.0.1:1984", "CLIENT-1");
ps_client.connect();
ps_client.subscribe("/writea");
ps_client.subscribe("/writeb");
ClientCallback_CS_PS_NoBroker cbk = new ClientCallback_CS_PS_NoBroker(ps_client);
ps_client.setCallback(cbk);
 
/*
* CS client will send a message here
*/
Form form = new Form();
form.add("name", "Giorgos");
Request request = new Request(Method.POST,
"http://127.0.0.1:8071/write",
form.getWebRepresentation());
 
Client cs_client = new Client(Protocol.HTTP);
 
cs_client.handle(request);
 
try {
cs_client.stop();
} catch (Exception e) {
GLog.log.e(TAG, e.getMessage());
}
 
Thread.sleep(15000);
ps_client.unsubscribe("/writea");
ps_client.unsubscribe("/writeb");
ps_client.disconnect();
ps_client.close();
} catch (MqttException e) {
GLog.log.e(TAG, e.getMessage());
}
 
return true;
}
 
}
 
class ClientCallback_CS_PS_NoBroker implements MqttCallback {
 
private MqttClient client = null;
private int numberOfMessages = 0;
 
public ClientCallback_CS_PS_NoBroker(MqttClient client) {
this.client = client;
}
 
public void connectionLost(Throwable cause) {
// TODO Auto-generated method stub
 
}
 
public void messageArrived(String topic, MqttMessage message)
throws Exception {
GLog.log.i("MQTT Client", "====>Message arrived --> Topic: " + topic
+ " Message: " + new String(message.getPayload(), "UTF-8"));
this.numberOfMessages++;
 
}
 
public void deliveryComplete(IMqttDeliveryToken token) {
// TODO Auto-generated method stub
 
}
 
public int getNumberOfMessages() {
return numberOfMessages;
}
 
public void setNumberOfMessages(int numberOfMessages) {
this.numberOfMessages = numberOfMessages;
}
 
}
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_STR.java
8,10 → 8,8
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
42,19 → 40,17
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("http://127.0.0.1", 8061,
LsbConfig app1Config = new LsbConfig("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.STR,
WebsocketConnector.class, "http://127.0.0.1", 8887,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8092,
ServiceBusRestletResource.class);
Semantics app2Semantics = new Semantics("http://127.0.0.1", 7799,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8092);
LsbConfig app2Config = new LsbConfig("http://127.0.0.1", 7799,
fr.inria.arles.lsb.commons.Constants.STR,
WebsocketConnector.class, "http://127.0.0.1", 1984,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091,
ServiceBusRestletResource2.class);
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
try {
Connector_Address = new URI("http://localhost:8887");
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_PS_STR.java
8,11 → 8,9
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.MQTT_Connector;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
49,19 → 47,17
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("http://127.0.0.1", 8061,
LsbConfig app1Config = new LsbConfig("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.STR,
WebsocketConnector.class, "http://127.0.0.1", 8887,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8191,
ServiceBusRestletResource.class);
"http://127.0.0.1", 8091, "http://127.0.0.1", 8191);
 
Semantics app2Semantics = new Semantics("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
LsbConfig app2Config = new LsbConfig("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
MQTT_Connector.class, "tcp://127.0.0.1", 1984,
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091,
ServiceBusRestletResource2.class);
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
}
 
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_STR_PS.java
8,11 → 8,9
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.MQTT_Connector;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
51,19 → 49,17
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("http://127.0.0.1", 8061,
LsbConfig app1Config = new LsbConfig("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.STR,
WebsocketConnector.class, "http://127.0.0.1", 8887,
"http://127.0.0.1", 8091, "http://127.0.0.1", 8191,
ServiceBusRestletResource.class);
"http://127.0.0.1", 8091, "http://127.0.0.1", 8191);
 
Semantics app2Semantics = new Semantics("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
LsbConfig app2Config = new LsbConfig("tcp://127.0.0.1", 1886, fr.inria.arles.lsb.commons.Constants.PS,
MQTT_Connector.class, "tcp://127.0.0.1", 1984,
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091,
ServiceBusRestletResource2.class);
"http://127.0.0.1", 8191, "http://127.0.0.1", 8091);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
}
 
/trunk/LSB/src/test/java/fr/arles/inria/lsb/TestSourceServiceRestletResource.java
22,13 → 22,14
 
@Get
public String receiveGet() {
GLog.log.d(TAG, "Received GET in destination service Resource");
return "Successs";
}
 
@Post
public org.restlet.Response receivePost(Representation entity) {
try {
GLog.log.d(TAG, "Received POST in source: " + entity.getText());
GLog.log.d(TAG, "Received POST in destination service Resource: " + entity.getText());
} catch (IOException ex) {
Logger.getLogger(TestSourceServiceRestletResource.class.getName()).log(Level.SEVERE, null, ex);
}
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_CS_STR.java
8,11 → 8,9
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.RestConnector;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
47,8 → 45,8
private WsServerTest ws;
private Server _server = null;
private Component _component;
private Semantics app1Semantics;
private Semantics app2Semantics;
private LsbConfig app1Config;
private LsbConfig app2Config;
 
@Before
public void setUp() throws Exception {
58,19 → 56,18
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
app1Semantics = new Semantics("http://127.0.0.1", 8061,
app1Config = new LsbConfig("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.CS,
RestConnector.class, "http://127.0.0.1", 8887,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091,
ServiceBusRestletResource.class);
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091);
 
app2Semantics = new Semantics("http://127.0.0.1", 7799,
app2Config = new LsbConfig("http://127.0.0.1", 7799,
fr.inria.arles.lsb.commons.Constants.STR, WebsocketConnector.class,
"http://127.0.0.1", 8072, "http://127.0.0.1", 8091,
"http://127.0.0.1", 8092, ServiceBusRestletResource2.class);
"http://127.0.0.1", 8092);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
//Start source & destination services here
startSourceServiceRestletServer();
78,7 → 75,7
}
 
public void startSourceServiceRestletServer() {
_server = new Server(Protocol.HTTP, app1Semantics.get_servicePort());
_server = new Server(Protocol.HTTP, app1Config.get_servicePort());
 
try {
if (!_server.isStarted()) {
106,7 → 103,7
 
public void startDestinationService() {
//START destination websocket server here
ws = new WsServerTest(new InetSocketAddress(app2Semantics.get_servicePort()));
ws = new WsServerTest(new InetSocketAddress(app2Config.get_servicePort()));
ws.start();
}
 
139,7 → 136,7
 
public boolean sendGetAsyncRequest() throws InterruptedException {
Request request;
request = new Request(Method.GET, app1Semantics.get_connectorAddress() + ":" + app1Semantics.get_connectorPort());
request = new Request(Method.GET, app1Config.get_connectorAddress() + ":" + app1Config.get_connectorPort());
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs.get(HeaderConstants.ATTRIBUTE_HEADERS);
152,7 → 149,7
headers = prev;
}
}
headers.add("callbackURL", String.valueOf(app1Semantics.get_busAddress() + ":" + app1Semantics.get_busPort()));
headers.add("callbackURL", String.valueOf(app1Config.get_busAddress() + ":" + app1Config.get_busPort()));
Client client = new Client(Protocol.HTTP);
Response response = client.handle(request);
try {
/trunk/LSB/src/test/java/fr/arles/inria/lsb/Test_STR_CS.java
1,33 → 1,26
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
Status:
Description:
*******************************************************************/
 
package fr.arles.inria.lsb;
 
import java.io.IOException;
import java.net.InetSocketAddress;
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.RestConnector;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import java.net.URI;
import java.net.URISyntaxException;
 
import junit.framework.Assert;
 
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.connectors.RestConnector;
import fr.inria.arles.lsb.connectors.WebsocketConnector;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource;
import fr.inria.arles.lsb.converters.ServiceBusRestletResource2;
 
public class Test_STR_CS {
 
private static String TAG = "STR - CS test";
47,19 → 40,18
* Initiate the 2 binding components needed for the Test One for App. 1
* and one for App. 2
*/
Semantics app1Semantics = new Semantics("http://127.0.0.1", 8061,
LsbConfig app1Config = new LsbConfig("http://127.0.0.1", 8061,
fr.inria.arles.lsb.commons.Constants.STR,
WebsocketConnector.class, "http://127.0.0.1", 8887,
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091,
ServiceBusRestletResource.class);
"http://127.0.0.1", 8092, "http://127.0.0.1", 8091);
 
Semantics app2Semantics = new Semantics("http://127.0.0.1", 8062,
LsbConfig app2Config = new LsbConfig("http://127.0.0.1", 8062,
fr.inria.arles.lsb.commons.Constants.CS, RestConnector.class,
"http://127.0.0.1", 8072, "http://127.0.0.1", 8091,
"http://127.0.0.1", 8092, ServiceBusRestletResource2.class);
"http://127.0.0.1", 8092);
 
bcApp1 = new BindingComponent(app1Semantics);
bcApp2 = new BindingComponent(app2Semantics);
bcApp1 = new BindingComponent(app1Config);
bcApp2 = new BindingComponent(app2Config);
 
try {
Connector_Address = new URI("http://127.0.0.1:8887");
/trunk/LSB/src/main/java/fr/inria/arles/lsb/App.java
1,42 → 1,39
/**
* App.java
* Copyright(c) 2014 Georgios Mathioudakis (mathioudakis.giorgos@gmail.com)
* Created on Apr 1, 2014
*/
 
* App.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 1, 2014
*/
package fr.inria.arles.lsb;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class App {
 
private static final String TAG = "Main Class";
 
public static void main(String[] args) {
GLog.initLogger();
String jsonFileSemantics;
String jsonFileConfig;
 
if (args.length == 1) {
jsonFileSemantics = args[0];
jsonFileConfig = args[0];
} else {
GLog.log.e(TAG, "Wrong number of arguments");
return;
}
 
Semantics serviceSemantics = new Semantics(jsonFileSemantics);
LsbConfig config = new LsbConfig(jsonFileConfig);
 
BindingComponent bcApp;
bcApp = new BindingComponent(serviceSemantics);
bcApp = new BindingComponent(config);
bcApp.startUp();
System.out.println("Press Enter to stop listening...");
 
System.out.println("Press Enter to Shutdown the binding component...");
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
GLog.log.d(TAG, "EXIT");
}
 
bcApp.shutDown();
45,9 → 42,7
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
GLog.log.d(TAG, "EXIT");
}
 
System.exit(0);
}
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/gui/LSB_GUI.form
New file
0,0 → 1,299
<?xml version="1.0" encoding="UTF-8" ?>
 
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="menuBar">
<SubComponents>
<Menu class="javax.swing.JMenu" name="fileMenu">
<Properties>
<Property name="mnemonic" type="int" value="102"/>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="openMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="111"/>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="115"/>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveAsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="Save As ..."/>
<Property name="displayedMnemonicIndex" type="int" value="5"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="120"/>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitMenuItemActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
<Properties>
<Property name="mnemonic" type="int" value="104"/>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="aboutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="About"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="LSB - Binding Component"/>
<Property name="location" type="java.awt.Point" editor="org.netbeans.beaninfo.editors.PointEditor">
<Point value="[20, 40]"/>
</Property>
<Property name="name" type="java.lang.String" value="lsb_main_frame" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="_SP_Log" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="_JP_Status" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="_JP_Config" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="_JP_Status" max="32767" attributes="0"/>
<Component id="_JP_Config" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="_SP_Log" pref="309" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_JP_Status">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Status"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="_BT_bcEnable" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_bcDisable" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_LB_bcStatus" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_LB_bcStatus" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_BT_bcEnable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_BT_bcDisable" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Binding Component:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="_LB_bcStatus">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="13" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="Disabled"/>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="_BT_bcEnable">
<Properties>
<Property name="text" type="java.lang.String" value="Enable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_bcEnableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="_BT_bcDisable">
<Properties>
<Property name="text" type="java.lang.String" value="Disable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_bcDisableActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="_SP_Log">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
 
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="_TP_log">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Logging"/>
</Border>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="_JP_Config">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Configuration"/>
</Border>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Configuration"/>
<Property name="name" type="java.lang.String" value="config" noResource="true"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Config"/>
</AccessibilityProperties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_TA_configFile" pref="559" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="_BT_configPicker" min="-2" pref="136" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TB_OpenFile" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_TA_configFile" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_BT_configPicker" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_TB_OpenFile" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="_BT_configPicker">
<Properties>
<Property name="text" type="java.lang.String" value="Select file"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_configPickerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="_TA_configFile">
<Properties>
<Property name="toolTipText" type="java.lang.String" value="Config file"/>
</Properties>
<Events>
<EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="_TA_configFilePropertyChange"/>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="_TA_configFileKeyTyped"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="_TB_OpenFile">
<Properties>
<Property name="text" type="java.lang.String" value="Open selected file"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_TB_OpenFileActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
/trunk/LSB/src/main/java/fr/inria/arles/lsb/gui/LSB_GUI.java
New file
0,0 → 1,428
/*
* 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 fr.inria.arles.lsb.gui;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.logging.UpdateGUI_Listener;
import fr.inria.arles.lsb.BindingComponent;
import fr.inria.arles.lsb.commons.LsbConfig;
import java.awt.Color;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
 
/**
*
* @author mathioud
*/
public class LSB_GUI extends javax.swing.JFrame implements UpdateGUI_Listener {
 
BindingComponent bcApp;
 
/**
* Creates new form LSB_GUI
*/
public LSB_GUI() {
initComponents();
GLog.initLogger(this);
File f;
try {
f = new File(new File(".").getCanonicalPath());
_TA_configFile.setText(f.getCanonicalPath() + "/config/config_CS_1.json");
} catch (IOException ex) {
Logger.getLogger(LSB_GUI.class.getName()).log(Level.SEVERE, null, ex);
}
_TP_log.setEditable(false);
}
 
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
 
_JP_Status = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
_LB_bcStatus = new javax.swing.JLabel();
_BT_bcEnable = new javax.swing.JButton();
_BT_bcDisable = new javax.swing.JButton();
_SP_Log = new javax.swing.JScrollPane();
_TP_log = new javax.swing.JTextPane();
_JP_Config = new javax.swing.JPanel();
_BT_configPicker = new javax.swing.JButton();
_TA_configFile = new javax.swing.JTextField();
_TB_OpenFile = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
openMenuItem = new javax.swing.JMenuItem();
saveMenuItem = new javax.swing.JMenuItem();
saveAsMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
aboutMenuItem = new javax.swing.JMenuItem();
 
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("LSB - Binding Component");
setLocation(new java.awt.Point(20, 40));
setName("lsb_main_frame"); // NOI18N
 
_JP_Status.setBorder(javax.swing.BorderFactory.createTitledBorder("Status"));
 
jLabel1.setText("Binding Component:");
 
_LB_bcStatus.setBackground(java.awt.Color.red);
_LB_bcStatus.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
_LB_bcStatus.setForeground(new java.awt.Color(255, 255, 255));
_LB_bcStatus.setText("Disabled");
_LB_bcStatus.setOpaque(true);
 
_BT_bcEnable.setText("Enable");
_BT_bcEnable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_bcEnableActionPerformed(evt);
}
});
 
_BT_bcDisable.setText("Disable");
_BT_bcDisable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_bcDisableActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _JP_StatusLayout = new javax.swing.GroupLayout(_JP_Status);
_JP_Status.setLayout(_JP_StatusLayout);
_JP_StatusLayout.setHorizontalGroup(
_JP_StatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_JP_StatusLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_JP_StatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, _JP_StatusLayout.createSequentialGroup()
.addComponent(_BT_bcEnable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_bcDisable))
.addGroup(_JP_StatusLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_LB_bcStatus)))
.addContainerGap(30, Short.MAX_VALUE))
);
_JP_StatusLayout.setVerticalGroup(
_JP_StatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_JP_StatusLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_JP_StatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(_LB_bcStatus))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(_JP_StatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_BT_bcEnable)
.addComponent(_BT_bcDisable))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
_TP_log.setBorder(javax.swing.BorderFactory.createTitledBorder("Logging"));
_SP_Log.setViewportView(_TP_log);
 
_JP_Config.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
_JP_Config.setToolTipText("Configuration");
_JP_Config.setName("config"); // NOI18N
 
_BT_configPicker.setText("Select file");
_BT_configPicker.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_configPickerActionPerformed(evt);
}
});
 
_TA_configFile.setToolTipText("Config file");
_TA_configFile.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
_TA_configFilePropertyChange(evt);
}
});
_TA_configFile.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
_TA_configFileKeyTyped(evt);
}
});
 
_TB_OpenFile.setText("Open selected file");
_TB_OpenFile.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_TB_OpenFileActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _JP_ConfigLayout = new javax.swing.GroupLayout(_JP_Config);
_JP_Config.setLayout(_JP_ConfigLayout);
_JP_ConfigLayout.setHorizontalGroup(
_JP_ConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_JP_ConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_JP_ConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_TA_configFile, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _JP_ConfigLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(_BT_configPicker, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TB_OpenFile)))
.addContainerGap())
);
_JP_ConfigLayout.setVerticalGroup(
_JP_ConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_JP_ConfigLayout.createSequentialGroup()
.addContainerGap()
.addComponent(_TA_configFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_JP_ConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_BT_configPicker)
.addComponent(_TB_OpenFile))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
fileMenu.setMnemonic('f');
fileMenu.setText("File");
 
openMenuItem.setMnemonic('o');
openMenuItem.setText("Open");
fileMenu.add(openMenuItem);
 
saveMenuItem.setMnemonic('s');
saveMenuItem.setText("Save");
fileMenu.add(saveMenuItem);
 
saveAsMenuItem.setMnemonic('a');
saveAsMenuItem.setText("Save As ...");
saveAsMenuItem.setDisplayedMnemonicIndex(5);
fileMenu.add(saveAsMenuItem);
 
exitMenuItem.setMnemonic('x');
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
}
});
fileMenu.add(exitMenuItem);
 
menuBar.add(fileMenu);
 
helpMenu.setMnemonic('h');
helpMenu.setText("Help");
 
aboutMenuItem.setMnemonic('a');
aboutMenuItem.setText("About");
helpMenu.add(aboutMenuItem);
 
menuBar.add(helpMenu);
 
setJMenuBar(menuBar);
 
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_SP_Log)
.addGroup(layout.createSequentialGroup()
.addComponent(_JP_Status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(_JP_Config, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(_JP_Status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_JP_Config, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(_SP_Log, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE)
.addContainerGap())
);
 
_JP_Config.getAccessibleContext().setAccessibleName("Config");
 
pack();
}// </editor-fold>//GEN-END:initComponents
 
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
stopBC();
System.exit(0);
}//GEN-LAST:event_exitMenuItemActionPerformed
 
private void _BT_bcEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_bcEnableActionPerformed
startBC();
}//GEN-LAST:event__BT_bcEnableActionPerformed
 
private void _BT_bcDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_bcDisableActionPerformed
stopBC();
}//GEN-LAST:event__BT_bcDisableActionPerformed
 
@Override
public void writeToLog(String type, String tag, String message) {
SimpleAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setForeground(keyWord, Color.WHITE);
 
if(type.equals("e"))
StyleConstants.setBackground(keyWord, Color.RED);
else if(type.equals("d"))
StyleConstants.setBackground(keyWord, Color.BLUE);
else if(type.equals("i"))
StyleConstants.setBackground(keyWord, Color.GREEN);
else
StyleConstants.setBackground(keyWord, Color.BLUE);
 
StyleConstants.setBold(keyWord, true);
 
StyledDocument document = (StyledDocument) _TP_log.getDocument();
try {
document.insertString(document.getLength(), "[" + tag + "]", keyWord);
document.insertString(document.getLength(), " - " + message + "\n", null);
} catch (BadLocationException ex) {
Logger.getLogger(LSB_GUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
 
private void stopBC() {
if (bcApp.isEnabled() == false) {
return;
}
 
bcApp.shutDown();
_LB_bcStatus.setText("Disabled");
_LB_bcStatus.setBackground(Color.red);
_LB_bcStatus.setForeground(Color.white);
}
 
private void startBC() {
if (_TA_configFile.getText().length() == 0) {
return;
}
 
LsbConfig serviceSemantics = new LsbConfig(_TA_configFile.getText());
bcApp = new BindingComponent(serviceSemantics);
boolean startStatus = bcApp.startUp();
if (startStatus == true) {
_LB_bcStatus.setText("Enabled");
_LB_bcStatus.setBackground(Color.green);
_LB_bcStatus.setForeground(Color.black);
}
}
private void _BT_configPickerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_configPickerActionPerformed
final JFileChooser fc = new JFileChooser();
File f = null;
try {
f = new File(new File(".").getCanonicalPath() + "/config");
} catch (IOException ex) {
Logger.getLogger(LSB_GUI.class.getName()).log(Level.SEVERE, null, ex);
}
fc.setCurrentDirectory(f);
fc.showOpenDialog(this);
if (fc.getSelectedFile().getName() != null) {
try {
_TA_configFile.setText(fc.getSelectedFile().getCanonicalPath());
} catch (IOException ex) {
Logger.getLogger(LSB_GUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event__BT_configPickerActionPerformed
 
private void _TA_configFilePropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event__TA_configFilePropertyChange
 
}//GEN-LAST:event__TA_configFilePropertyChange
 
private void _TA_configFileKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event__TA_configFileKeyTyped
if (_TA_configFile.getText().length() == 0) {
_TB_OpenFile.setEnabled(false);
} else {
_TB_OpenFile.setEnabled(true);
}
}//GEN-LAST:event__TA_configFileKeyTyped
 
private void _TB_OpenFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__TB_OpenFileActionPerformed
if (_TA_configFile.getText().length() != 0) {
File f = new File(_TA_configFile.getText());
try {
Desktop.getDesktop().open(f);
} catch (IOException ex) {
Logger.getLogger(LSB_GUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event__TB_OpenFileActionPerformed
 
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LSB_GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LSB_GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LSB_GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LSB_GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
 
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LSB_GUI().setVisible(true);
}
});
}
 
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton _BT_bcDisable;
private javax.swing.JButton _BT_bcEnable;
private javax.swing.JButton _BT_configPicker;
private javax.swing.JPanel _JP_Config;
private javax.swing.JPanel _JP_Status;
private javax.swing.JLabel _LB_bcStatus;
private javax.swing.JScrollPane _SP_Log;
private javax.swing.JTextField _TA_configFile;
private javax.swing.JButton _TB_OpenFile;
private javax.swing.JTextPane _TP_log;
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenu helpMenu;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem openMenuItem;
private javax.swing.JMenuItem saveAsMenuItem;
private javax.swing.JMenuItem saveMenuItem;
// End of variables declaration//GEN-END:variables
 
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/ConverterCS_GA.java
6,23 → 6,23
*/
package fr.inria.arles.lsb.converters;
 
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.connectors.Interface_CS;
import fr.inria.arles.lsb.connectors.LsbConnector;
 
public class ConverterCS_GA extends ConverterParadigm_GA {
 
private String TAG = "Converter CS-GA";
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private GA_Bus _GA_Bus;
private Interface_CS _connectorRef;
 
public ConverterCS_GA(Semantics _serviceSemantics, LsbConnector _connectorRef) {
public ConverterCS_GA(LsbConfig _serviceConfig, LsbConnector _connectorRef) {
super();
this._serviceSemantics = _serviceSemantics;
_GA_Bus = new GA_Bus(_serviceSemantics, this);
this._serviceConfig = _serviceConfig;
_GA_Bus = new GA_Bus(_serviceConfig, this);
this._connectorRef = (Interface_CS) _connectorRef;
}
 
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/ServiceBusRestletResource.java
35,6 → 35,7
 
/**
* Receives a Get request
* @return
*/
@Get
public org.restlet.Response receiveGet() {
76,12 → 77,14
org.restlet.Response restletResponse = getResponse();
 
if (callback == null) {
GLog.log.d(TAG, busRef.toString() + " receiveGet_sync");
Response resp = busRef.receiveGet_sync(message);
restletResponse.setStatus(resp.get_respStatus());
restletResponse.setEntity(new StringRepresentation(resp
.getDataString()));
return restletResponse;
} else {
GLog.log.d(TAG, busRef.toString() + " receiveGet_async");
restletResponse.setStatus(Status.SUCCESS_ACCEPTED);
busRef.receiveGet_async(message, callback);
return restletResponse;
93,6 → 96,7
* Receives a Post request
*
* @param entity Describes the contents of the HTTP post request
* @return
*/
@Post
public org.restlet.Response receivePost(Representation entity) {
136,7 → 140,6
/**
* Receives a Delete request
*
* @param entity Describes the contents of the HTTP post request
*/
@Delete
public void receiveDelete() {
153,7 → 156,11
 
}
 
public static void setBusRef(GA_Bus bus) {
busRef = bus;
public static void setBusRef(GA_Bus bus) throws Exception{
GLog.log.d("Set Bus ref: ", bus.toString());
if(busRef == null)
busRef = bus;
else
throw new Exception();
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/ConverterSTR_GA.java
6,9 → 6,9
*/
package fr.inria.arles.lsb.converters;
 
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.connectors.Interface_STR;
import fr.inria.arles.lsb.connectors.LsbConnector;
 
18,10 → 18,10
private GA_Bus _GA_Bus;
private Interface_STR _connectorRef;
 
public ConverterSTR_GA(Semantics _serviceSemantics,
public ConverterSTR_GA(LsbConfig _serviceConfig,
LsbConnector _connectorRef) {
super();
_GA_Bus = new GA_Bus(_serviceSemantics, this);
_GA_Bus = new GA_Bus(_serviceConfig, this);
this._connectorRef = null;
this._connectorRef = (Interface_STR) _connectorRef;
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/GA_Bus_API.java
New file
0,0 → 1,172
/**
* GA_Bus_API.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Jul 25, 2014
*/
package fr.inria.arles.lsb.converters;
 
import fr.inria.arles.lsb.commons.Message;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.restlet.Client;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.engine.header.Header;
import org.restlet.engine.header.HeaderConstants;
import org.restlet.representation.StringRepresentation;
import org.restlet.util.Series;
 
public class GA_Bus_API {
 
/**
* Transform and send through service bus (Common protocol)
*
* @param msg LSB message
* @return
*/
public fr.inria.arles.lsb.commons.Response post(Message msg) {
 
//Test for adding mediator
Request request;
Client client = new Client(Protocol.HTTP);
 
if (!msg.get_mediatorAddress().equals("")) {
request = new Request(Method.POST, msg.get_mediatorAddress() + ":" + msg.get_mediatorPort(),
new StringRepresentation(msg.serializeToJson().toString()));
} else {
request = new Request(Method.POST, msg.get_destination() + ":" + msg.get_destinationPort(),
new StringRepresentation(msg.serializeToJson().toString()));
}
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs
.get(HeaderConstants.ATTRIBUTE_HEADERS);
 
if (headers == null) {
headers = new Series<Header>(Header.class);
Series<Header> prev = (Series<Header>) attrs.putIfAbsent(
HeaderConstants.ATTRIBUTE_HEADERS, headers);
if (prev != null) {
headers = prev;
}
}
headers.add("connectionTimeout", String.valueOf(msg.get_timeout()));
 
Context context = new Context();
context.getParameters().add("socketTimeout",
String.valueOf(msg.get_timeout()));
context.getParameters().add("readTimeout",
String.valueOf(msg.get_timeout()));
 
Response response = client.handle(request);
 
/*
* Transform response from bus TO lsb response
*/
fr.inria.arles.lsb.commons.Response lsbResponse = new fr.inria.arles.lsb.commons.Response(
response.getEntityAsText(), response.getStatus());
 
try {
client.stop();
} catch (Exception ex) {
Logger.getLogger(GA_Bus_API.class.getName()).log(Level.SEVERE, null, ex);
}
return lsbResponse;
}
 
/**
* Transform and send through service bus (Common protocol)
*
* @param msg LSB message
* @return
*/
public fr.inria.arles.lsb.commons.Response get_sync(Message msg) {
Request request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
Client client = new Client(Protocol.HTTP);
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs
.get(HeaderConstants.ATTRIBUTE_HEADERS);
 
if (headers == null) {
headers = new Series<Header>(Header.class);
Series<Header> prev = (Series<Header>) attrs.putIfAbsent(
HeaderConstants.ATTRIBUTE_HEADERS, headers);
if (prev != null) {
headers = prev;
}
}
headers.add("connectionTimeout", String.valueOf(msg.get_timeout()));
headers.add("message", msg.serializeToJson().toString());
 
Context context = new Context();
context.getParameters().add("socketTimeout",
String.valueOf(msg.get_timeout()));
context.getParameters().add("readTimeout",
String.valueOf(msg.get_timeout()));
 
Response response = client.handle(request);
 
/* Transform response from bus TO lsb response */
fr.inria.arles.lsb.commons.Response lsbResponse = new fr.inria.arles.lsb.commons.Response(response.getEntityAsText(), response.getStatus());
 
try {
client.stop();
} catch (Exception ex) {
Logger.getLogger(GA_Bus_API.class.getName()).log(Level.SEVERE, null, ex);
}
 
return lsbResponse;
}
 
/**
* Transform and send through service bus (Common protocol). We need an HTTP
* request (Webhooks) with a callback to the binding component Make a *
* normal http POST request and add an extra header for the callback
*
* @param msg LSB message
* @param callback
* @return
*/
//TODO: Make callback be dynamic, not a parameter
public fr.inria.arles.lsb.commons.Response get_async(Message msg, String callback) {
Request request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
Client client = new Client(Protocol.HTTP);
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs.get(HeaderConstants.ATTRIBUTE_HEADERS);
if (headers == null) {
headers = new Series<Header>(Header.class);
Series<Header> prev = (Series<Header>) attrs.putIfAbsent(HeaderConstants.ATTRIBUTE_HEADERS, headers);
if (prev != null) {
headers = prev;
}
}
headers.add("connectionTimeout", String.valueOf(msg.get_timeout()));
headers.add("callbackURL", callback);
headers.add("message", String.valueOf(new StringRepresentation(msg.serializeToJson().toString())));
Context context = new Context();
context.getParameters().add("socketTimeout", String.valueOf(msg.get_timeout()));
context.getParameters().add("readTimeout", String.valueOf(msg.get_timeout()));
 
Response response;
response = client.handle(request);
 
/*
* Transform response from bus TO lsb response
*/
fr.inria.arles.lsb.commons.Response lsbResponse = new fr.inria.arles.lsb.commons.Response(
response.getEntityAsText(), response.getStatus());
 
try {
client.stop();
} catch (Exception ex) {
Logger.getLogger(GA_Bus_API.class.getName()).log(Level.SEVERE, null, ex);
}
 
return lsbResponse;
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/GA_Bus.java
1,18 → 1,16
/**
* GA_Bus.java
* Copyright(c) 2014 Georgios Mathioudakis (mathioudakis.giorgos@gmail.com)
* Created on Nov 14, 2013
* GA_Bus.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Nov 14, 2013
*/
package fr.inria.arles.lsb.converters;
 
import com.eclipsesource.json.JsonObject;
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Message_CS;
import fr.inria.arles.lsb.commons.Message_PS;
import fr.inria.arles.lsb.commons.Message_STR;
import fr.inria.arles.lsb.commons.Semantics;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
import org.restlet.Client;
31,16 → 29,16
public class GA_Bus {
 
private String TAG = "GA_Bus";
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private Server _server = null;
private Component _component;
private ConverterParadigm_GA _converterP_GA;
private Client _client;
 
public GA_Bus(Semantics _serviceSemantics,
public GA_Bus(LsbConfig _serviceConfig,
ConverterParadigm_GA _converterP_GA) {
super();
this._serviceSemantics = _serviceSemantics;
this._serviceConfig = _serviceConfig;
this._converterP_GA = _converterP_GA;
org.restlet.engine.Engine.setLogLevel(Level.OFF);
startRESTLETServer();
55,9 → 53,18
*/
public fr.inria.arles.lsb.commons.Response post(Message msg) {
GLog.log.d(TAG, "post - Message: " + msg.toString());
Request request = new Request(Method.POST, msg.get_destination() + ":" + msg.get_destinationPort(),
new StringRepresentation(msg.serializeToJson().toString()));
 
//Test for adding mediator
Request request;
 
if (!msg.get_mediatorAddress().equals("")) {
request = new Request(Method.POST, msg.get_mediatorAddress() + ":" + msg.get_mediatorPort(),
new StringRepresentation(msg.serializeToJson().toString()));
} else {
request = new Request(Method.POST, msg.get_destination() + ":" + msg.get_destinationPort(),
new StringRepresentation(msg.serializeToJson().toString()));
}
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs
.get(HeaderConstants.ATTRIBUTE_HEADERS);
80,7 → 87,7
 
 
Response response = _client.handle(request);
GLog.log.d(TAG, "POST::: " + response.getStatus());
GLog.log.d(TAG, "POST: " + request + " Response: " + response.getStatus());
 
/*
* Transform response from bus TO lsb response
101,21 → 108,21
public fr.inria.arles.lsb.commons.Response receivePost(String msg) {
GLog.log.d(TAG, "receivePost - Message: " + msg);
Message pMsg = null;
if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
pMsg = new Message_CS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
 
return _converterP_GA.receiveSend(pMsg);
} else if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
} else if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
pMsg = new Message_PS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
 
if (pMsg.get_operation().equals(fr.inria.arles.lsb.commons.Constants.PUBLISH)) {
if (pMsg.get_operation().equals(fr.inria.arles.lsb.commons.Constants.PUBLISH) || pMsg.get_operation().equals(fr.inria.arles.lsb.commons.Constants.POST)) {
return _converterP_GA.receivePublish(pMsg);
} else if (pMsg.get_operation().equals(fr.inria.arles.lsb.commons.Constants.UNSUBSCRIBE)) {
return _converterP_GA.receiveUnsubscribe(pMsg);
}
} else if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.STR)) {
} else if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.STR)) {
pMsg = new Message_STR();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
 
142,8 → 149,13
*/
public fr.inria.arles.lsb.commons.Response get_sync(Message msg) {
GLog.log.d(TAG, "get_sync - Message: " + msg.toString());
Request request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
 
Request request = null;
if (!msg.get_mediatorAddress().equals("")) {
request = new Request(Method.GET, msg.get_mediatorAddress()+ ":" + msg.get_mediatorPort());
} else {
request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
}
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs
.get(HeaderConstants.ATTRIBUTE_HEADERS);
182,10 → 194,10
public fr.inria.arles.lsb.commons.Response receiveGet_sync(String msg) {
GLog.log.d(TAG, "receiveGet_sync - Message: " + msg);
Message pMsg = null;
if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
pMsg = new Message_CS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
} else if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
} else if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
pMsg = new Message_PS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
}
195,14 → 207,23
 
/**
* Transform and send through service bus (Common protocol). We need an HTTP
* request (Webhooks) with a callback to the binding component Make a * normal http POST request and add an extra header for the callback
* request (Webhooks) with a callback to the binding component Make a *
* normal http POST request and add an extra header for the callback
*
* @param msg LSB message
* @return
*/
public fr.inria.arles.lsb.commons.Response get_async(Message msg) {
GLog.log.d(TAG, "get_async - Message: " + msg);
Request request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
//Request request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
 
Request request;
if (!msg.get_mediatorAddress().equals("")) {
request = new Request(Method.GET, msg.get_mediatorAddress()+ ":" + msg.get_mediatorPort());
} else {
request = new Request(Method.GET, msg.get_destination() + ":" + msg.get_destinationPort());
}
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs.get(HeaderConstants.ATTRIBUTE_HEADERS);
if (headers == null) {
213,7 → 234,7
}
}
headers.add("connectionTimeout", String.valueOf(msg.get_timeout()));
headers.add("callbackURL", String.valueOf(this._serviceSemantics.get_busAddress() + ":" + this._serviceSemantics.get_busPort()));
headers.add("callbackURL", String.valueOf(this._serviceConfig.get_busAddress() + ":" + this._serviceConfig.get_busPort()));
headers.add("message", String.valueOf(new StringRepresentation(msg.serializeToJson().toString())));
Context context = new Context();
context.getParameters().add("socketTimeout", String.valueOf(msg.get_timeout()));
242,17 → 263,18
public fr.inria.arles.lsb.commons.Response receiveGet_async(String msg, String callback) {
GLog.log.d(TAG, "receiveGet_async - Message: " + msg);
Message pMsg;
if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.CS)) {
pMsg = new Message_CS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
pMsg.set_callback(callback);
return _converterP_GA.receiveInvoke_async(pMsg);
} else if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
fr.inria.arles.lsb.commons.Response rs = _converterP_GA.receiveInvoke_async(pMsg);
return rs;
} else if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.PS)) {
pMsg = new Message_PS();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
pMsg.set_callback(callback);
return _converterP_GA.receiveSubscribe(pMsg);
} else if (this._serviceSemantics.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.STR)) {
} else if (this._serviceConfig.getServiceParadigm().equals(fr.inria.arles.lsb.commons.Constants.STR)) {
pMsg = new Message_STR();
pMsg.deserializeFromJson(JsonObject.readFrom(msg));
pMsg.set_callback(callback);
282,32 → 304,22
 
private void startRESTLETServer() {
try {
java.lang.reflect.Method setBusRefMethod = _serviceSemantics.get_busRestletClass().getMethod("setBusRef", new Class[]{GA_Bus.class});
setBusRefMethod.invoke(getClass(), this);
} catch (NoSuchMethodException e1) {
System.out.println(e1.getMessage());
} catch (SecurityException e1) {
System.out.println(e1.getMessage());
} catch (IllegalAccessException e) {
System.out.println(e.getMessage());
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
} catch (InvocationTargetException e) {
System.out.println(e.getMessage());
ServiceBusRestletResource.setBusRef(this);
} catch (Exception ex) {
GLog.log.e(TAG, "Cannot initialize bus server resource");
return;
}
_server = new Server(Protocol.HTTP, _serviceSemantics.get_busPort());
_server = new Server(Protocol.HTTP, _serviceConfig.get_busPort());
GLog.log.d(
TAG,
"Bus server started at PORT: "
+ _serviceSemantics.get_busPort());
+ _serviceConfig.get_busPort());
 
Class restletClass = _serviceSemantics.get_busRestletClass();
try {
if (!_server.isStarted()) {
_component = new Component();
_component.getServers().add(_server);
_component.getDefaultHost().attach("/",
restletClass);
_component.getDefaultHost().attach("/", ServiceBusRestletResource.class);
_component.start();
}
} catch (Exception e) {
/trunk/LSB/src/main/java/fr/inria/arles/lsb/converters/ConverterPS_GA.java
7,24 → 7,24
package fr.inria.arles.lsb.converters;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Message_PS;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.connectors.Interface_PS;
import fr.inria.arles.lsb.connectors.LsbConnector;
 
public class ConverterPS_GA extends ConverterParadigm_GA {
 
private String TAG = "Converter PS-GA";
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private GA_Bus _GA_Bus;
private Interface_PS _connectorRef;
 
public ConverterPS_GA(Semantics _serviceSemantics, LsbConnector _connectorRef) {
public ConverterPS_GA(LsbConfig _serviceConfig, LsbConnector _connectorRef) {
super();
this._serviceSemantics = _serviceSemantics;
_GA_Bus = new GA_Bus(_serviceSemantics, this);
this._serviceConfig = _serviceConfig;
_GA_Bus = new GA_Bus(_serviceConfig, this);
this._connectorRef = (Interface_PS) _connectorRef;
}
 
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/Message.java
1,166 → 1,204
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
*******************************************************************/
 
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* 14, 2013 Status: Description:
* *****************************************************************
*/
package fr.inria.arles.lsb.commons;
 
import com.eclipsesource.json.JsonObject;
 
public class Message {
private String _destinationServiceAddress;
private int _destinationServicePort;
private String _sourceServiceAddress;
private int _sourceServicePort;
private String _operation;
private Object _data;
private int _timeout;
private String _callback;
private String _interactionParadigm;
 
/*
* Getters and Setters
*/
public String get_destination() {
return _destinationServiceAddress;
}
private String _destinationServiceAddress;
private int _destinationServicePort;
private String _sourceServiceAddress;
private int _sourceServicePort;
private String _operation;
private Object _data;
private int _timeout;
private String _callback;
private String _interactionParadigm;
private String _mediatorAddress;
private int _mediatorPort;
 
public void set_destination(String _destination) {
this._destinationServiceAddress = _destination;
}
/*
* Getters and Setters
*/
public String get_destination() {
return _destinationServiceAddress;
}
 
public String get_source() {
return _sourceServiceAddress;
}
public void set_destination(String _destination) {
this._destinationServiceAddress = _destination;
}
 
public void set_sourceServiceAddress(String _source) {
this._sourceServiceAddress = _source;
}
public String get_source() {
return _sourceServiceAddress;
}
 
public String get_operation() {
return _operation;
}
public void set_sourceServiceAddress(String _source) {
this._sourceServiceAddress = _source;
}
 
public void set_operation(String _operation) {
this._operation = _operation;
}
public String get_operation() {
return _operation;
}
 
public Object get_data() {
return _data;
}
public void set_operation(String _operation) {
this._operation = _operation;
}
 
public String get_data_string() {
return _data.toString();
}
public Object get_data() {
return _data;
}
 
public void set_data(String _data) {
this._data = _data;
}
public String get_data_string() {
return _data.toString();
}
 
public int get_timeout() {
return _timeout;
}
public void set_data(String _data) {
this._data = _data;
}
 
public void set_timeout(int _timeout) {
this._timeout = _timeout;
}
public int get_timeout() {
return _timeout;
}
 
public int get_destinationPort() {
return _destinationServicePort;
}
public void set_timeout(int _timeout) {
this._timeout = _timeout;
}
 
public void set_destinationPort(int _destinationPort) {
this._destinationServicePort = _destinationPort;
}
public int get_destinationPort() {
return _destinationServicePort;
}
 
public int get_sourceServicePort() {
return _sourceServicePort;
}
public void set_destinationPort(int _destinationPort) {
this._destinationServicePort = _destinationPort;
}
 
public void set_sourceServicePort(int _sourceServicePort) {
this._sourceServicePort = _sourceServicePort;
}
public int get_sourceServicePort() {
return _sourceServicePort;
}
 
/**
* @param _destinationAddress
* @param _destinationPort
* @param _source
* @param _operation
* @param _data
* @param _timeout
*/
public Message(String _destinationAddress, int _destinationPort,
String _sourceServiceAddress, int _sourceServicePort,
String _operation, Object _data, int _timeout,
String _interactionParadigm) {
super();
this._destinationServiceAddress = _destinationAddress;
this._destinationServicePort = _destinationPort;
this._sourceServiceAddress = _sourceServiceAddress;
this._sourceServicePort = _sourceServicePort;
this._operation = _operation;
this._data = _data;
this._timeout = _timeout;
this._interactionParadigm = _interactionParadigm;
}
public void set_sourceServicePort(int _sourceServicePort) {
this._sourceServicePort = _sourceServicePort;
}
 
public Message() {
super();
}
public String get_callback() {
return _callback;
}
 
@Override
public String toString() {
return "Message [_destinationServiceAddress="
+ _destinationServiceAddress + ", _destinationServicePort="
+ _destinationServicePort + ", _sourceServiceAddress="
+ _sourceServiceAddress + ", _sourceServicePort="
+ _sourceServicePort + ", _operation=" + _operation
+ ", _data=" + _data + ", _timeout=" + _timeout
+ ", _interactionParadigm=" + _interactionParadigm + "]";
}
public void set_callback(String _callback) {
this._callback = _callback;
}
 
public JsonObject serializeToJson() {
JsonObject jsonObject = new JsonObject()
.add("_destinationServiceAddress", this.get_destination())
.add("_destinationServicePort", this.get_destinationPort())
.add("_sourceServiceAddress", this.get_source())
.add("_sourceServicePort", this.get_sourceServicePort())
.add("_operation", this.get_operation())
.add("_data", this.get_data_string())
.add("_timeout", this.get_timeout())
.add("_interactionParadigm", this.get_interactionParadigm());
return jsonObject;
}
public String get_interactionParadigm() {
return _interactionParadigm;
}
 
public void deserializeFromJson(JsonObject object) {
this.set_destination(object.get("_destinationServiceAddress")
.asString());
this.set_destinationPort(object.get("_destinationServicePort").asInt());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress")
.asString());
this.set_sourceServicePort(object.get("_sourceServicePort").asInt());
this.set_operation(object.get("_operation").asString());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_interactionParadigm(object.get("_interactionParadigm")
.asString());
}
public void set_interactionParadigm(String _interactionParadigm) {
this._interactionParadigm = _interactionParadigm;
}
 
public String get_callback() {
return _callback;
}
/**
* @return the _mediatorAddress
*/
public String get_mediatorAddress() {
return _mediatorAddress;
}
 
public void set_callback(String _callback) {
this._callback = _callback;
}
/**
* @param _mediatorAddress the _mediatorAddress to set
*/
public void set_mediatorAddress(String _mediatorAddress) {
this._mediatorAddress = _mediatorAddress;
}
 
public String get_interactionParadigm() {
return _interactionParadigm;
}
/**
* @return the _mediatorPort
*/
public int get_mediatorPort() {
return _mediatorPort;
}
 
public void set_interactionParadigm(String _interactionParadigm) {
this._interactionParadigm = _interactionParadigm;
}
/**
* @param _mediatorPort the _mediatorPort to set
*/
public void set_mediatorPort(int _mediatorPort) {
this._mediatorPort = _mediatorPort;
}
 
/**
* @param _destinationAddress
* @param _destinationPort
* @param _sourceServiceAddress
* @param _sourceServicePort
* @param _operation
* @param _data
* @param _timeout
* @param _mediatorAddress
* @param _mediatorPort
* @param _interactionParadigm
*/
public Message(
String _destinationAddress,
int _destinationPort,
String _sourceServiceAddress,
int _sourceServicePort,
String _operation,
Object _data,
int _timeout,
String _mediatorAddress,
int _mediatorPort,
String _interactionParadigm) {
super();
this._destinationServiceAddress = _destinationAddress;
this._destinationServicePort = _destinationPort;
this._sourceServiceAddress = _sourceServiceAddress;
this._sourceServicePort = _sourceServicePort;
this._operation = _operation;
this._data = _data;
this._timeout = _timeout;
this._mediatorAddress = _mediatorAddress;
this._mediatorPort = _mediatorPort;
this._interactionParadigm = _interactionParadigm;
}
 
public Message() {
super();
}
 
@Override
public String toString() {
return serializeToJson().toString();
}
 
public JsonObject serializeToJson() {
JsonObject jsonObject = new JsonObject()
.add("_destinationServiceAddress", this.get_destination())
.add("_destinationServicePort", this.get_destinationPort())
.add("_sourceServiceAddress", this.get_source())
.add("_sourceServicePort", this.get_sourceServicePort())
.add("_operation", this.get_operation())
.add("_data", this.get_data_string())
.add("_timeout", this.get_timeout())
.add("_mediatorAddress", this.get_mediatorAddress())
.add("_mediatorPort", this.get_mediatorPort())
.add("_interactionParadigm", this.get_interactionParadigm());
return jsonObject;
}
 
public void deserializeFromJson(JsonObject object) {
this.set_destination(object.get("_destinationServiceAddress").asString());
this.set_destinationPort(object.get("_destinationServicePort").asInt());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress").asString());
this.set_sourceServicePort(object.get("_sourceServicePort").asInt());
this.set_operation(object.get("_operation").asString());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_mediatorAddress(object.get("_mediatorAddress").asString());
this.set_mediatorPort(object.get("_mediatorPort").asInt());
this.set_interactionParadigm(object.get("_interactionParadigm").asString());
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/LsbConfig.java
New file
0,0 → 1,220
/**
* Semantics.java
* Copyright(c) 2014 Georgios Mathioudakis (mathioudakis.giorgos@gmail.com)
* Created on Nov 14, 2013
*/
package fr.inria.arles.lsb.commons;
 
import com.eclipsesource.json.JsonObject;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class LsbConfig {
 
private String _serviceAddress;
private int _servicePort;
private String _serviceParadigm;
private Class<?> _connectorType;
private int _connectorPort;
private String _connectorAddress;
private String _busAddress;
private int _busPort;
private String _destinationAdress;
private int _destinationPort;
private String _mediatorAddress;
private int _mediatorPort;
 
public int get_servicePort() {
return _servicePort;
}
 
public void set_servicePort(int _servicePort) {
this._servicePort = _servicePort;
}
 
public String getServiceParadigm() {
return _serviceParadigm;
}
 
public void setServiceParadigm(String _serviceParadigm) {
this._serviceParadigm = _serviceParadigm;
}
 
public Class<?> get_connectorType() {
return _connectorType;
}
 
public void set_connectorType(Class<?> _connector) {
this._connectorType = _connector;
}
 
public String get_serviceAddress() {
return _serviceAddress;
}
 
public void set_serviceAddress(String _serviceAddress) {
this._serviceAddress = _serviceAddress;
}
 
public int get_connectorPort() {
return _connectorPort;
}
 
public void set_connectorPort(int _connectorPort) {
this._connectorPort = _connectorPort;
}
 
public String get_connectorAddress() {
return _connectorAddress;
}
 
public void set_connectorAddress(String _connectorAddress) {
this._connectorAddress = _connectorAddress;
}
 
public String get_busAddress() {
return _busAddress;
}
 
public void set_busAddress(String _busAddress) {
this._busAddress = _busAddress;
}
 
public int get_busPort() {
return _busPort;
}
 
public void set_busPort(int _busPort) {
this._busPort = _busPort;
}
 
public String get_destinationAdress() {
return _destinationAdress;
}
 
public void set_destinationAdress(String _destinationAdress) {
this._destinationAdress = _destinationAdress;
}
 
public int get_destinationPort() {
return _destinationPort;
}
 
public void set_destinationPort(int _destinationPort) {
this._destinationPort = _destinationPort;
}
 
/**
* @return the _mediatorAddress
*/
public String get_mediatorAddress() {
return _mediatorAddress;
}
 
/**
* @param _mediatorAddress the _mediatorAddress to set
*/
public void set_mediatorAddress(String _mediatorAddress) {
this._mediatorAddress = _mediatorAddress;
}
 
/**
* @return the _mediatorPort
*/
public int get_mediatorPort() {
return _mediatorPort;
}
 
/**
* @param _mediatorPort the _mediatorPort to set
*/
public void set_mediatorPort(int _mediatorPort) {
this._mediatorPort = _mediatorPort;
}
 
/**
*
* @param _serviceAddress
* @param _servicePort
* @param _serviceParadigm
* @param _connectorType
* @param _connectorAddress
* @param _connectorPort
* @param _busAddress
* @param _busPort
* @param _destinationAdress
* @param _destinationPort
*/
public LsbConfig(String _serviceAddress, int _servicePort,
String _serviceParadigm, Class<?> _connectorType,
String _connectorAddress, int _connectorPort, String _busAddress,
int _busPort, String _destinationAdress, int _destinationPort) {
super();
this._serviceAddress = _serviceAddress;
this._servicePort = _servicePort;
this._serviceParadigm = _serviceParadigm;
this._connectorType = _connectorType;
this._connectorPort = _connectorPort;
this._connectorAddress = _connectorAddress;
this._busAddress = _busAddress;
this._busPort = _busPort;
this._destinationAdress = _destinationAdress;
this._destinationPort = _destinationPort;
}
 
/**
* Initialize Semantics instance using an external JSON file
*
* @param jsonFile Semantics file path
*/
public LsbConfig(String jsonFile) {
super();
 
String stringFromFile = null;
JsonObject objectFromFile;
try {
BufferedReader br = new BufferedReader(new FileReader(jsonFile));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
 
while (line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
}
stringFromFile = sb.toString();
} catch (FileNotFoundException ex) {
Logger.getLogger(LsbConfig.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(LsbConfig.class.getName()).log(Level.SEVERE, null, ex);
}
if (stringFromFile == null) {
return;
}
objectFromFile = JsonObject.readFrom(stringFromFile);
 
this._serviceAddress = objectFromFile.get("sourceServiceAddress").asString();
this._servicePort = objectFromFile.get("sourceServicePort").asInt();
this._serviceParadigm = objectFromFile.get("sourceServiceParadigm").asString();
this._connectorPort = objectFromFile.get("connectorPort").asInt();
this._connectorAddress = objectFromFile.get("connectorAddress").asString();
this._busAddress = objectFromFile.get("sourceBusAddress").asString();
this._busPort = objectFromFile.get("sourceBusPort").asInt();
this._destinationAdress = objectFromFile.get("destinationAddress").asString();
this._destinationPort = objectFromFile.get("destinationPort").asInt();
this._mediatorAddress = objectFromFile.get("mediatorAddress").asString();
this._mediatorPort = objectFromFile.get("mediatorPort").asInt();
 
String connectorType = objectFromFile.get("connectorType").asString();
try {
Class<?> connectorClass = Class.forName(connectorType);
this._connectorType = connectorClass;
} catch (ClassNotFoundException ex) {
Logger.getLogger(LsbConfig.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/Message_PS.java
1,7 → 1,6
/**
* Message_PS.java
* Copyright(c) 2014 Georgios Mathioudakis (mathioudakis.giorgos@gmail.com)
* Created on Nov 15, 2013
* Message_PS.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Nov 15, 2013
*/
package fr.inria.arles.lsb.commons;
 
14,6 → 13,7
private String _clientID;
 
/**
*
* @param _destination
* @param _destinationPort
* @param _sourceServiceAddress
23,13 → 23,17
* @param _topic
* @param _timeout
* @param _clientID
* @param _mediatorAddress
* @param _mediatorPort
*/
public Message_PS(String _destination, int _destinationPort,
String _sourceServiceAddress, int _sourceServicePort,
String _operation, String _data, String _topic, int _timeout,
String _clientID) {
String _clientID, String _mediatorAddress,
int _mediatorPort) {
super(_destination, _destinationPort, _sourceServiceAddress,
_sourceServicePort, _operation, _data, _timeout, Constants.PS);
_sourceServicePort, _operation, _data, _timeout, _mediatorAddress,
_mediatorPort, Constants.PS);
 
this._topic = _topic;
this._clientID = _clientID;
57,8 → 61,7
 
@Override
public String toString() {
return "Message_PS [_topic=" + _topic + ", _clientID=" + _clientID
+ "]";
return serializeToJson().toString();
}
 
@Override
73,6 → 76,8
.add("_timeout", this.get_timeout())
.add("_topic", this.get_topic())
.add("_clientID", this.get_ClientID())
.add("_mediatorAddress", this.get_mediatorAddress())
.add("_mediatorPort", this.get_mediatorPort())
.add("_interactionParadigm", this.get_interactionParadigm());
return jsonObject;
}
84,15 → 89,15
* Attributes that exist in all messages no matter from what interaction
* paradigm
*/
this.set_destination(object.get("_destinationServiceAddress")
.asString());
this.set_destination(object.get("_destinationServiceAddress").asString());
this.set_destinationPort(object.get("_destinationServicePort").asInt());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress")
.asString());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress").asString());
this.set_sourceServicePort(object.get("_sourceServicePort").asInt());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_interactionParadigm(object.get("_interactionParadigm").asString());
this.set_mediatorAddress(object.get("_mediatorAddress").asString());
this.set_mediatorPort(object.get("_mediatorPort").asInt());
 
/*
* Check in what interaction paradigm the incoming message belongs. Map
112,7 → 117,7
}
 
this.set_ClientID(object.get("_sourceServiceAddress").asString());
this.set_topic("/" + object.get("_remainingPart").asString());
this.set_topic(object.get("_remainingPart").asString());
 
} else if (this.get_interactionParadigm().equals(Constants.STR)) {
this.set_topic("/topic");
126,4 → 131,5
}
}
}
 
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/Message_CS.java
21,12 → 21,22
* @param _remainingPart
* @param _data
* @param _timeout
* @param _mediatorAddress
* @param _mediatorPort
*/
public Message_CS(String _destination, int _destinationPort,
String _sourceServiceAddress, int _sourceServicePort,
String _operation, String _remainingPart, String _data, int _timeout) {
public Message_CS(
String _destination,
int _destinationPort,
String _sourceServiceAddress,
int _sourceServicePort,
String _operation,
String _remainingPart,
String _data,
int _timeout,
String _mediatorAddress,
int _mediatorPort) {
super(_destination, _destinationPort, _sourceServiceAddress,
_sourceServicePort, _operation, _data, _timeout, Constants.CS);
_sourceServicePort, _operation, _data, _timeout, _mediatorAddress, _mediatorPort, Constants.CS);
this._remainingPart = _remainingPart;
}
 
53,6 → 63,8
.add("_data", this.get_data_string())
.add("_timeout", this.get_timeout())
.add("_remainingPart", this.get_remainingPart())
.add("_mediatorAddress", this.get_mediatorAddress())
.add("_mediatorPort", this.get_mediatorPort())
.add("_interactionParadigm", this.get_interactionParadigm());
return jsonObject;
}
75,22 → 87,28
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_interactionParadigm(object.get("_interactionParadigm").asString());
this.set_mediatorAddress(object.get("_mediatorAddress").asString());
this.set_mediatorPort(object.get("_mediatorPort").asInt());
this.set_operation(object.get("_operation").asString());
 
/*
* Check in what interaction paradigm the incoming message belongs. Map
* the functions and attributes
*/
if (this.get_interactionParadigm().equals(Constants.STR)) {
this.set_operation(object.get("_operation").asString());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
} else if (this.get_interactionParadigm().equals(Constants.CS)) {
this.set_operation(object.get("_operation").asString());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_remainingPart(object.get("_remainingPart").asString());
} else if (this.get_interactionParadigm().equals(Constants.PS)) {
 
this.set_remainingPart(object.get("_topic").asString());
}
}
 
@Override
public String toString() {
return serializeToJson().toString();
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/Message_STR.java
1,6 → 1,6
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
* 15, 2013 Status: Description:
* *****************************************************************
*/
14,20 → 14,24
private static String TAG = "Message_STR";
 
/**
*
* @param _destination
* @param _destinationPort
* @param _sourceServiceAddress
* @param _sourceServicePort
* @param _operation
* @param _remainingPart
* @param _data
* @param _timeout
* @param _mediatorAddress
* @param _mediatorPort
*/
public Message_STR(String _destination, int _destinationPort,
String _sourceServiceAddress, int _sourceServicePort,
String _operation, String _data, int _timeout) {
String _operation, String _data, int _timeout, String _mediatorAddress,
int _mediatorPort) {
super(_destination, _destinationPort, _sourceServiceAddress,
_sourceServicePort, _operation, _data, _timeout, Constants.STR);
_sourceServicePort, _operation, _data, _timeout, _mediatorAddress,
_mediatorPort, Constants.STR);
}
 
public Message_STR() {
44,30 → 48,33
.add("_operation", this.get_operation())
.add("_data", this.get_data_string())
.add("_timeout", this.get_timeout())
.add("_mediatorAddress", this.get_mediatorAddress())
.add("_mediatorPort", this.get_mediatorPort())
.add("_interactionParadigm", this.get_interactionParadigm());
return jsonObject;
}
 
@Override
public void deserializeFromJson(JsonObject object) {
 
/*
* Attributes that exist in all messages no matter from what interaction
* paradigm
*/
this.set_destination(object.get("_destinationServiceAddress")
.asString());
this.set_destination(object.get("_destinationServiceAddress").asString());
this.set_destinationPort(object.get("_destinationServicePort").asInt());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress")
.asString());
this.set_sourceServiceAddress(object.get("_sourceServiceAddress").asString());
this.set_sourceServicePort(object.get("_sourceServicePort").asInt());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
this.set_interactionParadigm(object.get("_interactionParadigm")
.asString());
this.set_interactionParadigm(object.get("_interactionParadigm").asString());
this.set_mediatorAddress(object.get("_mediatorAddress").asString());
this.set_mediatorPort(object.get("_mediatorPort").asInt());
 
this.set_operation(object.get("_operation").asString());
this.set_data(object.get("_data").asString());
this.set_timeout(object.get("_timeout").asInt());
 
/*
* Check in what interaction paradigm the incoming message belongs. Map
* the functions and attributes
79,6 → 86,9
} else if (object.get("_interactionParadigm").asString().equals(Constants.PS)) {
GLog.log.d(TAG, "PS message in MESSAGE_STR");
}
}
 
public String toString(){
return serializeToJson().toString();
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/commons/Response.java
1,8 → 1,8
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
Status:
Description:
*******************************************************************/
 
package fr.inria.arles.lsb.commons;
10,9 → 10,6
import org.restlet.data.Status;
 
public class Response {
public static enum StatusCode{
OK, ERROR, RECEIVED
}
private Status _respStatus;
private Object data;
public Object getData() {
40,5 → 37,5
return "Response [_respStatusCode=" + _respStatus.toString() + ", data="
+ data + "]";
}
 
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/BindingComponent.java
7,7 → 7,7
package fr.inria.arles.lsb;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.connectors.LsbConnector;
import java.lang.reflect.InvocationTargetException;
 
15,17 → 15,18
 
private String TAG = "Binding Component";
private int _serviceBusPort;
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private LsbConnector _serviceConnector;
private boolean _enabled = false;
 
public BindingComponent(Semantics serviceSemantics) {
this._serviceSemantics = serviceSemantics;
public BindingComponent(LsbConfig serviceConfig) {
this._serviceConfig = serviceConfig;
 
/*
* Trigger the relevant connector as described in Semantics file
* Trigger the relevant connector as described in LsbConfig file
*/
try {
Class<?> connectorClass = serviceSemantics.get_connectorType();
Class<?> connectorClass = serviceConfig.get_connectorType();
if (connectorClass.getSuperclass() != LsbConnector.class) {
GLog.log.e(
TAG,
33,7 → 34,7
return;
}
 
_serviceConnector = (LsbConnector) connectorClass.getDeclaredConstructor(Semantics.class).newInstance(serviceSemantics);
_serviceConnector = (LsbConnector) connectorClass.getDeclaredConstructor(LsbConfig.class).newInstance(serviceConfig);
} catch (InstantiationException e) {
GLog.log.e(TAG, e.getMessage());
} catch (IllegalAccessException e) {
49,16 → 50,16
}
}
 
public BindingComponent(int _serviceBusPort, Semantics serviceSemantics) {
public BindingComponent(int _serviceBusPort, LsbConfig serviceConfig) {
super();
this._serviceBusPort = _serviceBusPort;
this._serviceSemantics = serviceSemantics;
this._serviceConfig = serviceConfig;
 
/*
* Trigger the relevant connector as described in Semantics file
* Trigger the relevant connector as described in LsbConfig file
*/
try {
Class<?> connectorClass = serviceSemantics.get_connectorType();
Class<?> connectorClass = serviceConfig.get_connectorType();
if (connectorClass.getSuperclass() != LsbConnector.class) {
GLog.log.e(
TAG,
66,8 → 67,8
return;
}
_serviceConnector = (LsbConnector) connectorClass
.getDeclaredConstructor(Semantics.class).newInstance(
serviceSemantics);
.getDeclaredConstructor(LsbConfig.class).newInstance(
serviceConfig);
} catch (InstantiationException e) {
GLog.log.e(TAG, e.getMessage());
} catch (IllegalAccessException e) {
87,11 → 88,28
if (_serviceConnector != null) {
_serviceConnector.shutDown();
}
_enabled = false;
}
 
public void startUp() {
public boolean startUp() {
if (_serviceConnector != null) {
_serviceConnector.startUp();
}
_enabled = true;
return true;
}
 
/**
* @return the _enabled
*/
public boolean isEnabled() {
return _enabled;
}
 
/**
* @param _enabled the _enabled to set
*/
public void setEnabled(boolean _enabled) {
this._enabled = _enabled;
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/StandaloneMain.java
New file
0,0 → 1,39
/**
* App.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 1, 2014
*/
package fr.inria.arles.lsb;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.LsbConfig;
 
public class StandaloneMain {
 
private static final String TAG = "Main Class";
 
public static void main(String[] args) {
GLog.initLogger();
String jsonFileConfig;
 
if (args.length == 1) {
jsonFileConfig = args[0];
} else {
GLog.log.e(TAG, "Wrong number of arguments");
return;
}
 
LsbConfig config = new LsbConfig(jsonFileConfig);
 
final BindingComponent bcApp;
bcApp = new BindingComponent(config);
bcApp.startUp();
 
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
bcApp.shutDown();
System.out.println("EXIT");
}
}));
}
}
/trunk/LSB/src/main/java/fr/inria/arles/lsb/connectors/RestConnector.java
7,13 → 7,15
package fr.inria.arles.lsb.connectors;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Message_CS;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.converters.ConverterCS_GA;
import java.io.IOException;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.restlet.Client;
25,7 → 27,6
import org.restlet.engine.header.Header;
import org.restlet.engine.header.HeaderConstants;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ServerResource;
import org.restlet.util.Series;
 
public class RestConnector extends LsbConnector implements Interface_CS {
33,17 → 34,17
public static String TAG = "RestConnector";
private Server _server = null;
private Component _component;
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private ConverterCS_GA _converterRef;
private Client _client;
 
public RestConnector(Semantics _serviceSemantics) {
this._serviceSemantics = _serviceSemantics;
_converterRef = new ConverterCS_GA(_serviceSemantics, this);
public RestConnector(LsbConfig _serviceConfig) {
this._serviceConfig = _serviceConfig;
_converterRef = new ConverterCS_GA(_serviceConfig, this);
}
 
@Override
public void startUp(){
public void startUp() {
org.restlet.engine.Engine.setLogLevel(Level.OFF);
startRESTLETServer();
startRestletClient();
65,8 → 66,7
*/
public Response send(Message msg) {
GLog.log.d(TAG, "send - Message: " + msg.toString());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
loadDetailsFromConfig(msg);
 
Response resp = _converterRef.send(msg);
GLog.log.d(TAG, resp.get_respStatus().toString());
83,8 → 83,11
public Response receiveSend(Message msg) {
GLog.log.d(TAG, "receiveSend - Message: " + msg.toString());
Request request;
 
Message_CS csMSG = (Message_CS) msg;
 
request = new Request(Method.POST,
this._serviceSemantics.get_serviceAddress() + ":" + this._serviceSemantics.get_servicePort(),
this._serviceConfig.get_serviceAddress() + ":" + this._serviceConfig.get_servicePort() + "?operation=" + csMSG.get_remainingPart(),
new StringRepresentation(msg.get_data_string()));
 
org.restlet.Response response = _client.handle(request);
92,6 → 95,15
return lsbResponse;
}
 
private void loadDetailsFromConfig(Message msg) {
msg.set_sourceServiceAddress(_serviceConfig.get_serviceAddress());
msg.set_sourceServicePort(_serviceConfig.get_servicePort());
msg.set_destination(_serviceConfig.get_destinationAdress());
msg.set_destinationPort(_serviceConfig.get_destinationPort());
msg.set_mediatorAddress(_serviceConfig.get_mediatorAddress());
msg.set_mediatorPort(_serviceConfig.get_mediatorPort());
}
 
/**
* Receives messages from service and forwards them inside the BC. Get
* messages will go here
100,10 → 112,7
* @return
*/
public Response invokeSync(Message msg) {
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
loadDetailsFromConfig(msg);
GLog.log.d(TAG, "invokeSync - Message: " + msg.toString());
Response resp = _converterRef.invoke_sync(msg);
return resp;
117,10 → 126,7
* @return
*/
public Response invokeAsync(Message msg) {
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
loadDetailsFromConfig(msg);
GLog.log.d(TAG, "invokeAsync - Message: " + msg.toString());
Response resp = _converterRef.invoke_async(msg);
return resp;
136,7 → 142,7
public Response receiveInvokeSync(Message msg) {
Message_CS csMsg = (Message_CS) msg;
GLog.log.d(TAG, "receiveInvokeSync - Message: " + csMsg.toString());
Request request = new Request(Method.GET, this._serviceSemantics.get_serviceAddress() + ":" + this._serviceSemantics.get_servicePort() + "/" + csMsg.get_remainingPart());
Request request = new Request(Method.GET, this._serviceConfig.get_serviceAddress() + ":" + this._serviceConfig.get_servicePort() + "/?operation=" + csMsg.get_remainingPart());
 
org.restlet.Response response = _client.handle(request);
String textResponse = null;
161,7 → 167,7
public Response receiveInvokeAsync(Message msg) {
GLog.log.d(TAG, "receiveInvokeAsync - Message: " + msg.toString());
Message_CS csMsg = (Message_CS) msg;
Request request = new Request(Method.GET, this._serviceSemantics.get_serviceAddress() + ":" + this._serviceSemantics.get_servicePort() + "/");
Request request = new Request(Method.GET, this._serviceConfig.get_serviceAddress() + ":" + this._serviceConfig.get_servicePort() + "/?operation=" + csMsg.get_remainingPart());
 
ConcurrentMap<String, Object> attrs = request.getAttributes();
Series<Header> headers = (Series<Header>) attrs
178,8 → 184,8
headers.add("connectionTimeout", String.valueOf(msg.get_timeout()));
headers.add(
"callbackURL",
String.valueOf(this._serviceSemantics.get_busAddress() + ":"
+ this._serviceSemantics.get_busPort()));
String.valueOf(this._serviceConfig.get_busAddress() + ":"
+ this._serviceConfig.get_busPort()));
org.restlet.Response response = _client.handle(request);
String textResponse = null;
 
189,6 → 195,40
Logger.getLogger(RestConnector.class.getName()).log(Level.SEVERE, null, ex);
}
 
/*
* Since this is an async call -> An asynchronous response should be sent
* to the service lying in the callback URL included in the initial msg
*/
final Message_CS fcsMsg = csMsg;
final String fStrResp = textResponse;
 
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
executor.schedule(new Runnable() {
@Override
public void run() {
String[] callbackStr = fcsMsg.get_callback().split(":");
 
if (callbackStr[2] == null) {
callbackStr[2] = "80";
}
 
Message_CS msg = new Message_CS(callbackStr[0] + ":" + callbackStr[1], Integer.parseInt(callbackStr[2]), _serviceConfig.get_busAddress(), _serviceConfig.get_busPort(), Method.POST.toString(), fcsMsg.get_remainingPart(), fStrResp, fcsMsg.get_timeout(), fcsMsg.get_mediatorAddress(), fcsMsg.get_mediatorPort());
 
GLog.log.d(TAG, "Asynchronous message: " + msg.toString());
String URL = msg.get_destination() + ":" + msg.get_destinationPort();
Request request = new Request(Method.POST, URL, new StringRepresentation(msg.serializeToJson().toString()));
Client client = new Client(Protocol.HTTP);
org.restlet.Response resp = client.handle(request);
try {
client.stop();
} catch (Exception ex) {
Logger.getLogger(RestConnector.class.getName()).log(Level.SEVERE, null, ex);
}
GLog.log.d(TAG, "Asynchronous URL: " + URL);
GLog.log.d(TAG, "Asynchronous response: " + resp.toString());
}
}, 10, TimeUnit.MILLISECONDS);
 
Response lsbResponse = new Response(textResponse, response.getStatus());
return lsbResponse;
}
199,31 → 239,20
private void startRESTLETServer() {
 
_server = new Server(Protocol.HTTP,
_serviceSemantics.get_connectorPort());
_serviceConfig.get_connectorPort());
 
try {
if (!_server.isStarted()) {
_component = new Component();
_component.getServers().add(_server);
 
/* This is for testing purposes and targets to address the issues with the static nature of the restlet resource */
if (_serviceSemantics.getRestletResourceClass() != null) {
_component.getDefaultHost().attach("/", (Class<? extends ServerResource>) _serviceSemantics.getRestletResourceClass());
if (_serviceSemantics.getRestletResourceClass() == RestConnectorRestletResource.class) {
RestConnectorRestletResource.setConnectorRef(this);
} else {
RestConnectorRestletResource2.setConnectorRef(this);
}
} else {
_component.getDefaultHost().attach("/", RestConnectorRestletResource.class);
RestConnectorRestletResource.setConnectorRef(this);
}
_component.getDefaultHost().attach("/", RestConnectorRestletResource.class);
RestConnectorRestletResource.setConnectorRef(this);
_component.start();
}
} catch (Exception e) {
GLog.log.e(TAG, "Server Started Exception: " + e.getMessage());
}
GLog.log.d(TAG, "Rest CONNECTOR Server started at PORT: " + _serviceSemantics.get_connectorPort());
GLog.log.d(TAG, "Rest CONNECTOR Server started at PORT: " + _serviceConfig.get_connectorPort());
}
 
private void stopRESTLETServer() {
240,6 → 269,7
private void startRestletClient() {
_client = new Client(Protocol.HTTP);
}
 
private void stopRestletClient() {
try {
_client.stop();
/trunk/LSB/src/main/java/fr/inria/arles/lsb/connectors/LsbConnector.java
6,19 → 6,19
*/
package fr.inria.arles.lsb.connectors;
 
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.converters.ConverterParadigm_GA;
 
public class LsbConnector {
 
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private ConverterParadigm_GA _connectorRef;
 
public LsbConnector() {
}
 
public LsbConnector(Semantics _serviceSemantics) {
this._serviceSemantics = _serviceSemantics;
public LsbConnector(LsbConfig _serviceConfig) {
this._serviceConfig = _serviceConfig;
}
 
public void shutDown() {
28,17 → 28,17
}
 
/**
* @return the _serviceSemantics
* @return the _serviceConfig
*/
public Semantics getServiceSemantics() {
return _serviceSemantics;
public LsbConfig getServiceConfig() {
return _serviceConfig;
}
 
/**
* @param _serviceSemantics the _serviceSemantics to set
* @param _serviceConfig the _serviceConfig to set
*/
public void setServiceSemantics(Semantics _serviceSemantics) {
this._serviceSemantics = _serviceSemantics;
public void setServiceConfig(LsbConfig _serviceConfig) {
this._serviceConfig = _serviceConfig;
}
 
/**
/trunk/LSB/src/main/java/fr/inria/arles/lsb/connectors/MQTT_Connector.java
5,9 → 5,9
package fr.inria.arles.lsb.connectors;
 
import fr.inria.arles.logging.GLog;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.commons.Message_PS;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import static fr.inria.arles.lsb.connectors.MQTT_Connector.TAG;
import fr.inria.arles.lsb.converters.ConverterPS_GA;
import java.io.IOException;
17,6 → 17,8
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.Properties;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.dna.mqtt.commons.Constants;
import org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging;
import static org.dna.mqtt.moquette.proto.messages.AbstractMessage.CONNECT;
45,7 → 47,7
BrokerEventListener {
 
public static String TAG = "MQTT Connector";
private Semantics _serviceSemantics;
private LsbConfig _serviceConfig;
private ConverterPS_GA _converterRef;
private String _sourceClientID = "";
private ServerAcceptor m_acceptor;
53,9 → 55,9
private MqttClient clientToBCbroker;
private MqttClient clientToBrokerService;
 
public MQTT_Connector(Semantics _serviceSemantics) {
this._serviceSemantics = _serviceSemantics;
_converterRef = new ConverterPS_GA(_serviceSemantics, this);
public MQTT_Connector(LsbConfig _serviceConfig) {
this._serviceConfig = _serviceConfig;
_converterRef = new ConverterPS_GA(_serviceConfig, this);
}
 
@Override
77,7 → 79,7
* Protocol specific methods - Control by BC developer
*/
private void startBroker() {
Constants.setPort(_serviceSemantics.get_connectorPort());
Constants.setPort(_serviceConfig.get_connectorPort());
Properties m_properties = new Properties();
m_properties.put("port", Integer.toString(Constants.PORT));
m_properties.put("host", Constants.HOST);
109,18 → 111,35
private void startClientForBrokerService() {
try {
clientToBrokerService = new MqttClient(
_serviceSemantics.get_serviceAddress() + ":"
+ _serviceSemantics.get_servicePort(),
_serviceConfig.get_serviceAddress() + ":"
+ _serviceConfig.get_servicePort(),
"BC-Incoming");
 
clientToBrokerService.connect();
GLog.log.d(TAG, "clientToBrokerService is now connected on port: " + _serviceSemantics.get_servicePort());
GLog.log.d(TAG, "clientToBrokerService is now connected on port: " + _serviceConfig.get_servicePort());
} catch (MqttSecurityException e) {
GLog.log.e(TAG, e.getMessage());
} catch (MqttException e) {
GLog.log.e(TAG, "clientToBrokerService could not be connected on port: " + _serviceSemantics.get_servicePort() + " " + e.getMessage());
GLog.log.e(TAG, "clientToBrokerService could not be connected on port: " + _serviceConfig.get_servicePort() + " " + e.getMessage());
}
 
//If the client cannot be connected then there is no broker available there. Instead connect to the local broker of the binding component
if (!clientToBrokerService.isConnected()) {
try {
clientToBrokerService = new MqttClient(
_serviceConfig.get_connectorAddress() + ":"
+ _serviceConfig.get_connectorPort(),
"BC-Incoming");
 
clientToBrokerService.connect();
GLog.log.d(TAG, "clientToBrokerService is now connected on port: " + _serviceConfig.get_connectorPort());
} catch (MqttSecurityException e) {
GLog.log.e(TAG, e.getMessage());
} catch (MqttException e) {
GLog.log.e(TAG, "clientToBrokerService could not be connected on port: " + _serviceConfig.get_connectorPort() + " " + e.getMessage());
}
}
 
}
 
/**
139,9 → 158,9
private void startClientToBCbroker() {
try {
clientToBCbroker = new MqttClient(
_serviceSemantics.get_connectorAddress() + ":"
+ _serviceSemantics.get_connectorPort(), "BC-"
+ _serviceSemantics.get_servicePort());
_serviceConfig.get_connectorAddress() + ":"
+ _serviceConfig.get_connectorPort(), "BC-"
+ _serviceConfig.get_servicePort());
clientToBCbroker.connect();
GLog.log.d(TAG, "cientToBCbroker is now connected");
} catch (MqttException e) {
188,19 → 207,36
_converterRef.publish(msg);
}
 
public Response subscribe(Message_PS msg) {
GLog.log.d(TAG,
"Sending a SUBSCRIBE request from connector to the core of BC. MSG: "
+ msg.toString());
Response resp = _converterRef.subscribe(msg);
public Response subscribe(final Message_PS msg) {
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
executor.schedule(new Runnable() {
@Override
public void run() {
GLog.log.d(TAG,
"Sending a SUBSCRIBE request from connector to the core of BC. MSG: "
+ msg.toString());
Response resp = _converterRef.subscribe(msg);
}
}, 1, TimeUnit.SECONDS);
 
Response resp = new fr.inria.arles.lsb.commons.Response(
"", Status.SUCCESS_NO_CONTENT);
return resp;
}
 
public Response unsubscribe(Message_PS msg) {
GLog.log.d(TAG,
"Sending an UNSUBSCRIBE request from connector to the core of BC. MSG: "
+ msg.toString());
Response resp = _converterRef.unsubscribe(msg);
public Response unsubscribe(final Message_PS msg) {
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
executor.schedule(new Runnable() {
@Override
public void run() {
GLog.log.d(TAG,
"Sending an UNSUBSCRIBE request from connector to the core of BC. MSG: "
+ msg.toString());
Response resp = _converterRef.unsubscribe(msg);
}
}, 1, TimeUnit.SECONDS);
Response resp = new fr.inria.arles.lsb.commons.Response(
"", Status.SUCCESS_NO_CONTENT);
return resp;
}
 
289,30 → 325,48
case CONNECT:
case SUBSCRIBE:
Message_PS eventMessageSub = new Message_PS(
_serviceSemantics.get_destinationAdress(),
_serviceSemantics.get_destinationPort(),
_serviceSemantics.get_serviceAddress(),
_serviceSemantics.get_servicePort(), fr.inria.arles.lsb.commons.Constants.SUBSCRIBE,
_stringPayload, topic, 100000, clientID);
_serviceConfig.get_destinationAdress(),
_serviceConfig.get_destinationPort(),
_serviceConfig.get_serviceAddress(),
_serviceConfig.get_servicePort(),
fr.inria.arles.lsb.commons.Constants.SUBSCRIBE,
_stringPayload,
topic,
100000,
clientID,
_serviceConfig.get_mediatorAddress(),
_serviceConfig.get_mediatorPort());
 
this.subscribe(eventMessageSub);
break;
case UNSUBSCRIBE:
Message_PS eventMessageUnsub = new Message_PS(
_serviceSemantics.get_destinationAdress(),
_serviceSemantics.get_destinationPort(),
_serviceSemantics.get_serviceAddress(),
_serviceSemantics.get_servicePort(), fr.inria.arles.lsb.commons.Constants.UNSUBSCRIBE,
_stringPayload, topic, 100000, clientID);
_serviceConfig.get_destinationAdress(),
_serviceConfig.get_destinationPort(),
_serviceConfig.get_serviceAddress(),
_serviceConfig.get_servicePort(),
fr.inria.arles.lsb.commons.Constants.UNSUBSCRIBE,
_stringPayload,
topic,
100000,
clientID,
_serviceConfig.get_mediatorAddress(),
_serviceConfig.get_mediatorPort());
this.unsubscribe(eventMessageUnsub);
break;
case PUBLISH:
Message_PS eventMessagePub = new Message_PS(
_serviceSemantics.get_destinationAdress(),
_serviceSemantics.get_destinationPort(),
_serviceSemantics.get_serviceAddress(),
_serviceSemantics.get_servicePort(), fr.inria.arles.lsb.commons.Constants.PUBLISH,
_stringPayload, topic, 100000, clientID);
_serviceConfig.get_destinationAdress(),
_serviceConfig.get_destinationPort(),
_serviceConfig.get_serviceAddress(),
_serviceConfig.get_servicePort(),
fr.inria.arles.lsb.commons.Constants.PUBLISH,
_stringPayload,
topic,
100000,
clientID,
_serviceConfig.get_mediatorAddress(),
_serviceConfig.get_mediatorPort());
this.publish(eventMessagePub);
break;
case PUBREC:
/trunk/LSB/src/main/java/fr/inria/arles/lsb/connectors/WebsocketConnector.java
11,7 → 11,7
import fr.inria.arles.lsb.commons.Message;
import fr.inria.arles.lsb.commons.Message_STR;
import fr.inria.arles.lsb.commons.Response;
import fr.inria.arles.lsb.commons.Semantics;
import fr.inria.arles.lsb.commons.LsbConfig;
import fr.inria.arles.lsb.converters.ConverterSTR_GA;
import java.io.IOException;
import java.net.InetSocketAddress;
30,18 → 30,18
 
public static String TAG = "Websocket Connector";
private WS_Server _wsServer;
private Semantics _serviceSemantics;
private LsbConfig _serviceSemantics;
private ConverterSTR_GA _converterRef;
private WebsocketConnector _self;
private HashMap<String, WebSocketClient> _connectedClients;
 
public WebsocketConnector(Semantics _serviceSemantics) {
public WebsocketConnector(LsbConfig _serviceSemantics) {
this._serviceSemantics = _serviceSemantics;
_converterRef = new ConverterSTR_GA(_serviceSemantics, this);
}
 
@Override
public void startUp(){
public void startUp() {
startWebsocketServer();
_connectedClients = new HashMap<String, WebSocketClient>();
_self = this; // Keep reference to the connector instance to use it inside listeners
78,10 → 78,7
public Response openStream(Message msg) {
 
GLog.log.d(TAG, "Received OPENSTREAM from service");
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
loadDetailsFromSemantics(msg);
 
if (_converterRef != null) {
return _converterRef.openStream(msg);
92,10 → 89,7
 
public Response sendItem(Message msg) {
GLog.log.d(TAG, "Received SENDITEM from service");
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
loadDetailsFromSemantics(msg);
 
if (_converterRef != null) {
return _converterRef.sendItem(msg);
106,10 → 100,6
 
public Response sendItemToClient(Message msg) {
GLog.log.d(TAG, "Received SENDITEM from service");
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
 
if (_converterRef != null) {
return _converterRef.sendItemToClient(msg);
120,10 → 110,7
 
public Response closeStream(Message msg) {
GLog.log.d(TAG, "Received CLOSESTREAM from service");
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
loadDetailsFromSemantics(msg);
 
if (_converterRef != null) {
return _converterRef.closeStream(msg);
132,6 → 119,15
}
}
 
private void loadDetailsFromSemantics(Message msg) {
msg.set_sourceServiceAddress(_serviceSemantics.get_serviceAddress());
msg.set_sourceServicePort(_serviceSemantics.get_servicePort());
msg.set_destination(_serviceSemantics.get_destinationAdress());
msg.set_destinationPort(_serviceSemantics.get_destinationPort());
msg.set_mediatorAddress(_serviceSemantics.get_mediatorAddress());
msg.set_mediatorPort(_serviceSemantics.get_mediatorPort());
}
 
public Response out_openStream(Message msg) {
if (_connectedClients.containsKey(msg.get_source() + ":" + msg.get_sourceServicePort())) {
return null;
159,7 → 155,7
GLog.log.d(TAG, "MESSAGE RETURNED");
_self.sendItemToClient(new Message_STR("", 0, "", 0,
Constants.SENDITEMTOCLIENT, message,
Constants.MessageDefaultTimeout));
Constants.MessageDefaultTimeout, "", 0));
}
 
@Override
254,7 → 250,7
if (_connectorRef != null) {
_connectorRef.openStream(new Message_STR("", 0, "", 0,
Constants.OPENSTREAM, Constants.OPENSTREAM,
Constants.MessageDefaultTimeout));
Constants.MessageDefaultTimeout, "", 0));
}
}
 
265,7 → 261,7
if (_connectorRef != null) {
_connectorRef.closeStream(new Message_STR("", 0, "", 0,
Constants.CLOSESTREAM, Constants.CLOSESTREAM,
Constants.MessageDefaultTimeout));
Constants.MessageDefaultTimeout, "", 0));
}
}
 
276,7 → 272,7
if (_connectorRef != null) {
_connectorRef.sendItem(new Message_STR("", 0, "", 0,
Constants.SENDITEMTOSERVER, message,
Constants.MessageDefaultTimeout));
Constants.MessageDefaultTimeout, "", 0));
}
}
 
/trunk/LSB/src/main/java/fr/inria/arles/lsb/connectors/RestConnectorRestletResource.java
40,6 → 40,8
public org.restlet.Response receiveGet() {
String remainingPart = getReference().getRemainingPart();
Request req = getRequest();
 
//TODO: Remove source. Not needed
String source = req.getHostRef().getHostDomain();
int port = req.getHostRef().getHostPort();
 
65,7 → 67,7
GLog.log.e(TAG, "Class cast exeption: " + nfe);
}
 
Message_CS msg = new Message_CS("", 0, source, port, "GET", remainingPart, "", connectionTimeout);
Message_CS msg = new Message_CS("", 0, source, port, "GET", remainingPart, "", connectionTimeout, "", 0);
 
fr.inria.arles.lsb.commons.Response lsbResponse = null;
 
118,7 → 120,7
GLog.log.e(TAG, "Class cast exeption: " + nfe);
}
 
Message_CS msg = new Message_CS("", 0, source, port, "POST", remainingPart, data, connectionTimeout);
Message_CS msg = new Message_CS("", 0, source, port, "POST", remainingPart, data, connectionTimeout, "", 0);
fr.inria.arles.lsb.commons.Response lsbResponse = connectorRef.send(msg);
 
//GLog.log.d(TAG, lsbResponse.get_respStatus().toString());
/trunk/LSB/src/main/java/fr/inria/arles/logging/GLog.java
1,27 → 1,35
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
*******************************************************************/
 
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* 14, 2013 Status: Description:
******************************************************************
*/
package fr.inria.arles.logging;
 
public class GLog {
 
public static Logger log = null;
public static Logger log = null;
 
/**
* @return Returns the current active logger object
*/
public static Logger initLogger() {
if (log == null) {
String space = "%-10s %-30s %-50s\n";
System.out.printf(space, "Type", "Tag", "Message");
System.out.printf(space, "--------", "--------", "--------");
log = new JavaLogger();
log.setLogLevel(1);
}
return log;
/**
* @return Returns the current active logger object
*/
public static Logger initLogger() {
if (log == null) {
String space = "%-10s %-30s %-50s\n";
System.out.printf(space, "Type", "Tag", "Message");
System.out.printf(space, "--------", "--------", "--------");
log = new JavaLogger();
log.setLogLevel(5);
}
return log;
}
 
public static Logger initLogger(UpdateGUI_Listener listener){
if (log == null) {
log = new GuiLogger();
((GuiLogger) log).addListener(listener);
log.setLogLevel(5);
}
return log;
}
}
/trunk/LSB/src/main/java/fr/inria/arles/logging/UpdateGUI_Listener.java
New file
0,0 → 1,15
/*
* 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 fr.inria.arles.logging;
 
/**
*
* @author mathioud
*/
public interface UpdateGUI_Listener {
public void writeToLog(String type, String tag, String msg);
}
/trunk/LSB/src/main/java/fr/inria/arles/logging/Logger.java
1,72 → 1,62
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
*******************************************************************/
 
/**
* ****************************************************************
* Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr) Created: Nov
* 14, 2013 Status: Description:
******************************************************************
*/
package fr.inria.arles.logging;
 
public abstract class Logger{
public abstract class Logger {
 
private int _logLevel = 0;
/**
* Error Logging
*
* @param tag
* The tag to indicate the source of the message
* @param message
* The message
*/
public abstract void e(String tag, String message);
private int _logLevel = 0;
 
/**
* Warning Logging
*
* @param tag
* The tag to indicate the source of the message
* @param message
* The message
*/
public abstract void w(String tag, String message);
/**
* Error Logging
*
* @param tag The tag to indicate the source of the message
* @param message The message
*/
public abstract void e(String tag, String message);
 
/**
* Info Logging
*
* @param tag
* The tag to indicate the source of the message
* @param message
* The message
*/
public abstract void i(String tag, String message);
/**
* Warning Logging
*
* @param tag The tag to indicate the source of the message
* @param message The message
*/
public abstract void w(String tag, String message);
 
/**
* Debug Logging
*
* @param tag
* The tag to indicate the source of the message
* @param message
* The message
*/
public abstract void d(String tag, String message);
/**
* Set the log level
*
* @param level
* 0: No messages<br/>
* 1: Just the Info<br/>
* 2: Info - Errors<br/>
* 3: Info - Errors - Warnings<br/>
* 4: Info - Errors - Warnings - Debug
* 5: All
*
*/
public void setLogLevel(int level){
_logLevel = level;
}
public int getLogLevel(){
return _logLevel;
}
/**
* Info Logging
*
* @param tag The tag to indicate the source of the message
* @param message The message
*/
public abstract void i(String tag, String message);
 
/**
* Debug Logging
*
* @param tag The tag to indicate the source of the message
* @param message The message
*/
public abstract void d(String tag, String message);
 
/**
* Set the log level
*
* @param level 0: No messages<br/>
* 1: Just the Info<br/>
* 2: Info - Errors<br/>
* 3: Info - Errors - Warnings<br/>
* 4: Info - Errors - Warnings - Debug 5: All
*
*/
public void setLogLevel(int level) {
_logLevel = level;
}
 
public int getLogLevel() {
return _logLevel;
}
}
/trunk/LSB/src/main/java/fr/inria/arles/logging/JavaLogger.java
1,16 → 1,16
/******************************************************************
Author: Georgios Mathioudakis (georgios.mathioudakis@inria.fr)
Created: Nov 14, 2013
Status:
Description:
Status:
Description:
*******************************************************************/
 
package fr.inria.arles.logging;
 
public class JavaLogger extends Logger{
 
String space = "%-10s %-30s %-50s\n";
String space = "%-10s %-30s %-50s\n\n";
 
public void i(String tag, String message) {
if(this.getLogLevel()>1)
System.out.printf(space, "[Info]", tag, message);
25,7 → 25,7
if(this.getLogLevel()>3)
System.out.printf(space, "[Warning]", tag, message);
}
 
public void d(String tag, String message) {
if(this.getLogLevel()>4)
System.out.printf(space, "[Debug]", tag, message);
/trunk/LSB/src/main/java/fr/inria/arles/logging/GuiLogger.java
New file
0,0 → 1,66
/**
* GuiLogger.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Jul 11, 2014
*/
package fr.inria.arles.logging;
 
import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.List;
 
public class GuiLogger extends Logger {
 
private List<UpdateGUI_Listener> _listeners = new ArrayList<UpdateGUI_Listener>();
 
public void addListener(UpdateGUI_Listener toAdd) {
_listeners.add(toAdd);
}
 
@Override
public void e(final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("e", tag, message);
}
}
});
}
 
@Override
public void w(final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("w", tag, message);
}
}
});
}
 
@Override
public void i(final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("i", tag, message);
}
}
});
}
 
@Override
public void d(final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("d", tag, message);
}
}
});
}
}
/trunk/LSB/pom.xml
26,6 → 26,22
<url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fr.inria.arles.lsb.StandaloneMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
 
<dependencies>
<!-- JSON -->
88,6 → 104,10
<artifactId>Java-WebSocket</artifactId>
<version>1.3.0</version>
</dependency>
 
<dependency>
<groupId>org.jdesktop</groupId>
<artifactId>beansbinding</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>
/trunk/LSB/nbactions-CS_1.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_CS_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_CS_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_CS_1.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_CS_1.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_CS_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_CS_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB/nbactions-CS_2.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_CS_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_CS_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_CS_2.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_CS_2.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_CS_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_CS_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB/config/config_PS_1.json
New file
0,0 → 1,14
{
"sourceServiceAddress":"tcp://128.93.41.127",
"sourceServicePort":8061,
"sourceServiceParadigm":"PS",
"connectorType":"fr.inria.arles.lsb.connectors.MQTT_Connector",
"connectorAddress":"tcp://128.93.41.127",
"connectorPort":1884,
"sourceBusAddress":"http://128.93.41.127",
"sourceBusPort":8091,
"destinationAddress":"http://128.93.41.127",
"destinationPort":8092,
"mediatorAddress":"http://128.93.59.54",
"mediatorPort":8080
}
/trunk/LSB/config/config_PS_2.json
New file
0,0 → 1,14
{
"sourceServiceAddress":"tcp://127.0.0.1",
"sourceServicePort":1886,
"sourceServiceParadigm":"PS",
"connectorType":"fr.inria.arles.lsb.connectors.MQTT_Connector",
"connectorAddress":"tcp://127.0.0.1",
"connectorPort":1984,
"sourceBusAddress":"http://127.0.0.1",
"sourceBusPort":8092,
"destinationAddress":"http://127.0.0.1",
"destinationPort":80,
"mediatorAddress":"http://127.0.0.1",
"mediatorPort":80
}
/trunk/LSB/config/config_CS_1.json
New file
0,0 → 1,14
{
"sourceServiceAddress":"http://127.0.0.1",
"sourceServicePort":8061,
"sourceServiceParadigm":"CS",
"connectorType":"fr.inria.arles.lsb.connectors.RestConnector",
"connectorAddress":"http://127.0.0.1",
"connectorPort":8071,
"sourceBusAddress":"http://127.0.0.1",
"sourceBusPort":8091,
"destinationAddress":"http://127.0.0.1",
"destinationPort":8092,
"mediatorAddress":"",
"mediatorPort":8082
}
/trunk/LSB/config/config_CS_2.json
New file
0,0 → 1,14
{
"sourceServiceAddress":"http://128.93.41.127",
"sourceServicePort":8062,
"sourceServiceParadigm":"CS",
"connectorType":"fr.inria.arles.lsb.connectors.RestConnector",
"connectorAddress":"http://128.93.41.127",
"connectorPort":8072,
"sourceBusAddress":"http://128.93.41.127",
"sourceBusPort":8092,
"destinationAddress":"http://128.93.41.127",
"destinationPort":8091,
"mediatorAddress":"http://128.93.59.54",
"mediatorPort":8082
}
/trunk/LSB/config/config_STR_1.json
New file
0,0 → 1,12
{
"sourceServiceAddress":"http://127.0.0.1",
"sourceServicePort":8061,
"sourceServiceParadigm":"STR",
"connectorType":"fr.inria.arles.lsb.connectors.WebsocketConnector",
"connectorAddress":"http://127.0.0.1",
"connectorPort":8886,
"sourceBusAddress":"http://127.0.0.1",
"sourceBusPort":8091,
"destinationAddress":"http://127.0.0.1",
"destinationPort":8092
}
/trunk/LSB/config/config_STR_2.json
New file
0,0 → 1,12
{
"sourceServiceAddress":"http://127.0.0.1",
"sourceServicePort":7799,
"sourceServiceParadigm":"STR",
"connectorType":"fr.inria.arles.lsb.connectors.WebsocketConnector",
"connectorAddress":"http://127.0.0.1",
"connectorPort":1984,
"sourceBusAddress":"http://127.0.0.1",
"sourceBusPort":8092,
"destinationAddress":"http://127.0.0.1",
"destinationPort":8091
}
/trunk/LSB/nbactions-STR_1.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_STR_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_STR_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_STR_1.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_STR_1.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_STR_1.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_STR_1.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB/nbactions-STR_2.xml
10,7 → 10,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_STR_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_STR_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
24,7 → 24,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App semantics_STR_2.json</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.lsb.App config/config_STR_2.json</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
39,7 → 39,7
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App semantics_STR_2.json</exec.args>
<exec.args>-classpath %classpath fr.inria.arles.lsb.App config/config_STR_2.json</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
/trunk/LSB_helpers/MQTT_Playground/nbactions.xml
New file
0,0 → 1,32
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath fr.inria.arles.samplemqttclient.App</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath fr.inria.arles.samplemqttclient.App</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
</actions>
/trunk/LSB_helpers/MQTT_Playground/moquette.log
New file
0,0 → 1,84
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
16 [pool-1-thread-1] WARN FileAuthenticator - Parsing not existing file mqtt-conf.txt
java.io.FileNotFoundException: mqtt-conf.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileReader.<init>(FileReader.java:72)
at org.dna.mqtt.moquette.messaging.spi.impl.FileAuthenticator.<init>(FileAuthenticator.java:30)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.processInit(SimpleMessaging.java:220)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.onEvent(SimpleMessaging.java:205)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.onEvent(SimpleMessaging.java:50)
at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
138 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
10172 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
10185 [pool-3-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
10185 [pool-3-thread-1] WARN FileAuthenticator - Parsing not existing file mqtt-conf.txt
java.io.FileNotFoundException: mqtt-conf.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileReader.<init>(FileReader.java:72)
at org.dna.mqtt.moquette.messaging.spi.impl.FileAuthenticator.<init>(FileAuthenticator.java:30)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.processInit(SimpleMessaging.java:220)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.onEvent(SimpleMessaging.java:205)
at org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging.onEvent(SimpleMessaging.java:50)
at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
133 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
11249 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
11250 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
11264 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
42328 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 2
42334 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
42338 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
43496 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
43501 [pool-3-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
132 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
1387 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 0, msg wrote: 0
2877 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
2880 [pool-3-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
7694 [pool-3-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
7696 [pool-3-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
7709 [pool-3-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
14942 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 0, msg wrote: 0
14943 [pool-3-thread-1] INFO ProtocolProcessor - Lost connection with client <CLIENT-1>
1 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
116 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
1142 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
1144 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
1157 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <http://www.lemonde.fr/international/rss_full.xml> with QoS 1 - LEAST_ONE
2978 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
2982 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
5891 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
5891 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
6543 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml> with QoS LEAST_ONE
6544 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <http://www.lemonde.fr/international/rss_full.xml>
9321 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 5
9324 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
9326 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
13408 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
13408 [pool-1-thread-1] INFO ProtocolProcessor - Connected client ID <CLIENT-1> with clean session true
13409 [pool-1-thread-1] INFO ProtocolProcessor - <CLIENT-1> subscribed to topic <topic 1> with QoS 1 - LEAST_ONE
14633 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <topic 1> with QoS LEAST_ONE
14634 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <topic 1>
15095 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <topic 1> with QoS LEAST_ONE
15096 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <topic 1>
15220 [pool-1-thread-1] INFO ProtocolProcessor - Publish recieved from clientID <CLIENT-1> on topic <topic 1> with QoS LEAST_ONE
15221 [pool-1-thread-1] INFO ProtocolProcessor - send publish message to <CLIENT-1> on topic <topic 1>
17996 [pool-1-thread-1] INFO ProtocolProcessor - replying with UnsubAck to MSG ID 5
17998 [pool-1-thread-1] INFO ProtocolProcessor - cleaning old saved subscriptions for client <CLIENT-1>
18000 [pool-1-thread-1] INFO ProtocolProcessor - Disconnected client <CLIENT-1> with clean session true
19021 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 40, msg wrote: 36
0 [pool-1-thread-1] INFO FileAuthenticator - Loading password file: mqtt-conf.txt
97 [AWT-EventQueue-0] INFO NettyAcceptor - Server binded
2509 [AWT-EventQueue-0] INFO NettyAcceptor - Msg read: 0, msg wrote: 0
/trunk/LSB_helpers/MQTT_Playground/mqtt-conf.txt
New file
0,0 → 1,0
CLIENT-1:
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/Client$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/Broker.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/GUI.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/Broker$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/GUI$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/GUI$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/ClientCallback.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/GUI$3.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/GUI$4.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/UpdateGUI_Listener.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/Client.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/classes/fr/inria/arles/mqttplayground/App.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/target/test-classes/Test_PubSub.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/MQTT_Playground/src/test/java/Test_PubSub.java
New file
0,0 → 1,56
/*
* 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.
*/
 
import fr.inria.arles.mqttplayground.Client;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
 
/**
*
* @author mathioud
*/
public class Test_PubSub {
 
Client cl;
 
public Test_PubSub() {
}
 
@BeforeClass
public static void setUpClass() {
}
 
@AfterClass
public static void tearDownClass() {
}
 
@Before
public void setUp() {
cl = new Client();
cl.start("tcp://127.0.0.1:1886");
cl.subscribe("/topic");
}
 
@After
public void tearDown() {
cl.stop("/topic");
}
 
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
// @Test
// public void hello() {}
@Test
public void testPubSub() {
for (int i = 0; i < 1100; i++) {
cl.sendMessage(i + "", "/topic");
}
}
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/UpdateGUI_Listener.java
New file
0,0 → 1,15
/*
* 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 fr.inria.arles.mqttplayground;
 
/**
*
* @author mathioud
*/
public interface UpdateGUI_Listener {
public void writeToLog(String dest, String type, String tag, String msg);
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/Client.java
New file
0,0 → 1,130
/**
* Subscriber.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 3, 2014
*/
package fr.inria.arles.mqttplayground;
 
import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
 
public class Client {
 
private List<UpdateGUI_Listener> _listeners = new ArrayList<UpdateGUI_Listener>();
 
private MqttClient client;
 
public void Client() {
 
}
 
public void addListener(UpdateGUI_Listener toAdd) {
_listeners.add(toAdd);
}
 
public void start(String brokerHost) {
try {
client = new MqttClient(brokerHost, "CLIENT-1");
client.connect();
} catch (MqttException e) {
System.out.println(e.getMessage());
}
}
 
public void sendMessage(String msg, String topic) {
try {
client.publish(topic, new MqttMessage(msg.getBytes()));
//System.out.println("Sending: " + msg);
} catch (MqttException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
}
}
 
public void subscribe(String topic) {
try {
client.subscribe(topic);
ClientCallback cbk = new ClientCallback(client, this);
client.setCallback(cbk);
} catch (MqttException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
}
}
 
public void stop(String topic) {
try {
client.unsubscribe(topic);
if (client.isConnected()) {
client.disconnect();
}
client.close();
} catch (MqttException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
}
}
 
public void writeToGuiLog(final String type, final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("client", "d", tag, message);
}
}
});
}
}
 
class ClientCallback implements MqttCallback {
 
private MqttClient client = null;
private Client cl = null;
private int numberOfMessages = 0;
 
public ClientCallback(MqttClient mqttClient, Client cl) {
this.client = mqttClient;
this.cl = cl;
}
 
@Override
public void connectionLost(Throwable cause) {
// TODO Auto-generated method stub
 
}
 
@Override
public void messageArrived(String topic, MqttMessage message)
throws Exception {
System.out.println("Topic: " + topic + " Message: " + message);
 
cl.writeToGuiLog("d", topic, message.toString());
 
// int id = Integer.parseInt(new String(message.getPayload()));
// if(App.times.get(id) != null){
// long dif = System.nanoTime() - App.times.get(id);
// App.times.set(id, dif);
// System.out.println(id+":"+dif);
// }
}
 
@Override
public void deliveryComplete(IMqttDeliveryToken token) {
// TODO Auto-generated method stub
 
}
 
public int getNumberOfMessages() {
return numberOfMessages;
}
 
public void setNumberOfMessages(int numberOfMessages) {
this.numberOfMessages = numberOfMessages;
}
 
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/App.java
New file
0,0 → 1,53
/**
* App.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 3, 2014
*/
package fr.inria.arles.mqttplayground;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class App {
 
public static ArrayList<Long> times;
 
public static void main(String[] args) {
times = new ArrayList<>();
Client cl;
cl = new Client();
cl.start("tcp://127.0.0.1:1884");
String topic = "http://www.lemonde.fr/international/rss_full.xml";
 
cl.subscribe(topic);
 
// for (int i = 0; i < 1000; i++) {
// long startTime = System.nanoTime();
// times.add(startTime);
// cl.sendMessage(i + "", "/topic");
// }
// System.out.println("All messages transmitted\n");
 
System.out.println("Started");
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
cl.stop(topic);
 
// for(double d : times)
// System.out.println(d * 0.000001);
 
System.out.println("Press Enter to exit app...");
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
System.exit(0);
}
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/Broker.java
New file
0,0 → 1,67
/**
* Broker.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 3, 2014
*/
package fr.inria.arles.mqttplayground;
 
import java.awt.EventQueue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.dna.mqtt.commons.Constants;
import org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging;
import org.dna.mqtt.moquette.server.netty.NettyAcceptor;
 
public class Broker {
 
private NettyAcceptor m_acceptor;
private SimpleMessaging messaging;
private Properties m_properties;
private List<UpdateGUI_Listener> _listeners = new ArrayList<UpdateGUI_Listener>();
 
public void Broker() {
 
}
 
public void start(int port) {
Constants.setPort(port);
m_properties = new Properties();
m_properties.put("port", Integer.toString(Constants.PORT));
m_properties.put("host", Constants.HOST);
m_properties.put("password_file", "mqtt-conf.txt");
messaging = new SimpleMessaging();
messaging.init(m_properties);
m_acceptor = new NettyAcceptor();
try {
m_acceptor.initialize(messaging, m_properties);
} catch (IOException e) {
System.out.println(e.getLocalizedMessage());
}
writeToGuiLog("d", "Broker", "Started at port: " + port);
}
 
public void shutdown() {
if (messaging != null) {
messaging.stop();
}
if (m_acceptor != null) {
m_acceptor.close();
}
}
 
public void addListener(UpdateGUI_Listener toAdd) {
_listeners.add(toAdd);
}
 
public void writeToGuiLog(final String type, final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("broker","d", tag, message);
}
}
});
}
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/GUI.java
New file
0,0 → 1,417
/*
* 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 fr.inria.arles.mqttplayground;
 
import java.awt.Color;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
 
/**
*
* @author mathioud
*/
public class GUI extends javax.swing.JFrame implements UpdateGUI_Listener {
 
private Client cl;
private Broker br;
 
/**
* Creates new form GUI
*/
public GUI() {
initComponents();
}
 
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
 
_P_Client = new javax.swing.JPanel();
_P_ClientLog = new javax.swing.JScrollPane();
_TP_ClientLog = new javax.swing.JTextPane();
_P_ClientConfig = new javax.swing.JPanel();
_TF_Destination = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
_TF_Topic = new javax.swing.JTextField();
_BT_Subscribe = new javax.swing.JToggleButton();
_P_ClientPublish = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
_TF_PublishMessage = new javax.swing.JTextField();
_BT_Publish = new javax.swing.JButton();
_P_Broker = new javax.swing.JPanel();
_P_BrokerConfig = new javax.swing.JPanel();
_TF_BrokerPort = new javax.swing.JTextField();
_LB_BrokerPort = new javax.swing.JLabel();
_BT_BrokerStart = new javax.swing.JToggleButton();
_LB_BrokerEnabled = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
_TP_BrokerLog = new javax.swing.JTextPane();
 
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("MQTT Playground");
 
_P_Client.setBorder(javax.swing.BorderFactory.createTitledBorder("Client"));
 
_P_ClientLog.setViewportView(_TP_ClientLog);
 
_P_ClientConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_Destination.setText("tcp://127.0.0.1:1884");
 
jLabel1.setText("Broker:");
 
jLabel2.setText("Topic:");
 
_TF_Topic.setText("http://www.lemonde.fr/international/rss_full.xml");
 
_BT_Subscribe.setText("Subscribe");
_BT_Subscribe.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_SubscribeActionPerformed(evt);
}
});
 
_P_ClientPublish.setBackground(new java.awt.Color(204, 204, 204));
 
jLabel8.setText("Message:");
 
_BT_Publish.setText("Publish");
_BT_Publish.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_PublishActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _P_ClientPublishLayout = new javax.swing.GroupLayout(_P_ClientPublish);
_P_ClientPublish.setLayout(_P_ClientPublishLayout);
_P_ClientPublishLayout.setHorizontalGroup(
_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublishLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_PublishMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_Publish, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
_P_ClientPublishLayout.setVerticalGroup(
_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublishLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(_TF_PublishMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_BT_Publish))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
javax.swing.GroupLayout _P_ClientConfigLayout = new javax.swing.GroupLayout(_P_ClientConfig);
_P_ClientConfig.setLayout(_P_ClientConfigLayout);
_P_ClientConfigLayout.setHorizontalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_BT_Subscribe, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_TF_Destination)
.addComponent(_TF_Topic, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)))))
.addComponent(_P_ClientPublish, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_ClientConfigLayout.setVerticalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_TF_Destination, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(_TF_Topic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_Subscribe, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_ClientPublish, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
javax.swing.GroupLayout _P_ClientLayout = new javax.swing.GroupLayout(_P_Client);
_P_Client.setLayout(_P_ClientLayout);
_P_ClientLayout.setHorizontalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_P_ClientLog, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_ClientLayout.setVerticalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_ClientLog, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE))
);
 
_P_Broker.setBorder(javax.swing.BorderFactory.createTitledBorder("Broker"));
 
_P_BrokerConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_BrokerPort.setText("1884");
 
_LB_BrokerPort.setText("Port:");
 
_BT_BrokerStart.setText("Start");
_BT_BrokerStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_BrokerStartActionPerformed(evt);
}
});
 
_LB_BrokerEnabled.setBackground(java.awt.Color.red);
_LB_BrokerEnabled.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
_LB_BrokerEnabled.setForeground(new java.awt.Color(255, 255, 255));
_LB_BrokerEnabled.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
_LB_BrokerEnabled.setText("Disabled");
_LB_BrokerEnabled.setOpaque(true);
 
javax.swing.GroupLayout _P_BrokerConfigLayout = new javax.swing.GroupLayout(_P_BrokerConfig);
_P_BrokerConfig.setLayout(_P_BrokerConfigLayout);
_P_BrokerConfigLayout.setHorizontalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_BT_BrokerStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addComponent(_LB_BrokerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_BrokerPort, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_LB_BrokerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
_P_BrokerConfigLayout.setVerticalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_LB_BrokerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_TF_BrokerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_LB_BrokerPort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_BrokerStart, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
.addContainerGap())
);
 
jScrollPane1.setViewportView(_TP_BrokerLog);
 
javax.swing.GroupLayout _P_BrokerLayout = new javax.swing.GroupLayout(_P_Broker);
_P_Broker.setLayout(_P_BrokerLayout);
_P_BrokerLayout.setHorizontalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_BrokerLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1)
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_BrokerLayout.setVerticalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 385, javax.swing.GroupLayout.PREFERRED_SIZE))
);
 
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_Client, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_Broker, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_P_Client, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_P_Broker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
 
pack();
}// </editor-fold>//GEN-END:initComponents
 
private void _BT_SubscribeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_SubscribeActionPerformed
if (_BT_Subscribe.isSelected() && _TF_Destination.getText().length() > 0 && _TF_Topic.getText().length() > 0) {
_BT_Subscribe.setText("Unsubscribe");
cl = new Client();
cl.addListener(this);
cl.start(_TF_Destination.getText());
String topic = _TF_Topic.getText();
cl.subscribe(topic);
} else if (_BT_Subscribe.isSelected() == false && _TF_Topic.getText().length() > 0) {
_BT_Subscribe.setText("Subscribe");
String topic = _TF_Topic.getText();
cl.stop(topic);
}
}//GEN-LAST:event__BT_SubscribeActionPerformed
 
private void _BT_BrokerStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_BrokerStartActionPerformed
 
if (_BT_BrokerStart.isSelected()) {
if (_TF_BrokerPort.getText().length() == 0) {
return;
}
 
br = new Broker();
int port = Integer.parseInt(_TF_BrokerPort.getText());
br.start(port);
br.addListener(this);
 
_LB_BrokerEnabled.setBackground(Color.green);
_LB_BrokerEnabled.setText("Enabled");
} else {
br.shutdown();
_LB_BrokerEnabled.setBackground(Color.red);
_LB_BrokerEnabled.setText("Disabled");
}
 
}//GEN-LAST:event__BT_BrokerStartActionPerformed
 
private void _BT_PublishActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_PublishActionPerformed
if (_TF_PublishMessage.getText().length() == 0) {
return;
}
 
if (_TF_PublishMessage.getText().length() == 0 || _TF_Topic.getText().length() == 0)
return;
 
cl.sendMessage(_TF_PublishMessage.getText(), _TF_Topic.getText());
}//GEN-LAST:event__BT_PublishActionPerformed
 
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
 
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUI().setVisible(true);
}
});
}
 
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton _BT_BrokerStart;
private javax.swing.JButton _BT_Publish;
private javax.swing.JToggleButton _BT_Subscribe;
private javax.swing.JLabel _LB_BrokerEnabled;
private javax.swing.JLabel _LB_BrokerPort;
private javax.swing.JPanel _P_Broker;
private javax.swing.JPanel _P_BrokerConfig;
private javax.swing.JPanel _P_Client;
private javax.swing.JPanel _P_ClientConfig;
private javax.swing.JScrollPane _P_ClientLog;
private javax.swing.JPanel _P_ClientPublish;
private javax.swing.JTextField _TF_BrokerPort;
private javax.swing.JTextField _TF_Destination;
private javax.swing.JTextField _TF_PublishMessage;
private javax.swing.JTextField _TF_Topic;
private javax.swing.JTextPane _TP_BrokerLog;
private javax.swing.JTextPane _TP_ClientLog;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel8;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
 
@Override
public void writeToLog(String dest, String type, String tag, String msg) {
SimpleAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setForeground(keyWord, Color.WHITE);
 
switch (type) {
case "e":
StyleConstants.setBackground(keyWord, Color.RED);
break;
case "d":
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
case "i":
StyleConstants.setBackground(keyWord, Color.GREEN);
break;
default:
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
}
 
StyleConstants.setBold(keyWord, true);
StyledDocument document;
 
//Choose the write log panel
if(dest.equals("client"))
document = (StyledDocument) _TP_ClientLog.getDocument();
else
document = (StyledDocument) _TP_BrokerLog.getDocument();
 
try {
document.insertString(document.getLength(), "[" + tag + "]", keyWord);
document.insertString(document.getLength(), " - " + msg + "\n", null);
} catch (BadLocationException ex) {
System.out.println(ex.getMessage());
}
}
}
/trunk/LSB_helpers/MQTT_Playground/src/main/java/fr/inria/arles/mqttplayground/GUI.form
New file
0,0 → 1,367
<?xml version="1.0" encoding="UTF-8" ?>
 
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="MQTT Playground"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Client" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Broker" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_P_Client" min="-2" max="-2" attributes="0"/>
<Component id="_P_Broker" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_P_Client">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Client"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_P_ClientLog" alignment="1" max="32767" attributes="0"/>
<Component id="_P_ClientConfig" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="_P_ClientConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_ClientLog" min="-2" pref="316" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="_P_ClientLog">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
 
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="_TP_ClientLog">
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="_P_ClientConfig">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Configuration"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_BT_Subscribe" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jLabel2" max="32767" attributes="0"/>
<Component id="jLabel1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_TF_Destination" max="32767" attributes="0"/>
<Component id="_TF_Topic" pref="354" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Component id="_P_ClientPublish" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_TF_Destination" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_TF_Topic" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_Subscribe" min="-2" pref="40" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_ClientPublish" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="_TF_Destination">
<Properties>
<Property name="text" type="java.lang.String" value="tcp://127.0.0.1:1884"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Broker:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Topic:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="_TF_Topic">
<Properties>
<Property name="text" type="java.lang.String" value="http://www.lemonde.fr/international/rss_full.xml"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="_BT_Subscribe">
<Properties>
<Property name="text" type="java.lang.String" value="Subscribe"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_SubscribeActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="_P_ClientPublish">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_PublishMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_Publish" min="-2" pref="97" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_TF_PublishMessage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_BT_Publish" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="Message:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="_TF_PublishMessage">
</Component>
<Component class="javax.swing.JButton" name="_BT_Publish">
<Properties>
<Property name="text" type="java.lang.String" value="Publish"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_PublishActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="_P_Broker">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Broker"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Component id="_P_BrokerConfig" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="_P_BrokerConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="385" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_P_BrokerConfig">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Configuration"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="_BT_BrokerStart" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="_LB_BrokerPort" min="-2" pref="39" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_BrokerPort" pref="258" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_LB_BrokerEnabled" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_LB_BrokerEnabled" alignment="3" min="-2" pref="22" max="-2" attributes="0"/>
<Component id="_TF_BrokerPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_LB_BrokerPort" alignment="3" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_BrokerStart" pref="45" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="_TF_BrokerPort">
<Properties>
<Property name="text" type="java.lang.String" value="1884"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="_LB_BrokerPort">
<Properties>
<Property name="text" type="java.lang.String" value="Port:"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="_BT_BrokerStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_BrokerStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="_LB_BrokerEnabled">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="13" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Disabled"/>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
 
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="_TP_BrokerLog">
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
/trunk/LSB_helpers/MQTT_Playground/pom.xml
New file
0,0 → 1,98
<?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>
<groupId>fr.inria.arles</groupId>
<artifactId>MQTT_Playground</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
 
<repository>
<id>Paho Releases</id>
<url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
</repository>
</repositories>
 
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fr.inria.arles.samplemqttclient.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JSON -->
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.1</version>
<type>jar</type>
</dependency>
 
 
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
 
<!-- REST dependencies -->
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>2.1.4</version>
</dependency>
 
<!-- MQTT Depenndencies -->
<dependency>
<groupId>org.dna.mqtt</groupId>
<artifactId>moquette-broker</artifactId>
<version>0.5</version>
</dependency>
 
<dependency>
<groupId>org.dna.mqtt</groupId>
<artifactId>moquette-parser-commons</artifactId>
<version>0.5</version>
</dependency>
 
<dependency>
<groupId>org.dna.mqtt</groupId>
<artifactId>moquette-netty-parser</artifactId>
<version>0.5</version>
</dependency>
 
<dependency>
<groupId>org.fusesource.mqtt-client</groupId>
<artifactId>mqtt-client</artifactId>
<version>1.9</version>
</dependency>
 
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>mqtt-client</artifactId>
<version>0.4.0</version>
</dependency>
</dependencies>
<name>MQTT_Playground</name>
</project>
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/WsClient.java
New file
0,0 → 1,86
/**
* Client.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 4, 2014
*/
package fr.inria.arles.websocketplayground;
 
import java.awt.EventQueue;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
 
public class WsClient{
 
private List<UpdateGUI_Listener> _listeners = new ArrayList<>();
private URI Connector_Address;
private WebSocketClient WebSocket_Conn;
private int msgCount = 0;
 
public void startup(String address, final Object lock) {
try {
try {
Connector_Address = new URI(address);
} catch (URISyntaxException e) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, e);
}
 
System.out.println("Open: " + this);
 
WebSocket_Conn = new WebSocketClient(Connector_Address) {
 
@Override
public void onOpen(ServerHandshake handshakedata) {
writeToLog("d", "OPEN", "Client connected");
}
 
@Override
public void onMessage(String message) {
writeToLog("d", "MESSAGE", message);
}
 
@Override
public void onClose(int code, String reason, boolean remote) {
writeToLog("d", "CLOSE", "Client disconnected " + reason);
}
 
@Override
public void onError(Exception ex) {
writeToLog("e", "ERROR", ex.getMessage());
}
};
 
WebSocket_Conn.connectBlocking();
} catch (InterruptedException ex) {
Logger.getLogger(WsClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
 
public void shutdown() {
WebSocket_Conn.close();
}
 
public void sendMsg(String msg) {
WebSocket_Conn.send(msg);
msgCount = 0;
}
 
public void addListener(UpdateGUI_Listener toAdd) {
_listeners.add(toAdd);
}
 
public void writeToLog(final String type, final String tag, final String msg) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("client", "d", tag, msg);
}
}
});
}
}
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/UpdateGUI_Listener.java
New file
0,0 → 1,15
/*
* 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 fr.inria.arles.websocketplayground;
 
/**
*
* @author mathioud
*/
public interface UpdateGUI_Listener {
public void writeToLog(String dest, String type, String tag, String msg);
}
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/App.java
New file
0,0 → 1,46
/**
* App.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 4, 2014
*/
package fr.inria.arles.websocketplayground;
 
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class App {
 
private static final int port = 7799;
 
public static void main(String[] args) {
 
WsServer ws;
ws = new WsServer(new InetSocketAddress(port));
ws.start();
System.out.println("Server started at port: " + port);
 
System.out.println("Press enter to stop the Server...");
 
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
try {
ws.stop();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
System.out.println("Press Enter to exit app...");
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
System.exit(0);
}
}
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/WsServer.java
New file
0,0 → 1,93
/**
* WsServer.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 4, 2014
*/
package fr.inria.arles.websocketplayground;
 
import java.awt.EventQueue;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.java_websocket.WebSocket;
import org.java_websocket.drafts.Draft;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;
 
public class WsServer extends WebSocketServer {
 
private List<UpdateGUI_Listener> _listeners = new ArrayList<>();
 
public WsServer() throws UnknownHostException {
super();
// TODO Auto-generated constructor stub
}
 
public WsServer(InetSocketAddress address, int decodercount,
List<Draft> drafts, Collection<WebSocket> connectionscontainer) {
super(address, decodercount, drafts, connectionscontainer);
// TODO Auto-generated constructor stub
}
 
public WsServer(InetSocketAddress address, int decodercount,
List<Draft> drafts) {
super(address, decodercount, drafts);
// TODO Auto-generated constructor stub
}
 
public WsServer(InetSocketAddress address, int decoders) {
super(address, decoders);
// TODO Auto-generated constructor stub
}
 
public WsServer(InetSocketAddress address, List<Draft> drafts) {
super(address, drafts);
// TODO Auto-generated constructor stub
}
 
public WsServer(InetSocketAddress address) {
super(address);
}
 
@Override
public void onOpen(WebSocket conn, ClientHandshake handshake) {
writeToGuiLog("d", "OPEN", "Connection opened " + conn.getRemoteSocketAddress());
}
 
@Override
public void onClose(WebSocket conn, int code, String reason, boolean remote) {
writeToGuiLog("d", "CLOSE", "Connection closed " + conn.getRemoteSocketAddress());
}
 
@Override
public void onMessage(WebSocket conn, String message) {
writeToGuiLog("d", "Message", message);
}
 
@Override
public void onError(WebSocket conn, Exception ex) {
System.out.println("Error");
}
 
public void sendToAll(String message){
for ( WebSocket conn: this.connections()) {
conn.send(message);
}
}
 
public void addListener(UpdateGUI_Listener toAdd) {
_listeners.add(toAdd);
}
 
public void writeToGuiLog(final String type, final String tag, final String message) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (UpdateGUI_Listener hl : _listeners) {
hl.writeToLog("server", "d", tag, message);
}
}
});
}
}
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/GUI.java
New file
0,0 → 1,463
/*
* 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 fr.inria.arles.websocketplayground;
 
import java.awt.Color;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
 
/**
*
* @author mathioud
*/
public class GUI extends javax.swing.JFrame implements UpdateGUI_Listener {
 
private WsClient client;
private WsServer server;
 
/**
* Creates new form GUI
*/
public GUI() {
initComponents();
}
 
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
 
_P_Client = new javax.swing.JPanel();
_P_ClientLog = new javax.swing.JScrollPane();
_TP_ClientLog = new javax.swing.JTextPane();
_P_ClientConfig = new javax.swing.JPanel();
_TF_Destination = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
_BT_Connect = new javax.swing.JToggleButton();
_P_ClientPublish = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
_TF_SendMessage = new javax.swing.JTextField();
_BT_Send = new javax.swing.JButton();
_P_Broker = new javax.swing.JPanel();
_P_BrokerConfig = new javax.swing.JPanel();
_TF_ServerPort = new javax.swing.JTextField();
_LB_BrokerPort = new javax.swing.JLabel();
_BT_ServerStart = new javax.swing.JToggleButton();
_LB_ServerEnabled = new javax.swing.JLabel();
_P_ClientPublish1 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
_TF_ServerSendMessage = new javax.swing.JTextField();
_BT_ServerSend = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
_TP_ServerLog = new javax.swing.JTextPane();
 
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Websocket Playground");
 
_P_Client.setBorder(javax.swing.BorderFactory.createTitledBorder("Client"));
 
_P_ClientLog.setViewportView(_TP_ClientLog);
 
_P_ClientConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_Destination.setText("http://127.0.0.1:8887");
 
jLabel1.setText("Destination:");
 
_BT_Connect.setText("Connect");
_BT_Connect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_ConnectActionPerformed(evt);
}
});
 
_P_ClientPublish.setBackground(new java.awt.Color(204, 204, 204));
 
jLabel8.setText("Message:");
 
_BT_Send.setText("Send");
_BT_Send.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_SendActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _P_ClientPublishLayout = new javax.swing.GroupLayout(_P_ClientPublish);
_P_ClientPublish.setLayout(_P_ClientPublishLayout);
_P_ClientPublishLayout.setHorizontalGroup(
_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublishLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_SendMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_Send, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
_P_ClientPublishLayout.setVerticalGroup(
_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublishLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientPublishLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(_TF_SendMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_BT_Send))
.addContainerGap(12, Short.MAX_VALUE))
);
 
javax.swing.GroupLayout _P_ClientConfigLayout = new javax.swing.GroupLayout(_P_ClientConfig);
_P_ClientConfig.setLayout(_P_ClientConfigLayout);
_P_ClientConfigLayout.setHorizontalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_BT_Connect, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_ClientConfigLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_Destination, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE))))
.addComponent(_P_ClientPublish, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_ClientConfigLayout.setVerticalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_TF_Destination, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_Connect, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_ClientPublish, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
 
javax.swing.GroupLayout _P_ClientLayout = new javax.swing.GroupLayout(_P_Client);
_P_Client.setLayout(_P_ClientLayout);
_P_ClientLayout.setHorizontalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_P_ClientLog, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_ClientLayout.setVerticalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_ClientLog)
.addContainerGap())
);
 
_P_Broker.setBorder(javax.swing.BorderFactory.createTitledBorder("Server"));
 
_P_BrokerConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_ServerPort.setText("8887");
 
_LB_BrokerPort.setText("Port:");
 
_BT_ServerStart.setText("Start");
_BT_ServerStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_ServerStartActionPerformed(evt);
}
});
 
_LB_ServerEnabled.setBackground(java.awt.Color.red);
_LB_ServerEnabled.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
_LB_ServerEnabled.setForeground(new java.awt.Color(255, 255, 255));
_LB_ServerEnabled.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
_LB_ServerEnabled.setText("Disabled");
_LB_ServerEnabled.setOpaque(true);
 
_P_ClientPublish1.setBackground(new java.awt.Color(204, 204, 204));
 
jLabel9.setText("Message:");
 
_BT_ServerSend.setText("Send to all");
_BT_ServerSend.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_ServerSendActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _P_ClientPublish1Layout = new javax.swing.GroupLayout(_P_ClientPublish1);
_P_ClientPublish1.setLayout(_P_ClientPublish1Layout);
_P_ClientPublish1Layout.setHorizontalGroup(
_P_ClientPublish1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublish1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_ServerSendMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_ServerSend, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
_P_ClientPublish1Layout.setVerticalGroup(
_P_ClientPublish1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientPublish1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientPublish1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(_TF_ServerSendMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_BT_ServerSend))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
javax.swing.GroupLayout _P_BrokerConfigLayout = new javax.swing.GroupLayout(_P_BrokerConfig);
_P_BrokerConfig.setLayout(_P_BrokerConfigLayout);
_P_BrokerConfigLayout.setHorizontalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_BT_ServerStart, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_BrokerConfigLayout.createSequentialGroup()
.addComponent(_LB_BrokerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_ServerPort, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_LB_ServerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(_P_ClientPublish1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_BrokerConfigLayout.setVerticalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_TF_ServerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_LB_BrokerPort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_LB_ServerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(_BT_ServerStart, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addComponent(_P_ClientPublish1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(7, 7, 7))
);
 
jScrollPane1.setViewportView(_TP_ServerLog);
 
javax.swing.GroupLayout _P_BrokerLayout = new javax.swing.GroupLayout(_P_Broker);
_P_Broker.setLayout(_P_BrokerLayout);
_P_BrokerLayout.setHorizontalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_BrokerLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1)
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_BrokerLayout.setVerticalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerLayout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 499, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
 
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_Client, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_Broker, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(_P_Client, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_P_Broker, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
 
pack();
}// </editor-fold>//GEN-END:initComponents
 
private void _BT_ConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_ConnectActionPerformed
if (_BT_Connect.isSelected() && _TF_Destination.getText().length() > 0) {
Object lock = new Object();
client = new WsClient();
client.addListener(this);
client.startup(_TF_Destination.getText(), lock);
_BT_Connect.setText("Disconnect");
} else if (_BT_Connect.isSelected() == false) {
client.shutdown();
_BT_Connect.setText("Connect");
}
}//GEN-LAST:event__BT_ConnectActionPerformed
 
private void _BT_ServerStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_ServerStartActionPerformed
if (_BT_ServerStart.isSelected()) {
if (_TF_ServerPort.getText().length() == 0) {
return;
}
 
int port = Integer.parseInt(_TF_ServerPort.getText());
server = new WsServer(new InetSocketAddress(port));
server.addListener(this);
 
server.start();
_LB_ServerEnabled.setBackground(Color.green);
_LB_ServerEnabled.setForeground(Color.black);
_LB_ServerEnabled.setText("Enabled");
_BT_ServerStart.setText("Stop");
} else {
try {
server.stop();
_LB_ServerEnabled.setBackground(Color.red);
_LB_ServerEnabled.setForeground(Color.white);
_LB_ServerEnabled.setText("Disabled");
_BT_ServerStart.setText("Start");
} catch (IOException | InterruptedException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
}
 
}
 
}//GEN-LAST:event__BT_ServerStartActionPerformed
 
private void _BT_SendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_SendActionPerformed
if (_TF_SendMessage.getText().length() == 0) {
return;
}
 
client.sendMsg(_TF_SendMessage.getText());
}//GEN-LAST:event__BT_SendActionPerformed
 
private void _BT_ServerSendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_ServerSendActionPerformed
if (_TF_ServerSendMessage.getText().length() == 0) {
return;
}
 
server.sendToAll(_TF_ServerSendMessage.getText());
}//GEN-LAST:event__BT_ServerSendActionPerformed
 
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
 
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUI().setVisible(true);
}
});
}
 
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton _BT_Connect;
private javax.swing.JButton _BT_Send;
private javax.swing.JButton _BT_ServerSend;
private javax.swing.JToggleButton _BT_ServerStart;
private javax.swing.JLabel _LB_BrokerPort;
private javax.swing.JLabel _LB_ServerEnabled;
private javax.swing.JPanel _P_Broker;
private javax.swing.JPanel _P_BrokerConfig;
private javax.swing.JPanel _P_Client;
private javax.swing.JPanel _P_ClientConfig;
private javax.swing.JScrollPane _P_ClientLog;
private javax.swing.JPanel _P_ClientPublish;
private javax.swing.JPanel _P_ClientPublish1;
private javax.swing.JTextField _TF_Destination;
private javax.swing.JTextField _TF_SendMessage;
private javax.swing.JTextField _TF_ServerPort;
private javax.swing.JTextField _TF_ServerSendMessage;
private javax.swing.JTextPane _TP_ClientLog;
private javax.swing.JTextPane _TP_ServerLog;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
 
@Override
public void writeToLog(String dest, String type, String tag, String msg) {
SimpleAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setForeground(keyWord, Color.WHITE);
 
switch (type) {
case "e":
StyleConstants.setBackground(keyWord, Color.RED);
break;
case "d":
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
case "i":
StyleConstants.setBackground(keyWord, Color.GREEN);
break;
default:
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
}
 
StyleConstants.setBold(keyWord, true);
StyledDocument document;
 
//Choose the write log panel
if (dest.equals("client")) {
document = (StyledDocument) _TP_ClientLog.getDocument();
} else {
document = (StyledDocument) _TP_ServerLog.getDocument();
}
 
try {
document.insertString(document.getLength(), "[" + tag + "]", keyWord);
document.insertString(document.getLength(), " - " + msg + "\n", null);
} catch (BadLocationException ex) {
System.out.println(ex.getMessage());
}
}
}
/trunk/LSB_helpers/Websocket_Playground/src/main/java/fr/inria/arles/websocketplayground/GUI.form
New file
0,0 → 1,402
<?xml version="1.0" encoding="UTF-8" ?>
 
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="Websocket Playground"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Client" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Broker" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="_P_Client" max="32767" attributes="0"/>
<Component id="_P_Broker" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_P_Client">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Client"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_P_ClientLog" alignment="1" max="32767" attributes="0"/>
<Component id="_P_ClientConfig" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_ClientConfig" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_ClientLog" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="_P_ClientLog">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
 
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="_TP_ClientLog">
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="_P_ClientConfig">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Configuration"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_BT_Connect" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_Destination" pref="337" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Component id="_P_ClientPublish" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_TF_Destination" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_Connect" min="-2" pref="40" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_ClientPublish" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="_TF_Destination">
<Properties>
<Property name="text" type="java.lang.String" value="http://127.0.0.1:8887"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Destination:"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="_BT_Connect">
<Properties>
<Property name="text" type="java.lang.String" value="Connect"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_ConnectActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="_P_ClientPublish">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_SendMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_Send" min="-2" pref="97" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_TF_SendMessage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_BT_Send" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="12" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="Message:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="_TF_SendMessage">
</Component>
<Component class="javax.swing.JButton" name="_BT_Send">
<Properties>
<Property name="text" type="java.lang.String" value="Send"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_SendActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="_P_Broker">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Server"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Component id="_P_BrokerConfig" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_BrokerConfig" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="499" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_P_BrokerConfig">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Configuration"/>
</Border>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="_BT_ServerStart" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="_LB_BrokerPort" min="-2" pref="39" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_ServerPort" pref="242" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_LB_ServerEnabled" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
<Component id="_P_ClientPublish1" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="_TF_ServerPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_LB_BrokerPort" alignment="3" max="32767" attributes="0"/>
<Component id="_LB_ServerEnabled" alignment="3" min="-2" pref="22" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="12" max="32767" attributes="0"/>
<Component id="_BT_ServerStart" min="-2" pref="40" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Component id="_P_ClientPublish1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="_TF_ServerPort">
<Properties>
<Property name="text" type="java.lang.String" value="8887"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="_LB_BrokerPort">
<Properties>
<Property name="text" type="java.lang.String" value="Port:"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="_BT_ServerStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_ServerStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="_LB_ServerEnabled">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="13" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Disabled"/>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="_P_ClientPublish1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
</Properties>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_TF_ServerSendMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_BT_ServerSend" min="-2" pref="97" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_TF_ServerSendMessage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="_BT_ServerSend" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="Message:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="_TF_ServerSendMessage">
</Component>
<Component class="javax.swing.JButton" name="_BT_ServerSend">
<Properties>
<Property name="text" type="java.lang.String" value="Send to all"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="_BT_ServerSendActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
 
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="_TP_ServerLog">
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
/trunk/LSB_helpers/Websocket_Playground/pom.xml
New file
0,0 → 1,54
<?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>
<groupId>fr.inria.arles</groupId>
<artifactId>Websocket_Playground</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
 
<dependencies>
<!-- JSON -->
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.1</version>
<type>jar</type>
</dependency>
 
 
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
 
<!-- REST dependencies -->
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>2.1.4</version>
</dependency>
 
<!-- Websocket dependencies -->
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.0</version>
</dependency>
 
</dependencies>
<name>Websocket_Playground</name>
</project>
/trunk/LSB_helpers/Websocket_Playground/target/maven-archiver/pom.properties
New file
0,0 → 1,5
#Generated by Maven
#Fri Apr 04 11:13:02 CEST 2014
version=1.0-SNAPSHOT
groupId=fr.inria.arles
artifactId=SampleWebsocketServer
/trunk/LSB_helpers/Websocket_Playground/target/test-classes/.netbeans_automatic_build
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/WsServer$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/WsClient.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI$3.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI$4.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/UpdateGUI_Listener.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI$5.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/WsClient$1.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/WsClient$2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/App.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/WsServer.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/classes/fr/inria/arles/websocketplayground/GUI.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/Websocket_Playground/target/SampleWebsocketServer-1.0-SNAPSHOT.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/LSB_helpers/REST_Playground/src/main/java/fr/inria/arles/restplayground/PlainRestletResource.java
New file
0,0 → 1,68
package fr.inria.arles.restplayground;
 
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.restlet.Response;
import org.restlet.representation.Representation;
import org.restlet.resource.Delete;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.Put;
import org.restlet.resource.ServerResource;
 
public class PlainRestletResource extends ServerResource {
 
private static RestletServer serverRef;
 
public PlainRestletResource() {
}
 
@Get
public String receiveGet() {
return "[OK] - Response from server";
}
 
/**
* Receives a Post request
*
* @param entity Describes the contents of the HTTP post request
* @return
*/
@Post
public Response receivePost(Representation entity) {
if (serverRef != null) {
try {
serverRef.writeToGuiLog("d", "RECEPTION", entity.getText());
} catch (IOException ex) {
Logger.getLogger(PlainRestletResource.class.getName()).log(Level.SEVERE, null, ex);
}
}
Response response = Response.getCurrent();
return response;
}
 
/**
* Receives a Delete request
*
*/
@Delete
public void receiveDelete() {
 
}
 
/**
* Receives a Put request
*
* @param entity Describes the contents of the HTTP post request
*/
@Put
public void receivePut(Representation entity) {
 
}
 
public static void setServerRef(RestletServer server) {
serverRef = server;
}
 
}
/trunk/LSB_helpers/REST_Playground/src/main/java/fr/inria/arles/restplayground/App.java
New file
0,0 → 1,26
/**
* App.java Copyright(c) 2014 Georgios Mathioudakis
* (mathioudakis.giorgos@gmail.com) Created on Apr 2, 2014
*/
package fr.inria.arles.restplayground;
 
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class App {
 
public static void main(String[] args) {
RestletServer server = new RestletServer(8062);
 
// client.sendGetAsyncRequest("http://127.0.0.1:8071", "http://127.0.0.1:8061");
try {
System.in.read();
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
 
server.stopServer();
}
}
/trunk/LSB_helpers/REST_Playground/src/main/java/fr/inria/arles/restplayground/GUI.java
New file
0,0 → 1,403
/*
* 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 fr.inria.arles.restplayground;
 
import java.awt.Color;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
 
/**
*
* @author mathioud
*/
public class GUI extends javax.swing.JFrame implements UpdateGUI_Listener {
 
private RestletServer server;
private RestClient client;
 
/**
* Creates new form GUI
*/
public GUI() {
initComponents();
client = new RestClient();
client.addListener(this);
}
 
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
 
_P_Client = new javax.swing.JPanel();
_P_ClientLog = new javax.swing.JScrollPane();
_TP_ClientLog = new javax.swing.JTextPane();
_P_ClientConfig = new javax.swing.JPanel();
_TF_Destination = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
_CB_Method = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
_TF_ClientMessage = new javax.swing.JTextField();
_BT_Send = new javax.swing.JButton();
_P_Broker = new javax.swing.JPanel();
_P_BrokerConfig = new javax.swing.JPanel();
_TF_ServerPort = new javax.swing.JTextField();
_LB_ServerPort = new javax.swing.JLabel();
_BT_ServerStart = new javax.swing.JToggleButton();
_LB_ServerEnabled = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
_TP_ServerLog = new javax.swing.JTextPane();
 
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("REST Playground");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
 
_P_Client.setBorder(javax.swing.BorderFactory.createTitledBorder("Client"));
 
_P_ClientLog.setViewportView(_TP_ClientLog);
 
_P_ClientConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_Destination.setText("http://127.0.0.1:8062/plain");
 
jLabel1.setText("Destination:");
 
jLabel2.setText("Method:");
 
_CB_Method.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "GET", "POST", "PUT", "DELETE" }));
 
jLabel3.setText("Message:");
 
_TF_ClientMessage.setText("Sample message");
 
_BT_Send.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
_BT_Send.setText("Send");
_BT_Send.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_SendActionPerformed(evt);
}
});
 
javax.swing.GroupLayout _P_ClientConfigLayout = new javax.swing.GroupLayout(_P_ClientConfig);
_P_ClientConfig.setLayout(_P_ClientConfigLayout);
_P_ClientConfigLayout.setHorizontalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_BT_Send, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_TF_Destination, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
.addComponent(_CB_Method, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_TF_ClientMessage))))
.addContainerGap())
);
_P_ClientConfigLayout.setVerticalGroup(
_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientConfigLayout.createSequentialGroup()
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_TF_Destination, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(_CB_Method, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(_P_ClientConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(_TF_ClientMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_Send, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
.addContainerGap())
);
 
javax.swing.GroupLayout _P_ClientLayout = new javax.swing.GroupLayout(_P_Client);
_P_Client.setLayout(_P_ClientLayout);
_P_ClientLayout.setHorizontalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(_P_ClientLog, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_ClientLayout.setVerticalGroup(
_P_ClientLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_ClientLayout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_ClientConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_ClientLog, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
_P_Broker.setBorder(javax.swing.BorderFactory.createTitledBorder("Server"));
 
_P_BrokerConfig.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration"));
 
_TF_ServerPort.setText("8062");
 
_LB_ServerPort.setText("Port:");
 
_BT_ServerStart.setText("Start");
_BT_ServerStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
_BT_ServerStartActionPerformed(evt);
}
});
 
_LB_ServerEnabled.setBackground(java.awt.Color.red);
_LB_ServerEnabled.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
_LB_ServerEnabled.setForeground(new java.awt.Color(255, 255, 255));
_LB_ServerEnabled.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
_LB_ServerEnabled.setText("Disabled");
_LB_ServerEnabled.setOpaque(true);
 
javax.swing.GroupLayout _P_BrokerConfigLayout = new javax.swing.GroupLayout(_P_BrokerConfig);
_P_BrokerConfig.setLayout(_P_BrokerConfigLayout);
_P_BrokerConfigLayout.setHorizontalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(_BT_ServerStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addComponent(_LB_ServerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_TF_ServerPort, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_LB_ServerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
_P_BrokerConfigLayout.setVerticalGroup(
_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerConfigLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(_LB_ServerEnabled, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_TF_ServerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(_LB_ServerPort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_BT_ServerStart, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
.addContainerGap())
);
 
jScrollPane1.setViewportView(_TP_ServerLog);
 
javax.swing.GroupLayout _P_BrokerLayout = new javax.swing.GroupLayout(_P_Broker);
_P_Broker.setLayout(_P_BrokerLayout);
_P_BrokerLayout.setHorizontalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, _P_BrokerLayout.createSequentialGroup()
.addContainerGap()
.addGroup(_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1)
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
_P_BrokerLayout.setVerticalGroup(
_P_BrokerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(_P_BrokerLayout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_BrokerConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
 
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(_P_Client, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(_P_Broker, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(_P_Client, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(_P_Broker, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
 
pack();
}// </editor-fold>//GEN-END:initComponents
 
private void _BT_ServerStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_ServerStartActionPerformed
 
if (_BT_ServerStart.isSelected()) {
if (_TF_ServerPort.getText().length() == 0) {
return;
}
int port = Integer.parseInt(_TF_ServerPort.getText());
server = new RestletServer(port);
server.addListener(this);
_LB_ServerEnabled.setBackground(Color.green);
_LB_ServerEnabled.setText("Enabled");
} else {
server.stopServer();
_LB_ServerEnabled.setBackground(Color.red);
_LB_ServerEnabled.setText("Disabled");
}
}//GEN-LAST:event__BT_ServerStartActionPerformed
 
private void _BT_SendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__BT_SendActionPerformed
if (_TF_Destination.getText().length() == 0) {
return;
}
 
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
 
switch (_CB_Method.getSelectedItem().toString()) {
case "GET": {
executor.schedule(new Runnable() {
@Override
public void run() {
client.sendGetRequest(_TF_Destination.getText());
}
}, 0, TimeUnit.SECONDS);
break;
}
case "POST": {
if (_TF_ClientMessage.getText().length() == 0) {
break;
}
executor.schedule(new Runnable() {
@Override
public void run() {
client.sendPostRequest(_TF_Destination.getText(), _TF_ClientMessage.getText());
}
}, 0, TimeUnit.SECONDS);
break;
}
}
 
}//GEN-LAST:event__BT_SendActionPerformed
 
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
client.shutDownClient();
}//GEN-LAST:event_formWindowClosing
 
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
 
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUI().setVisible(true);
}
});
}
 
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton _BT_Send;
private javax.swing.JToggleButton _BT_ServerStart;
private javax.swing.JComboBox _CB_Method;
private javax.swing.JLabel _LB_ServerEnabled;
private javax.swing.JLabel _LB_ServerPort;
private javax.swing.JPanel _P_Broker;
private javax.swing.JPanel _P_BrokerConfig;
private javax.swing.JPanel _P_Client;
private javax.swing.JPanel _P_ClientConfig;
private javax.swing.JScrollPane _P_ClientLog;
private javax.swing.JTextField _TF_ClientMessage;
private javax.swing.JTextField _TF_Destination;
private javax.swing.JTextField _TF_ServerPort;
private javax.swing.JTextPane _TP_ClientLog;
private javax.swing.JTextPane _TP_ServerLog;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
 
@Override
public void writeToLog(String dest, String type, String tag, String msg) {
SimpleAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setForeground(keyWord, Color.WHITE);
 
switch (type) {
case "e":
StyleConstants.setBackground(keyWord, Color.RED);
break;
case "d":
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
case "i":
StyleConstants.setBackground(keyWord, Color.GREEN);
break;
default:
StyleConstants.setBackground(keyWord, Color.BLUE);
break;
}
 
StyleConstants.setBold(keyWord, true);
StyledDocument document;
 
//Choose the write log panel
if (dest.equals("client")) {
document = (StyledDocument) _TP_ClientLog.getDocument();
} else {
document = (StyledDocument) _TP_ServerLog.getDocument();
}
 
try {
document.insertString(document.getLength(), "[" + tag + "]", keyWord);
document.insertString(document.getLength(), " - " + msg + "\n", null);
} catch (BadLocationException ex) {
System.out.println(ex.getMessage());
}
}
}
/trunk/LSB_helpers/REST_Playground/src/main/java/fr/inria/arles/restplayground/GUI.form
New file
0,0 → 1,340
<?xml version="1.0" encoding="UTF-8" ?>
 
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="REST Playground"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
 
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Client" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="_P_Broker" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="_P_Client" alignment="0" max="32767" attributes="0"/>
<Component id="_P_Broker" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="_P_Client">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Client"/>
</Border>
</Property>
</Properties>
&n