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

Package org.opennebula.client.template

# Class TemplatePool

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

All Implemented Interfaces:
  `Iterable<Template>`

public class TemplatePool extends Pool implements Iterable<Template>
This class represents an OpenNebula Template pool. It also offers static XML-RPC call wrappers.

- ## Field Summary

  ### Fields inherited from class org.opennebula.client.Pool

  `ALL, client, elementName, GROUP, infoMethod, MINE, MINE_GROUP, poolElements, xpath`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TemplatePool(Client client)`
  Creates a new Template pool with the default filter flag value set to `Pool.MINE_GROUP` (Template belonging to the connected user, and the ones in his group)
  `TemplatePool(Client client, int filter)`
  Creates a new Template pool.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PoolElement`
  `factory(Node node)`
  The factory method returns a suitable PoolElement object from an XML node.
  `Template`
  `getById(int id)`
  Returns the Template with the given Id from the pool.
  `OneResponse`
  `info()`
  Loads the xml representation of all or part of the Templates in the pool.
  `OneResponse`
  `info(int filter, int startId, int endId)`
  Retrieves all or part of the Templates in the pool.
  `static OneResponse`
  `info(Client client, int filter)`
  Retrieves all or part of the Templates in the pool.
  `static OneResponse`
  `info(Client client, int filter, int startId, int endId)`
  Retrieves all or part of the Templates in the pool.
  `OneResponse`
  `infoAll()`
  Loads the xml representation of all the Templates in the pool.
  `static OneResponse`
  `infoAll(Client client)`
  Retrieves all the Templates in the pool.
  `OneResponse`
  `infoGroup()`
  Loads the xml representation of all the connected user's Templates and the ones in his group.
  `static OneResponse`
  `infoGroup(Client client)`
  Retrieves all the connected user's Templates and the ones in his group.
  `OneResponse`
  `infoMine()`
  Loads the xml representation of all the connected user's Templates.
  `static OneResponse`
  `infoMine(Client client)`
  Retrieves all the connected user's Templates.
  `Iterator<Template>`
  `iterator()`

  ### Methods inherited from class org.opennebula.client.Pool

  `getLength, info, info, infoAll, infoGroup, infoGroupPrimary, infoMine, item, processInfo, xmlrpcInfo`

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

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

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Constructor Details

  - ### TemplatePool

    public TemplatePool(Client client)
    Creates a new Template pool with the default filter flag value set to `Pool.MINE_GROUP` (Template belonging to the connected user, and the ones in his group)
    Parameters:
      `client` - XML-RPC Client.
    See Also:
      - `TemplatePool(Client, int)`

  - ### TemplatePool

    public TemplatePool(Client client, int filter)
    Creates a new Template pool.
    Parameters:
      `client` - XML-RPC Client.
      `filter` - Filter flag to use by default in the method `info()`. Possible values:
      - `Pool.ALL`: All Templates
      - `Pool.MINE`: Connected user's Templates
      - `Pool.MINE_GROUP`: Connected user's Templates, and the ones in his group
      - `Pool.GROUP`: User's primary group Templates
      - >= 0: UID User's Templates

- ## Method Details

  - ### factory

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

  - ### info

    public static OneResponse info(Client client, int filter)
    Retrieves all or part of the Templates in the pool.
    Parameters:
      `client` - XML-RPC Client.
      `filter` - Filter flag to use. Possible values:
      - `Pool.ALL`: All Templates
      - `Pool.MINE`: Connected user's Templates
      - `Pool.MINE_GROUP`: Connected user's Templates, and the ones in his group
      - `Pool.GROUP`: User's primary group Templates
      - >= 0: UID User's Templates
      - >= 0: UID User's Templates
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### infoAll

    public static OneResponse infoAll(Client client)
    Retrieves all the Templates in the pool.
    Parameters:
      `client` - XML-RPC Client.
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### infoMine

    public static OneResponse infoMine(Client client)
    Retrieves all the connected user's Templates.
    Parameters:
      `client` - XML-RPC Client.
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### infoGroup

    public static OneResponse infoGroup(Client client)
    Retrieves all the connected user's Templates and the ones in his group.
    Parameters:
      `client` - XML-RPC Client.
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### info

    public static OneResponse info(Client client, int filter, int startId, int endId)
    Retrieves all or part of the Templates in the pool. The Templates to retrieve can be also filtered by Id, specifying the first and last Id to include.
    Parameters:
      `client` - XML-RPC Client.
      `filter` - Filter flag to use. Possible values:
      - `Pool.ALL`: All Templates
      - `Pool.MINE`: Connected user's Templates
      - `Pool.MINE_GROUP`: Connected user's Templates, and the ones in his group
      - `Pool.GROUP`: User's primary group Templates
      - >= 0: UID User's Templates
      - >= 0: UID User's Templates
      `startId` - Lowest Id to retrieve
      `endId` - Biggest Id to retrieve
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### info

    public OneResponse info()
    Loads the xml representation of all or part of the Templates in the pool. The filter used is the one set in the constructor.
    Overrides:
      `info` in class `Pool`
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.
    See Also:
      - `info(Client, int)`

  - ### infoAll

    public OneResponse infoAll()
    Loads the xml representation of all the Templates in the pool.
    Overrides:
      `infoAll` in class `Pool`
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### infoMine

    public OneResponse infoMine()
    Loads the xml representation of all the connected user's Templates.
    Overrides:
      `infoMine` in class `Pool`
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### infoGroup

    public OneResponse infoGroup()
    Loads the xml representation of all the connected user's Templates and the ones in his group.
    Overrides:
      `infoGroup` in class `Pool`
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### info

    public OneResponse info(int filter, int startId, int endId)
    Retrieves all or part of the Templates in the pool. The Templates to retrieve can be also filtered by Id, specifying the first and last Id to include.
    Overrides:
      `info` in class `Pool`
    Parameters:
      `filter` - Filter flag to use. Possible values:
      - `Pool.ALL`: All Templates
      - `Pool.MINE`: Connected user's Templates
      - `Pool.MINE_GROUP`: Connected user's Templates, and the ones in his group
      - `Pool.GROUP`: User's primary group Templates
      - >= 0: UID User's Templates
      - >= 0: UID User's Templates
      `startId` - Lowest Id to retrieve
      `endId` - Biggest Id to retrieve
    Returns:
      If successful the message contains the string with the information returned by OpenNebula.

  - ### iterator

    public Iterator<Template> iterator()
    Specified by:
      `iterator` in interface `Iterable<Template>`

  - ### getById

    public Template getById(int id)
    Returns the Template with the given Id from the pool. If it is not found, then returns null. The method `info()` must be called before.
    Overrides:
      `getById` in class `Pool`
    Parameters:
      `id` - of the ACl rule to retrieve
    Returns:
      The Template with the given Id, or null if it was not found.