Login | Register
My pages Projects Community openCollabNet

jswitchboard
Project home

If you were registered and logged in, you could join this project.

Summary A Java library enabling the loose coupling of components.
Category libraries
License GNU Lesser Public License
Owner(s) rexorient

jSwitchboard is a Java library enabling the loose coupling of components in an application. Loosely coupled components can be added, removed, or replaced without modifying the rest of the application. Components can be plugins, protocols, UIs, etc

Summary

jSwitchboard is designed to connect entities generating events to entities interested in those events. An event is defined using a dot separated name like weather.usa.colorado.boulder.rain.started. Entities can register as creators of this event. Similarly, entities can register to listen for this event. Listeners can use wild cards to specify which events they are interested in. A listener who wants to receive rain information for all of Colorado could register as weather.usa.colorado.*.rain.*, matching any rain event for any Colorado city. It is possible to register a listener without the event being registered, and vice versa.

The switchboard connects events with listeners. When an event is fired, all listeners interested in it are called. The listener list is created and updated when events and listeners are registered or unregistered. The firing of an event takes very little processing, as all that is required is walking the existing list of interested listeners. Each listener has a priority; upon firing of an event, the listeners are called sequentially in order of priority. The listeners are called on the thread which fired the event, and listeners which perform lots of processing should hand the event over to another thread.

When an event is fired, a set of parameters can be provided. These parameters are used to call the method associated with each of the listeners.

Mission

The intent of this project is to make jSwitchboard a widely used anonymous event system. Currently jSwitchboard provides basic anonymous event capabilities within one JVM. This needs to be extended to provide cross-JVM, cross-machine, and cross-application anonymous messaging.

Currently planned features:

  • Link multiple jSwitchboard's together -- within one JVM, on one machine, and across networks.
  • Multiple entities being able to fire the same event.
  • Application / Owner isolation by signing and encrypting events
  • Support multiple event profiles (sequential, sequential distributed, parallel, parallel distributed, etc.)

Anonymous Events

Anonymous events are events for which the recipient doesn't know who sent them, and the sender doesn't know who the recipients are. Having anonymous events help to make the parts of an application loosely coupled, but are invaluable when trying to couple multiple applications or devices together. For example, a heart-rate monitor embedded in a shirt (in the relatively near future) needs to send a distress call. Rather than developing specific protocols to let the device talk to a cell phone (like a Distress protocol for bluetooth), the device could issue a distress event. jSwitchboard would broadcast this event over bluetooth, and the cell phone's application would respond to it. Similarly, a PDA connected to WIFI could respond to it as well, and initiate a VoIP Wifi call.

Anonymous does not mean the events have to be insecure, that the sender can't be trusted, nor that they can be received by anyone. In the above example, a common secret can be provided to all the devices, and the event can be encrypted using that secret. As long as every shirt and device owned by that person receives the secret, they will always be able to use secure anonymous events.

What jSwitchboard has been used for

To do: Document IM and analytical system.

Related resources

Firing events across multiple machines/JVMs will be implemented using JavaGroups.