html5-img
1 / 13

JSK 1.1 A practical Approach

Schlatter:. 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

ikia
Télécharger la présentation

JSK 1.1 A practical Approach

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Schlatter: JSK 1.1A 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

  2. Schlatter: 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.

  3. Schlatter: 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

  4. Schlatter: 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

  5. Schlatter: JSK 1.1 Packages • Important Packages • net.jini.discoveryThese 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.discoveryA standard utility class for finding particular lookup services.  find a particular lookup service • net.jini.lookupThese are interfaces and classes for managing discovery of lookup services. manage the discovery process • net.jini.core.lookupThese are the lookup service interfaces and classes. communicate with lookup services (e.g. register/find services) • net.jini.leaseInterfaces and classes used for lease management.  manage leases • net.jini.core.leaseThese are distributed leasing interfaces and exception classes. manipulate a distinct lease • net.jini.core.eventThe RemoteEventListener interface and related standard classes. • net.jini.spaceThe JavaSpacesTM technology package.

  6. Schlatter: 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

  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.DiscoveryEventServiceRegistrar[] getRegistrars(); • net.jini.core.lookup.ServiceRegistrar • Interfaces • net.jini.discovery.DiscoverListenervoid discovered(DiscoveryEvent e); void discarded(DiscoveryEvent e);

  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. Specific APIs:Client Search • Packages • net.jini.core.discovery • net.jini.core.lookup • net.jini.core.entry • Classes • net.jini.core.lookup.ServiceRegistrarjava.lang.Object lookup(ServiceTemplate tmpl) ServiceMatcheslookup(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.ServiceItemEntry[] attributeSets; java.lang.Object service; ServiceID serviceID; • Interfaces • net.jini.core.entry.Entry

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

  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); net.jini.discovery DiscoveryLocatorManagement DiscoveryGroupManagement Looks after groups and multicast search Looks after unicast discovery DiscoveryManagement Looks after discovery events LookupLocatorDiscovery LookupDiscovery LookupDiscoveryManager

  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.LeaseListenervoid 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. 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.ServiceIDListenervoid serviceIDNotify(ServiceID serviceID);Called when the JoinManager gets a valid ServiceID from a lookup service.

More Related