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

Package org.opennebula.client

# Class PoolElement

java.lang.Object
org.opennebula.client.PoolElement

Direct Known Subclasses:
  `Acl`, `Cluster`, `Datastore`, `Document`, `Group`, `Hook`, `Host`, `Image`, `MarketPlace`, `MarketPlaceApp`, `SecurityGroup`, `Template`, `User`, `Vdc`, `VirtualMachine`, `VirtualNetwork`, `VirtualNetworkTemplate`, `VirtualRouter`, `VMGroup`, `Zone`

public abstract class PoolElement extends Object
Represents a generic element of a Pool in XML format.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Client`
  `client`
  `protected int`
  `id`
  `protected Node`
  `xml`
  `protected static XPath`
  `xpath`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `PoolElement(int id, Client client)`
  Creates a new PoolElement with the specified attributes.
  `protected`
  `PoolElement(Node xmlElement, Client client)`
  Creates a new PoolElement from the xml provided.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected static OneResponse`
  `chmod(Client client, String method, int id, int octet)`
  Changes the permissions
  `protected static OneResponse`
  `chmod(Client client, String method, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)`
  Changes the permissions
  `protected static OneResponse`
  `chmod(Client client, String method, int id, String octet)`
  Changes the permissions
  `String`
  `getId()`
  Returns the element's ID.
  `String`
  `getName()`
  Returns the element's name.
  `int`
  `gid()`
  Returns the element group's ID, or -1 if the element doesn't have one.
  `int`
  `id()`
  `protected void`
  `processInfo(OneResponse info)`
  After a *.info call, this method builds the internal xml representation of the pool.
  `int`
  `state()`
  Performs an xpath evaluation for the "state" expression.
  `int`
  `uid()`
  Returns the owner User's ID, or -1 if the element doesn't have one.
  `String`
  `xpath(String expression)`
  Evaluates an XPath expression and returns the result as a String.

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

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

- ## Field Details

  - ### xpath

    protected static XPath xpath

  - ### id

    protected int id

  - ### xml

    protected Node xml

  - ### client

    protected Client client

- ## Constructor Details

  - ### PoolElement

    protected PoolElement(int id, Client client)
    Creates a new PoolElement with the specified attributes.
    Parameters:
      `id` - Id of the element.
      `client` - XML-RPC Client.

  - ### PoolElement

    protected PoolElement(Node xmlElement, Client client)
    Creates a new PoolElement from the xml provided.
    Parameters:
      `client` - XML-RPC Client.
      `xmlElement` - XML representation of the element.

- ## Method Details

  - ### processInfo

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

  - ### chmod

    protected static OneResponse chmod(Client client, String method, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
    Changes the permissions
    Parameters:
      `client` - XML-RPC Client.
      `method` - XML-RPC method.
      `id` - The id of the target object.
      `owner_u` - 1 to allow, 0 deny, -1 do not change
      `owner_m` - 1 to allow, 0 deny, -1 do not change
      `owner_a` - 1 to allow, 0 deny, -1 do not change
      `group_u` - 1 to allow, 0 deny, -1 do not change
      `group_m` - 1 to allow, 0 deny, -1 do not change
      `group_a` - 1 to allow, 0 deny, -1 do not change
      `other_u` - 1 to allow, 0 deny, -1 do not change
      `other_m` - 1 to allow, 0 deny, -1 do not change
      `other_a` - 1 to allow, 0 deny, -1 do not change
    Returns:
      If an error occurs the error message contains the reason.

  - ### chmod

    protected static OneResponse chmod(Client client, String method, int id, String octet)
    Changes the permissions
    Parameters:
      `client` - XML-RPC Client.
      `method` - XML-RPC method.
      `id` - The id of the target object.
      `octet` - Permissions octet, e.g. 640
    Returns:
      If an error occurs the error message contains the reason.

  - ### chmod

    protected static OneResponse chmod(Client client, String method, int id, int octet)
    Changes the permissions
    Parameters:
      `client` - XML-RPC Client.
      `method` - XML-RPC method.
      `id` - The id of the target object.
      `octet` - Permissions octed , e.g. 640
    Returns:
      If an error occurs the error message contains the reason.

  - ### getId

    public String getId()
    Returns the element's ID.
    Returns:
      the element's ID.

  - ### id

    public int id()

  - ### getName

    public String getName()
    Returns the element's name.
    Returns:
      the element's name.

  - ### state

    public int state()
    Performs an xpath evaluation for the "state" expression.
    Returns:
      The value of the STATE element.

  - ### uid

    public int uid()
    Returns the owner User's ID, or -1 if the element doesn't have one.
    Returns:
      the owner User's ID, or -1 if the element doesn't have one.

  - ### gid

    public int gid()
    Returns the element group's ID, or -1 if the element doesn't have one.
    Returns:
      the element group's ID, or -1 if the element doesn't have one.

  - ### xpath

    public String xpath(String expression)
    Evaluates an XPath expression and returns the result as a String. If the internal xml representation is not built, returns null. The subclass method info() must be called before.
    Parameters:
      `expression` - The XPath expression.
    Returns:
      The String that is the result of evaluating the expression and converting the result to a String. An empty String is returned if the expression is not a valid path; null if the internal xml representation is not built.