OpenNebula
Cloud API

org.opennebula.client
Class PoolElement

java.lang.Object
  extended by org.opennebula.client.PoolElement
Direct Known Subclasses:
Acl, Group, Host, Image, Template, User, VirtualMachine, VirtualNetwork

public abstract class PoolElement
extends java.lang.Object

Represents a generic element of a Pool in XML format.


Field Summary
protected  Client client
           
protected  int id
           
protected  org.w3c.dom.Node xml
           
protected static javax.xml.xpath.XPath xpath
           
 
Constructor Summary
protected PoolElement(int id, Client client)
          Creates a new PoolElement with the specified attributes.
protected PoolElement(org.w3c.dom.Node xmlElement, Client client)
          Creates a new PoolElement from the xml provided.
 
Method Summary
 java.lang.String getId()
          Returns the element's ID.
 java.lang.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.
 java.lang.String xpath(java.lang.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 Detail

xpath

protected static javax.xml.xpath.XPath xpath

id

protected int id

xml

protected org.w3c.dom.Node xml

client

protected Client client
Constructor Detail

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(org.w3c.dom.Node xmlElement,
                      Client client)
Creates a new PoolElement from the xml provided.

Parameters:
client - XML-RPC Client.
xmlElement - XML representation of the element.
Method Detail

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

getId

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

Returns:
the element's ID.

id

public int id()

getName

public java.lang.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 java.lang.String xpath(java.lang.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.

OpenNebula
Cloud API

Visit OpenNebula.org
Copyright 2002-2011 © OpenNebula Project Leads (OpenNebula.org).