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

## backupAndRecovery
Class RepoHost

    java.lang.Object
      backupAndRecovery.RepoHost

All Implemented Interfaces:
  java.lang.Comparable<RepoHost>

    public class RepoHost

extends java.lang.Object
implements java.lang.Comparable<RepoHost>

This class represents single computer capable of storing backup files. Information about usage of host resources is stored within this class together with IP address of host and its type. Any information about usage of disk space(e.g repository size, used repository) is in MB. Type of host is used to distiguish desktops and notebooks. Notebooks can be further divided into two categories - ordinary notebooks that are often disconnected from network and carried around and static notebooks which are used more like desktop computers, however, employees can use them to work from home.

Field Summary
`int` | `backupsStored`
`static int` | `DESKTOP`
`java.net.InetAddress` | `hostAddress`
`int` | `hostMask`
`int` | `hostPort`
`int` | `hostType`
`static int` | `NOTEBOOK`
`int` | `repoSize`
`int` | `repoUsed`
`static int` | `UNKNOWN`

Constructor Summary
`RepoHost()` Creates empty container with default data.
`RepoHost(java.net.InetAddress address, int maskLength, int port, int size, int used, int stored, int type)` Builds container using passed arguments.
`RepoHost(java.lang.String xmlRepoHostData)` Loads information about host from xml file.

Method Summary
`int` | `compareTo(RepoHost o)`
`java.net.InetAddress` | `getAddress()` Returns IP address of host.
`int` | `getBackupsStored()` Number of backups stored.
`int` | `getHostType()` Returns type of host.
`int` | `getRepoSize()` Size of repository.
`int` | `getRepoUsed()` Returns size of used repository
`byte[]` | `getSubnetMask()` Returns subnet mask of host as array of bytes.
`double` | `getWeight()` Returns weight or desirability of host to store backup.
`java.lang.String` | `getXml()` Convers inner data of container into xml representation.
`java.lang.String` | `toString()` Returns XML representation of host as string.

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

Field Detail

### hostAddress

    public java.net.InetAddress hostAddress

### hostMask

    public int hostMask

### hostPort

    public int hostPort

### repoSize

    public int repoSize

### repoUsed

    public int repoUsed

### hostType

    public int hostType

### backupsStored

    public int backupsStored

### UNKNOWN

    public static final int UNKNOWN

See Also:
  Constant Field Values

### NOTEBOOK

    public static final int NOTEBOOK

See Also:
  Constant Field Values

### DESKTOP

    public static final int DESKTOP

See Also:
  Constant Field Values

Constructor Detail

### RepoHost

    public RepoHost()

  Creates empty container with default data.

### RepoHost

    public RepoHost(java.lang.String xmlRepoHostData)
             throws java.lang.IllegalArgumentException

  Loads information about host from xml file.

  Parameters:
    `xmlRepoHostData` - String representation of xml file.
  Throws:
    `java.lang.IllegalArgumentException` - if xml data is malformed or invalid

### RepoHost

    public RepoHost(java.net.InetAddress address,
                    int maskLength,
                    int port,
                    int size,
                    int used,
                    int stored,
                    int type)

  Builds container using passed arguments.

  Parameters:
    `address` - IP address of host
    `maskLength` - Length of subnet mask
    `size` - Size of repository in MB.
    `used` - Used portion of repository storage in MB.
    `stored` - Number of stored backups.
    `type` - Type of host.

Method Detail

### getAddress

    public java.net.InetAddress getAddress()

  Returns IP address of host.

  Returns:
    InetAddress of host.

### getSubnetMask

    public byte[] getSubnetMask()

  Returns subnet mask of host as array of bytes. Byte 0 is for first octet of address byte 1 for second and so on.

  Returns:
    array of bytes representing subnet mask.

### getRepoSize

    public int getRepoSize()

  Size of repository.

  Returns:
    Size of repository

### getRepoUsed

    public int getRepoUsed()

  Returns size of used repository

  Returns:
    Size of used repository

### getBackupsStored

    public int getBackupsStored()

  Number of backups stored.

  Returns:
    Number of backups stored.

### getHostType

    public int getHostType()

  Returns type of host. Used to determine probality of host going down.

  Returns:
    int representing type of host

### getXml

    public java.lang.String getXml()

  Convers inner data of container into xml representation.

  Returns:
    String representing container data.

### getWeight

    public double getWeight()

  Returns weight or desirability of host to store backup. This method is used to compare hosts and to find the best nodes for our backup. Higher number means better host.

  Returns:
    weight of host

### toString

    public java.lang.String toString()

  Returns XML representation of host as string.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    xml string

### compareTo

    public int compareTo(RepoHost o)

  Specified by:
    `compareTo` in interface `java.lang.Comparable<RepoHost>`

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