p2ps.imp.endpoint
Class EndpointAdvertisementImp

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

public class EndpointAdvertisementImp
extends java.lang.Object
implements EndpointAdvertisement

An advertisement for a pipe endpoint

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

Field Summary
 
Fields inherited from interface p2ps.endpoint.EndpointAdvertisement
ENDPOINT_ADVERTISEMENT_TYPE, PIPE_ID_TAG, SCHEME_TAG, URI_TAG
 
Fields inherited from interface p2ps.discovery.Advertisement
ADVERT_ID_TAG, EXPIRY_DATE, PEER_ID_TAG
 
Constructor Summary
EndpointAdvertisementImp(Element root)
           
EndpointAdvertisementImp(java.lang.String peerid, java.lang.String adverid)
          Construct a failed pipe resolution event
 
Method Summary
 java.lang.String getAdvertID()
           
 java.net.URI getEndpointURI()
           
 long getExpiryDate()
           
 java.lang.String getPeerID()
           
 java.lang.String getPipeID()
           
 java.lang.String getScheme()
           
 java.lang.String getType()
           
 Element getXMLAdvert()
          Output the advert as an XML document
 Element getXMLEnvelope(long expdate)
           
 void setEndpointURI(java.net.URI uri)
          Sets URI of the endpoint
 void setPipeID(java.lang.String pipeid)
          Set the pipe id for the endpoint (optional)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndpointAdvertisementImp

public EndpointAdvertisementImp(java.lang.String peerid,
                                java.lang.String adverid)
Construct a failed pipe resolution event


EndpointAdvertisementImp

public EndpointAdvertisementImp(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)

getEndpointURI

public java.net.URI getEndpointURI()
Specified by:
getEndpointURI in interface EndpointAdvertisement
Returns:
the URI of the endpoint

setEndpointURI

public void setEndpointURI(java.net.URI uri)
Sets URI of the endpoint

Specified by:
setEndpointURI in interface EndpointAdvertisement

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface EndpointAdvertisement
Returns:
the scheme for the endpoint

getPipeID

public java.lang.String getPipeID()
Specified by:
getPipeID in interface EndpointAdvertisement
Returns:
the pipe id for the endpoint (optional)

setPipeID

public void setPipeID(java.lang.String pipeid)
Set the pipe id for the endpoint (optional)

Specified by:
setPipeID in interface EndpointAdvertisement

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