VMWorker: add IVMWorker class
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 16 Jun 2015 04:16:08 +0000 (13:16 +0900)
committerJiHye Kim <jihye424.kim@samsung.com>
Tue, 16 Jun 2015 07:36:16 +0000 (16:36 +0900)
- redefine inheritance relationship of VMWorker

Change-Id: Ib91313ccad064821b6b5bb5873b18393ceb29c86
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/vms/IVMWorker.java [new file with mode: 0644]
src/org/tizen/emulator/manager/vms/VMWorkerCommon.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 (file)
index 0000000..0725318
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihyse424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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;
+}
index 5300a62..021f6d1 100644 (file)
@@ -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;