next up previous contents
Next: The Promise Class Up: The Haystack Data Model Previous: The tie.Causal Class

The NeedleWeavable Interface and Needle Class

  An important issue that we have so far glossed over involves the content of Straws. NeedleWeavable, and its implementation Needle, provides us with the mechanism for holding actual ``data.'' One could say that these Needles represent atomic values within the Haystack graph. However, calling them ``atomic'' is slightly misleading. Needles have the same functionality as Straws in their ability to be linked from and to by other Straws. They are atomic in that they provide wrappers around pre-existing data (such as files, database entries, web pages, etc).

This difference should be obvious to those with knowledge of database systems. However, in Haystack we extend the concept of database primitive from the usual set of strings, ints, reals, etc. The Haystack data model primitive provides a wrapper around any conceivable data type. For example a needle.Text represents a wrapping around a particular bit of digital text. An needle.Date may wrap around a long representation of the date.

To access this information, NeedleWeavable defines the getData() method. The return type of getData() is of the Java Object class. Therefore it is up to the programmer to cast the Object to a more specific type. So for example, postsciptNeedle.getData() may return a String, or an integer, or some other primitive type. The setData(...) operation of the Needle will also take as argument an Object. However, the Needle programmer may throw a NeedleDataException if the data is not castable to the required format. For example, if the Needle is supposed to hold an integer, and is passed the string: ``foo bar mumble,'' a NeedleDataException is throw.

It is our hope that this flexibility will not cause great difficulties to the programmers and users of our system. By properly specifying the behavior of all nodes we hope that the added functionality will allow for a richer set of services and applications.




next up previous contents
Next: The Promise Class Up: The Haystack Data Model Previous: The tie.Causal Class

Copyright 1998, Eytan Adar (eytan@alum.mit.edu)