Storing your WFS in a JAR

The initial version of WFS in v0.3 came with a cool feature: your WFS can be packaged as a JAR file and located either on disk or over the net. The WFS tutorial (here) hinted at this feature towards the end, but I wanted to expand upon it here and what I had in mind when I included it in the code.

First off, you can package your WFS as a JAR simply as:

% jar cvf mywfs.jar ./my-wfs

where my-wfs is the root of your WFS directory on disk.

Then, you set the wonderland.wfs.root property to point to that JAR, for example: jar:file:/home/me/mywfs.jar!/. Don’t forget the final !/; Java won’t parse the URL properly without it.

You can also store the JAR file over the network and load it from there. In that case, set the wonderland.wfs.root property to something like: jar:http://www.me.com/mywfs.jar!/.

It let’s you, for example, package up your world, export it via the net, and let others use the same world definition as you.

In the future I can see this feature being used in several ways:

1. The world gets automatically generated on-the-fly by web server code (e.g. servlet), perhaps as a result of HTTP parameters passed to it. (Staring in v0.4, we’ll be providing a more robust API and class library to both read and write WFSs).

2. Break the definition of a world into a collection of individual WFSs, each stored in JARs. We could, for example, include a new cell type (WFSCell) that is simply a collection of cells stored within a WFS JAR file. In your world, you can include cells as you do today, but also WFS cells that simply point to a portion of the world stored as a JAR elsewhere. This can be used to borrow components of a world (e.g. a room design) from elsewhere, and also enable highly-reconfigurable provisioning of the world space (e.g. break the world into a set of regions, each defined by a WFS cell that points elsewhere letting individual users control their own space). (Interesting challenge: The world definition is a directed acyclic graph where we would need to prevent infinite loops in its definition).

What do you think? Let me know your ideas!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 56 other followers

%d bloggers like this: