Pool (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client, class: Pool

Package org.opennebula.client

# Class Pool

java.lang.Object
org.opennebula.client.Pool

Direct Known Subclasses:
  `AclPool`, `ClusterPool`, `DatastorePool`, `DocumentPool`, `GroupPool`, `HookPool`, `HostPool`, `ImagePool`, `MarketPlaceAppPool`, `MarketPlacePool`, `SecurityGroupPool`, `TemplatePool`, `UserPool`, `VdcPool`, `VirtualMachinePool`, `VirtualNetworkPool`, `VirtualNetworkTemplatePool`, `VirtualRouterPool`, `VMGroupPool`, `ZonePool`

public abstract class Pool extends Object
Represents a generic OpenNebula Pool in XML format and provides the basic functionality to handle the Pool elements.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ALL`
  All resources in the pool
  `protected Client`
  `client`
  `protected String`
  `elementName`
  `static final int`
  `GROUP`
  Resources owned by the user's primary group
  `protected String`
  `infoMethod`
  `static final int`
  `MINE`
  Connected user's resources
  `static final int`
  `MINE_GROUP`
  Connected user's resources, and the ones in his group
  `protected NodeList`
  `poolElements`
  `protected static XPath`
  `xpath`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Pool(String elementName, Client client, String infoMethod)`
  Protected constructor, to be called from subclasses.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract PoolElement`
  `factory(Node node)`
  The factory method returns a suitable PoolElement object from an XML node.
  `protected PoolElement`
  `getById(int id)`
  Returns the element with the given Id from the pool.
  `int`
  `getLength()`
  The number of elements in the pool.
  `protected OneResponse`
  `info()`
  `protected OneResponse`
  `info(int filter, int startId, int endId)`
  `protected static OneResponse`
  `info(Client client, String infoMethod)`
  Info methods
  `protected static OneResponse`
  `info(Client client, String infoMethod, int filter, int startId, int endId)`
  `protected OneResponse`
  `infoAll()`
  `protected static OneResponse`
  `infoAll(Client client, String infoMethod)`
  `protected OneResponse`
  `infoGroup()`
  `protected static OneResponse`
  `infoGroup(Client client, String infoMethod)`
  `protected static OneResponse`
  `infoGroupPrimary(Client client, String infoMethod)`
  `protected OneResponse`
  `infoMine()`
  `protected static OneResponse`
  `infoMine(Client client, String infoMethod)`
  `PoolElement`
  `item(int index)`
  Returns the indexth element in the pool.
  `protected void`
  `processInfo(OneResponse info)`
  After a *pool.info call, this method builds the internal xml representation of the pool.
  `protected static OneResponse`
  `xmlrpcInfo(Client client, String infoMethod, Object... args)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### client

    protected Client client

  - ### elementName

    protected String elementName

  - ### infoMethod

    protected String infoMethod

  - ### poolElements

    protected NodeList poolElements

  - ### xpath

    protected static XPath xpath

  - ### ALL

    public static final int ALL
    All resources in the pool
    See Also:
      - Constant Field Values

  - ### MINE

    public static final int MINE
    Connected user's resources
    See Also:
      - Constant Field Values

  - ### MINE_GROUP

    public static final int MINE_GROUP
    Connected user's resources, and the ones in his group
    See Also:
      - Constant Field Values

  - ### GROUP

    public static final int GROUP
    Resources owned by the user's primary group
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Pool

    protected Pool(String elementName, Client client, String infoMethod)
    Protected constructor, to be called from subclasses.
    Parameters:
      `elementName` - Name of the PoolElement's xml element
      `client` - XML-RPC client which will handle calls
      `infoMethod` - XML-RPC info method for the subclass Pool

- ## Method Details

  - ### factory

    public abstract PoolElement factory(Node node)
    The factory method returns a suitable PoolElement object from an XML node. Each Pool must implement the corresponding factory method.
    Parameters:
      `node` - XML Dom node to build the PoolElement from
    Returns:
      The corresponding PoolElement

  - ### info

    protected static OneResponse info(Client client, String infoMethod)
    Info methods

  - ### info

    protected static OneResponse info(Client client, String infoMethod, int filter, int startId, int endId)

  - ### infoAll

    protected static OneResponse infoAll(Client client, String infoMethod)

  - ### infoMine

    protected static OneResponse infoMine(Client client, String infoMethod)

  - ### infoGroup

    protected static OneResponse infoGroup(Client client, String infoMethod)

  - ### infoGroupPrimary

    protected static OneResponse infoGroupPrimary(Client client, String infoMethod)

  - ### xmlrpcInfo

    protected static OneResponse xmlrpcInfo(Client client, String infoMethod, Object... args)

  - ### info

    protected OneResponse info()

  - ### infoAll

    protected OneResponse infoAll()

  - ### infoMine

    protected OneResponse infoMine()

  - ### infoGroup

    protected OneResponse infoGroup()

  - ### info

    protected OneResponse info(int filter, int startId, int endId)

  - ### processInfo

    protected void processInfo(OneResponse info)
    After a *pool.info call, this method builds the internal xml representation of the pool.
    Parameters:
      `info` - The XML-RPC *pool.info response

  - ### item

    public PoolElement item(int index)
    Returns the indexth element in the pool. If index is greater than or equal to the number of elements in the pool, this returns null.
    Parameters:
      `index` - Index of the element.
    Returns:
      The element at the indexth position in the pool, or null if that is not a valid index.

  - ### getById

    protected PoolElement getById(int id)
    Returns the element with the given Id from the pool. If it is not found, then returns null. The method `info()` must be called before.
    Parameters:
      `id` - of the element to retrieve
    Returns:
      The element with the given Id, or null if it was not found.

  - ### getLength

    public int getLength()
    The number of elements in the pool.
    Returns:
      The number of elements in the pool.