From 3ba0cc3cdb7d2a11dd0e01cd4c4bac003b4733d8 Mon Sep 17 00:00:00 2001 From: "jihye424.kim" Date: Tue, 16 Jun 2015 13:16:08 +0900 Subject: [PATCH] VMWorker: add IVMWorker class - redefine inheritance relationship of VMWorker Change-Id: Ib91313ccad064821b6b5bb5873b18393ceb29c86 Signed-off-by: jihye424.kim --- src/org/tizen/emulator/manager/vms/IVMWorker.java | 47 ++++++++++++++++++++++ .../tizen/emulator/manager/vms/VMWorkerCommon.java | 13 ++++-- 2 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 src/org/tizen/emulator/manager/vms/IVMWorker.java diff --git a/src/org/tizen/emulator/manager/vms/IVMWorker.java b/src/org/tizen/emulator/manager/vms/IVMWorker.java new file mode 100644 index 0000000..0725318 --- /dev/null +++ b/src/org/tizen/emulator/manager/vms/IVMWorker.java @@ -0,0 +1,47 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * Minkee Lee + * SeokYeon Hwang + * Sangho Park + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.vms; + +import org.tizen.emulator.manager.vms.helper.VMLauncherException; +import org.tizen.emulator.manager.vms.helper.VMWorkerException; + +public interface IVMWorker { + public void sendRemoteLog(String msg); + public void initLauncher(); + + public void launchVM() throws VMLauncherException, VMWorkerException; + public void modifyVM(VMPropertyValue newVM) throws VMWorkerException; + public void createNewBaseImage(VMProperty property, String dest) + throws VMWorkerException; + public boolean deleteVM() throws VMWorkerException; + public void resetVM() throws VMWorkerException; + public void cloneVM(String newVMName) throws VMWorkerException; +} diff --git a/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java b/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java index 5300a62..021f6d1 100644 --- a/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java +++ b/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java @@ -49,7 +49,7 @@ import org.tizen.emulator.manager.vms.helper.VMWorkerException; import org.tizen.emulator.manager.vms.helper.WorkerLock; import org.tizen.emulator.manager.vms.option.IOption; -public class VMWorkerCommon { +public class VMWorkerCommon implements IVMWorker { private VMProperty property; private WorkerThread worker = null; private String baseImagePath = null; @@ -58,12 +58,12 @@ public class VMWorkerCommon { private ILauncher launcher; private boolean isModified; + @Override public void sendRemoteLog(String msg) { - } + @Override public void initLauncher() { - } protected void setLauncher(ILauncher launcher) { @@ -74,7 +74,6 @@ public class VMWorkerCommon { return launcher; } - public void setVMProperty(VMProperty property) { this.property = property; } @@ -91,6 +90,7 @@ public class VMWorkerCommon { return baseImagePartPath; } + @Override public void launchVM() throws VMLauncherException, VMWorkerException { launchVM(false, null); } @@ -149,6 +149,7 @@ public class VMWorkerCommon { } } + @Override public void modifyVM(VMPropertyValue newVM) throws VMWorkerException { // lock.acquire WorkerLock.acquire(); @@ -179,6 +180,7 @@ public class VMWorkerCommon { } } + @Override public void createNewBaseImage(VMProperty property, String dest) throws VMWorkerException { // lock.acuire @@ -335,6 +337,7 @@ public class VMWorkerCommon { } } + @Override public boolean deleteVM() throws VMWorkerException { boolean result = true; @@ -373,6 +376,7 @@ public class VMWorkerCommon { return result; } + @Override public void resetVM() throws VMWorkerException { // lock.acquire WorkerLock.acquire(); @@ -437,6 +441,7 @@ public class VMWorkerCommon { } } + @Override public void cloneVM(String newVMName) throws VMWorkerException { VMPropertyValue newValue = property.getPropertyValue(); newValue.vmsName = newVMName; -- 2.7.4