diff --git a/src/cli/oneimage b/src/cli/oneimage index de9d2d8850..aa810cfd3f 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -404,8 +404,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end i.lock(level) end diff --git a/src/cli/onemarketapp b/src/cli/onemarketapp index 7a34785782..5febd3bfa9 100755 --- a/src/cli/onemarketapp +++ b/src/cli/onemarketapp @@ -326,8 +326,7 @@ CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end app.lock(level) end diff --git a/src/cli/onetemplate b/src/cli/onetemplate index 0e9ecb2957..0ca52637ff 100755 --- a/src/cli/onetemplate +++ b/src/cli/onetemplate @@ -388,8 +388,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end t.lock(level) end diff --git a/src/cli/onevm b/src/cli/onevm index 4e705eb010..d6b52b8576 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -1038,8 +1038,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end vm.lock(level) end diff --git a/src/cli/onevmgroup b/src/cli/onevmgroup index 7e15c27e18..a3409c55a5 100755 --- a/src/cli/onevmgroup +++ b/src/cli/onevmgroup @@ -229,8 +229,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end vmg.lock(level) end diff --git a/src/cli/onevnet b/src/cli/onevnet index 3a5db4e529..ca07024108 100755 --- a/src/cli/onevnet +++ b/src/cli/onevnet @@ -469,8 +469,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end vnet.lock(level) end diff --git a/src/cli/onevrouter b/src/cli/onevrouter index 3a8c99d8a9..443ae1cf03 100755 --- a/src/cli/onevrouter +++ b/src/cli/onevrouter @@ -361,8 +361,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do elsif !options[:all].nil? level = 4 else - STDERR.puts "Need to level of lock." - exit -1 + level = 1 end vr.lock(level) end diff --git a/src/oca/java/src/org/opennebula/client/document/Document.java b/src/oca/java/src/org/opennebula/client/document/Document.java index b49f85f6f2..7b51ae73e2 100644 --- a/src/oca/java/src/org/opennebula/client/document/Document.java +++ b/src/oca/java/src/org/opennebula/client/document/Document.java @@ -87,6 +87,31 @@ public abstract class Document extends PoolElement super(xmlElement, client); } + /** + * lock this Document + * + * @param client XML-RPC Client. + * @param id The Image id. + * @param level Lock level. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse lock(Client client, int id, int level) + { + return client.call(LOCK, id, level); + } + + /** + * Unlock this Document + * + * @param client XML-RPC Client. + * @param id The Image id. + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse unlock(Client client, int id) + { + return client.call(UNLOCK, id); + } + // ================================= // Static XML-RPC methods // ================================= @@ -244,24 +269,23 @@ public abstract class Document extends PoolElement /** * Locks this object * - * @param owner String to identify the application requestiong the lock + * @param level int to identify the lock level * @return In case of success, a boolean with true if the lock was granted, * and false if the object is already locked. */ - public OneResponse lock(String owner) + public OneResponse lock(int level) { - return client.call(LOCK, id, owner); + return client.call(LOCK, id, level); } /** * Unlocks this object * - * @param owner String to identify the application requestiong the lock * @return If an error occurs the error message contains the reason. */ - public OneResponse unlock(String owner) + public OneResponse unlock() { - return client.call(UNLOCK, id, owner); + return client.call(UNLOCK, id); } // ================================= diff --git a/src/sunstone/public/app/tabs/images-tab/buttons.js b/src/sunstone/public/app/tabs/images-tab/buttons.js index 4f76f09d04..a29d496fc5 100644 --- a/src/sunstone/public/app/tabs/images-tab/buttons.js +++ b/src/sunstone/public/app/tabs/images-tab/buttons.js @@ -85,21 +85,21 @@ define(function(require) { "Image.edit_labels" : { layout: "labels", }, - "Image.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "Image.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "Image.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "Image.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "Image.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/buttons.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/buttons.js index 26c2550d2b..fa8f690ac2 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab/buttons.js +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/buttons.js @@ -68,21 +68,21 @@ define(function(require) { "MarketPlaceApp.edit_labels" : { layout: "labels", }, - "MarketPlaceApp.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "MarketPlaceApp.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "MarketPlaceApp.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "MarketPlaceApp.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "MarketPlaceApp.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/templates-tab/buttons.js b/src/sunstone/public/app/tabs/templates-tab/buttons.js index 718c67eed9..d8a3675213 100644 --- a/src/sunstone/public/app/tabs/templates-tab/buttons.js +++ b/src/sunstone/public/app/tabs/templates-tab/buttons.js @@ -84,21 +84,21 @@ define(function(require) { "Template.edit_labels" : { layout: "labels", }, - "Template.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "Template.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "Template.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "Template.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "Template.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/vmgroup-tab/buttons.js b/src/sunstone/public/app/tabs/vmgroup-tab/buttons.js index 6f34fbedf8..32693867b5 100644 --- a/src/sunstone/public/app/tabs/vmgroup-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vmgroup-tab/buttons.js @@ -53,21 +53,21 @@ define(function(require) { text: Locale.tr("Delete"), layout: "del" }, - "VMGroup.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "VMGroup.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "VMGroup.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "VMGroup.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "VMGroup.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/vms-tab/buttons.js b/src/sunstone/public/app/tabs/vms-tab/buttons.js index 34a0aa07ca..f66c11d519 100644 --- a/src/sunstone/public/app/tabs/vms-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vms-tab/buttons.js @@ -198,21 +198,21 @@ define(function(require) { "VM.edit_labels" : { layout: "labels", }, - "VM.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "VM.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "VM.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "VM.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "VM.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/vnets-tab/buttons.js b/src/sunstone/public/app/tabs/vnets-tab/buttons.js index a7dcdfc027..ef7a4b771f 100644 --- a/src/sunstone/public/app/tabs/vnets-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vnets-tab/buttons.js @@ -75,21 +75,21 @@ define(function(require) { "Network.edit_labels" : { layout: "labels", }, - "Network.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "Network.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "Network.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "Network.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "Network.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 }, diff --git a/src/sunstone/public/app/tabs/vrouters-tab/buttons.js b/src/sunstone/public/app/tabs/vrouters-tab/buttons.js index ca2b3099b4..39c3948fd7 100644 --- a/src/sunstone/public/app/tabs/vrouters-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vrouters-tab/buttons.js @@ -55,21 +55,21 @@ define(function(require) { "VirtualRouter.edit_labels" : { layout: "labels", }, - "VirtualRouter.lockA" : { - type: "action", - text: Locale.tr("Admin"), - layout: "lock_buttons", - data: 3 - }, - "VirtualRouter.lockM" : { - type: "action", - text: Locale.tr("Manage"), - layout: "lock_buttons", - data: 2 - }, + // "VirtualRouter.lockA" : { + // type: "action", + // text: Locale.tr("Admin"), + // layout: "lock_buttons", + // data: 3 + // }, + // "VirtualRouter.lockM" : { + // type: "action", + // text: Locale.tr("Manage"), + // layout: "lock_buttons", + // data: 2 + // }, "VirtualRouter.lockU" : { type: "action", - text: Locale.tr("Use"), + text: Locale.tr("Lock"), layout: "lock_buttons", data: 1 },