Title: Developer Libraries and Services
1Developer Libraries and Services
2Learning 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
3Overview
- Optional Libraries
- EZEL
- JAL
- JXTA Services
- JAAS
- JNLP
- RMI, SOAP, etc.
4EZEL 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
5Benefits
- 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
6JAL 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
7JAL Architecture
Application
EZEL
Peer interface
JXTA Abstraction Layer
JXTA
8EZEL 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.PipeMsg
Listener - class net.pkg.jal.EZUtilities
9JAL 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
10JAL 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
11JAL 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)
12JAL 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
13JAL Example
- import net.jxta.endpoint.Messageimport
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"
args0) me.displayPeers() me.displayGroups(
) me.createGroup("MDE") me.displayGroups()
me.joinGroup("MDE") me.displayPeers() me.d
isplayGroups() //finally try out
getJoinedGroups String a me.getJoinedGroups(
) System.out.println("getJoinedGroups") for
(int i 0 i lt a.length i) System.out.prin
tln(ai) System.exit(0) catch
(Exception e) e.printStackTrace() System.ex
it(0) System.exit(0)
14JAAS 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
15JAAS 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 JaasMembershipServi
ce is in place - http//jaas-membership.jxta.org
16Code Example
try MembershipService membership
jaasGroup.getMembershipService()
AuthenticationCredential authCred
new AuthenticationCredential(jaasGroup,
"JAAS",
null) membership.join(membership.apply(authCred)
) Enumeration enum membership.getCurrentCreden
tials() if(enum.hasMoreElements())
JaasCredential subjCred (JaasCredential)enum
.nextElement() Subject subject
subjCred.getSubject() else System.out.prin
tln("No Credentials!") catch (Exception e)
17JXTA 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/
18JXTA 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 ...
19Developer Libraries and Services