JXTA

net.jxta.impl.membership.passwd
Class PasswdMembershipService.PasswdCredential

java.lang.Object
  extended by net.jxta.impl.membership.passwd.PasswdMembershipService.PasswdCredential
All Implemented Interfaces:
Credential, CredentialPCLSupport
Enclosing class:
PasswdMembershipService

public static final class PasswdMembershipService.PasswdCredential
extends Object
implements Credential, CredentialPCLSupport

This class provides the sub-class of Credential which is associated with the password membership service.


Field Summary
(package private)  ID peerid
          The peerid associated with this credential.
(package private)  String signedPeerID
          The peerid which has been "signed" so that the identity may be verified.
(package private)  PasswdMembershipService source
          The MembershipService service which generated this credential.
(package private)  boolean valid
          Whether the credential is valid.
(package private)  String whoami
          The identity associated with this credential
 
Fields inherited from interface net.jxta.credential.CredentialPCLSupport
EXPIRED_CREDENTIAL_PROPERTY, VALID_CREDENTIAL_PROPERTY
 
Constructor Summary
protected PasswdMembershipService.PasswdCredential(PasswdMembershipService source, Element root)
           
protected PasswdMembershipService.PasswdCredential(PasswdMembershipService source, String whoami, String signedPeerID)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a listener
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener
 StructuredDocument getDocument(MimeMediaType as)
          Write credential into a document.
 ID getPeerGroupID()
          Returns the peerGroupID associated with this credential.
 ID getPeerID()
          Returns the peerID associated with this credential.
 Service getSourceService()
          Returns the service which generated this credential.
 Object getSubject()
          Returns the subject of this credential.
protected  boolean handleElement(XMLElement elem)
          Process an individual element from the document.
protected  void initialize(Element root)
          Intialize from a portion of a structured document.
 boolean isExpired()
          Returns true if this credential is expired.
 boolean isValid()
          Returns true if this credential is currently valid.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a listener
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

PasswdMembershipService source
The MembershipService service which generated this credential.


whoami

String whoami
The identity associated with this credential


peerid

ID peerid
The peerid associated with this credential.


signedPeerID

String signedPeerID
The peerid which has been "signed" so that the identity may be verified.


valid

boolean valid
Whether the credential is valid.

Constructor Detail

PasswdMembershipService.PasswdCredential

protected PasswdMembershipService.PasswdCredential(PasswdMembershipService source,
                                                   String whoami,
                                                   String signedPeerID)

PasswdMembershipService.PasswdCredential

protected PasswdMembershipService.PasswdCredential(PasswdMembershipService source,
                                                   Element root)
                                            throws PeerGroupException
Throws:
PeerGroupException
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a listener

Specified by:
addPropertyChangeListener in interface CredentialPCLSupport
Parameters:
listener - the listener

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Add a listener

Specified by:
addPropertyChangeListener in interface CredentialPCLSupport
Parameters:
propertyName - the property to watch
listener - the listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a listener

Specified by:
removePropertyChangeListener in interface CredentialPCLSupport
Parameters:
listener - the listener

removePropertyChangeListener

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

Specified by:
removePropertyChangeListener in interface CredentialPCLSupport
Parameters:
propertyName - the property which was watched
listener - the listener

getPeerGroupID

public ID getPeerGroupID()
Returns the peerGroupID associated with this credential.

Specified by:
getPeerGroupID in interface Credential
Returns:
The peerGroupID associated with this credential.

getPeerID

public ID getPeerID()
Returns the peerID associated with this credential.

Specified by:
getPeerID in interface Credential
Returns:
The peerID associated with this credential.

isExpired

public boolean isExpired()
Returns true if this credential is expired. Some credential implementations may never expire.

PasswdCredential never expire.

Specified by:
isExpired in interface Credential
Returns:
true if this credential is expired, otherwise false.

isValid

public boolean isValid()
Returns true if this credential is currently valid.

PasswdCredential are almost always valid.

Specified by:
isValid in interface Credential
Returns:
true if the credential is currently valid, otherwise false.

getSubject

public Object getSubject()
Returns the subject of this credential. The Objects returned must support Object.equals(Object) and Object.hashCode().

Specified by:
getSubject in interface Credential
Returns:
The subject of the credential as an abstract object.

getSourceService

public Service getSourceService()
Returns the service which generated this credential.

Specified by:
getSourceService in interface Credential
Returns:
The service which generated this credential.

getDocument

public StructuredDocument getDocument(MimeMediaType as)
                               throws Exception
Write credential into a document. asMimeType is a mime media-type specification and provides the form of the document which is being requested. Two standard document forms are defined. "text/plain" encodes the document in a "pretty-print" format for human viewing and "text/xml" which provides an XML format.

Depending on the credential format this document may be cryptographically signed to prevent alteration.

Specified by:
getDocument in interface Credential
Parameters:
as - MimeMediaType format representation requested
Returns:
The credential serialized to a Document.
Throws:
Exception - if an error occurs

handleElement

protected boolean handleElement(XMLElement elem)
Process an individual element from the document.

Parameters:
elem - the element to be processed.
Returns:
true if the element was recognized, otherwise false.

initialize

protected void initialize(Element root)
Intialize from a portion of a structured document.


JXSE