13.07.2015 Views

Page 2 Lecture Notes in Computer Science 2865 Edited by G. Goos ...

Page 2 Lecture Notes in Computer Science 2865 Edited by G. Goos ...

Page 2 Lecture Notes in Computer Science 2865 Edited by G. Goos ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A New Framework for Build<strong>in</strong>g Secure Collaborative Systems 167ta<strong>in</strong> <strong>in</strong>terface X, called the omnihandle's target <strong>in</strong>terface. (A handle can implementmore than one target <strong>in</strong>terface if desired. An omnihandle for <strong>in</strong>terface Foo; the omnihandleis named allFoos is created <strong>by</strong> code like this:Foo allFoos = M2MI.getOmnihandle(Foo.class);Once an omnihandle is created, call<strong>in</strong>g method doSometh<strong>in</strong>g on the omnihandlefor <strong>in</strong>terface AnInterface means, “Every object out there that implements <strong>in</strong>terfaceAnInterface, perform method doSometh<strong>in</strong>g.” The method is actuallyperformed <strong>by</strong> whichever objects implement<strong>in</strong>g <strong>in</strong>terface AnInterface exist at the timethe method is <strong>in</strong>voked on the omnihandle. Thus, different objects could respond to anomnihandle <strong>in</strong>vocationat different times. Three objects implement<strong>in</strong>g <strong>in</strong>terface Foo,objects A, B, and D, happen to be <strong>in</strong> existence at that time; so all three objects performmethod y. Note that even though object D did not exist when the omnihandleallFoos was created, the method is nonetheless <strong>in</strong>voked on object D.The target objects <strong>in</strong>voked <strong>by</strong> an M2MI method call need not reside <strong>in</strong> the sameprocess as the call<strong>in</strong>g object. The target objects can reside <strong>in</strong> other processes or otherdevices. As long as the target objects are <strong>in</strong> range to receive a broadcast from thecall<strong>in</strong>g object over the network, the M2MI layer will f<strong>in</strong>d the target objects and performa remote method <strong>in</strong>vocation on each one.Export<strong>in</strong>g ObjectsTo receive <strong>in</strong>vocations on a certa<strong>in</strong> <strong>in</strong>terface X, an application creates an object thatimplements <strong>in</strong>terface X and exports the object to the M2MI layer. Thereafter, theM2MI layer will <strong>in</strong>voke that object's method Y whenever anyone calls method Y onan omnihandle for <strong>in</strong>terface X. An object is exported with code like this:M2MI.export(b, Foo.class);Foo.class is the class of the target <strong>in</strong>terface through which M2MI <strong>in</strong>vocations willcome to the object. We say the object is “exported as type Foo.” M2MI also lets anobject be exported as more than one target <strong>in</strong>terface. Once exported, an object staysexported until explicitly unexported:M2MI.unexport(b);In other words, M2MI does not do distributed garbage collection (DGC). In manydistributed collaborative applications, DGC is unwanted; an object that is exported <strong>by</strong>one device as part of a distributed application should rema<strong>in</strong> exported even if thereare no other devices <strong>in</strong>vok<strong>in</strong>g the object yet. In cases where DGC is needed, it can beprovided <strong>by</strong> a leas<strong>in</strong>g mechanism explicit <strong>in</strong> the <strong>in</strong>terface.UnihandlesA unihandle for an <strong>in</strong>terface stands for “one particular object out there that implementsthis <strong>in</strong>terface.” An application can export an object and have the M2MI layer

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!