|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.p2p.protocol.SICP
public class SICP
SICP.java
Schema Information Control Protocol: provides standard interface functions
for publishing/obtaining information regarding resources on the P2P network.
Field Summary | |
---|---|
private static DirectoryServicePeer |
_dsp
|
private static SICP |
_instance
|
private static AutoMedPeer |
_mainPeer
|
private static MessagingService |
_msgService
|
Constructor Summary | |
---|---|
private |
SICP(AutoMedPeer mainPeer)
Creates a new instance of SICP |
Method Summary | |
---|---|
void |
advertiseKeywords(java.lang.String schema,
java.util.Map dict)
Peer->DSP: advertise the keywords to the DSP to be stored there |
void |
advertisePathway(java.lang.String schemaName)
Peer->DSP: advertise pathway to a schema to the DSP |
private void |
advertisePathwayAbstract(AbstractMessage request,
ResponseHandler outputHandler)
Peer->DS: advertise pathway abstraction/b> to the directory service for routing |
java.util.Map |
askDomainKeywords(java.lang.String schema)
Peer->DSP: ask a dsp for the keyword map of this domain if schema is specified then return keywords for a specific schema otherwise return all keywords |
private void |
askPathwayToSourceAbstract(PeerDescription peerDesc,
java.lang.String schemaName)
DS->Peer: Directory service ask peer for pathways abstraction |
java.lang.String |
askPeerDescription(java.lang.String peerName,
java.lang.String peerURL)
Peer->DSP: ask for the description of a peer |
java.lang.String |
askPeerSchemaAssociation(java.lang.String schema)
Peer -> DSP: similar to {#requestPeerSchemaAssociations(String peer, String schema)} Ask the dsp for a list of peer-to-schema associations but return the first one that is found |
java.util.Map |
askPeerSchemaAssociations(java.lang.String peer,
java.lang.String schema)
Peer -> DSP: Ask the dsp for a list of peer-to-schema associations. |
java.util.Collection |
askPeersImplementingSchema(java.lang.String schemaName,
java.util.Collection excludePeers)
Find all peers that implement a public schema which are not in a given set of peers (optional) |
java.util.Collection |
askRelatedKeywords(java.lang.String kw)
Peer->DSP: ask a dsp for the related keywords of a keyword |
java.lang.String[] |
askSchemaList(java.lang.String schemaType,
PeerProcessDescription peerDesc)
Peer->Peer: Peer asks another peer for a schema list |
void |
askToWrapSchema(java.lang.String schema,
PeerProcessDescription peerDesc)
Peer->Peer: Peer asks another peer to wrap a schema from the directroy service |
void |
close()
|
private void |
confirmAdvertiseKeywords(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: update the keywords and send confirmation to peer |
private void |
confirmAdvertisePathway(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: store the fact that a peer is implementing a public schema and, if successful, replies with a confirmation. |
static SICP |
getInstance(AutoMedPeer mainPeer)
Return a single instance of SICP protocol |
java.lang.String |
getLinkAddress()
Return the IP address of the network interface which connects a peer to the network |
private java.lang.Object |
handleDomainEvent(DomainEvent de)
Handle a domain event. |
boolean |
isLinkUp()
Test whether or not the peer's link to the network is up |
static void |
main(java.lang.String[] args)
|
private void |
processPathwayAbstract(AbstractMessage advert,
ResponseHandler outputHandler)
DS<-Peer: Directory service process pathways advertised by a peer |
void |
publishSchema(java.lang.String schemaName,
java.lang.String globalName,
java.lang.String desc)
This peer publish a public schema to the network |
private void |
registerDirectoryHandlers()
DSP: Register message handlers on the directory server |
private void |
registerPeerHandlers()
Peer: Register message handlers on the peer |
private void |
replyAbstractPathwayToSource(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: reply to requestAbstractPathwayToSource(String schemaName) by a peer |
java.util.List |
requestAbstractPathwayToSource(java.lang.String schemaName)
Peer->DS: A peer invokes this method to request the directory service about possible pathways to data source for a public schema that the peer knows |
private void |
setPeerInstance(AutoMedPeer peer)
Because we must maintain separate AutoMedPeer instances for normal peer and directory service, we must decide which instance to use at protocol initialisation time |
private void |
tellDomainKeywords(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: tells the peer about the keyword map of this domain |
private void |
tellPeerDescription(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: DSP notifies a peer of the description of that peer |
private void |
tellPeerSchemaAssociations(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: reply to requestPeerSchemaAssociations(String peer, String schema) by a peer |
private void |
tellRelatedKeywords(AbstractMessage request,
ResponseHandler outputHandler)
DSP->Peer: reply to peer with the collection of related keywords to a keyword |
Schema |
wrapSchema(java.lang.String schemaName,
PeerDescription pd)
Wrap a public schema from the network |
Schema |
wrapSchema(java.lang.String schemaName,
java.lang.String newName,
PeerDescription pd)
Takes an additional parameter to allow caller to specified a new schema name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static SICP _instance
private static AutoMedPeer _mainPeer
private static DirectoryServicePeer _dsp
private static MessagingService _msgService
Constructor Detail |
---|
private SICP(AutoMedPeer mainPeer)
Method Detail |
---|
public static SICP getInstance(AutoMedPeer mainPeer)
private void setPeerInstance(AutoMedPeer peer)
public java.lang.String[] askSchemaList(java.lang.String schemaType, PeerProcessDescription peerDesc) throws CommunicationException, AutoMedException
CommunicationException
AutoMedException
public void publishSchema(java.lang.String schemaName, java.lang.String globalName, java.lang.String desc) throws AutoMedException
AutoMedException
public void advertiseKeywords(java.lang.String schema, java.util.Map dict) throws AutoMedException
keywords
-
AutoMedException
private void confirmAdvertiseKeywords(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
request
- outputHandler
-
CommunicationException
public java.util.Collection askRelatedKeywords(java.lang.String kw) throws AutoMedException
schema
- kw
-
AutoMedException
private void tellRelatedKeywords(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
schema
- kw
-
AutoMedException
CommunicationException
public java.util.Map askDomainKeywords(java.lang.String schema) throws AutoMedException
AutoMedException
private void tellDomainKeywords(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
request
- outputHandler
-
CommunicationException
public void askToWrapSchema(java.lang.String schema, PeerProcessDescription peerDesc) throws CommunicationException, AutoMedException
CommunicationException
AutoMedException
public java.lang.String askPeerDescription(java.lang.String peerName, java.lang.String peerURL) throws AutoMedException
AutoMedException
private void tellPeerDescription(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
request
- outputHandler
-
AutoMedException
CommunicationException
public Schema wrapSchema(java.lang.String schemaName, PeerDescription pd) throws CommunicationException, AutoMedException
schemaName
- the public schema namepd
- a PeerDescription
object that encapsulates the current
peer information for use by the wrapper
CommunicationException
AutoMedException
public Schema wrapSchema(java.lang.String schemaName, java.lang.String newName, PeerDescription pd) throws CommunicationException, AutoMedException
schemaName
- newName
- pd
-
CommunicationException
AutoMedException
private void askPathwayToSourceAbstract(PeerDescription peerDesc, java.lang.String schemaName) throws CommunicationException, AutoMedException
peerDesc
- a PeerDescription
object that was created with address,
name and portschemaName
- the schema whose data sources we wish to obtain pathways from
CommunicationException
AutoMedException
public java.util.List requestAbstractPathwayToSource(java.lang.String schemaName) throws CommunicationException, AutoMedException
PathwayDescripition
objects
CommunicationException
AutoMedException
private void replyAbstractPathwayToSource(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
requestAbstractPathwayToSource(String schemaName)
by a peer
CommunicationException
public void advertisePathway(java.lang.String schemaName) throws AutoMedException
schemaName
-
AutoMedException
private void confirmAdvertisePathway(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
request
- outputHandler
-
CommunicationException
private void advertisePathwayAbstract(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
CommunicationException
private void processPathwayAbstract(AbstractMessage advert, ResponseHandler outputHandler) throws CommunicationException
CommunicationException
public java.util.Map askPeerSchemaAssociations(java.lang.String peer, java.lang.String schema) throws CommunicationException, AutoMedException
peer
- name of the peer (use wild cart '*' for any)schema
- name of the schema (use wild cart '*' for any)
PeerDescription
->
String<schemaname>
CommunicationException
AutoMedException
public java.util.Collection askPeersImplementingSchema(java.lang.String schemaName, java.util.Collection excludePeers) throws CommunicationException, AutoMedException
schemaName
- excludePeers
- a collection of peer names to exclude
CommunicationException
AutoMedException
public java.lang.String askPeerSchemaAssociation(java.lang.String schema) throws CommunicationException, AutoMedException
schema
-
CommunicationException
AutoMedException
private void tellPeerSchemaAssociations(AbstractMessage request, ResponseHandler outputHandler) throws CommunicationException
requestPeerSchemaAssociations(String peer, String schema)
by a peer
CommunicationException
public boolean isLinkUp()
public java.lang.String getLinkAddress()
private java.lang.Object handleDomainEvent(DomainEvent de) throws AutoMedException
AutoMedException
private void registerDirectoryHandlers()
private void registerPeerHandlers()
public void close()
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |