From 15bcb0e0c7bd678770cfdd0600e2be6e5fa861f8 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Thu, 28 Feb 2013 15:43:34 -0800 Subject: [PATCH] CLOUDSTACK-1455: fix the wiring for dynamically created objects --- .../api/VirtualMachineEntityFactory.java | 41 ------------------- .../orchestration/CloudOrchestrator.java | 11 +---- 2 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 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 e8ad8e47745..00000000000 --- 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{ - - @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; - } - -} 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 570a787478c..34673f20c57 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(networkNicMap.keySet()));