The goal for the PS is the implementation of an ObjectSpace similar (but, of course, not as full-featured) to the one implemented by Linda and JavaSpaces, as discussed in class. Each client should be able to add new object instances to the space, retrieve specific instances, search for instances by name, and add callbacks to specific instances, as shown in Figure 1.
Every object in the ObjectSpace has a name that is represented
by a String. Any client should be able to create a new class and
added to the ObjectSpace. Any such object must implement a
getName():String function which returns the name of
the given object and a
returns the hostname of the client that owns that object. You
should enforce this via the use of interfaces. The ObjectSpace
must make sure that there does not already exist an object with
the same name. If there is one then an exception should get
When a client adds a new object, the client still retains "ownership" of the object. That is, if any other clients gets a reference to this object and calls a method on the object, it is the owner of the object that actually executes that method.
Every client should be able to search for instances using the
search(String query) function. This function should
return an iterator which the client can then use to iterate over
all the received results. The
query is a string
with at most one "*" character in it. The "*" is a wildcard. For
example, if the query is "mi*" then the search function should
return references to all the objects whose names start with
Once the client knows the name of the object it wants, it can
retrieve it with the
get(String name) function. The
client should then be able to call the methods on this object
which will execute on the owner's machine.
A client is also able to delete an object from the ObjectSpace, but only it is the same client that added it in the first place. Your implementation should check for this and throw an exception if a client tries to delete an object it does not own.
A client can also set callbacks. You will implement two type of callbacks. The first callback should be called whenever a new object is added to the ObjectSpace. The second callback is called whenever some client calls anyone of the methods on an object that is part of the object space. You must provide an API for the clients to register for these callbacks, if they want to.
You must provide a set of tests that are easy to run and test all the requirements as specified above. Some specific issues to test for are:
Proper design is very important in this PS. You will need to spend a lot of time thinking about possible designs to make sure that yours can accomplish all that I ask for. Note that I am not asking for the ObjectSpace to be distributed, only that the actual objects should be owned by their creators. Your design will also impose some restrictions on your users about how these objects are to be created, that is fine.
Since the design of this project is very important, your design document will count for a large portion of your grade. That is, you need to turn in
I understand that it is the responsibility of every member of the Carolina community to uphold an maintain the academic standards and integrity of the University of South Carolina. Any member of the University community, who has reasonable grounds to believe that an infraction of the Code of Student Academic Responsibility has occurred, has an obligation to report the alleged violation.
I certify that I have neither given nor received unauthorized aid on this problem set.