JXTA

net.jxta.membership
Interface MembershipService

All Superinterfaces:
Module, Service

public interface MembershipService
extends Service

Allows a peer to establish an identity within a peer group. Identities are used by services and applications to determine the capabilities available to peers. A peer have any number of identities at one time. Once an identity has been established a Credential object is available which allows the peer to prove that it rightfully has that identity.

The sequence for associating an identity with a peer within a peer group is as follows:

Apply An application or service provides the membership service with an initial credential which may be used by the membership service to determine the method of authentication to be used for establishing the identity. If the membership service implementations allows authentication using the requested mechanism then an Authenticator object is returned.
Join The application or service completes the authenticator. This may involve presenting a user interface, completing challenges, etc. How the authenticator is completed depends on the type of membership service and authenticator in use.

Once completed, the authenticator is returned to the membership service. If the authenticator has been correctly completed, a new credential for the new identity will be available to the peer from the membership service.

Resign Whenever the application or service no longer wishes to no longer use the identities it has claimed, it may resign from the peergroup. This will cause any identity credentials held by the membership service to discarded.

See Also:
Credential, AuthenticationCredential

Field Summary
static String ADD_CREDENTIAL_PROPERTY
          Property name for credential addition bound property.
static String DEFAULT_CREDENTIAL_PROPERTY
          Property name for the default credential bound property.
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a listener
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener.
 Authenticator apply(AuthenticationCredential application)
          Request the necessary credentials to join the group with which this service is associated.
 Enumeration<AuthenticationCredential> getAuthCredentials()
          Deprecated. This interface is being removed in favour of individual Credentials providing their AuthenticationCredential as appropriate.
 Enumeration<Credential> getCurrentCredentials()
          Returns the current credentials for this peer.
 Credential getDefaultCredential()
          Returns the default credential for this peer.
 Credential join(Authenticator authenticated)
          Join the group by virtue of the completed authentication provided.
 Credential makeCredential(Element element)
          Given a fragment of a StructuredDocument, reconstruct a Credential object from that fragment.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a listener
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a listener
 void resign()
          Resign all credentials which were previously gained through prior join() operations.
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Field Detail

DEFAULT_CREDENTIAL_PROPERTY

static final String DEFAULT_CREDENTIAL_PROPERTY
Property name for the default credential bound property.

See Also:
Constant Field Values

ADD_CREDENTIAL_PROPERTY

static final String ADD_CREDENTIAL_PROPERTY
Property name for credential addition bound property.

See Also:
Constant Field Values
Method Detail

apply

Authenticator apply(AuthenticationCredential application)
                    throws PeerGroupException,
                           ProtocolNotSupportedException
Request the necessary credentials to join the group with which this service is associated.

Parameters:
application - The authentication Credential associated with this membership application. See AuthenticationCredential for more information.
Returns:
An Authenticator for the membership service.
Throws:
PeerGroupException - Thrown in the event of errors.
ProtocolNotSupportedException - if the authentication method requested in the application is not supported by this service.

join

Credential join(Authenticator authenticated)
                throws PeerGroupException
Join the group by virtue of the completed authentication provided.

Parameters:
authenticated - the completed authentication.
Returns:
Credential the credential for this completed authentication.
Throws:
PeerGroupException - Thrown in the event of errors.

resign

void resign()
            throws PeerGroupException
Resign all credentials which were previously gained through prior join() operations.

Throws:
PeerGroupException - Thrown in the event of errors.

getDefaultCredential

Credential getDefaultCredential()
                                throws PeerGroupException
Returns the default credential for this peer.

Returns:
The current default Credential or null if there is no current default.
Throws:
PeerGroupException - Thrown in the event of errors.

getCurrentCredentials

Enumeration<Credential> getCurrentCredentials()
                                              throws PeerGroupException
Returns the current credentials for this peer.

Returns:
Enumeration of the Credentials currently associated with this peer for this peergroup.
Throws:
PeerGroupException - Thrown in the event of errors.

getAuthCredentials

@Deprecated
Enumeration<AuthenticationCredential> getAuthCredentials()
                                                         throws PeerGroupException
Deprecated. This interface is being removed in favour of individual Credentials providing their AuthenticationCredential as appropriate.

Returns the authentication credentials which were used to establish the current identities.

Returns:
Enumeration of the AuthenticationCredentials which were used to establish the current identities.
Throws:
PeerGroupException - Thrown in the event of errors.

makeCredential

Credential makeCredential(Element element)
                          throws PeerGroupException,
                                 Exception
Given a fragment of a StructuredDocument, reconstruct a Credential object from that fragment.

Parameters:
element - The StructuredDocument fragment to use for building the credential.
Returns:
Credential The created credential
Throws:
PeerGroupException - Thrown in the event of errors.
Exception - Thrown in the event of errors.

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Add a listener

Parameters:
listener - the listener

addPropertyChangeListener

void addPropertyChangeListener(String propertyName,
                               PropertyChangeListener listener)
Add a listener. Available properties from all Membership Services are :

Membership Services may offer additional properties.

Parameters:
propertyName - The property to watch
listener - The listener

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Remove a listener

Parameters:
listener - the listener

removePropertyChangeListener

void removePropertyChangeListener(String propertyName,
                                  PropertyChangeListener listener)
Remove a listener

Parameters:
propertyName - the property which was watched
listener - the listener

JXSE