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

## network
Class ProtocolRecovery

    java.lang.Object
      network.ProtocolRecovery

    public class ProtocolRecovery

extends java.lang.Object

Request for fragments used during recovery process. There are two basic types of request. Full request contains exact metadata of file to be recovered. Filename request contains only filename. All messages are expected to be in XML format.

Field Summary
`static int` | `FILENAME_REQUEST`
`static int` | `FULL_REQUEST`
`static java.lang.String` | `POLL`
`static int` | `UNKNOWN`

Constructor Summary
`ProtocolRecovery()`

Method Summary
`static byte[]` | `buildRequest(BackupMetaContainer meta)` Builds full request for exact backup identified by full backup metadata.
`static byte[]` | `buildRequest(java.lang.String filename)` Builds partial request containing only filename.
`static byte[]` | `buildResponse(BackupMetaContainer meta, java.lang.String[] files)` This method build reponse to any request, either full or partial.
`static java.lang.String` | `getFilename(org.dom4j.Document msg)` Seeks request for name of file.
`static BackupMetaContainer` | `getMeta(org.dom4j.Document msg)` Attempts to convert request into backup metadata container.
`static int` | `getRequestType(org.dom4j.Document msg)` Method used to distinguis different types of request.
`static java.util.HashMap<BackupMetaContainer,java.lang.String[]>` | `parseResponse(java.lang.String response)` Parses response.

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

Field Detail

### UNKNOWN

    public static int UNKNOWN

### FULL_REQUEST

    public static int FULL_REQUEST

### FILENAME_REQUEST

    public static int FILENAME_REQUEST

### POLL

    public static final java.lang.String POLL

See Also:
  Constant Field Values

Constructor Detail

### ProtocolRecovery

    public ProtocolRecovery()

Method Detail

### buildRequest

    public static byte[] buildRequest(java.lang.String filename)

  Builds partial request containing only filename. Hosts storing matching backups should respond with list of files related to that backup they are storing.

  Parameters:
    `filename` - of file to be found
  Returns:
    byte array to be placed directly into UDP packet

### buildRequest

    public static byte[] buildRequest(BackupMetaContainer meta)

  Builds full request for exact backup identified by full backup metadata. Hosts storing matching backups should respond with list of files related to that backup they are storing.

  Parameters:
    `meta` - Backup metadata container of requested backup
  Returns:
    byte array to be placed directly into UDP packet

### getFilename

    public static java.lang.String getFilename(org.dom4j.Document msg)

  Seeks request for name of file.

  Parameters:
    `msg` - Xml request received over network
  Returns:
    name of file

### getMeta

    public static BackupMetaContainer getMeta(org.dom4j.Document msg)

  Attempts to convert request into backup metadata container.

  Parameters:
    `msg` - xml message received over network.
  Returns:
    BackupMetaContainer corresponding to passed Xml document

### getRequestType

    public static int getRequestType(org.dom4j.Document msg)

  Method used to distinguis different types of request. Request can be either full request indicating exact information abou backup or partial which is request only for filename.

  Parameters:
    `msg` - Xml message received over network
  Returns:
    type of request

### buildResponse

    public static byte[] buildResponse(BackupMetaContainer meta,
                                       java.lang.String[] files)

  This method build reponse to any request, either full or partial. Response contains metadata of backup and list of files hosts stores. Both of this information must be passed as arguments.

  Parameters:
    `meta` - metadata of backup
    `files` - array of stored files belonging to backup
  Returns:
    byte array to be placed directly into UDP packet

### parseResponse

    public static java.util.HashMap<BackupMetaContainer,java.lang.String[]> parseResponse(java.lang.String response)

  Parses response. Returns hashtable which facilitates searching for files belonging to known backup. Any required information can be loaded from this hashtable. This HashMap represents state of single network host.

  Parameters:
    `response` - to request in xml format received over network
  Returns:
    HashMap storing backup metadata and list of files

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