Package org.opennebula.client.document
Class Document
java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.document.Document
This class represents an OpenNebula document.
Documents are generic objects. You can dynamically create new Pools in
OpenNebula, creating subclasses with different TYPE values.
TYPE must be the same for the corresponding pool, see
For example:
TYPE must be the same for the corresponding pool, see
DocumentPool
For example:
public class GenericObjA extends Document
{
private static final int TYPE = 200;
public GenericObjA(int id, Client client)
{
super(id, client);
}
public GenericObjA(Node xmlElement, Client client)
{
super(xmlElement, client);
}
public static OneResponse allocate(Client client, String description)
{
return Document.allocate(client, description, TYPE);
}
}
-
Field Summary
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static OneResponse
Allocates a new Document in OpenNebula.chgrp
(int gid) Changes the groupchmod
(int octet) Changes the permissionschmod
(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 document permissionsChanges the permissionschown
(int uid) Changes the ownerchown
(int uid, int gid) Changes the owner/groupClones this document into a new onedelete()
Deletes a document from OpenNebula.info()
Retrieves the information of the given Document.lock
(int level) Locks this objectstatic OneResponse
lock this Documentpublish()
Publishes the document.publish
(boolean publish) Publishes or unpublishes a document.Renames this documentunlock()
Unlocks this objectstatic OneResponse
Unlock this DocumentUnpublishes the document.Replaces the document template contents.Replaces the document template contents.
-
Constructor Details
-
Document
Creates a new Document representation.- Parameters:
id
- The document id.client
- XML-RPC Client.
-
Document
- See Also:
-
-
Method Details
-
lock
lock this Document- Parameters:
client
- XML-RPC Client.id
- The Image id.level
- Lock level.- Returns:
- If an error occurs the error message contains the reason.
-
unlock
Unlock this Document- Parameters:
client
- XML-RPC Client.id
- The Image id.- Returns:
- If an error occurs the error message contains the reason.
-
allocate
Allocates a new Document in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the document.- Returns:
- If successful the message contains the associated id generated for this Document.
-
info
Retrieves the information of the given Document.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes a document from OpenNebula.- Returns:
- A encapsulated response.
-
update
Replaces the document template contents.- Parameters:
new_document
- New template contents.- Returns:
- If successful the message contains the document id.
-
update
Replaces the document template contents.- Parameters:
new_document
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the document id.
-
publish
Publishes or unpublishes a document.- Parameters:
publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the document id.
-
chown
Changes the owner/group- Parameters:
uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(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 document permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
clone
Clones this document into a new one- Parameters:
name
- Name for the new document.- Returns:
- If successful the message contains the new document ID.
-
rename
Renames this document- Parameters:
name
- New name for the document.- Returns:
- If an error occurs the error message contains the reason.
-
lock
Locks this object- Parameters:
level
- int to identify the lock level- Returns:
- In case of success, a boolean with true if the lock was granted, and false if the object is already locked.
-
unlock
Unlocks this object- Returns:
- If an error occurs the error message contains the reason.
-
publish
Publishes the document.- Returns:
- If successful the message contains the document id.
-
unpublish
Unpublishes the document.- Returns:
- If successful the message contains the document id.
-
chown
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-