Updated Branches: refs/heads/4.1 2093aefcb -> 15bcb0e0c
CLOUDSTACK-1455: fix the wiring for dynamically created objects Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/15bcb0e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/15bcb0e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/15bcb0e0 Branch: refs/heads/4.1 Commit: 15bcb0e0c7bd678770cfdd0600e2be6e5fa861f8 Parents: 2093aef Author: Kelven Yang <[email protected]> Authored: Thu Feb 28 15:43:34 2013 -0800 Committer: Kelven Yang <[email protected]> Committed: Thu Feb 28 15:44:06 2013 -0800 ---------------------------------------------------------------------- .../entity/api/VirtualMachineEntityFactory.java | 41 --------------- .../platform/orchestration/CloudOrchestrator.java | 11 +---- 2 files changed, 1 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/15bcb0e0/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java deleted file mode 100644 index e8ad8e4..0000000 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.engine.cloud.entity.api; - -import com.cloud.utils.component.ComponentContext; -import org.springframework.beans.factory.FactoryBean; -import org.springframework.stereotype.Component; - -@Component -public class VirtualMachineEntityFactory implements FactoryBean<VirtualMachineEntityImpl>{ - - @Override - public VirtualMachineEntityImpl getObject() throws Exception { - return ComponentContext.inject(VirtualMachineEntityImpl.class.newInstance()); - } - - @Override - public Class<?> getObjectType() { - return VirtualMachineEntityImpl.class; - } - - @Override - public boolean isSingleton() { - return false; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/15bcb0e0/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java index 570a787..34673f2 100755 --- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java @@ -29,7 +29,6 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; -import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityFactory; import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl; import org.apache.cloudstack.engine.cloud.entity.api.VMEntityManager; import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; @@ -66,9 +65,6 @@ public class CloudOrchestrator implements OrchestrationService { @Inject private VMEntityManager vmEntityManager; - @Inject - private VirtualMachineEntityFactory _vmEntityFactory; - @Inject private VirtualMachineManager _itMgr; @@ -174,12 +170,7 @@ public class CloudOrchestrator implements OrchestrationService { } } - VirtualMachineEntityImpl vmEntity = null; - try { - vmEntity = _vmEntityFactory.getObject(); - } catch (Exception e) { - // add error handling here - } + VirtualMachineEntityImpl vmEntity = ComponentContext.inject(VirtualMachineEntityImpl.class); vmEntity.init(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, new ArrayList<String>(networkNicMap.keySet()));
