MessageHandler
Keywords: uk.ac.ic.doc.automed.p2p.MessageHandler class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.ic.doc.automed.p2p
Class MessageHandler

    java.lang.Object
      uk.ac.ic.doc.automed.p2p.MessageHandler

    public class MessageHandler

extends java.lang.Object

Author:
  Charis TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
`static int` | `MODEL`
`static int` | `PEER`
`static int` | `SCHEMA`

Constructor Summary
`MessageHandler(AutoMedPeer peer)`

Method Summary
`java.util.List` | `getAllPublicSchemas()`
`java.util.List` | `getAllResultObjects(java.util.Map content, int type)`
`static byte[]` | `getMessageBytes(java.lang.String performative, java.lang.String context, java.util.Map content)` An utility method to get byte-representation of an XML message This method is used in UDP communication
`MessageHandlable` | `getMessageHandler(java.lang.String mesgType)` A method to get a message handler for a message
`java.util.Map` | `getModels(java.lang.String modelsStr)` Ask P2P directory for one or more model objects
`java.util.List` | `getPeersImplementing(java.lang.String schema)`
`java.util.Map` | `getPublicSchema(java.lang.String name)` Edited by MDLE on 19/10/2005 to get extra model information for a schema
`uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage` | `getReply(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request, java.lang.String peerName, java.lang.String address, java.lang.String correctReply)`
`RequestListener` | `getResponseHandler(java.lang.String mesgType)` Return the same MessageHandler object that also acts as the handler for reponse resulted from the client's message
`java.util.List` | `getSchemasImplementedBy(java.lang.String peer)`
`void` | `implementSchema(java.lang.String peer, java.lang.String schema)`
`void` | `publishModels(Schema theSchema, java.lang.String[] modelIDs)` To transfer all models associated to a schema to P2P directory.
`void` | `publishSchema(java.lang.String peerName, Schema schema, java.lang.String description)` Edited by MDLE on 17,21/10/2005 to: (1) include a string of models to send to P2PDirectory for checking (2) check reply from P2PDirectory if there are any models that need to be transmitted (3) also sends peer's name to directory to remember the peer-schema association
`void` | `registerPeer(java.lang.String name)` Register a peer after successful login dmle 2/11/2005: also update peer's status at login
`void` | `registerPeer(java.lang.String name, java.lang.String ip, java.lang.String status, java.lang.String lastUpdate)` Register a peer with the server at login dmle 2/11/2005: also update peer's status at login
`protected uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage` | `requestAdvertise(java.lang.String context, java.util.Map content)`
`PathwayDescription` | `requestPathToSource(java.lang.String peerName, java.lang.String address, java.lang.String schema)`
`PathwayDescription` | `requestPathway(java.lang.String peerName, java.lang.String address, java.lang.String fromSchema, java.lang.String toSchema)`
`QueryResultDescription` | `requestQuery(java.lang.String peerName, java.lang.String address, java.lang.String schema, java.lang.String query)`
`void` | `updatePeer(java.lang.String name)`
`void` | `updatePeer(java.lang.String name, java.lang.String ip)`
`void` | `validateReply(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage reply, java.lang.String required)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SCHEMA

    public static final int SCHEMA

See Also:
  Constant Field Values

### PEER

    public static final int PEER

See Also:
  Constant Field Values

### MODEL

    public static final int MODEL

See Also:
  Constant Field Values

Constructor Detail

### MessageHandler

    public MessageHandler(AutoMedPeer peer)

Method Detail

### getAllPublicSchemas

    public java.util.List getAllPublicSchemas()
                                       throws UnsuccessfulReplyException,
                                              java.io.IOException

  Throws:
    `UnsuccessfulReplyException`
    `java.io.IOException`

### getPeersImplementing

    public java.util.List getPeersImplementing(java.lang.String schema)
                                        throws UnsuccessfulReplyException,
                                               java.io.IOException

  Throws:
    `UnsuccessfulReplyException`
    `java.io.IOException`

### getSchemasImplementedBy

    public java.util.List getSchemasImplementedBy(java.lang.String peer)
                                           throws UnsuccessfulReplyException,
                                                  java.io.IOException

  Throws:
    `UnsuccessfulReplyException`
    `java.io.IOException`

### getPublicSchema

    public java.util.Map getPublicSchema(java.lang.String name)
                                  throws UnsuccessfulReplyException,
                                         java.io.IOException

  Edited by MDLE on 19/10/2005 to get extra model information for a schema

  Throws:
    `UnsuccessfulReplyException`
    `java.io.IOException`

### implementSchema

    public void implementSchema(java.lang.String peer,
                                java.lang.String schema)
                         throws java.io.IOException,
                                UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### publishSchema

    public void publishSchema(java.lang.String peerName,
                              Schema schema,
                              java.lang.String description)
                       throws UnsuccessfulReplyException,
                              java.io.IOException

  Edited by MDLE on 17,21/10/2005 to:
  (1) include a string of models to send to P2PDirectory for checking
  (2) check reply from P2PDirectory if there are any models that need to be transmitted
  (3) also sends peer's name to directory to remember the peer-schema association

  Throws:
    `UnsuccessfulReplyException`
    `java.io.IOException`

### registerPeer

    public void registerPeer(java.lang.String name)
                      throws java.io.IOException,
                             UnsuccessfulReplyException

  Register a peer after successful login dmle 2/11/2005: also update peer's status at login

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### registerPeer

    public void registerPeer(java.lang.String name,
                             java.lang.String ip,
                             java.lang.String status,
                             java.lang.String lastUpdate)
                      throws java.io.IOException,
                             UnsuccessfulReplyException

  Register a peer with the server at login dmle 2/11/2005: also update peer's status at login

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### updatePeer

    public void updatePeer(java.lang.String name)
                    throws java.io.IOException,
                           UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### updatePeer

    public void updatePeer(java.lang.String name,
                           java.lang.String ip)
                    throws java.io.IOException,
                           UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### requestAdvertise

    protected uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage requestAdvertise(java.lang.String context,
                                                                                               java.util.Map content)
                                                                                        throws java.io.IOException,
                                                                                               UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `UnsuccessfulReplyException`

### getAllResultObjects

    public java.util.List getAllResultObjects(java.util.Map content,
                                              int type)
                                       throws IllegalReplyException

  Throws:
    `IllegalReplyException`

### validateReply

    public void validateReply(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage reply,
                              java.lang.String required)
                       throws UnsuccessfulReplyException

  Parameters:
    `reply` -
  Throws:
    `UnsuccessfulReplyException`

### requestPathway

    public PathwayDescription requestPathway(java.lang.String peerName,
                                             java.lang.String address,
                                             java.lang.String fromSchema,
                                             java.lang.String toSchema)
                                      throws java.io.IOException,
                                             CommunicationException,
                                             UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `CommunicationException`
    `UnsuccessfulReplyException`

### requestPathToSource

    public PathwayDescription requestPathToSource(java.lang.String peerName,
                                                  java.lang.String address,
                                                  java.lang.String schema)
                                           throws java.io.IOException,
                                                  CommunicationException,
                                                  UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `CommunicationException`
    `UnsuccessfulReplyException`

### requestQuery

    public QueryResultDescription requestQuery(java.lang.String peerName,
                                               java.lang.String address,
                                               java.lang.String schema,
                                               java.lang.String query)
                                        throws UnsuccessfulReplyException,
                                               CommunicationException,
                                               java.io.IOException

  Throws:
    `UnsuccessfulReplyException`
    `CommunicationException`
    `java.io.IOException`

### getReply

    public uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage getReply(uk.ac.ic.doc.automed.p2p.messages.abstractlayer.AbstractMessage request,
                                                                                    java.lang.String peerName,
                                                                                    java.lang.String address,
                                                                                    java.lang.String correctReply)
                                                                             throws java.io.IOException,
                                                                                    CommunicationException,
                                                                                    UnsuccessfulReplyException

  Throws:
    `java.io.IOException`
    `CommunicationException`
    `UnsuccessfulReplyException`

### publishModels

    public void publishModels(Schema theSchema,
                              java.lang.String[] modelIDs)
                       throws java.io.IOException,
                              UnsuccessfulReplyException

  To transfer all models associated to a schema to P2P directory.
  This method works the same as `#publishSchema()` method.
  It can generally be used to publish one or more models to P2P Directory

  Part of model publishing is to find all associated `TypeHierarchy`s and publish those to the directory as well.

  Parameters:
    `theSchema` - the `Schema` object whose model/s we wish to publish
    `modelIDs` - an array of model IDs to be added
  Throws:
    `{@link` - IOException} if there is an error in network connection
    `{@link` - UnsucessfulReplyException} if the directory could not handle the request
    `java.io.IOException`
    `UnsuccessfulReplyException`

### getModels

    public java.util.Map getModels(java.lang.String modelsStr)
                            throws UnsuccessfulReplyException,
                                   java.io.IOException

  Ask P2P directory for one or more model objects

  Parameters:
    `modelsStr` - A string of model names
  Returns:
    `Map` a hash map or XML documents
  Throws:
    `{@link` - IOException} if there is an error in network connection
    `{@link` - UnsucessfulReplyException} if the directory could not handle the request
    `UnsuccessfulReplyException`
    `java.io.IOException`

### getMessageHandler

    public MessageHandlable getMessageHandler(java.lang.String mesgType)
                                       throws HandlerNotFoundException

  A method to get a message handler for a message

  Parameters:
    `mesgType` - a message type
  Throws:
    `{@link` - HandlerNotFoundException} if the handler is not found
    `HandlerNotFoundException`

### getResponseHandler

    public RequestListener getResponseHandler(java.lang.String mesgType)
                                       throws HandlerNotFoundException

  Return the same MessageHandler object that also acts as the handler for
  reponse resulted from the client's message

  Throws:
    `HandlerNotFoundException`

### getMessageBytes

    public static byte[] getMessageBytes(java.lang.String performative,
                                         java.lang.String context,
                                         java.util.Map content)

  An utility method to get byte-representation of an XML message
  This method is used in UDP communication

  Parameters:
    `performative` - the message's performative
    `context` - the message's context
    `content` - a `Map` object of content fields

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD