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

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)`
`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
`AbstractMessage` | `getReply(AbstractMessage request, java.lang.String peerName, java.lang.String address, java.lang.String correctReply)` Get reply for each send message of a broker query
`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, java.lang.String ip)` 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 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, java.lang.String ip)`
`void` | `validateReply(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,
                                              CommunicationException,
                                              AutoMedException

  Throws:
    `UnsuccessfulReplyException`
    `CommunicationException`
    `AutoMedException`

### getPeersImplementing

    public java.util.List getPeersImplementing(java.lang.String schema)
                                        throws UnsuccessfulReplyException,
                                               CommunicationException,
                                               AutoMedException

  Throws:
    `UnsuccessfulReplyException`
    `CommunicationException`
    `AutoMedException`

### getSchemasImplementedBy

    public java.util.List getSchemasImplementedBy(java.lang.String peer)
                                           throws UnsuccessfulReplyException,
                                                  CommunicationException,
                                                  AutoMedException

  Throws:
    `UnsuccessfulReplyException`
    `CommunicationException`
    `AutoMedException`

### 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 CommunicationException,
                                UnsuccessfulReplyException,
                                AutoMedException

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### publishSchema

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

  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`
    `CommunicationException`
    `AutoMedException`

### registerPeer

    public void registerPeer(java.lang.String name,
                             java.lang.String ip)
                      throws CommunicationException,
                             UnsuccessfulReplyException,
                             AutoMedException

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

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### registerPeer

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

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

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### updatePeer

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

  Throws:
    `UnsuccessfulReplyException`
    `AutoMedException`

### requestAdvertise

    protected AbstractMessage requestAdvertise(java.lang.String context,
                                               java.util.Map content)
                                        throws CommunicationException,
                                               UnsuccessfulReplyException,
                                               AutoMedException

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### getAllResultObjects

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

  Throws:
    `IllegalReplyException`

### validateReply

    public void validateReply(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 CommunicationException,
                                             UnsuccessfulReplyException,
                                             AutoMedException

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### requestPathToSource

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

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### requestQuery

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

  Throws:
    `UnsuccessfulReplyException`
    `CommunicationException`
    `AutoMedException`

### getReply

    public AbstractMessage getReply(AbstractMessage request,
                                    java.lang.String peerName,
                                    java.lang.String address,
                                    java.lang.String correctReply)
                             throws CommunicationException,
                                    UnsuccessfulReplyException,
                                    AutoMedException

  Get reply for each send message of a broker query

  Throws:
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### publishModels

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

  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
    `CommunicationException`
    `UnsuccessfulReplyException`
    `AutoMedException`

### getModels

    public java.util.Map getModels(java.lang.String modelsStr)
                            throws UnsuccessfulReplyException,
                                   CommunicationException,
                                   AutoMedException

  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`
    `CommunicationException`
    `AutoMedException`

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