SQLSpaces is an implementation of the TupleSpaces concept that features many new ideas while keeping the API clear and simple. It is based on top of a relational database, which gives the project its name.
The idea of TupleSpaces goes back to the mid-80s, when they were first introduced by Gelernter and Carriero from Yale University together with the Linda coordination language. The idea is to have a client server architecture with a communication solely based on tuples, i.e. ordered lists of primitive data. The clients can write and take tuples from the server and do not need to know anything about other clients. They just communicate over the server without "knowing" any other client's address. The query mechanisms of a TupleSpaces system are mainly associative, i.e. the queries are defined by creating templates tuples with so-called formal fields, that are interpreted as wildcards.
TupleSpaces are an elegant and easy way of creating distributed software systems that are robust and modular since they are loosely coupled. In addition to the original set of operations (in, out, rd) and to some typical features already known by other TupleSpaces implementations, SQLSpaces furthermore introduces some unique features like multi-language support, versioning, reverse structured naming, wildcard fields and now even support for Android.
Show me some code!¶
This example shows how to establish a connection, write a tuple to the space, and take it out.
TupleSpace ts = new TupleSpace(); Tuple t1 = new Tuple("MyFirstTuple", 1); ts.write(t1); Tuple templateTuple = new Tuple(String.class, Integer.class); Tuple returnTuple = ts.take(templateTuple);
More in the Quickstart!
How to get the SQLSpaces?¶
Basically you only need to download and run the server via the startServer.bat or startServer.sh file:
If you want (and you actually should) use Maven just add the following dependency pom and it will (almost) work.
1 <dependencies> 2 <dependency> 3 <groupId>info.collide</groupId> 4 <artifactId>sqlspaces-client</artifactId> 5 <version>4.0.0-beta2</version> 6 <scope>compile</scope> 7 </dependency> 8 </dependencies>
Visit Download for more information about how to add the dependency to the SQLSpaces libraries and to add the Collide Maven repository. Also check the Quickstart section and the Wiki for more information.
Doing it the old-school way, you need to add the following three jars to your project:
That's basically it. Don't forget to check the Quickstart section and the Wiki for more information.