OpenNebula
Cloud API

org.opennebula.client.image
Class Image

java.lang.Object
  extended by org.opennebula.client.PoolElement
      extended by org.opennebula.client.image.Image

public class Image
extends PoolElement

This class represents an OpenNebula image. It also offers static XML-RPC call wrappers.


Field Summary
 
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
 
Constructor Summary
  Image(int id, Client client)
          Creates a new Image representation.
protected Image(org.w3c.dom.Node xmlElement, Client client)
           
 
Method Summary
static OneResponse allocate(Client client, java.lang.String description)
          Allocates a new Image in OpenNebula.
 OneResponse delete()
          Deletes the image from OpenNebula.
static OneResponse delete(Client client, int id)
          Deletes an image from OpenNebula.
 OneResponse disable()
          Disables the image.
 OneResponse enable()
          Enables the image.
 OneResponse enable(boolean enable)
          Enables or disables the image.
static OneResponse enable(Client client, int id, boolean enable)
          Enables or disables an image.
 OneResponse info()
          Retrieves the information of the Image.
static OneResponse info(Client client, int id)
          Retrieves the information of the given Image.
 boolean isEnabled()
          Returns true if the image is enabled.
 boolean isPublic()
          Returns true if the image is public.
 OneResponse publish()
          Publishes the image.
 OneResponse publish(boolean publish)
          Publishes or unpublishes the image.
static OneResponse publish(Client client, int id, boolean publish)
          Publishes or unpublishes an image.
static OneResponse rmattr(Client client, int id, java.lang.String att_name)
          Removes an image attribute.
 OneResponse rmattr(java.lang.String att_name)
          Removes an image attribute.
 java.lang.String shortStateStr()
          Returns the short length string state of the Image.
 java.lang.String shortTypeStr()
          Returns the type of the Image as a short String.
 java.lang.String stateString()
          Returns the state of the Image.
 int type()
          Returns the type of the Image.
 java.lang.String typeStr()
          Returns the type of the Image as a String.
 OneResponse unpublish()
          Unpublishes the image.
static OneResponse update(Client client, int id, java.lang.String att_name, java.lang.String att_val)
          Modifies an image attribute.
 OneResponse update(java.lang.String att_name, java.lang.String att_val)
          Modifies an image attribute.
 
Methods inherited from class org.opennebula.client.PoolElement
getId, getName, id, processInfo, state, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Image

public Image(int id,
             Client client)
Creates a new Image representation.

Parameters:
id - The image id.
client - XML-RPC Client.

Image

protected Image(org.w3c.dom.Node xmlElement,
                Client client)
See Also:
PoolElement
Method Detail

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String description)
Allocates a new Image in OpenNebula.

Parameters:
client - XML-RPC Client.
description - A string containing the template of the image.
Returns:
If successful the message contains the associated id generated for this Image.

info

public static OneResponse info(Client client,
                               int id)
Retrieves the information of the given Image.

Parameters:
client - XML-RPC Client.
id - The image id for the image to retrieve the information from
Returns:
If successful the message contains the string with the information returned by OpenNebula.

delete

public static OneResponse delete(Client client,
                                 int id)
Deletes an image from OpenNebula.

Parameters:
client - XML-RPC Client.
id - The image id of the target image we want to delete.
Returns:
A encapsulated response.

update

public static OneResponse update(Client client,
                                 int id,
                                 java.lang.String att_name,
                                 java.lang.String att_val)
Modifies an image attribute.

Parameters:
client - XML-RPC Client.
id - The image id of the target image we want to modify.
att_name - The name of the attribute to update.
att_val - The new value for the attribute.
Returns:
If successful the message contains the image id.

rmattr

public static OneResponse rmattr(Client client,
                                 int id,
                                 java.lang.String att_name)
Removes an image attribute.

Parameters:
client - XML-RPC Client.
id - The image id of the target image we want to modify.
att_name - The name of the attribute to remove.
Returns:
If successful the message contains the image id.

enable

public static OneResponse enable(Client client,
                                 int id,
                                 boolean enable)
Enables or disables an image.

Parameters:
client - XML-RPC Client.
id - The image id of the target image we want to modify.
enable - True for enabling, false for disabling.
Returns:
If successful the message contains the image id.

publish

public static OneResponse publish(Client client,
                                  int id,
                                  boolean publish)
Publishes or unpublishes an image.

Parameters:
client - XML-RPC Client.
id - The image id of the target image we want to modify.
publish - True for publishing, false for unpublishing.
Returns:
If successful the message contains the image id.

info

public OneResponse info()
Retrieves the information of the Image.

Returns:
If successful the message contains the string with the information returned by OpenNebula.

delete

public OneResponse delete()
Deletes the image from OpenNebula.

Returns:
A encapsulated response.

update

public OneResponse update(java.lang.String att_name,
                          java.lang.String att_val)
Modifies an image attribute.

Parameters:
att_name - The name of the attribute to update.
att_val - The new value for the attribute.
Returns:
If successful the message contains the image id.

rmattr

public OneResponse rmattr(java.lang.String att_name)
Removes an image attribute.

Parameters:
att_name - The name of the attribute to remove.
Returns:
If successful the message contains the image id.

enable

public OneResponse enable(boolean enable)
Enables or disables the image.

Parameters:
enable - True for enabling, false for disabling.
Returns:
If successful the message contains the image id.

enable

public OneResponse enable()
Enables the image.

Returns:
If successful the message contains the image id.

disable

public OneResponse disable()
Disables the image.

Returns:
If successful the message contains the image id.

publish

public OneResponse publish(boolean publish)
Publishes or unpublishes the image.

Parameters:
publish - True for publishing, false for unpublishing.
Returns:
If successful the message contains the image id.

publish

public OneResponse publish()
Publishes the image.

Returns:
If successful the message contains the image id.

unpublish

public OneResponse unpublish()
Unpublishes the image.

Returns:
If successful the message contains the image id.

stateString

public java.lang.String stateString()
Returns the state of the Image.
The method info() must be called before.

Returns:
The state of the Image.

shortStateStr

public java.lang.String shortStateStr()
Returns the short length string state of the Image.
The method info() must be called before.

Returns:
The short length string state of the Image.

type

public int type()
Returns the type of the Image.

Returns:
The type of the Image.

typeStr

public java.lang.String typeStr()
Returns the type of the Image as a String.

Returns:
The type of the Image as a String.

shortTypeStr

public java.lang.String shortTypeStr()
Returns the type of the Image as a short String.

Returns:
The type of the Image as a short String.

isEnabled

public boolean isEnabled()
Returns true if the image is enabled.

Returns:
True if the image is enabled.

isPublic

public boolean isPublic()
Returns true if the image is public.

Returns:
True if the image is public.

OpenNebula
Cloud API

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