Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK.

Similar presentations


Presentation on theme: "1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK."— Presentation transcript:

1 1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK 1.1 –Usage of specific APIs Unicast Discovery Broadcast Discovery Service Registration Client Search Leasing –Helper utilities included in JSK 1.1 Discovery Management Lease Management Join Manager Schlatter:

2 2 Working with JSK 1.1 Status of JSK 1.1 –JSK 1.1 (Jini Technology Starter Kit, v 1.1) was released in october 2000 by Sun Microsystems, Inc. –JSK 1.1 is the second release of JSK improving JSK 1.01. –Due to the rather short life of JSK there are yet many changes to come. What do you get from Sun Microsystems? –Core APIs to perform all typical tasks in a Jini environment –Helper utilites which gives the programmer high level interfaces to the core APIs –Some implementations of Jini services like reggie, a lookup service, or mahalo, a transaction manager service. –User friendly API documentation in HTML format –Specification docs of Jini in pdf format –Some Jini examples What do you need to run a Jini environment? –In addition to the JSK, one needs the JDK 1.2 (or higher) installed, since reggie is based on RMI. –All other software, like a simple HTTP server, is included in the JSK. Schlatter:

3 3 Jini Environments Lookup Service –Sun shippes an implementation of a lookup service called reggie. –reggie is implemented using the activation system of Java RMI.  an activation server ( rmid ) has to be running –With RMI, serialized instances of objects has to be shipped over the network  a HTTP (any other file delivery protocol like FTP works as well) server has to be running Services and Clients –Jini services and clients has to interact with Jini lookup services in a specified manner. This introduces the need of having at least all of the software pieces responsible for this interaction written in Java and running in a JVM. Service/Client Communication –The Jini specification gives no definitions on how services and clients do communicate (or even if they have to communicate at all). – Possible communication designs: No communication (proxy is the service) RMI proxy Non-RMI proxy (using as an example TCP sockets) RMI with non-RMI proxy Schlatter:

4 4 Writing Jini Software Client Structure in pseudocode –prepare for discovery –discover a lookup service –prepare a template for lookup search –lookup a service –call the service Service Structure in pseudocode –prepare for discovery –discovery a lookup service –create information about a service –export a service –renew leasing periodically Schlatter:

5 5 JSK 1.1 Packages Important Packages –net.jini.discovery These are utility classes and interfaces that conform to the discovery and join protocol defined in the Jini(TM) Discovery and Join Specification.  find lookup services –net.jini.core.discovery A standard utility class for finding particular lookup services.  find a particular lookup service –net.jini.lookup These are interfaces and classes for managing discovery of lookup services.  manage the discovery process –net.jini.core.lookup These are the lookup service interfaces and classes.  communicate with lookup services (e.g. register/find services) –net.jini.lease Interfaces and classes used for lease management.  manage leases –net.jini.core.lease These are distributed leasing interfaces and exception classes.  manipulate a distinct lease –net.jini.core.event The RemoteEventListener interface and related standard classes. –net.jini.space The JavaSpaces TM technology package. Schlatter:

6 6 Specific APIs: Unicast Discovery Packages –net.jini.core.discovery –net.jini.core.lookup Classes –net.jini.core.discovery.LookupLocator LookupLocator(java.lang.String url); LookupLocator(java.lang.String host,int port); ServiceRegistrar getRegistrar(); –net.jini.core.lookup.ServiceRegistrar Schlatter:

7 7 Specific APIs: Broadcast Discovery Packages –net.jini.discovery –net.jini.core.lookup Classes –net.jini.discovery.LookupDiscovery LookupDiscovery(java.lang.String[] groups); void addDiscoveryListener(DiscoveryListener l); –net.jini.discovery.DiscoveryEvent ServiceRegistrar[] getRegistrars(); –net.jini.core.lookup.ServiceRegistrar Interfaces –net.jini.discovery.DiscoverListener void discovered(DiscoveryEvent e); void discarded(DiscoveryEvent e);

8 8 Specific APIs: Service Registration Packages –net.jini.core.discovery –net.jini.core.lookup Classes –net.jini.core.lookup.ServiceRegistrar (= proxy for the lookup service) ServiceRegistration register(ServiceItem item, long leaseDuration); –net.jini.core.lookup.ServiceItem ServiceItem(ServiceID serviceID, java.lang.Object service, Entry[] attrSets); –net.jini.core.lookup.ServiceRegistration (= proxy for the registration) ServiceID getServiceID(); void addAttributes(Entry[] attrSets); void modifyAttributes(Entry[] attrSetTemplates, Entry[] attrSets); void setAttributes(Entry[] attrSets);

9 9 Specific APIs: Client Search Packages –net.jini.core.discovery –net.jini.core.lookup –net.jini.core.entry Classes –net.jini.core.lookup.ServiceRegistrar java.lang.Object lookup(ServiceTemplate tmpl) ServiceMatches lookup(ServiceTemplate tmpl, int maxMatches) –net.jini.core.lookup.ServiceTemplate ServiceTemplate(ServiceID serviceID, java.lang.Class[] serviceTypes, Entry[] attrSetTemplates); –net.jini.core.lookup.ServiceMatches ServiceItem[] items; int totalMatches ; (  items.length) –net.jini.core.lookup.ServiceItem Entry[] attributeSets; java.lang.Object service; ServiceID serviceID; Interfaces –net.jini.core.entry.Entry

10 10 Specific APIs: Leasing Packages –net.jini.core –net.jini.core.lookup –net.jini.core.lease Classes –net.jini.core.lookup.ServiceRegistrar ServiceRegistration register(ServiceItem item, long leaseDuration); –net.jini.core.lookup.ServiceRegistration Lease getLease(); Interfaces –net.jini.core.lease.Lease void cancel(); void renew(long duration); long getExpiration(); (  System.currentTimeMillis() ) static long FOREVER; static long ANY;

11 11 Helper Utilities: Discovery Management Interfaces and classes used for Discovery Management Helper classes –net.jini.discovery.LookupLocatorDiscovery LookupLocatorDiscovery(LookupLocator[] locators); –net.jini.discovery.LookupDiscoveryManager LookupDiscoveryManager(String[] groups, LookupLocator[] locators, DiscoveryListener listener); DiscoveryManagement DiscoveryGroupManagementDiscoveryLocatorManagement LookupDiscoveryLookupLocatorDiscovery LookupDiscoveryManager Looks after discovery events Looks after groups and multicast search Looks after unicast discovery net.jini.discovery

12 12 Helper Utilities: Lease Management Helper Class –net.jini.lease.LeaseRenewalManager LeaseRenewalManager(); LeaseRenewalManager(Lease lease, long desiredExpiration, LeaseListener listener); void renewUntil(Lease lease, long desiredExpiration, LeaseListener listener); Interfaces –net.jinj.lease.LeaseListener void notify(LeaseRenewelEvent e); Called by the LeaseRenewalManager when it cannot renew a lease that it is managing, and the lease's desired expiration time has not yet been reached.

13 13 Helper Utilities: Join Manager Helper Class –net.jini.lookup.JoinManager JoinManager(Object obj, Entry[] attrSets, ServiceIDListener callback, DiscoveryManagement discoverMgr, LeaseRenewalManager leaseMgr); JoinManager(Object obj, /* service */ Entry[] attrSets, ServiceID serviceID, DiscoveryManagement discoverMgr, LeaseRenewalManager leaseMgr); Usage of JoinManager –JoinManager encapsulates all of the necessary steps when registering a service and renewing the leases in all found lookup services. Interfaces –net.jini.lookup.ServiceIDListener void serviceIDNotify(ServiceID serviceID); Called when the JoinManager gets a valid ServiceID from a lookup service.


Download ppt "1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK."

Similar presentations


Ads by Google