}
PackageManagerOutputReceiver getOutputReceiver();
-
+
void actionBeforeUsingZypper();
void setHttpProxy(String proxy);
-
+
String getArchFromRemoteFile(String filePath);
String getNameFromRemoteFile(String filePath);
- String getVerFromRemoteFile(String filePath);
+ String getVerFromRemoteFile(String filePath);
String getArchFromFile(String filePath);
String getNameFromFile(String filePath);
String getVerFromFile(String filePath);
-
+
String[] getInfoFromFile(String filePath);
String[] getArch(String pkg);
ICommandStatus installLocalPkg(String[] files, boolean isEfl, IProgressMonitor monitor);
ICommandStatus installLocalPkg(String[] files, IProgressMonitor monitor);
-
+
ICommandStatus installLocalPkg(String file, boolean isEfl, IProgressMonitor monitor);
ICommandStatus installLocalPkg(String file, IProgressMonitor monitor);
ICommandStatus uninstallPkg(String[] pkgs, IProgressMonitor monitor);
ICommandStatus uninstallPkg(String pkg, IProgressMonitor monitor);
-
- ICommandStatus downloadFilesFromRemote(String[] fileList);
-
- ICommandStatus downlaodFileFromRemote(String src, String dst);
+
+ ICommandStatus downloadRemoteFiles(String[] fileList);
+
+ ICommandStatus downloadRemoteFiles(String[] fileList, boolean useSdb);
+
+ ICommandStatus downloadRemoteFile(String src, String dst, boolean useSdb);
+
+ ICommandStatus downloadRemoteFile(String src, String dst);
ICommandStatus copyFilesToTmpDir(String[] fileList);
return null;
}
- @Override
- public ICommandStatus downloadFilesFromRemote(String[] fileList) {
- return null;
- }
-
- public ICommandStatus downlaodFileFromRemote(String src, String dst) {
- return null;
- }
-
@Override
public void actionBeforeUsingZypper() {
}
public ICommandStatus installLocalPkg(String file, boolean isEfl, IProgressMonitor monitor) {
return null;
}
+
+ @Override
+ public ICommandStatus downloadRemoteFiles(String[] fileList) {
+ return null;
+ }
+
+ @Override
+ public ICommandStatus downloadRemoteFiles(String[] fileList, boolean useSdb) {
+ return null;
+ }
+
+ @Override
+ public ICommandStatus downloadRemoteFile(String src, String dst, boolean useSdb) {
+ return null;
+ }
+
+ @Override
+ public ICommandStatus downloadRemoteFile(String src, String dst) {
+ return null;
+ }
}
}
}
- public ICommandStatus downloadFilesFromRemote(String[] fileList) {
+ public ICommandStatus downloadRemoteFiles(String[] fileList) {
return null;
}
- public ICommandStatus downlaodFileFromRemote(String src, String dst) {
+ public ICommandStatus downloadRemoteFiles(String[] fileList, boolean useSdb) {
+ return null;
+ }
+
+ public ICommandStatus downloadRemoteFile(String src, String dst) {
+ return null;
+ }
+
+ public ICommandStatus downloadRemoteFile(String src, String dst, boolean useSdb) {
return null;
}
origStatus.setInstalledVer(version);
origStatus.setInstallInfo(PkgInstallTypes.INSTALLED);
}
- /*
- * Package pkg = pkgMap.get(name); if (pkg == null) {
- * pkgMap.put(name, new Package(name, version,
- * Package.INSTALLINFO.INSTALLED, "", arch)); } else {
- * pkg.setInstalledVersion(version);
- * pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED); }
- */
}
}
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.ptp.remotetools.core.IRemoteCopyTools;
+import org.eclipse.ptp.remotetools.exception.CancelException;
+import org.eclipse.ptp.remotetools.exception.RemoteConnectionException;
+import org.eclipse.ptp.remotetools.exception.RemoteOperationException;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.OSChecker;
import org.tizen.nativeplatform.pkg.tools.RpmTool;
import org.tizen.nativeplatform.pkg.tools.ZypperTool;
import org.tizen.nativeplatform.pkgmgr.PackageManagerOutputReceiver;
+import org.tizen.nativeplatform.preferences.DevicePreferencesManager;
import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.util.PlatformFileUtil;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.PlatformUserInteraction;
import org.tizen.nativeplatform.util.SSHUtil;
return new CommandStatus(IStatus.OK, value, null);
}
- public ICommandStatus downlaodFileFromRemote(String src, String dst) {
+ public ICommandStatus downloadRemoteFile(String src, String dst, boolean useSdb) {
+ if (useSdb) {
+ return downloadRemoteFileWithSDB(src, dst);
+ } else {
+ return downloadRemoteFileWithSCP(src, dst);
+ }
+ }
+
+ public ICommandStatus downloadRemoteFile(String src, String dst) {
+ return downloadRemoteFileWithSDB(src, dst);
+ }
+
+ private ICommandStatus downloadRemoteFileWithSDB(String src, String dst) {
+ String filename = FilenameUtil.getFilename(src);
+ String tmpdir = PlatformFileUtil.getTmpDir();
+ String downloadPath = new Path(tmpdir).append(filename).toOSString();
+ IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
+ try {
+ copytool.downloadFileToFile(src, downloadPath);
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (CancelException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ }
+
+ return copyFile(downloadPath, dst);
+ }
+
+ private ICommandStatus downloadRemoteFileWithSCP(String src, String dst) {
String keyPath = SSHUtil.getDeviceSshPrivateKeyPath();
String host = RemoteConnectionManager.getRemoteTools().getHost();
String user = RemoteConnectionManager.getRemoteTools().getUser();
return status;
}
- public ICommandStatus downloadFilesFromRemote(String[] fileList) {
+ private ICommandStatus downloadRemoteFilesWithSDB(String[] fileList) {
+ List<String> value = new ArrayList<String>();
+ List<String> targetPaths = new ArrayList<String>();
+ IPath pathOnDevice = new Path(TMP_DIR);
+ for (String remotePath : fileList) {
+ String filename = FilenameUtil.getFilename(remotePath);
+ String tmpdir = PlatformFileUtil.getTmpDir();
+ String downloadPath = new Path(tmpdir).append(filename).toOSString();
+ IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
+ try {
+ copytool.downloadFileToFile(remotePath, downloadPath);
+ value.add(downloadPath);
+ targetPaths.add(pathOnDevice.append(filename).toString());
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (CancelException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ }
+ }
+ SyncService syncService;
+ try {
+ syncService = device.getSyncService();
+ } catch (TimeoutException e) {
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (SdbCommandRejectedException e) {
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (IOException e) {
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ }
+ SyncResult syncResult = syncService.push(value.toArray(new String[0]),
+ device.getFileEntry(pathOnDevice.toString()));// Fixxed
+ if (!syncResult.isOk()) {
+ return new CommandStatus(IStatus.ERROR, "", syncResult.getMessage(), null);
+ }
+ return new CommandStatus(IStatus.OK, targetPaths, null);
+ }
+
+ private ICommandStatus downloadRemoteFilesWithSCP(String[] fileList) {
List<String> value = new ArrayList<String>();
String files = "";
StringBuffer list = new StringBuffer();
if (fileList.length == 1) {
files = fileList[0];
String filename = FilenameUtil.getFilename(files);
+ String tmpdir = PlatformFileUtil.getTmpDir();
+ String downloadPath = new Path(tmpdir).append(filename).toOSString();
+ IRemoteCopyTools copytool = RemoteConnectionManager.getRemoteTools().getCopyTool();
+ try {
+ copytool.downloadFileToFile(files, downloadPath);
+ } catch (RemoteConnectionException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (RemoteOperationException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ } catch (CancelException e) {
+ e.printStackTrace();
+ return new CommandStatus(IStatus.ERROR, "", e.getMessage(), e);
+ }
String pathOnDevice = new Path(TMP_DIR).append(filename).toString();
value.add(pathOnDevice);
} else {
return status;
}
+ public ICommandStatus downloadRemoteFiles(String[] fileList, boolean useSdb) {
+ if (useSdb) {
+ return downloadRemoteFilesWithSDB(fileList);
+ } else {
+ return downloadRemoteFilesWithSCP(fileList);
+ }
+ }
+
+ public ICommandStatus downloadRemoteFiles(String[] fileList) {
+ return downloadRemoteFilesWithSDB(fileList);
+ }
+
public ICommandStatus copyFilesToTmpDir(String[] fileList) {
List<String> value = new ArrayList<String>();
for (String filePath : fileList) {
UserLogger.start(PlatformUserInteraction.COPY_PKG);
ICommandStatus status = null;
if (OSChecker.isWindows()) {
- status = downloadFilesFromRemote(files);
+ boolean useSDB = DevicePreferencesManager.isTransferToolSDB();
+ status = downloadRemoteFiles(files, useSDB);
} else {
status = copyFilesToTmpDir(files);
}
public CmdTargetTypes getCommandType() {
return CMD_TYPE;
}
-}
+}
\ No newline at end of file
package org.tizen.nativeplatform.preferences;\r
\r
public class DevicePreferencesManager extends PreferencesManager {\r
- \r
+ public static final String TRANSFER_TOOL_SDB = "sdb";\r
+ public static final String TRANSFER_TOOL_SCP = "scp";\r
+\r
public static final String DEVICE_PKG_TRANSFER = "device.pkg.transfer";\r
public static final String DEVICE_LOCAL_PKG_INSTALL_TOOL = "device.local.pkg.install.tool";\r
public static final String DEVICE_LOCAL_PKG_INSTALL_OP = "device.local.pkg.install.op";\r
public static final String DEVICE_REMOTE_PKG_INSTALL_OP = "device.remote.pkg.install.op";\r
public static final String DEVICE_EFL_INSTALL_TOOL = "device.efl.install.tool";\r
public static final String DEVICE_EFL_INSTALL_OP = "devie.efl.install.op";\r
- \r
+\r
public static void setDevicePkgTransferDefault(String value) {\r
prefStore.setDefault(DEVICE_PKG_TRANSFER, value);\r
}\r
+\r
public static void setDeviceLocalPkgInstallToolDefault(String value) {\r
prefStore.setDefault(DEVICE_LOCAL_PKG_INSTALL_TOOL, value);\r
}\r
+\r
public static void setDeviceLocalPkgInstallOpDefault(String value) {\r
prefStore.setDefault(DEVICE_LOCAL_PKG_INSTALL_OP, value);\r
}\r
+\r
public static void setDeviceRemotePkgInstallToolDefault(String value) {\r
prefStore.setDefault(DEVICE_REMOTE_PKG_INSTALL_TOOL, value);\r
}\r
+\r
public static void setDeviceRemotePkgInstallOpDefault(String value) {\r
prefStore.setDefault(DEVICE_REMOTE_PKG_INSTALL_OP, value);\r
}\r
+\r
public static void setDeviceEflInstallToolDefault(String value) {\r
prefStore.setDefault(DEVICE_EFL_INSTALL_TOOL, value);\r
}\r
+\r
public static void setDeviceEflInstallOpDefault(String value) {\r
prefStore.setDefault(DEVICE_EFL_INSTALL_OP, value);\r
}\r
+\r
public static String getDevicePkgTransfer() {\r
return prefStore.getString(DEVICE_PKG_TRANSFER);\r
}\r
+\r
+ public static boolean isTransferToolSCP() {\r
+ if (getDevicePkgTransfer().equals(TRANSFER_TOOL_SCP)) {\r
+ return true;\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ public static boolean isTransferToolSDB() {\r
+ if (getDevicePkgTransfer().equals(TRANSFER_TOOL_SDB)) {\r
+ return true;\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+\r
public static String getDeviceLocalPkgInstallTool() {\r
return prefStore.getString(DEVICE_LOCAL_PKG_INSTALL_TOOL);\r
}\r
+\r
public static String getDeviceLocalPkgInstallOp() {\r
return prefStore.getString(DEVICE_LOCAL_PKG_INSTALL_OP);\r
}\r
+\r
public static String getDeviceRemotePkgInstallTool() {\r
return prefStore.getString(DEVICE_REMOTE_PKG_INSTALL_TOOL);\r
}\r
+\r
public static String getDeviceRemotePkgInstallOp() {\r
return prefStore.getString(DEVICE_REMOTE_PKG_INSTALL_OP);\r
}\r
+\r
public static String getDeviceEflInstallTool() {\r
return prefStore.getString(DEVICE_EFL_INSTALL_TOOL);\r
}\r
+\r
public static String getDeviceEflInstallOp() {\r
return prefStore.getString(DEVICE_EFL_INSTALL_OP);\r
}\r
\r
@Override\r
public void initializeDefaultPreferences() {\r
- //DevicePreferencesManager.setDevicePkgTransferDefault("ssh");\r
+ DevicePreferencesManager\r
+ .setDevicePkgTransferDefault(DevicePreferencesManager.TRANSFER_TOOL_SCP);\r
DevicePreferencesManager.setDeviceEflInstallToolDefault(PkgcmdTool.NAME);\r
DevicePreferencesManager.setDeviceEflInstallOpDefault(PkgcmdTool.getInstallCommandFormat());\r
DevicePreferencesManager.setDeviceLocalPkgInstallToolDefault(RpmTool.NAME);\r
- DevicePreferencesManager.setDeviceLocalPkgInstallOpDefault(RpmTool.getInstallCommandFormat());\r
+ DevicePreferencesManager.setDeviceLocalPkgInstallOpDefault(RpmTool\r
+ .getInstallCommandFormat());\r
DevicePreferencesManager.setDeviceRemotePkgInstallToolDefault(ZypperTool.NAME);\r
- DevicePreferencesManager.setDeviceRemotePkgInstallOpDefault(ZypperTool.getRemoteInstallCommandFormat());\r
+ DevicePreferencesManager.setDeviceRemotePkgInstallOpDefault(ZypperTool\r
+ .getRemoteInstallCommandFormat());\r
RootstrapPreferencesManager.setRootstrapLocalPkgInstallToolDefault(RpmTool.NAME);\r
- RootstrapPreferencesManager.setRootstrapLocalPkgInstallOpDefault(RpmTool.getInstallCommandFormat());\r
+ RootstrapPreferencesManager.setRootstrapLocalPkgInstallOpDefault(RpmTool\r
+ .getInstallCommandFormat());\r
RootstrapPreferencesManager.setRootstrapRemotePkgInstallToolDefault(ZypperTool.NAME);\r
- RootstrapPreferencesManager.setRootstrapRemotePkgInstallOpDefault(ZypperTool.getRemoteInstallCommandFormat());\r
+ RootstrapPreferencesManager.setRootstrapRemotePkgInstallOpDefault(ZypperTool\r
+ .getRemoteInstallCommandFormat());\r
}\r
\r
-}\r
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.ui.IWorkbench;\r
import org.eclipse.ui.IWorkbenchPreferencePage;\r
+import org.tizen.common.util.OSChecker;\r
import org.tizen.common.util.SWTUtil;\r
import org.tizen.nativeplatform.pkg.tools.PkgcmdTool;\r
import org.tizen.nativeplatform.pkg.tools.RpmTool;\r
import org.tizen.nativeplatform.preferences.PreferencesManager;\r
import org.tizen.nativeplatform.preferences.DevicePreferencesManager;\r
\r
-public class DevicePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {\r
+public class DevicePreferencePage extends FieldEditorPreferencePage implements\r
+ IWorkbenchPreferencePage {\r
\r
private StringFieldEditor eflInstallOpField;\r
private StringFieldEditor localPkgInstallOpField;\r
private StringFieldEditor remotePkgInstallOpField;\r
- \r
+\r
@Override\r
public void init(IWorkbench workbench) {\r
IPreferenceStore store = PreferencesManager.getPreferenceStore();\r
data.verticalAlignment = GridData.FILL;\r
data.horizontalAlignment = GridData.FILL;\r
composite.setLayoutData(data);\r
- //SWTUtil.createSpacer(composite, 1);\r
- //createTransferMethodComposite(composite);\r
+\r
SWTUtil.createSpacer(composite, 1);\r
createEFLPackageToolComposite(composite);\r
SWTUtil.createSpacer(composite, 1);\r
createLocalPackageToolComposite(composite);\r
SWTUtil.createSpacer(composite, 1);\r
createRemotePackageToolComposite(composite);\r
+ if (OSChecker.isWindows()) {\r
+ SWTUtil.createSpacer(composite, 1);\r
+ createTransferMethodComposite(composite);\r
+ }\r
}\r
- \r
+\r
private void createTransferMethodComposite(Composite parent) {\r
Composite comp = SWTUtil.createGroup(parent, "Package Transfer Method", 1);\r
- Composite formatComposite = SWTUtil.createCompositeEx(comp, 2, GridData.FILL_HORIZONTAL);\r
- RadioGroupFieldEditor transferField = new RadioGroupFieldEditor(DevicePreferencesManager.DEVICE_PKG_TRANSFER, \r
- "Choose package transfer method:", 2,\r
- new String[][] { { "SDB", "sdb" },\r
- { "SSH", "ssh" } }, formatComposite);\r
+ Composite formatComposite = SWTUtil.createCompositeEx(comp, 1, GridData.FILL_HORIZONTAL);\r
+ RadioGroupFieldEditor transferField = new RadioGroupFieldEditor(\r
+ DevicePreferencesManager.DEVICE_PKG_TRANSFER, "", 2, new String[][] {\r
+ { "SDB", DevicePreferencesManager.TRANSFER_TOOL_SDB },\r
+ { "SCP", DevicePreferencesManager.TRANSFER_TOOL_SCP } }, formatComposite);\r
addField(transferField);\r
}\r
- \r
+\r
private void createEFLPackageToolComposite(Composite parent) {\r
Composite comp = SWTUtil.createGroup(parent, "EFL Package Install Command", 1);\r
Composite formatComposite = SWTUtil.createCompositeEx(comp, 1, GridData.FILL_HORIZONTAL);\r
- RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(DevicePreferencesManager.DEVICE_EFL_INSTALL_TOOL, \r
- "Tool:", 2,\r
- new String[][] { { "PKGCMD", PkgcmdTool.NAME },\r
- { "RPM", RpmTool.NAME } }, formatComposite);\r
+ RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(\r
+ DevicePreferencesManager.DEVICE_EFL_INSTALL_TOOL, "Tool:", 2, new String[][] {\r
+ { "PKGCMD", PkgcmdTool.NAME }, { "RPM", RpmTool.NAME } }, formatComposite);\r
addField(pkgToolField);\r
- eflInstallOpField = new StringFieldEditor(DevicePreferencesManager.DEVICE_EFL_INSTALL_OP, \r
+ eflInstallOpField = new StringFieldEditor(DevicePreferencesManager.DEVICE_EFL_INSTALL_OP,\r
"Install option:", formatComposite);\r
addField(eflInstallOpField);\r
}\r
- \r
+\r
private void createLocalPackageToolComposite(Composite parent) {\r
Composite comp = SWTUtil.createGroup(parent, "Local Package Install Command", 1);\r
Composite formatComposite = SWTUtil.createCompositeEx(comp, 1, GridData.FILL_HORIZONTAL);\r
- RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(DevicePreferencesManager.DEVICE_LOCAL_PKG_INSTALL_TOOL, \r
- "Tool:", 2,\r
- new String[][] { { "ZYPPER", ZypperTool.NAME },\r
- { "RPM", RpmTool.NAME } }, formatComposite);\r
+ RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(\r
+ DevicePreferencesManager.DEVICE_LOCAL_PKG_INSTALL_TOOL, "Tool:", 2, new String[][] {\r
+ { "ZYPPER", ZypperTool.NAME }, { "RPM", RpmTool.NAME } }, formatComposite);\r
addField(pkgToolField);\r
- localPkgInstallOpField = new StringFieldEditor(DevicePreferencesManager.DEVICE_LOCAL_PKG_INSTALL_OP, \r
- "Install option:", formatComposite);\r
+ localPkgInstallOpField = new StringFieldEditor(\r
+ DevicePreferencesManager.DEVICE_LOCAL_PKG_INSTALL_OP, "Install option:",\r
+ formatComposite);\r
addField(localPkgInstallOpField);\r
}\r
- \r
+\r
private void createRemotePackageToolComposite(Composite parent) {\r
Composite comp = SWTUtil.createGroup(parent, "Remote Package Install Command", 1);\r
Composite formatComposite = SWTUtil.createCompositeEx(comp, 1, GridData.FILL_HORIZONTAL);\r
- RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(DevicePreferencesManager.DEVICE_REMOTE_PKG_INSTALL_TOOL, \r
- "Tool:", 2,\r
+ RadioGroupFieldEditor pkgToolField = new RadioGroupFieldEditor(\r
+ DevicePreferencesManager.DEVICE_REMOTE_PKG_INSTALL_TOOL, "Tool:", 2,\r
new String[][] { { "ZYPPER", ZypperTool.NAME } }, formatComposite);\r
addField(pkgToolField);\r
- remotePkgInstallOpField = new StringFieldEditor(DevicePreferencesManager.DEVICE_REMOTE_PKG_INSTALL_OP, \r
- "Install option:", formatComposite);\r
+ remotePkgInstallOpField = new StringFieldEditor(\r
+ DevicePreferencesManager.DEVICE_REMOTE_PKG_INSTALL_OP, "Install option:",\r
+ formatComposite);\r
addField(remotePkgInstallOpField);\r
}\r
\r
@Override\r
public void propertyChange(PropertyChangeEvent event) {\r
if (event.getSource() instanceof FieldEditor) {\r
- FieldEditor editor = (FieldEditor)event.getSource();\r
+ FieldEditor editor = (FieldEditor) event.getSource();\r
String prefName = editor.getPreferenceName();\r
if (prefName.equals(DevicePreferencesManager.DEVICE_EFL_INSTALL_TOOL)) {\r
if (event.getNewValue().equals(RpmTool.NAME)) {\r
if (event.getNewValue().equals(RpmTool.NAME)) {\r
localPkgInstallOpField.setStringValue(RpmTool.getInstallCommandFormat());\r
} else if (event.getNewValue().equals(ZypperTool.NAME)) {\r
- localPkgInstallOpField.setStringValue(ZypperTool.getLocalInstallCommandFormat());\r
+ localPkgInstallOpField\r
+ .setStringValue(ZypperTool.getLocalInstallCommandFormat());\r
}\r
- } \r
+ }\r
}\r
super.propertyChange(event);\r
}\r
-}\r
+}
\ No newline at end of file
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.ptp.remotetools.core.IRemoteCopyTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.FileUtil;
-import org.tizen.common.util.FilenameUtil;
import org.tizen.nativeplatform.command.launcher.CommandUtil;
import org.tizen.nativeplatform.command.launcher.LocalCommandUtil;
import org.tizen.nativeplatform.command.launcher.RemoteCommandUtil;
import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
import org.tizen.nativeplatform.pkg.model.IPackage;
-import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager;
+import org.tizen.nativeplatform.preferences.DevicePreferencesManager;
import org.tizen.nativeplatform.types.CmdTargetTypes;
import org.tizen.nativeplatform.util.PlatformLaunchUtil;
import org.tizen.nativeplatform.util.RootstrapUtil;
this.project = project;
this.commander = commander;
for (IPackage pkg : pkgs) {
- String path = pkg.getPath();
- String[] segments = new Path(path).segments();
- String configNamae = segments[segments.length - 2];
- String fileNamae = segments[segments.length - 1];
- String remoteWorkspacePath = RootstrapUtil.getUserSyncWorkspacePath(project.getName());
- String remotePkgPath = new Path(remoteWorkspacePath).append(configNamae).append(fileNamae).toString();
- IPackage newPkg = pkg.clonePkg();
- newPkg.setPath(remotePkgPath);
- packages.add(newPkg);
+ String path = pkg.getPath();
+ String[] segments = new Path(path).segments();
+ String configNamae = segments[segments.length - 2];
+ String fileNamae = segments[segments.length - 1];
+ String remoteWorkspacePath = RootstrapUtil.getUserSyncWorkspacePath(project.getName());
+ String remotePkgPath = new Path(remoteWorkspacePath).append(configNamae)
+ .append(fileNamae).toString();
+ IPackage newPkg = pkg.clonePkg();
+ newPkg.setPath(remotePkgPath);
+ packages.add(newPkg);
}
this.cmdType = commander.getCommandType();
}
if (!addList.isEmpty()) {
return false;
}
- // If copied files are more than 20, install packages normally. It might be better.
+ // If copied files are more than 20, install packages normally. It
+ // might be better.
if (copyList.size() > 20) {
return false;
}
return false;
}
}
- LocalCommandUtil.clearCachingDir();
- String cachingDir = LocalCommandUtil.getCachingDir(project);
- FileUtil.createDirectory(cachingDir);
+ LocalCommandUtil.clearCachingDir();
+ String cachingDir = LocalCommandUtil.getCachingDir(project);
+ FileUtil.createDirectory(cachingDir);
if (!processCopiedFiles(copyList)) {
return false;
logger.error(String.format("Failed to get cashing directory"));
return false;
}
- String remoteFilepath = new Path(cachingDir).append(file).toString();
- String targetFilePath = new Path(file).removeFirstSegments(1).toString();
- ICommandStatus status = commander.downlaodFileFromRemote(remoteFilepath, targetFilePath);
+ String remoteFilepath = new Path(cachingDir).append(file).toString();
+ String targetFilePath = new Path(file).removeFirstSegments(1).toString();
+ boolean useSDB = DevicePreferencesManager.isTransferToolSDB();
+ ICommandStatus status = commander.downloadRemoteFile(remoteFilepath,
+ targetFilePath, useSDB);
if (status == null || !status.isOk()) {
logger.error(String.format("Failed to copy files [%s]", remoteFilepath));
return false;
}
} else if (isRootstrapCommander()) {
for (final String file : fileList) {
- String remoteFilePath = new Path(RemoteCommandUtil.getCachingDir(project)).append(file).toString();
- String filePath = new Path(file).removeFirstSegments(1).toString();
+ String remoteFilePath = new Path(RemoteCommandUtil.getCachingDir(project)).append(
+ file).toString();
+ String filePath = new Path(file).removeFirstSegments(1).toString();
commander.copyFile(remoteFilePath, filePath);
}
}
private boolean processAddedFiles(List<String> fileList, Map<String, String[]> smackInfo) {
if (isDeviceCommander()) {
- // RDS can not add files to device because of setting smack information.
- // How set smack information for a new file ?
+ // RDS can not add files to device because of setting smack
+ // information.
+ // How set smack information for a new file ?
} else if (isRootstrapCommander()) {
for (String file : fileList) {
IPath filePath = new Path(file);
String targetFilePath = filePath.removeFirstSegments(1).toString();
- String targetPath = filePath.removeFirstSegments(1).removeLastSegments(1).toString();
+ String targetPath = filePath.removeFirstSegments(1).removeLastSegments(1)
+ .toString();
String cachingDir = CommandUtil.getCachingDir(project);
if (cachingDir == null) {
logger.error(String.format("Failed to get cashing directory"));
// Nothing will be removed because source files should be in target
// FIXME:
/*
- for (String file : fileList) {
- ICommandStatus status = commander.removeFile(file);
- if (status == null || !status.isOk()) {
- logger.error(String.format("Failed to remove files [%s]", file));
- return false;
- }
- }
- */
+ * for (String file : fileList) { ICommandStatus status =
+ * commander.removeFile(file); if (status == null || !status.isOk()) {
+ * logger.error(String.format("Failed to remove files [%s]", file));
+ * return false; } }
+ */
return true;
}
private boolean isDeviceCommander() {
return (cmdType == CmdTargetTypes.DEVICE);
}
-
+
private boolean isRootstrapCommander() {
return (cmdType == CmdTargetTypes.ROOTSTRAP);
}
return true;
}
- // compare source data and target data. divide all files into four list parts.
+ // compare source data and target data. divide all files into four list
+ // parts.
private String groupFiles(Map<String, String> sourceChecksums,
Map<String, String> targetChecksums, List<String> copyList, List<String> addList,
List<String> remainList, List<String> removeList) {
StringBuffer sbCopyFiles = new StringBuffer();
for (Entry<String, String> entry : sourceChecksums.entrySet()) {
- // key = aul-0.0.280-1.i586.rpm_d986faacda139c2d2d9c19c792ef07bc/etc/init.d/launchpad_run
+ // key =
+ // aul-0.0.280-1.i586.rpm_d986faacda139c2d2d9c19c792ef07bc/etc/init.d/launchpad_run
String key = entry.getKey();
// s_value = 50155d2eaed43a6cbf2632b38dd37242
String s_value = entry.getValue();
if (targetChecksums.containsKey(target_key)) {
// d_value = 50155d2eaed43a6cbf2632b38dd37242
String d_value = targetChecksums.get(target_key);
- // As comparing keys, divide files into 2 parts (copy list, remain list)
+ // As comparing keys, divide files into 2 parts (copy list,
+ // remain list)
if (!s_value.equals(d_value)) {
copyList.add(key);
sbCopyFiles.append("\"" + target_key + "\" ");
} else {
remainList.add(key);
}
- // if targetChecksums contains source key, remove the key from targetChecksums.
+ // if targetChecksums contains source key, remove the key from
+ // targetChecksums.
// it is for removing unused files on device later.
targetChecksums.remove(target_key);
} else {
- // if targetChecksums does not contains source key, it should be copied.
+ // if targetChecksums does not contains source key, it should be
+ // copied.
if (!key.equals("-")) {
addList.add(key);
}
result.put(key, v[0]);
}
return result;
- }
+ }
}