p2ps.imp.endpoint
Class EndpointResolverAdvertisementImp

java.lang.Object
  extended byp2ps.imp.endpoint.EndpointResolverAdvertisementImp
All Implemented Interfaces:
Advertisement, EndpointResolverAdvertisement, java.io.Serializable

public class EndpointResolverAdvertisementImp
extends java.lang.Object
implements EndpointResolverAdvertisement

An implementation of the Pipe Advertisement interface

Version:
$Revision: 295 $
Author:
Ian Wang
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface p2ps.endpoint.EndpointResolverAdvertisement
ENDPOINT_RESOLVER_ADVERTISEMENT_TYPE, RESOLVER_ENDPOINT_SCHEME_TAG, RESOLVER_FOR_PEER_ID_TAG, RESOLVER_URI_TAG
 
Fields inherited from interface p2ps.discovery.Advertisement
ADVERT_ID_TAG, EXPIRY_DATE, PEER_ID_TAG
 
Constructor Summary
EndpointResolverAdvertisementImp(Element root)
           
EndpointResolverAdvertisementImp(java.lang.String advertid, java.lang.String peerid)
           
 
Method Summary
 java.lang.String getAdvertID()
           
 java.lang.String[] getEndpointSchemes()
           
 java.net.URI[] getEndpointURIs()
           
 long getExpiryDate()
           
 java.lang.String getPeerID()
           
 java.lang.String[] getResolverForPeerIDs()
           
 java.lang.String getType()
           
 Element getXMLAdvert()
          Output the advert as an xml document
 Element getXMLEnvelope(long expdate)
           
 void setEndpointSchemes(java.lang.String[] types)
          Sets the pipe types for this advert
 void setEndpointURIs(java.net.URI[] uri)
          Sets the endpointuri for this resolver
 void setResolverForPeerIDs(java.lang.String[] peerids)
          Sets the transport protocol for this advert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndpointResolverAdvertisementImp

public EndpointResolverAdvertisementImp(java.lang.String advertid,
                                        java.lang.String peerid)

EndpointResolverAdvertisementImp

public EndpointResolverAdvertisementImp(Element root)
                                 throws java.io.IOException
Method Detail

getType

public java.lang.String getType()
Specified by:
getType in interface Advertisement
Returns:
the type for this advertisement

getAdvertID

public java.lang.String getAdvertID()
Specified by:
getAdvertID in interface Advertisement
Returns:
the unique id for this advertisement

getPeerID

public java.lang.String getPeerID()
Specified by:
getPeerID in interface Advertisement
Returns:
the id of the peer that created this advertisement

getExpiryDate

public long getExpiryDate()
Specified by:
getExpiryDate in interface Advertisement
Returns:
the expiry date for this advertisement (-1 if not published)

getEndpointURIs

public java.net.URI[] getEndpointURIs()
Specified by:
getEndpointURIs in interface EndpointResolverAdvertisement
Returns:
the endpointuri of the resolver in terms of the specified transport protocol

setEndpointURIs

public void setEndpointURIs(java.net.URI[] uri)
Sets the endpointuri for this resolver

Specified by:
setEndpointURIs in interface EndpointResolverAdvertisement

getEndpointSchemes

public java.lang.String[] getEndpointSchemes()
Specified by:
getEndpointSchemes in interface EndpointResolverAdvertisement
Returns:
the pipe types handled by the resolver

setEndpointSchemes

public void setEndpointSchemes(java.lang.String[] types)
Sets the pipe types for this advert

Specified by:
setEndpointSchemes in interface EndpointResolverAdvertisement

getResolverForPeerIDs

public java.lang.String[] getResolverForPeerIDs()
Specified by:
getResolverForPeerIDs in interface EndpointResolverAdvertisement
Returns:
the peer ids of the peers handled by the resolver

setResolverForPeerIDs

public void setResolverForPeerIDs(java.lang.String[] peerids)
Sets the transport protocol for this advert

Specified by:
setResolverForPeerIDs in interface EndpointResolverAdvertisement

getXMLAdvert

public Element getXMLAdvert()
                     throws java.io.IOException
Output the advert as an xml document

Specified by:
getXMLAdvert in interface Advertisement
Returns:
an XML element for advert
Throws:
java.io.IOException

getXMLEnvelope

public Element getXMLEnvelope(long expdate)
                       throws java.io.IOException
Specified by:
getXMLEnvelope in interface Advertisement
Parameters:
expdate -
Returns:
an XML element for the full enveloped advert (returns the same as getXMLAdvert if no envelope)
Throws:
java.io.IOException