import static org.tizen.common.util.CollectionUtil.isEmpty;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.util.FileUtil;
-import org.tizen.common.util.SdbCommandUtil;
+import org.tizen.common.util.IOUtil;
import org.tizen.common.util.log.Logger;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.IDevice.Arch;
import org.tizen.sdblib.MultiLineReceiver;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
/**
* On-demand Install class to deploy SDK tools to Tizen device or an emulator.
device = pDevice;
}
- private boolean copyPackage(String source, String destination) {
- return SdbCommandUtil.filePush(device, source, destination);
+ private boolean copyPackage(String source, String destination) throws IOException {
+ SyncService syncService = null;
+ try {
+ syncService = device.getSyncService();
+ SyncResult result = syncService.pushFile(source, destination, SyncService.getNullProgressMonitor());
+
+ if ( result.getCode() == SyncService.RESULT_OK ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ } finally {
+ IOUtil.tryClose(syncService);
+ }
}
private void installPackage(IProgressMonitor monitor) {
String result = "";
verbose("Deploying: " + tool);
- if (copyPackage(local, remote) == false) {
- Logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_COPY_FILE, tool.getBinaryname()));
+ try {
+ if (copyPackage(local, remote) == false) {
+ throw new IOException();
+ }
+ } catch (IOException e) {
+ Logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_COPY_FILE, tool.getBinaryname()), e);
return;
}