[Title] Refactoring sdblib
authorBonyong.lee <bonyong.lee@samsung.com>
Mon, 3 Jun 2013 11:00:05 +0000 (20:00 +0900)
committerBonyong.lee <bonyong.lee@samsung.com>
Mon, 3 Jun 2013 11:00:05 +0000 (20:00 +0900)
[Type]      Enhancement
[Module]
[Priority]  Major
[CQ#]
[Redmine#]  #9249
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformLaunchDelegate.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java

index 866ea5d..9c4867d 100644 (file)
@@ -27,6 +27,8 @@
 
 package org.tizen.nativeplatform.launch;
 
+import static org.tizen.sdblib.util.DeviceUtil.isOnline;
+
 import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
@@ -532,7 +534,7 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         if (currentDevice == null) {
             newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null);
         }
-        if (!currentDevice.isOnline()) {
+        if (!isOnline(currentDevice)) {
             newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null);
         }
         if (!currentDevice.isRoot()) {
index fd0fbad..3ce65b3 100644 (file)
@@ -27,6 +27,9 @@
 
 package org.tizen.nativeplatform.launch.wizards;
 
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+import static org.tizen.sdblib.util.DeviceUtil.isOnline;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -57,10 +60,8 @@ import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.console.MessageConsoleStream;
 import org.eclipse.ui.dialogs.TwoPaneElementSelector;
 import org.tizen.common.TizenPlatformConstants;
-import org.tizen.common.ui.view.console.ConsoleManager;
 import org.tizen.nativecommon.TizenNativeException;
 import org.tizen.nativecommon.launch.LaunchUtils;
 import org.tizen.nativecommon.launch.TizenDeviceProcessList;
@@ -73,7 +74,6 @@ import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
 import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
 import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 import org.tizen.nativeplatform.pkgmgr.model.Package;
@@ -82,8 +82,7 @@ import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.exception.SdbCommandRejectedException;
 import org.tizen.sdblib.exception.TimeoutException;
-import org.tizen.sdblib.service.SyncService;
-import org.tizen.sdblib.service.SyncService.SyncResult;
+import org.tizen.sdblib.service.SyncResult;
 
 @SuppressWarnings("restriction")
 public class PlatformLaunchUtils {
@@ -109,7 +108,7 @@ public class PlatformLaunchUtils {
 
     public boolean installPkgsToDevice(List<LocalPackage> packages, IProgressMonitor monitor)
             throws InterruptedException {
-        if (!target.getDevice().isOnline()) {
+        if (!isOnline(target.getDevice())) {
             newException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
         } else if (!target.getDevice().isRoot()) {
             newException(PlatformLaunchMessages.DEVICE_IS_NOT_ROOT_ON);
@@ -489,10 +488,9 @@ public class PlatformLaunchUtils {
 
     public void copyFileToDevice(IDevice device, String srcPath, String descPath)
             throws CoreException, TimeoutException, SdbCommandRejectedException, IOException {
-        SyncResult syncSuccess = device.getSyncService().pushFile(srcPath, descPath,
-                SyncService.getNullProgressMonitor());
+        SyncResult syncSuccess = device.getSyncService().push(srcPath, device.getFileEntry( descPath ) );
 
-        if (syncSuccess.getCode() != SyncService.RESULT_OK) {
+        if (syncSuccess.getCode() != RESULT_OK) {
             LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
         }
     }
index 492e0b7..c779858 100644 (file)
@@ -1,5 +1,7 @@
 package org.tizen.nativeplatform.pkg.commander.rpm;
 
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -18,8 +20,8 @@ import org.tizen.nativeplatform.util.CommandLauncherOnDevice;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.exception.SdbCommandRejectedException;
 import org.tizen.sdblib.exception.TimeoutException;
+import org.tizen.sdblib.service.SyncResult;
 import org.tizen.sdblib.service.SyncService;
-import org.tizen.sdblib.service.SyncService.SyncResult;
 
 public class RpmCommanderDevice extends RpmCommanderCommon {
 
@@ -56,9 +58,8 @@ public class RpmCommanderDevice extends RpmCommanderCommon {
             } catch (IOException e) {
                 return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
             }
-            SyncResult syncResult = syncService.pushFile(filePath, pathOnDevice.toOSString(),
-                    SyncService.getNullProgressMonitor());
-            if (syncResult.getCode() != SyncService.RESULT_OK) {
+            SyncResult syncResult = syncService.push(filePath, device.getFileEntry( pathOnDevice.toOSString() ) );
+            if (syncResult.getCode() != RESULT_OK) {
                 return new CommandStatus(IStatus.ERROR, "", syncResult.getMessage(), null);
             }
             value.add(pathOnDevice.toOSString());