Project JXTA

net.jxta.impl.peer
Class PeerInfoInterface

java.lang.Object
  |
  +--net.jxta.impl.peer.PeerInfoInterface

public class PeerInfoInterface
extends java.lang.Object
implements net.jxta.peer.PeerInfo

PeerInfoInterface provides a pure interface object that permits interaction with the actual PeerInfo implementation without giving access to the real object.


Constructor Summary
PeerInfoInterface(net.jxta.peer.PeerInfo theRealThing)
          Only authorized constructor
 
Method Summary
 void flushAdvertisements(java.lang.String id)
          Flush cached advertisements.
 net.jxta.document.Advertisement getAdvertisement()
          Returns the advertisment for that service.
 net.jxta.service.Service getInterface()
          returns an interface object that permits to use this service without having access to the real object.
 java.util.Enumeration getLocalPeerInfo(java.lang.String peer)
          Get PeerInfo from local cache.
 net.jxta.protocol.PeerInfoAdvertisement getPeerInfo()
          Retrieve Peer Information Advertisement for local peer
 void getRemotePeerInfo(java.lang.String peer)
          Get PeerInfo from a remote peer.
 void init(net.jxta.peergroup.PeerGroup pg, net.jxta.document.Advertisement a)
          Initialize the application FIXME: This is meaningless for the interface object; it is there only to satisfy the requirements of the interface that we implement.
 void registerService(net.jxta.protocol.ServiceAdvertisement advertisement)
          Register a Service in the Peer Advertisement service adversement describes a specific service that is running on the peer (i.e.
 int startApp(java.lang.String[] arg)
          This is here for temporary class hierarchy reasons.
 void stopApp()
          This is here for temporary class hierarchy reasons.
 void unRegisterService(net.jxta.protocol.ServiceAdvertisement advertisement)
          unRegisters a prevously registered service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerInfoInterface

public PeerInfoInterface(net.jxta.peer.PeerInfo theRealThing)
Only authorized constructor
Method Detail

getInterface

public net.jxta.service.Service getInterface()
returns an interface object that permits to use this service without having access to the real object. Since THIS is already such an object, it returns itself. FIXME: it is kind of absurd to have this method part of the interface but we do not want to define two levels of Service interface just for that.
Returns:
PeerInfoService An interface object that implements this service and nothing more.

getAdvertisement

public net.jxta.document.Advertisement getAdvertisement()
Returns the advertisment for that service.
Returns:
Advertisement the advertisement.
Since:
JXTA 1.0

init

public void init(net.jxta.peergroup.PeerGroup pg,
                 net.jxta.document.Advertisement a)
Initialize the application FIXME: This is meaningless for the interface object; it is there only to satisfy the requirements of the interface that we implement. Ultimately, the API should define two levels of interfaces: one for the real service implementation and one for the interface object. Right now it feels a bit heavy to so that since the only different between the two would be init() and may-be getName().
Parameters:
group - PeerGroup this application is started from
Since:
JXTA 1.0

startApp

public int startApp(java.lang.String[] arg)
This is here for temporary class hierarchy reasons. it is ALWAYS ignored. By definition, the interface object protects the real object's start/stop methods from being called
Parameters:
arg - A table of strings arguments.
Returns:
int status indication.

stopApp

public void stopApp()
This is here for temporary class hierarchy reasons. it is ALWAYS ignored. By definition, the interface object protects the real object's start/stop methods from being called This request is currently ignored.

getPeerInfo

public net.jxta.protocol.PeerInfoAdvertisement getPeerInfo()
Retrieve Peer Information Advertisement for local peer
Specified by:
getPeerInfo in interface net.jxta.peer.PeerInfo
Returns:
PeerInfoAdvertisement

registerService

public void registerService(net.jxta.protocol.ServiceAdvertisement advertisement)
                     throws java.io.IOException
Register a Service in the Peer Advertisement service adversement describes a specific service that is running on the peer (i.e. LDAP, etc)
Specified by:
registerService in interface net.jxta.peer.PeerInfo
Parameters:
advertisement - service advertisement to be registered
Throws:
java.io.IOException - if registeration fails

unRegisterService

public void unRegisterService(net.jxta.protocol.ServiceAdvertisement advertisement)
                       throws java.io.IOException
unRegisters a prevously registered service
Specified by:
unRegisterService in interface net.jxta.peer.PeerInfo
Parameters:
advertisement - service advertisement to be unregistered
Throws:
java.io.IOException - if the un-registeration fails

getRemotePeerInfo

public void getRemotePeerInfo(java.lang.String peer)
Get PeerInfo from a remote peer.
Specified by:
getRemotePeerInfo in interface net.jxta.peer.PeerInfo
Parameters:
peer - Address of a peer, or portal to connect to, if address is null

getLocalPeerInfo

public java.util.Enumeration getLocalPeerInfo(java.lang.String peer)
                                       throws java.io.IOException
Get PeerInfo from local cache.
Specified by:
getLocalPeerInfo in interface net.jxta.peer.PeerInfo
Parameters:
peer - Address of a peer, or portal to connect to, if address is null

flushAdvertisements

public void flushAdvertisements(java.lang.String id)
                         throws java.io.IOException
Flush cached advertisements.
Specified by:
flushAdvertisements in interface net.jxta.peer.PeerInfo
Parameters:
id - peerId of peer whose locally cached adv is to be deleted. If null, cached advs of all peers are deleted.

Project JXTA