From add1b9b05541564d24efaf5a0ddad5673edc7aa1 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 3 Dec 2012 23:54:19 -0800 Subject: [PATCH] api_refactor: refactor register apis - Split register apis across template, iso and ssh pkgs - Fix refactored apis, mappings in commands*.in - Fix comments etc. Signed-off-by: Rohit Yadav --- api/src/com/cloud/server/ManagementService.java | 2 +- api/src/com/cloud/template/TemplateService.java | 4 ++-- .../api/user/iso/command}/RegisterIsoCmd.java | 2 +- .../api/user/ssh/command}/RegisterSSHKeyPairCmd.java | 2 +- .../user/template/command}/RegisterTemplateCmd.java | 2 +- client/tomcatconf/commands.properties.in | 6 +++--- .../com/cloud/baremetal/BareMetalTemplateAdapter.java | 4 ++-- server/src/com/cloud/server/ManagementServerImpl.java | 2 +- .../com/cloud/template/HyervisorTemplateAdapter.java | 4 ++-- server/src/com/cloud/template/TemplateAdapter.java | 4 ++-- server/src/com/cloud/template/TemplateAdapterBase.java | 4 ++-- server/src/com/cloud/template/TemplateManagerImpl.java | 10 +++------- 12 files changed, 21 insertions(+), 25 deletions(-) rename api/src/{com/cloud/api/commands => org/apache/cloudstack/api/user/iso/command}/RegisterIsoCmd.java (99%) rename api/src/{com/cloud/api/commands => org/apache/cloudstack/api/user/ssh/command}/RegisterSSHKeyPairCmd.java (98%) rename api/src/{com/cloud/api/commands => org/apache/cloudstack/api/user/template/command}/RegisterTemplateCmd.java (99%) diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java index 331b27660c4..ccb1efa010a 100755 --- a/api/src/com/cloud/server/ManagementService.java +++ b/api/src/com/cloud/server/ManagementService.java @@ -54,7 +54,7 @@ import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd; import com.cloud.api.commands.ListVlanIpRangesCmd; import com.cloud.api.commands.ListZonesByCmd; import com.cloud.api.commands.RebootSystemVmCmd; -import com.cloud.api.commands.RegisterSSHKeyPairCmd; +import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd; import com.cloud.api.commands.StopSystemVmCmd; import com.cloud.api.commands.UpdateDomainCmd; import com.cloud.api.commands.UpdateHostPasswordCmd; diff --git a/api/src/com/cloud/template/TemplateService.java b/api/src/com/cloud/template/TemplateService.java index 9d63b259c85..1b41c332a0e 100755 --- a/api/src/com/cloud/template/TemplateService.java +++ b/api/src/com/cloud/template/TemplateService.java @@ -19,14 +19,14 @@ package com.cloud.template; import java.net.URISyntaxException; import java.util.List; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; import org.apache.cloudstack.api.user.template.command.CopyTemplateCmd; import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd; import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd; import org.apache.cloudstack.api.user.iso.command.ExtractIsoCmd; import org.apache.cloudstack.api.user.template.command.ExtractTemplateCmd; import com.cloud.api.commands.ListTemplateOrIsoPermissionsCmd; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd; import com.cloud.exception.InternalErrorException; import com.cloud.exception.ResourceAllocationException; diff --git a/api/src/com/cloud/api/commands/RegisterIsoCmd.java b/api/src/org/apache/cloudstack/api/user/iso/command/RegisterIsoCmd.java similarity index 99% rename from api/src/com/cloud/api/commands/RegisterIsoCmd.java rename to api/src/org/apache/cloudstack/api/user/iso/command/RegisterIsoCmd.java index ff7aa33039e..cedaa869886 100755 --- a/api/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/user/iso/command/RegisterIsoCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.user.iso.command; import java.util.List; diff --git a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/user/ssh/command/RegisterSSHKeyPairCmd.java similarity index 98% rename from api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java rename to api/src/org/apache/cloudstack/api/user/ssh/command/RegisterSSHKeyPairCmd.java index ae62e34a47d..9c4eb8cdeb9 100644 --- a/api/src/com/cloud/api/commands/RegisterSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/user/ssh/command/RegisterSSHKeyPairCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.user.ssh.command; import org.apache.log4j.Logger; diff --git a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java b/api/src/org/apache/cloudstack/api/user/template/command/RegisterTemplateCmd.java similarity index 99% rename from api/src/com/cloud/api/commands/RegisterTemplateCmd.java rename to api/src/org/apache/cloudstack/api/user/template/command/RegisterTemplateCmd.java index c479001b954..5ad284c0529 100755 --- a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/user/template/command/RegisterTemplateCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.user.template.command; import java.net.URISyntaxException; import java.util.Collection; diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 83d56dad108..05f949e318c 100755 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -80,7 +80,7 @@ listSnapshotPolicies=org.apache.cloudstack.api.user.snapshot.command.ListSnapsho #### template commands createTemplate=org.apache.cloudstack.api.user.template.command.CreateTemplateCmd;15 -registerTemplate=com.cloud.api.commands.RegisterTemplateCmd;15 +registerTemplate=org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd;15 updateTemplate=org.apache.cloudstack.api.user.template.command.UpdateTemplateCmd;15 copyTemplate=org.apache.cloudstack.api.user.template.command.CopyTemplateCmd;15 deleteTemplate=org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd;15 @@ -94,7 +94,7 @@ prepareTemplate=com.cloud.api.commands.PrepareTemplateCmd;1 attachIso=org.apache.cloudstack.api.user.iso.command.AttachIsoCmd;15 detachIso=org.apache.cloudstack.api.user.iso.command.DetachIsoCmd;15 listIsos=org.apache.cloudstack.api.user.iso.command.ListIsosCmd;15 -registerIso=com.cloud.api.commands.RegisterIsoCmd;15 +registerIso=org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd;15 updateIso=org.apache.cloudstack.api.user.iso.command.UpdateIsoCmd;15 deleteIso=org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd;15 copyIso=org.apache.cloudstack.api.user.template.command.CopyTemplateCmd;15 @@ -316,7 +316,7 @@ restartNetwork=org.apache.cloudstack.api.user.network.command.RestartNetworkCmd; updateNetwork=org.apache.cloudstack.api.user.network.command.UpdateNetworkCmd;15 #### SSH key pair commands -registerSSHKeyPair=com.cloud.api.commands.RegisterSSHKeyPairCmd;15 +registerSSHKeyPair=org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;15 createSSHKeyPair=org.apache.cloudstack.api.user.ssh.command.CreateSSHKeyPairCmd;15 deleteSSHKeyPair=org.apache.cloudstack.api.user.ssh.command.DeleteSSHKeyPairCmd;15 listSSHKeyPairs=org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;15 diff --git a/server/src/com/cloud/baremetal/BareMetalTemplateAdapter.java b/server/src/com/cloud/baremetal/BareMetalTemplateAdapter.java index 75e401d5452..c609e83468b 100755 --- a/server/src/com/cloud/baremetal/BareMetalTemplateAdapter.java +++ b/server/src/com/cloud/baremetal/BareMetalTemplateAdapter.java @@ -22,10 +22,10 @@ import java.util.List; import javax.ejb.Local; import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; import org.apache.log4j.Logger; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import com.cloud.configuration.Resource.ResourceType; import com.cloud.dc.DataCenterVO; import com.cloud.event.EventTypes; diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 4116d4c74a0..92a4fbcac91 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -44,6 +44,7 @@ import javax.crypto.spec.SecretKeySpec; import org.apache.cloudstack.api.user.iso.command.ListIsosCmd; import org.apache.cloudstack.api.user.ssh.command.DeleteSSHKeyPairCmd; +import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd; import org.apache.cloudstack.api.user.template.command.ListTemplatesCmd; import org.apache.cloudstack.api.user.template.command.UpdateTemplateCmd; import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd; @@ -88,7 +89,6 @@ import com.cloud.api.commands.ListSystemVMsCmd; import com.cloud.api.commands.ListVlanIpRangesCmd; import com.cloud.api.commands.ListZonesByCmd; import com.cloud.api.commands.RebootSystemVmCmd; -import com.cloud.api.commands.RegisterSSHKeyPairCmd; import com.cloud.api.commands.StopSystemVmCmd; import com.cloud.api.commands.UpdateDomainCmd; import com.cloud.api.commands.UpdateHostPasswordCmd; diff --git a/server/src/com/cloud/template/HyervisorTemplateAdapter.java b/server/src/com/cloud/template/HyervisorTemplateAdapter.java index f4348fd77f4..4d5ee65eac5 100755 --- a/server/src/com/cloud/template/HyervisorTemplateAdapter.java +++ b/server/src/com/cloud/template/HyervisorTemplateAdapter.java @@ -26,14 +26,14 @@ import java.util.List; import javax.ejb.Local; import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; import com.cloud.agent.api.storage.DeleteTemplateCommand; import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import com.cloud.configuration.Resource.ResourceType; import com.cloud.dc.DataCenterVO; import com.cloud.event.EventTypes; diff --git a/server/src/com/cloud/template/TemplateAdapter.java b/server/src/com/cloud/template/TemplateAdapter.java index 0c6f32982a5..ec6ed46b4cf 100755 --- a/server/src/com/cloud/template/TemplateAdapter.java +++ b/server/src/com/cloud/template/TemplateAdapter.java @@ -19,9 +19,9 @@ package com.cloud.template; import java.util.Map; import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import com.cloud.exception.ResourceAllocationException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.VMTemplateVO; diff --git a/server/src/com/cloud/template/TemplateAdapterBase.java b/server/src/com/cloud/template/TemplateAdapterBase.java index 916540fe9b1..6ac11976ed9 100755 --- a/server/src/com/cloud/template/TemplateAdapterBase.java +++ b/server/src/com/cloud/template/TemplateAdapterBase.java @@ -21,14 +21,14 @@ import java.util.Map; import javax.naming.ConfigurationException; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import com.cloud.api.ApiDBUtils; import org.apache.cloudstack.api.user.iso.command.DeleteIsoCmd; import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; import com.cloud.configuration.Resource.ResourceType; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dc.DataCenterVO; diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index ffe7d172dc4..f789e46859c 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -35,10 +35,7 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import org.apache.cloudstack.api.user.iso.command.*; -import org.apache.cloudstack.api.user.template.command.CopyTemplateCmd; -import org.apache.cloudstack.api.user.template.command.ExtractTemplateCmd; -import org.apache.cloudstack.api.user.template.command.ListTemplatePermissionsCmd; -import org.apache.cloudstack.api.user.template.command.UpdateTemplatePermissionsCmd; +import org.apache.cloudstack.api.user.template.command.*; import org.apache.log4j.Logger; import com.cloud.acl.SecurityChecker.AccessType; @@ -50,10 +47,9 @@ import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.to.SwiftTO; -import org.apache.cloudstack.api.user.template.command.DeleteTemplateCmd; import com.cloud.api.commands.ListTemplateOrIsoPermissionsCmd; -import com.cloud.api.commands.RegisterIsoCmd; -import com.cloud.api.commands.RegisterTemplateCmd; +import org.apache.cloudstack.api.user.iso.command.RegisterIsoCmd; +import org.apache.cloudstack.api.user.template.command.RegisterTemplateCmd; import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd; import com.cloud.async.AsyncJobManager; import com.cloud.async.AsyncJobVO;