p2ps.imp.group
Class GroupAdvertisementImp

java.lang.Object
  extended byp2ps.imp.group.GroupAdvertisementImp
All Implemented Interfaces:
Advertisement, GroupAdvertisement, java.io.Serializable

public class GroupAdvertisementImp
extends java.lang.Object
implements GroupAdvertisement

An implementation of the GroupAdvertisement interface

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

Field Summary
 
Fields inherited from interface p2ps.group.GroupAdvertisement
AUTHORIZATION_TYPE_TAG, GROUP_ADVERTISEMENT_TYPE, GROUP_ID_TAG, GROUP_NAME_TAG, GROUP_SERVICE_URI_TAG, MEMBERSHIP_SERVICE_URI_TAG
 
Fields inherited from interface p2ps.discovery.Advertisement
ADVERT_ID_TAG, EXPIRY_DATE, PEER_ID_TAG
 
Constructor Summary
GroupAdvertisementImp(Element root)
           
GroupAdvertisementImp(java.lang.String advertid, java.lang.String peerid, java.lang.String groupid)
           
 
Method Summary
 java.lang.String getAdvertID()
           
 java.lang.String getAuthorizationType()
           
 long getExpiryDate()
           
 java.lang.String getGroupID()
           
 java.lang.String getGroupName()
           
 java.net.URI[] getGroupServiceURIs()
           
 java.net.URI[] getMembershipServiceURIs()
           
 java.lang.String getPeerID()
           
 java.lang.String getType()
           
 Element getXMLAdvert()
          Output the advert as an xml document
 Element getXMLEnvelope(long expdate)
           
 void setAuthorizationType(java.lang.String authtype)
          Sets the authorization type required for this group (null if no authorization is required)
 void setGroupID(java.lang.String groupid)
          Set the unique id for the group
 void setGroupName(java.lang.String groupname)
          Sets the name for the group
 void setGroupServiceURIs(java.net.URI[] uri)
          Set endpoints where a peer can apply to join a group
 void setMembershipServiceURIs(java.net.URI[] uri)
          Set endpoints where a peer can apply to join a group
 void setPeerID(java.lang.String id)
          Sets the peer id for this pipe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupAdvertisementImp

public GroupAdvertisementImp(java.lang.String advertid,
                             java.lang.String peerid,
                             java.lang.String groupid)

GroupAdvertisementImp

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

setPeerID

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


getGroupID

public java.lang.String getGroupID()
Specified by:
getGroupID in interface GroupAdvertisement
Returns:
the unique id for the group

setGroupID

public void setGroupID(java.lang.String groupid)
Set the unique id for the group

Specified by:
setGroupID in interface GroupAdvertisement

getGroupName

public java.lang.String getGroupName()
Specified by:
getGroupName in interface GroupAdvertisement
Returns:
the name for the group

setGroupName

public void setGroupName(java.lang.String groupname)
Sets the name for the group

Specified by:
setGroupName in interface GroupAdvertisement

getAuthorizationType

public java.lang.String getAuthorizationType()
Specified by:
getAuthorizationType in interface GroupAdvertisement
Returns:
the authorization type required for this group (null if no authorization required)

setAuthorizationType

public void setAuthorizationType(java.lang.String authtype)
Sets the authorization type required for this group (null if no authorization is required)

Specified by:
setAuthorizationType in interface GroupAdvertisement

getMembershipServiceURIs

public java.net.URI[] getMembershipServiceURIs()
Specified by:
getMembershipServiceURIs in interface GroupAdvertisement
Returns:
endpoints where a peer can apply to join a group

setMembershipServiceURIs

public void setMembershipServiceURIs(java.net.URI[] uri)
Set endpoints where a peer can apply to join a group

Specified by:
setMembershipServiceURIs in interface GroupAdvertisement

getGroupServiceURIs

public java.net.URI[] getGroupServiceURIs()
Specified by:
getGroupServiceURIs in interface GroupAdvertisement
Returns:
endpoints where a peer can apply to join a group

setGroupServiceURIs

public void setGroupServiceURIs(java.net.URI[] uri)
Set endpoints where a peer can apply to join a group

Specified by:
setGroupServiceURIs in interface GroupAdvertisement

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