|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.ic.doc.automed.p2p.communication.AbstractRequestListener
uk.ac.ic.doc.automed.p2p.AutoMedPeer
public class AutoMedPeer
Represent the AutoMed Repository in this Java Virtual Machine (JVM)
as a peer on a peer-to-peer (P2P) network. Thus there should never
be more than one instance of this class in any JVM. For this to
function correctly, there must be a P2PRegistry running
on the local machine, and a directory.P2PDirectory running
on some host accesible by this peer.
| Method Summary | |
|---|---|
void |
close()
Close down the peer and its message handler, allowing another instance of this class to be created. |
boolean |
connected()
Determine if the current JVM is a peer on the P2P. |
static AutoMedPeer |
getAutoMedPeer()
Return the AutoMedPeer that represents the repository
in the JVM on the P2P network. |
PeerCache |
getCache()
Return the PeerCache that this AutoMedPeer keeps, containing
data fetched form the P2PDirectory of other peers and public
schemas. |
int |
getLocalPort()
public boolean isRegistered() { return this.registered; } |
MessageHandler |
getMessageHandler()
|
java.lang.String |
getName()
|
java.lang.String |
getPeerAddress()
Added by dmle 27/10/2005 to get a peer's IP address |
PeerApplication |
getPeerApplication()
Return the reference to the actual PeerApplication |
java.lang.String |
getPeerHost()
Added by dmle 27/10/2005 to get a peer's host name |
int |
getPeerState()
Return the current state of the peer as managed by PeerStateHandler |
static QueryCache |
getQueryCache()
Get query cache object |
java.io.InputStream |
getReplyForRequest(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.net.InetAddress address,
int port)
|
void |
handleRequest(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message,
java.io.OutputStream output)
Handle TCP-type requests |
void |
initMessagingPeer()
Start the messaging clients in the background |
static AutoMedPeer |
newAutoMedPeer(java.lang.String name,
PeerApplication peerApp,
PeerStateHandler stateHandler)
Create a new AutoMedPeer if one does not already exist. |
void |
outputPathway(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message,
java.io.OutputStream os)
|
void |
outputPathwayToSource(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
Deprecated. use outputSourcePathways(AbstractMessage request, OutputStream output)
to get multiple pathways |
void |
outputQuery(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
|
void |
outputSchema(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
|
void |
outputSourcePathways(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
Output all possible pathways to all data sources attached to a given public schema dmle 9/11/2005 |
void |
performStateAction(int newState)
Implements interface PeerStateListener |
void |
register()
|
java.io.InputStream |
requestPathToSource(java.lang.String host,
java.lang.String peerName,
java.lang.String schemaName)
|
java.io.InputStream |
requestPathway(java.lang.String host,
java.lang.String peerName,
java.lang.String fromSchema,
java.lang.String toSchema)
|
java.io.InputStream |
requestQuery(java.lang.String host,
java.lang.String peerName,
java.lang.String schema,
java.lang.String query)
|
java.io.InputStream |
requestSchema(java.lang.String host,
java.lang.String peerName,
java.lang.String schemaName)
|
java.io.InputStream |
sendRequest(java.lang.String host,
java.lang.String peerName,
uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message)
|
void |
setName(java.lang.String name)
Set a new name for peer |
void |
unregister()
Notify directory server that this peer is logged out |
| Methods inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractRequestListener |
|---|
handleRequest, handleUDPRequest, handleUDPRequest, handleUDPRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void close()
public void unregister()
public static AutoMedPeer newAutoMedPeer(java.lang.String name,
PeerApplication peerApp,
PeerStateHandler stateHandler)
throws P2PException,
java.io.IOException,
AutoMedException
AutoMedPeer if one does not already exist.
AutoMedPeer with the given name
P2PException - if an AutoMedPeer already exists for this JVM
java.io.IOException - if unable to connect the P2PRegistry
AutoMedExceptionpublic static AutoMedPeer getAutoMedPeer()
AutoMedPeer that represents the repository
in the JVM on the P2P network.
public boolean connected()
public MessageHandler getMessageHandler()
public int getPeerState()
PeerStateHandler
public PeerApplication getPeerApplication()
PeerApplication
public void initMessagingPeer()
public void setName(java.lang.String name)
name - the new peer name
public java.io.InputStream sendRequest(java.lang.String host,
java.lang.String peerName,
uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message)
throws java.io.IOException,
CommunicationException
java.io.IOException
CommunicationException
public java.io.InputStream requestSchema(java.lang.String host,
java.lang.String peerName,
java.lang.String schemaName)
throws java.io.IOException,
CommunicationException
java.io.IOException
CommunicationException
public java.io.InputStream requestPathToSource(java.lang.String host,
java.lang.String peerName,
java.lang.String schemaName)
throws java.io.IOException,
CommunicationException
java.io.IOException
CommunicationException
public java.io.InputStream requestQuery(java.lang.String host,
java.lang.String peerName,
java.lang.String schema,
java.lang.String query)
throws java.io.IOException,
CommunicationException
java.io.IOException
CommunicationException
public java.io.InputStream requestPathway(java.lang.String host,
java.lang.String peerName,
java.lang.String fromSchema,
java.lang.String toSchema)
throws java.io.IOException,
CommunicationException
java.io.IOException
CommunicationException
public java.io.InputStream getReplyForRequest(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.net.InetAddress address,
int port)
throws java.io.IOException
java.io.IOException
public void register()
throws java.io.IOException
java.io.IOException
public void handleRequest(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message,
java.io.OutputStream output)
throws java.io.IOException
AbstractRequestListener
handleRequest in interface RequestListenerhandleRequest in class AbstractRequestListenerjava.io.IOException
public void outputPathway(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage message,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOException
public void outputSchema(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOException
public void outputSourcePathways(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOException
public void outputPathwayToSource(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
throws java.io.IOException
outputSourcePathways(AbstractMessage request, OutputStream output)
java.io.IOException
public void outputQuery(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
java.io.OutputStream output)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getName()
public int getLocalPort()
public PeerCache getCache()
PeerCache that this AutoMedPeer keeps, containing
data fetched form the P2PDirectory of other peers and public
schemas.
public java.lang.String getPeerAddress()
public java.lang.String getPeerHost()
public static QueryCache getQueryCache()
public void performStateAction(int newState)
PeerStateListener
performStateAction in interface StateChangedListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||