p2ps.imp.pipe
Class PipeAdvertisementImp

java.lang.Object
  extended byp2ps.imp.pipe.PipeAdvertisementImp
All Implemented Interfaces:
Advertisement, PipeAdvertisement, PipeSchemes, java.io.Serializable

public class PipeAdvertisementImp
extends java.lang.Object
implements PipeAdvertisement, PipeSchemes

An implementation of the Pipe Advertisement interface

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

Field Summary
 
Fields inherited from interface p2ps.pipe.PipeAdvertisement
PIPE_ADVERTISEMENT_TYPE, PIPE_ID_TAG, PIPE_NAME_TAG, PIPE_SCHEME_TAG, PIPE_URI_TAG
 
Fields inherited from interface p2ps.discovery.Advertisement
ADVERT_ID_TAG, EXPIRY_DATE, PEER_ID_TAG
 
Fields inherited from interface p2ps.pipe.PipeSchemes
P2PS_DISCOVERY, P2PS_MULTICAST, P2PS_SECURE, P2PS_STANDARD
 
Constructor Summary
PipeAdvertisementImp(Element root)
           
PipeAdvertisementImp(java.lang.String advertid, java.lang.String peerid, java.lang.String pipeid)
           
 
Method Summary
 java.lang.String getAdvertID()
           
 long getExpiryDate()
           
 java.lang.String getPeerID()
           
 java.lang.String getPipeID()
           
 java.lang.String getPipeName()
           
 java.lang.String getPipeScheme()
           
 java.net.URI getPipeURI()
           
 java.lang.String getType()
           
 Element getXMLAdvert()
          Output the advert as an xml document
 Element getXMLEnvelope(long expdate)
           
 void setPeerID(java.lang.String id)
          Sets the peer id for this pipe
 void setPipeID(java.lang.String id)
          Sets the UUID of the pipe
 void setPipeName(java.lang.String name)
          Sets the name of the pipe
 void setPipeScheme(java.lang.String scheme)
          Sets the type of the pipe (e.g.
 void setPipeURI(java.net.URI uri)
          Sets the URI of the pipe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipeAdvertisementImp

public PipeAdvertisementImp(java.lang.String advertid,
                            java.lang.String peerid,
                            java.lang.String pipeid)

PipeAdvertisementImp

public PipeAdvertisementImp(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 PipeAdvertisement
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)

setPeerID

public void setPeerID(java.lang.String id)
Sets the peer id for this pipe

Specified by:
setPeerID in interface PipeAdvertisement

getPipeID

public java.lang.String getPipeID()
Specified by:
getPipeID in interface PipeAdvertisement
Returns:
the id of the pipe

setPipeID

public void setPipeID(java.lang.String id)
Sets the UUID of the pipe

Specified by:
setPipeID in interface PipeAdvertisement

getPipeURI

public java.net.URI getPipeURI()
Specified by:
getPipeURI in interface PipeAdvertisement
Returns:
the URI of the pipe

setPipeURI

public void setPipeURI(java.net.URI uri)
Sets the URI of the pipe

Specified by:
setPipeURI in interface PipeAdvertisement

getPipeName

public java.lang.String getPipeName()
Specified by:
getPipeName in interface PipeAdvertisement
Returns:
the name of the pipe

setPipeName

public void setPipeName(java.lang.String name)
Sets the name of the pipe

Specified by:
setPipeName in interface PipeAdvertisement

getPipeScheme

public java.lang.String getPipeScheme()
Specified by:
getPipeScheme in interface PipeAdvertisement
Returns:
the type of the pipe (e.g. P2PS_STANDARD, BIDIRECTIONAL, P2PS_MULTICAST)

setPipeScheme

public void setPipeScheme(java.lang.String scheme)
                   throws java.net.URISyntaxException
Sets the type of the pipe (e.g. P2PS_STANDARD, BIDIRECTIONAL, P2PS_MULTICAST)

Specified by:
setPipeScheme in interface PipeAdvertisement
Throws:
java.net.URISyntaxException

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