Version 19 (modified by 6 years ago) ( diff ) | ,
---|
Genius2 ProfilesServer
This is the home page of the genius2 profiles server. This server serves domain and profile files to interested parties, and can inform them of changes.
The profilesserver only serves profiles, it does not define them. To define profiles, check the genius2 core pages.
The Genius2 core/main page is here.
Installation
- Install your apache-tomcat 8 installation https://tomcat.apache.org/download-80.cgi. You can re-use an existing installation.
- Download the parties server war file from the artifactory. Go into the latest version of the partiesserver and download (right click) the war file. NOTICE: your browser must have cookies enabled to access the artifactory.
- Copy the downloaded war file into the tomcat webapps directory
- (Re)start tomcat
Now your local profilesserver should be up and running.
After installing and starting, go to http://localhost:8080/profilesserver-XXX (replace XXX with the version you installed) to see if it works.
Communication protocol
This section describes the communication protocols with the profilesserver.
Other implementations of a profilesserver should adhere to the same communication protocols to ensure compatibility with genius2.
List of available profiles
Clients can receive the list of available profiles as follows
- create a websocket to the server at
ws:...profilesserver/websocket/liststream
- The server sends the clients a JSON map, with the keys being the URI of the element containing a GeneralPartyInfo object.
- A new, full list is sent every time something changes in the list.
The java implementation provided here continuously checks the files inside the apache-tomcat directory webapps/profilesserverXXX/domainsrepo
. If you drop or rename files in there, it is detected automatically, the files are (re) parsed and made available.
Downloading a profile programatically
To download a profile in your agent, create a websocket and fetch the profile.
There are java examples available here. Basically you just open a websocket and read the incoming profile like this
WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(5000); WebSocket ws = factory.createSocket("ws://localhost:8080/profilesserver/websocket/get/jobs/jobs1"); ws.addListener(this); ... @Override public void onTextMessage(WebSocket websocket, String json) throws Exception { System.out.println("received profile: " + new ObjectMapper().readValue(json, Profile.class)); }
Using the source code
You can download the source repository. Note that you don't need this if you just want to use the profiles server.
svn checkout https://tracinsy.ewi.tudelft.nl/svn/Genius2ProfilesServer/
Since this is a tomcat web application, you need Eclipse Enterprise edition if you want to run this from Eclipse. Also, to checkout from Eclipse, you need to prepare Eclipse for this. Check https://tracinsy.ewi.tudelft.nl/trac/Genius2/wiki/WikiStart
It is maven based so you only need maven to compile the code.
Attachments (1)
- home.png (1.3 MB ) - added by 5 years ago.
Download all attachments as: .zip