Feature #1686: Add rename methods to java OCA

This commit is contained in:
Carlos Martín authored and Tino Vazquez committed 2012-12-21 11:14:04 +01:00
1 parent a89d081279
commit bf42ee22d6
5 files changed
+113 -1

No files matched your search

@@ -65,6 +65,7 @@ public abstract class Document extends PoolElement
private static final String CHOWN = METHOD_PREFIX + "chown";
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String CLONE = METHOD_PREFIX + "clone";
private static final String RENAME = METHOD_PREFIX + "rename";
/**
* Creates a new Document representation.
@@ -215,6 +216,17 @@ public abstract class Document extends PoolElement
return client.call(CLONE, id, name);
}
/**
* Renames this document
*
* @param name New name for the document.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Helpers
// =================================
@@ -38,6 +38,7 @@ public class Image extends PoolElement
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String CHTYPE = METHOD_PREFIX + "chtype";
private static final String CLONE = METHOD_PREFIX + "clone";
private static final String RENAME = METHOD_PREFIX + "rename";
private static final String[] IMAGE_STATES =
{"INIT", "READY", "USED", "DISABLED", "LOCKED",
@@ -265,6 +266,19 @@ public class Image extends PoolElement
return client.call(CLONE, id, name);
}
/**
* Renames this Image
*
* @param client XML-RPC Client.
* @param id The Image id of the target Image.
* @param name New name for the Image.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -498,6 +512,17 @@ public class Image extends PoolElement
return clone(client, id, name);
}
/**
* Renames this Image
*
* @param name New name for the Image.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================
@@ -36,6 +36,7 @@ public class Template extends PoolElement
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String INSTANTIATE = METHOD_PREFIX + "instantiate";
private static final String CLONE = METHOD_PREFIX + "clone";
private static final String RENAME = METHOD_PREFIX + "rename";
/**
* Creates a new Template representation.
@@ -219,6 +220,19 @@ public class Template extends PoolElement
return client.call(CLONE, id, name);
}
/**
* Renames this Template
*
* @param client XML-RPC Client.
* @param id The Template id of the target Template.
* @param name New name for the Template.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -400,6 +414,17 @@ public class Template extends PoolElement
return clone(client, id, name);
}
/**
* Renames this Template
*
* @param name New name for the Template.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================
@@ -39,6 +39,7 @@ public class VirtualMachine extends PoolElement{
private static final String MONITORING = METHOD_PREFIX + "monitoring";
private static final String ATTACH = METHOD_PREFIX + "attach";
private static final String DETACH = METHOD_PREFIX + "detach";
private static final String RENAME = METHOD_PREFIX + "rename";
private static final String[] VM_STATES =
{
@@ -273,6 +274,19 @@ public class VirtualMachine extends PoolElement{
return client.call(DETACH, id, diskId);
}
/**
* Renames this VM
*
* @param client XML-RPC Client.
* @param id The VM id of the target VM.
* @param name New name for the VM.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -486,6 +500,17 @@ public class VirtualMachine extends PoolElement{
return detachdisk(client, id, diskId);
}
/**
* Renames this VM
*
* @param name New name for the VM.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================
@@ -38,6 +38,7 @@ public class VirtualNetwork extends PoolElement{
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String HOLD = METHOD_PREFIX + "hold";
private static final String RELEASE = METHOD_PREFIX + "release";
private static final String RENAME = METHOD_PREFIX + "rename";
/**
* Creates a new virtual network representation.
@@ -263,7 +264,7 @@ public class VirtualNetwork extends PoolElement{
* Replaces the VirtualNetwork template contents.
*
* @param client XML-RPC Client.
* @param id The user id of the target vnet we want to modify.
* @param id The vnet id of the target vnet we want to modify.
* @param new_template New template contents.
* @return If successful the message contains the vnet id.
*/
@@ -272,6 +273,19 @@ public class VirtualNetwork extends PoolElement{
return client.call(UPDATE, id, new_template);
}
/**
* Renames this VirtualNetwork
*
* @param client XML-RPC Client.
* @param id The VirtualNetwork id of the target VirtualNetwork.
* @param name New name for the VirtualNetwork.
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -491,6 +505,17 @@ public class VirtualNetwork extends PoolElement{
return update(client, id, new_template);
}
/**
* Renames this VirtualNetwork
*
* @param name New name for the VirtualNetwork.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================