The Tupelo Server Webapp is a Java servlet that can be used to provide remote access to a Tupelo Context. For information about the protocol used, see the Tupelo Server Protocol specification.

Download / Build

Download

The release version of the Tupelo Server Webapp is available at:

http://dlt-dev.ncsa.uiuc.edu/m2/org/tupeloproject/tupelo-server-webapp/2...

Building from the SVN head

Check out the tupelo-server-webapp module from [https://svn.ncsa.uiuc.edu/svn/tupelo/trunk/tupelo-all/tupelo-server-webapp/ [https://svn.ncsa.uiuc.edu/svn/tupelo/trunk/tupelo-all/tupelo-server-webapp/]].

Or if you check out all of Tupelo from the SVN head, you will get tupelo-server-webapp along with it.

Run

mvn package

This will create a tupelo.war file in the "target" directory. This can be deployed to Tomcat as-is and by default will provide access to a MemoryContext (whose contents will only persist as long as Tomcat is up). See the sections below for configuration details.

Server configuration

Servlet name and URL pattern

By default, the tupelo servlet is called "tupelo" and is deployed at "/tupelo". Depending on how you deploy the webapp, it will probably also be called "tupelo", in which case the URL of the servlet will be

"http://{host}:{port}/tupelo/tupelo"

To change those mappings, edit the WEB-INF/web.xml in the tupelo webapp.

Authentication

By default, the tupelo servlet only permits users in the "tupelo-user" role to connect, with basic authentication. To create a user called "fred" with a password "x88)f3z_" and role "tupelo-user" in your Tomcat installation, add the following lines to $CATALINA_HOME/conf/tomcat-users.xml:

<role rolename="tupelo-user"/>
<user username="fred" password="x88)f3z_" roles="tupelo-user"/>

If you don't want authentication, or don't want Tomcat to handle authentication, just remove the authentication-specific stuff from WEB-INF/web.xml in the tupelo webapp.

Context

The Tupelo Server Webapp uses the Context specified in the configuration file at WEB-INF/default.rdf. If no such file exists the server runs backed by a MemoryContext-- the server will respond to requests, but any data and metadata written to it will not be stored when the server or servlet is shut down.

If no configuration file exists, accessing the root URL for the server will present a form for configuring a persistent context.

Currently, only contexts backed by PostgreSQl or MySQL can be configured using the setup form.

The configuration file can also be created programmatically using JenaContextFactory. This example creates a MysqlContext and saves it in /home/fred/tomcat/webapps/tupelo/WEB-INF/default.rdf:

MysqlContext mc = new MysqlContext();
mc.setJdbcUrl("jdbc:mysql://localhost/tsw?user=fred&password=ff7sjhw7");
JenaContextFactory jcf = new JenaContextFactory();
jcf.setDefaultContext(mc, new File("/home/fred/tomcat/webapps/tupelo/WEB-INF/default.rdf"));

[note: this is deprecated; PeerFacade and RdfXml should be used instead]

Note that any libraries required by the Context implementation you want to use need to be in the webapp's classpath. The easiest way to do this is to add a dependency to tupelo-server-webapp's pom.xml and run "mvn package" to create the war file.

Client configuration

To connect to a Tupelo server, create a HttpTupeloClient instance and set its tupeloUrl property to the URL of the deployed servlet. To authenticate, call the setUsername and setPassword methods. Like this:

HttpTupeloClient client = new HttpTupeloClient();
client.setTupeloUrl("http://localhost:8080/tupelo/tupelo");
client.setUsername("fred");
client.setPassword("x88)f3z_");

Then use it like any other Context.

  • No labels