p2ps.imp.group
Class GroupQueryImp

java.lang.Object
  extended byp2ps.imp.group.GroupQueryImp
All Implemented Interfaces:
Advertisement, GroupQuery, Query, java.io.Serializable

public class GroupQueryImp
extends java.lang.Object
implements GroupQuery

An implementation of the GroupQuery interface

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

Field Summary
 
Fields inherited from interface p2ps.group.GroupQuery
GROUP_QUERY_TYPE, QUERY_GROUP_ID_TAG, QUERY_GROUP_NAME_TAG, QUERY_PEER_ID_TAG
 
Fields inherited from interface p2ps.discovery.Query
QUERY_TAG, REPLY_URI_TAG
 
Fields inherited from interface p2ps.discovery.Advertisement
ADVERT_ID_TAG, EXPIRY_DATE, PEER_ID_TAG
 
Constructor Summary
GroupQueryImp(Element root)
           
GroupQueryImp(java.lang.String advertid, java.lang.String peerid)
           
 
Method Summary
 java.lang.String getAdvertID()
           
 long getExpiryDate()
           
 java.lang.String getPeerID()
           
 java.lang.String getQueryGroupID()
           
 java.lang.String getQueryGroupName()
           
 java.lang.String getQueryPeerID()
           
 java.lang.String getQueryType()
           
 java.net.URI[] getReplyURIs()
           
 java.lang.String getType()
           
 Element getXMLAdvert()
          Output the advert as an xml document
 Element getXMLEnvelope(long expdate)
           
 void setQueryGroupID(java.lang.String groupid)
          Set the unique id for the group
 void setQueryGroupName(java.lang.String groupname)
          Sets the name for the group
 void setQueryPeerID(java.lang.String id)
          Sets the id of the peer this query is interested in (null if any)
 void setReplyURIs(java.net.URI[] replyuri)
          Ssets the optional endpoint uri for the query reply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupQueryImp

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

GroupQueryImp

public GroupQueryImp(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

getQueryType

public java.lang.String getQueryType()
Specified by:
getQueryType in interface Query
Returns:
the type of advertisement this query is interested in (e.g. PipeAdvertisement)

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)

getQueryPeerID

public java.lang.String getQueryPeerID()
Returns:
the id of the peer this query is interested in (null if any)

setQueryPeerID

public void setQueryPeerID(java.lang.String id)
Sets the id of the peer this query is interested in (null if any)


getQueryGroupID

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

setQueryGroupID

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

Specified by:
setQueryGroupID in interface GroupQuery

getQueryGroupName

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

setQueryGroupName

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

Specified by:
setQueryGroupName in interface GroupQuery

getReplyURIs

public java.net.URI[] getReplyURIs()
Specified by:
getReplyURIs in interface Query
Returns:
optional endpoint uri for the query reply.

setReplyURIs

public void setReplyURIs(java.net.URI[] replyuri)
Ssets the optional endpoint uri for the query reply.

Specified by:
setReplyURIs in interface Query

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