Presentation is loading. Please wait.

Presentation is loading. Please wait.

16-1 Developer Libraries and Services. 16-1 Learning Objectives: ● This module will help you... – Learn about optional JXTA libraries and services – Understand.

Similar presentations


Presentation on theme: "16-1 Developer Libraries and Services. 16-1 Learning Objectives: ● This module will help you... – Learn about optional JXTA libraries and services – Understand."— Presentation transcript:

1 16-1 Developer Libraries and Services

2 16-1 Learning Objectives: ● This module will help you... – Learn about optional JXTA libraries and services – Understand the goals of the JXTA Easy Entry Library (EZEL) project – Understand the benefits of the JXTA Abstraction Library (JAL) API – Gain familiarity with the JAL API – Learn about other JXTA services

3 16-1 Overview ● Optional Libraries – EZEL – JAL ● JXTA Services – JAAS – JNLP – RMI, SOAP, etc.

4 16-1 EZEL Overview ● EZEL = Easy Entry Library for JXTA ● Goal: – Enable a client-server developer – with no JXTA or P2P experience – to create a JXTA service in a single afternoon ● Provides client/server-like API – Hides implementation details – Provides reasonable defaults

5 16-1 Benefits ● Simplifies JXTA application development – Reduces the learning curve – Provides “best practices” for handling common JXTA programming tasks ● Complete isolation from API changes ● Can “learn as you go” and supplement API with direct JXTA programming

6 16-1 JAL: JXTA Abstraction Library ● Extension to EZEL ● API for commonly used JXTA primitives – Discover peers (and allow to be discovered) – Search for peers and peergroups – Create and manage peergroups – Communicate with other peers – Get information about peers and peergroups

7 16-1 JAL Architecture Application EZEL J XTA Abstraction Layer JXTA Peer interface

8 16-1 EZEL Classes ● class net.pkg.jal.EZAdvertisement ● class net.pkg.jal.EZCommunication ● class net.pkg.jal.EZDiscovery ● class net.pkg.jal.EZDisplay ● class net.pkg.jal.EZGroups ● class net.pkg.jal.EZMinimalPeer – Implements net.pkg.jal.Peer, net.jxta.pipe.PipeMsgListener ● class net.pkg.jal.EZUtilities

9 16-1 JAL API ● void boot(String name) void boot(String name, String group) – Boot the peer; every peer must call it ● void publish() – Publish peer so other can discover it ● String getName() – Get the name of this peer ● String[] getPeers() – Get peers associated with this peer in current peergroup

10 16-1 JAL API Message Functions ● boolean sendMessage(String name, Message msg) Message receiveMessage() – Send or receive a message ● boolean broadcast(Message msg) – Broadcast a message to everyone in the group ● Message newMessage() – Create a new, blank message ● void pushObject(Message msg, String tag, Object obj) Object popObject(Message msg, String tag) – Push/pop an object to the Message

11 16-1 JAL API Group Functions ● String[] getGroups() – Get peergroups associated with this peer ● void createGroup(String name) – Create a new group ● void createAndOrJoinGroup(String name) – Create and/or join group ● void joinGroup(String name) – Join a group ● void leaveGroup(String name)

12 16-1 JAL API Search & Display Functions ● boolean searchGroupWithName(String name) – Search for a peergroup ● boolean searchPeerWithName(String name) – Search for a peer ● void displayPeers() void displayGroups() void displayServices() – Display all peers, peergroups, or services in the current peergroup ● String getPeerStatistics() – Display some useful statistics

13 16-1 JAL Example import net.jxta.endpoint.Message; import net.pkg.jal.*; import java.io.*; public class TestApp { private static Peer me; public static void main (String args[]) { me = new EZMinimalPeer(); try { me.boot("MDE" + args[0]); me.displayPeers(); me.displayGroups(); me.createGroup("MDE"); me.displayGroups(); me.joinGroup("MDE"); me.displayPeers(); me.displayGroups(); //finally try out getJoinedGroups String a[] = me.getJoinedGroups(); System.out.println("getJoinedGroups:"); for(int i = 0; i < a.length; i++){ System.out.println(a[i]); } System.exit(0); }catch (Exception e) { e.printStackTrace(); System.exit(0); } System.exit(0); } }

14 16-1 JAAS Overview ● Java Authentication and Authorization Service (JAAS) – Enables services to authenticate and enforce access controls upon users – Supports user-based authorization ● Releases – Integrated into the Java 2 SDK, Standard Edition, v 1.4 – Optional package to the Java 2 SDK, v 1.3.x

15 16-1 JAAS Membership Service Project ● JAAS MemberShip Service – JXTA MembershipService implementation ● Uses JAAS for authentication – Leverage existing authentication services ● (JNDI, LDAP, NIS, WinNT, and Unix) – Provides a framework for integrating new authentication services ● (Liberty, SAML, Passport) ● Status – A functional implementation of JaasMembershipService is in place ● http://jaas-membership.jxta.org

16 16-1 try { MembershipService membership = jaasGroup.getMembershipService(); AuthenticationCredential authCred = new AuthenticationCredential(jaasGroup, "JAAS", null); membership.join(membership.apply(authCred)); Enumeration enum = membership.getCurrentCredentials(); if(enum.hasMoreElements()) { JaasCredential subjCred = (JaasCredential)enum.nextElement(); Subject subject = subjCred.getSubject(); } else { System.out.println("No Credentials!"); } } catch (Exception e) { } Code Example

17 16-1 JXTA JnlpLoader Project ● Goals: – An implementation of JxtaLoader ● Utilizes Java Network Launching (JNLP) to load modules, and resources ● JnlpLoader is based on OpenJNLP ● http://openjnlp.nanode.org/ ● Status – Basic functionality is complete ● http://jnlploader.jxta.org/

18 16-1 JXTA Community Services ● http://services.jxta.org – SOAP ● JXTA SOAP bindings – JXTA-RMI ● RMI API on top of JXTA – Validation Service ● A ValidationService for JXTA Advertisements – Many more...

19 16-1 Developer Libraries and Services


Download ppt "16-1 Developer Libraries and Services. 16-1 Learning Objectives: ● This module will help you... – Learn about optional JXTA libraries and services – Understand."

Similar presentations


Ads by Google