mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[149150] new setLastModified() service call and use in file transfer operations
This commit is contained in:
parent
119d7c5588
commit
ced81d390f
10 changed files with 170 additions and 114 deletions
rse/plugins
org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources
org.eclipse.rse.services.dstore
miners/org/eclipse/rse/dstore/universal/miners
src/org/eclipse/rse/services/dstore/files
org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/services/files/ftp
org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files
org.eclipse.rse.services.ssh/src/org/eclipse/rse/services/ssh/files
org.eclipse.rse.services/src/org/eclipse/rse/services/files
org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core
|
@ -1030,6 +1030,10 @@ public class UniversalFileTransferUtility
|
|||
String srcFileLocation = srcFileOrFolder.getLocation().toOSString();
|
||||
targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(),monitor);
|
||||
newFilePathList.add(newPath);
|
||||
|
||||
// should check preference first
|
||||
SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
|
||||
((FileServiceSubSystem)targetFS).getFileService().setLastModified(monitor, newPathBuf.toString(), name, properties.getRemoteFileTimeStamp());
|
||||
}
|
||||
|
||||
catch (RemoteFileIOException e)
|
||||
|
@ -1220,9 +1224,14 @@ public class UniversalFileTransferUtility
|
|||
}
|
||||
|
||||
|
||||
|
||||
targetFS.upload(srcFileLocation, srcCharSet, newPath, targetFS.getRemoteEncoding(), monitor);
|
||||
IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name);
|
||||
|
||||
|
||||
// should check preference first
|
||||
SystemIFileProperties properties = new SystemIFileProperties(srcFileOrFolder);
|
||||
targetFS.setLastModified(monitor, copiedFile, properties.getRemoteFileTimeStamp());
|
||||
|
||||
return copiedFile;
|
||||
}
|
||||
|
||||
|
@ -1416,7 +1425,7 @@ public class UniversalFileTransferUtility
|
|||
if (source instanceof IFile)
|
||||
{
|
||||
SystemIFileProperties properties = new SystemIFileProperties(source);
|
||||
target.getParentRemoteFileSubSystem().setLastModified(target, properties.getRemoteFileTimeStamp());
|
||||
target.getParentRemoteFileSubSystem().setLastModified(monitor, target, properties.getRemoteFileTimeStamp());
|
||||
}
|
||||
else if (source instanceof IContainer)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,21 @@ public interface IUniversalDataStoreConstants extends IServiceConstants
|
|||
public static final String C_COPY = "C_COPY"; //$NON-NLS-1$
|
||||
public static final String C_COPY_BATCH = "C_COPY_BATCH"; //$NON-NLS-1$
|
||||
|
||||
public static final String C_SEARCH = "C_SEARCH"; //$NON-NLS-1$
|
||||
public static final String C_CANCEL = "C_CANCEL"; //$NON-NLS-1$
|
||||
|
||||
public static final String C_SET_READONLY = "C_SET_READONLY";//$NON-NLS-1$
|
||||
public static final String C_SET_LASTMODIFIED = "C_SET_LASTMODIFIED";//$NON-NLS-1$
|
||||
public static final String C_QUERY_BASIC_PROPERTY = "C_QUERY_BASIC_PROPERTY";//$NON-NLS-1$
|
||||
public static final String C_QUERY_CAN_WRITE_PROPERTY = "C_QUERY_CAN_WRITE_PROPERTY";//$NON-NLS-1$
|
||||
public static final String C_QUERY_ADVANCE_PROPERTY = "C_QUERY_ADVANCE_PROPERTY";//$NON-NLS-1$
|
||||
public static final String C_QUERY_FILE_CLASSIFICATION = "C_QUERY_FILE_CLASSIFICATION";//$NON-NLS-1$
|
||||
public static final String C_QUERY_FILE_CLASSIFICATIONS = "C_QUERY_FILE_CLASSIFICATIONS"; //$NON-NLS-1$
|
||||
public static final String C_QUERY_EXISTS = "C_QUERY_EXISTS";//$NON-NLS-1$
|
||||
public static final String C_GET_OSTYPE = "C_GET_OSTYPE";//$NON-NLS-1$
|
||||
public static final String C_QUERY_CLASSNAME = "C_QUERY_CLASSNAME"; //$NON-NLS-1$
|
||||
public static final String C_CREATE_TEMP = "C_CREATE_TEMP"; //$NON-NLS-1$
|
||||
|
||||
// Download file command
|
||||
public static final String C_DOWNLOAD_FILE = "C_DOWNLOAD_FILE"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -108,8 +108,6 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
public DataElement handleCommand(DataElement theElement) {
|
||||
String name = getCommandName(theElement);
|
||||
|
||||
|
||||
|
||||
|
||||
DataElement status = getCommandStatus(theElement);
|
||||
DataElement subject = getCommandArgument(theElement, 0);
|
||||
|
@ -120,7 +118,7 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
boolean caseSensitive = !_isWindows;
|
||||
// TODO: test on WINDOWS!
|
||||
|
||||
if ("C_QUERY_VIEW_ALL".equals(name)) { //$NON-NLS-1$
|
||||
if (C_QUERY_VIEW_ALL.equals(name)) {
|
||||
DataElement attributes = getCommandArgument(theElement, 1);
|
||||
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
|
||||
{
|
||||
|
@ -132,7 +130,7 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
return handleQueryAll(subject, null, status, queryType,
|
||||
caseSensitive);
|
||||
}
|
||||
} else if ("C_QUERY_VIEW_FILES".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_VIEW_FILES.equals(name)) {
|
||||
DataElement attributes = getCommandArgument(theElement, 1);
|
||||
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
|
||||
{
|
||||
|
@ -144,7 +142,7 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
return handleQueryFiles(subject, null, status, queryType,
|
||||
caseSensitive);
|
||||
}
|
||||
} else if ("C_QUERY_VIEW_FOLDERS".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_VIEW_FOLDERS.equals(name)) {
|
||||
DataElement attributes = getCommandArgument(theElement, 1);
|
||||
if (attributes != null && attributes.getType().equals("attributes")) //$NON-NLS-1$
|
||||
{
|
||||
|
@ -156,48 +154,48 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
return handleQueryFolders(subject, null, status, queryType,
|
||||
caseSensitive);
|
||||
}
|
||||
} else if ("C_QUERY_ROOTS".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_ROOTS.equals(name)) {
|
||||
return handleQueryRoots(subject, status);
|
||||
} else if ("C_SEARCH".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_SEARCH.equals(name)) {
|
||||
return handleSearch(theElement, status, queryType,
|
||||
caseSensitive);
|
||||
} else if ("C_CANCEL".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_CANCEL.equals(name)) {
|
||||
subject.getName();
|
||||
return handleCancel(subject, status);
|
||||
} else if ("C_RENAME".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_RENAME.equals(name)) {
|
||||
return handleRename(subject, status);
|
||||
} else if ("C_DELETE".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_DELETE.equals(name)) {
|
||||
return handleDelete(subject, status, true);
|
||||
} else if ("C_DELETE_BATCH".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_DELETE_BATCH.equals(name)) {
|
||||
return handleDeleteBatch(theElement, status);
|
||||
} else if ("C_COPY".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_COPY.equals(name)) {
|
||||
return handleCopy(subject, getCommandArgument(theElement, 1),
|
||||
getCommandArgument(theElement, 2), status);
|
||||
} else if ("C_COPY_BATCH".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_COPY_BATCH.equals(name)) {
|
||||
return handleCopyBatch(subject, theElement, status);
|
||||
} else if ("C_CREATE_FILE".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_CREATE_FILE.equals(name)) {
|
||||
return handleCreateFile(subject, status, queryType);
|
||||
} else if ("C_CREATE_FOLDER".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_CREATE_FOLDER.equals(name)) {
|
||||
return handleCreateFolder(subject, status, queryType);
|
||||
} else if ("C_SET_READONLY".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_SET_READONLY.equals(name)) {
|
||||
return handleSetReadOnly(subject, status);
|
||||
} else if ("C_SET_LASTMODIFIED".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_SET_LASTMODIFIED.equals(name)) {
|
||||
return handleSetLastModified(subject, status);
|
||||
} else if ("C_QUERY_BASIC_PROPERTY".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_BASIC_PROPERTY.equals(name)) {
|
||||
return handleQueryBasicProperty(subject, status);
|
||||
} else if ("C_QUERY_CAN_WRITE_PROPERTY".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_CAN_WRITE_PROPERTY.equals(name)) {
|
||||
return handleQuerycanWriteProperty(subject, status);
|
||||
} else if ("C_QUERY_ADVANCE_PROPERTY".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_ADVANCE_PROPERTY.equals(name)) {
|
||||
return handleQueryAdvanceProperty(subject, status);
|
||||
} else if ("C_QUERY_FILE_CLASSIFICATIONS".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_FILE_CLASSIFICATIONS.equals(name)) {
|
||||
return handleQueryFileClassification(subject, status);
|
||||
} else if ("C_QUERY_FILE_CLASSIFICATION".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_FILE_CLASSIFICATION.equals(name)) {
|
||||
return handleQueryFileClassification(subject, status);
|
||||
} else if ("C_QUERY_EXISTS".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_EXISTS.equals(name)) {
|
||||
return handleQueryExists(subject, status, queryType);
|
||||
} else if ("C_QUERY_GET_REMOTE_OBJECT".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_GET_REMOTE_OBJECT.equals(name)) {
|
||||
return handleQueryGetRemoteObject(subject, status, queryType);
|
||||
} else if ("C_GET_OSTYPE".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_GET_OSTYPE.equals(name)) {
|
||||
return handleGetOSType(subject, status);
|
||||
} else if (C_DOWNLOAD_FILE.equals(name)) {
|
||||
return handleDownload(theElement, status);
|
||||
|
@ -205,7 +203,7 @@ public class UniversalFileSystemMiner extends Miner implements
|
|||
return handleQueryEncoding(subject, status);
|
||||
} else if (C_QUERY_UNUSED_PORT.equals(name)) {
|
||||
return handleQueryUnusedPort(subject, status);
|
||||
} else if ("C_QUERY_CLASSNAME".equals(name)) { //$NON-NLS-1$
|
||||
} else if (C_QUERY_CLASSNAME.equals(name)) {
|
||||
return handleQueryClassName(subject, status);
|
||||
} else if (C_QUERY_QUALIFIED_CLASSNAME.equals(name)) {
|
||||
return handleQueryQualifiedClassName(subject, status);
|
||||
|
@ -1286,15 +1284,15 @@ private DataElement createDataElementFromLSString(DataElement subject,
|
|||
* Method to set LastModified to a file or folder.
|
||||
*/
|
||||
public DataElement handleSetLastModified(DataElement subject,
|
||||
DataElement status) {
|
||||
|
||||
DataElement status)
|
||||
{
|
||||
File filename = new File(subject.getAttribute(DE.A_VALUE));
|
||||
if (!filename.exists())
|
||||
status.setAttribute(DE.A_SOURCE, FAILED_WITH_DOES_NOT_EXIST);
|
||||
else {
|
||||
try {
|
||||
String str = subject.getAttribute(DE.A_SOURCE);
|
||||
|
||||
|
||||
long date = Long.parseLong(str);
|
||||
boolean done = filename.setLastModified(date);
|
||||
|
||||
|
@ -2525,32 +2523,23 @@ private DataElement createDataElementFromLSString(DataElement subject,
|
|||
_dataStore.refresh(schemaRoot);
|
||||
|
||||
// Define command descriptors
|
||||
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_VIEW_ALL"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_VIEW_FILES"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", "C_QUERY_ROOTS"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "Filter", C_QUERY_ROOTS); //$NON-NLS-1$
|
||||
|
||||
createCommandDescriptor(UniversalFilter, "GetOSType", "C_GET_OSTYPE"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(UniversalFilter, "Exists", "C_QUERY_EXISTS"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(UniversalFilter, "GetRemoteObject", //$NON-NLS-1$
|
||||
"C_QUERY_GET_REMOTE_OBJECT"); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "CreateNewFile", //$NON-NLS-1$
|
||||
"C_CREATE_FILE"); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "CreateNewFolder", //$NON-NLS-1$
|
||||
"C_CREATE_FOLDER"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_ALL"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_FILES"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_ALL"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_FILES"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", //$NON-NLS-1$
|
||||
"C_QUERY_VIEW_FOLDERS"); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "GetRemoteObject", C_QUERY_GET_REMOTE_OBJECT); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
|
||||
createCommandDescriptor(UniversalFilter, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_ALL); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_FILES); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalArchiveFileObject, "Filter", C_QUERY_VIEW_FOLDERS); //$NON-NLS-1$
|
||||
|
||||
_dataStore.createReference(deUniversalFileObject,
|
||||
deUniversalArchiveFileObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -2562,66 +2551,45 @@ private DataElement createDataElementFromLSString(DataElement subject,
|
|||
deUniversalVirtualFolderObject, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
// create the search descriptor and make it cacnellable
|
||||
DataElement searchDescriptor = createCommandDescriptor(
|
||||
deUniversalFolderObject, "Search", "C_SEARCH"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DataElement searchDescriptor = createCommandDescriptor(deUniversalFolderObject, "Search", C_SEARCH); //$NON-NLS-1$
|
||||
DataElement cancellable = _dataStore.find(schemaRoot, DE.A_NAME,
|
||||
DataStoreResources.model_Cancellable, 1);
|
||||
_dataStore.createReference(cancellable, searchDescriptor, "abstracts", //$NON-NLS-1$
|
||||
"abstracted by"); //$NON-NLS-1$
|
||||
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetAdvanceProperty", //$NON-NLS-1$
|
||||
"C_QUERY_ADVANCE_PROPERTY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(tempnode, "Filter", "C_CREATE_TEMP"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFileObject, "Delete", "C_DELETE"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFileObject, "DeleteBatch", "C_DELETE_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFileObject, "CreateNewFile", //$NON-NLS-1$
|
||||
"C_CREATE_FILE"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "CreateNewFolder", //$NON-NLS-1$
|
||||
"C_CREATE_FOLDER"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "Rename", "C_RENAME"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFileObject, "SetReadOnly", //$NON-NLS-1$
|
||||
"C_SET_READONLY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "SetLastModified", //$NON-NLS-1$
|
||||
"C_SET_LASTMODIFIED"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetAdvanceProperty", //$NON-NLS-1$
|
||||
"C_QUERY_ADVANCE_PROPERTY"); //$NON-NLS-1$
|
||||
// dePropertyQuery = createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", "C_QUERY_BASIC_PROPERTY");
|
||||
createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", "C_QUERY_BASIC_PROPERTY"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetAdvanceProperty", C_QUERY_ADVANCE_PROPERTY); //$NON-NLS-1$
|
||||
createCommandDescriptor(tempnode, "Filter", C_CREATE_TEMP); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "Delete", C_DELETE); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "DeleteBatch", C_DELETE_BATCH); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "Rename", C_RENAME); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "SetReadOnly", C_SET_READONLY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetAdvanceProperty", C_QUERY_ADVANCE_PROPERTY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetBasicProperty", C_QUERY_BASIC_PROPERTY); //$NON-NLS-1$
|
||||
|
||||
createCommandDescriptor(deUniversalFileObject, "GetcanWriteProperty", //$NON-NLS-1$
|
||||
"C_QUERY_CAN_WRITE_PROPERTY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "Exists", "C_QUERY_EXISTS"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetcanWriteProperty", C_QUERY_CAN_WRITE_PROPERTY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
|
||||
|
||||
createCommandDescriptor(deUniversalFolderObject, "Delete", "C_DELETE"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "DeleteBatch", "C_DELETE_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Rename", "C_RENAME"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Copy", "C_COPY"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CopyBatch", "C_COPY_BATCH"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", //$NON-NLS-1$
|
||||
"C_CREATE_FOLDER"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "SetReadOnly", //$NON-NLS-1$
|
||||
"C_SET_READONLY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "SetLastModified", //$NON-NLS-1$
|
||||
"C_SET_LASTMODIFIED"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetBasicProperty", //$NON-NLS-1$
|
||||
"C_QUERY_BASIC_PROPERTY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetcanWriteProperty", //$NON-NLS-1$
|
||||
"C_QUERY_CAN_WRITE_PROPERTY"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Delete", C_DELETE); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "DeleteBatch", C_DELETE_BATCH); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Rename", C_RENAME); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Copy", C_COPY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CopyBatch", C_COPY_BATCH); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "SetReadOnly", C_SET_READONLY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "SetLastModified", C_SET_LASTMODIFIED); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetBasicProperty", C_QUERY_BASIC_PROPERTY); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetcanWriteProperty", C_QUERY_CAN_WRITE_PROPERTY); //$NON-NLS-1$
|
||||
|
||||
// deFileClassificationQuery = createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", "C_QUERY_FILE_CLASSIFICATIONS");
|
||||
createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", "C_QUERY_FILE_CLASSIFICATIONS"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// deFolderClassificationQuery = createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", "C_QUERY_FILE_CLASSIFICATION");
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", "C_QUERY_FILE_CLASSIFICATION"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Exists", //$NON-NLS-1$
|
||||
"C_QUERY_EXISTS"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFile", //$NON-NLS-1$
|
||||
"C_CREATE_FILE"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", //$NON-NLS-1$
|
||||
"C_CREATE_FOLDER"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetOSType", //$NON-NLS-1$
|
||||
"C_GET_OSTYPE"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetOSType", //$NON-NLS-1$
|
||||
"C_GET_OSTYPE"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetFileClassifications", C_QUERY_FILE_CLASSIFICATIONS); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetFolderClassifications", C_QUERY_FILE_CLASSIFICATION); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "Exists", C_QUERY_EXISTS); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFile", C_CREATE_FILE); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "CreateNewFolder", C_CREATE_FOLDER); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFolderObject, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetOSType", C_GET_OSTYPE); //$NON-NLS-1$
|
||||
|
||||
// create a download command descriptor and make it cancellable
|
||||
DataElement downloadDescriptor = createCommandDescriptor(
|
||||
|
@ -2643,8 +2611,7 @@ private DataElement createDataElementFromLSString(DataElement subject,
|
|||
createCommandDescriptor(tempnode, "UnusedPort", C_QUERY_UNUSED_PORT); //$NON-NLS-1$
|
||||
|
||||
// command descriptor to retrieve package name for a class file
|
||||
createCommandDescriptor(deUniversalFileObject, "GetQualifiedClassName", //$NON-NLS-1$
|
||||
"C_QUERY_CLASSNAME"); //$NON-NLS-1$
|
||||
createCommandDescriptor(deUniversalFileObject, "GetQualifiedClassName", C_QUERY_CLASSNAME); //$NON-NLS-1$
|
||||
|
||||
// command descriptor to retrieve qualified class name for class file
|
||||
createCommandDescriptor(deUniversalFileObject, "GetFullClassName", //$NON-NLS-1$
|
||||
|
|
|
@ -1227,6 +1227,28 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean setLastModified(IProgressMonitor monitor, String parent,
|
||||
String name, long timestamp) throws SystemMessageException
|
||||
{
|
||||
String remotePath = parent + getSeparator(parent) + name;
|
||||
DataElement de = getElementFor(remotePath);
|
||||
DataStore ds = de.getDataStore();
|
||||
|
||||
|
||||
DataElement setCmd = getCommandDescriptor(de, C_SET_LASTMODIFIED);
|
||||
if (setCmd != null)
|
||||
{
|
||||
|
||||
|
||||
// first modify the source attribute to temporarily be the date field
|
||||
de.setAttribute(DE.A_SOURCE, timestamp + ""); //$NON-NLS-1$
|
||||
ds.command(setCmd, de, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -978,6 +978,15 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
|||
fMonitor.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean setLastModified(IProgressMonitor monitor, String parent,
|
||||
String name, long timestamp) throws SystemMessageException
|
||||
{
|
||||
// TODO - implement this to set the timestamp
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1310,5 +1310,11 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
|||
return ok;
|
||||
}
|
||||
|
||||
public boolean setLastModified(IProgressMonitor monitor, String parent, String name, long timestamp)
|
||||
{
|
||||
File file = new File(parent, name);
|
||||
return file.setLastModified(timestamp);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -752,4 +752,11 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean setLastModified(IProgressMonitor monitor, String parent,
|
||||
String name, long timestamp) throws SystemMessageException
|
||||
{
|
||||
// TODO implement this to set the timestamp on the specified file
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -264,4 +264,14 @@ public interface IFileService extends IService
|
|||
* @return true if the file system has case sensitive file names
|
||||
*/
|
||||
public boolean isCaseSensitive();
|
||||
|
||||
/**
|
||||
* Sets the last modified stamp of the file or folder with the specified timestamp
|
||||
* @param monitor the progress monitor
|
||||
* @param parent the parent path of the file to set
|
||||
* @param name the name of the file to set
|
||||
* @param timestamp the new timestamp
|
||||
* @return true if the file timestamp was changed successfully
|
||||
*/
|
||||
public boolean setLastModified(IProgressMonitor monitor, String parent, String name, long timestamp) throws SystemMessageException;
|
||||
}
|
|
@ -762,10 +762,20 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
|
||||
|
||||
public boolean setLastModified(IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException
|
||||
public boolean setLastModified(IProgressMonitor monitor, IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
String name = folderOrFile.getName();
|
||||
String parent = folderOrFile.getParentPath();
|
||||
try
|
||||
{
|
||||
return _hostFileService.setLastModified(monitor, parent, name, newDate);
|
||||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setReadOnly(IRemoteFile folderOrFile) throws RemoteFileSecurityException, RemoteFileIOException
|
||||
|
|
|
@ -346,11 +346,12 @@ public interface IRemoteFileSubSystem extends ISubSystem{
|
|||
* Set the last modified date for the given file or folder. Like a Unix "touch" operation.
|
||||
* Folder or file must exist on disk for this to succeed.
|
||||
*
|
||||
* @param monitor the progress monitor
|
||||
* @param folderOrFile represents the object to be renamed.
|
||||
* @param newDate new date, in milliseconds from epoch, to assign.
|
||||
* @return false if the given folder/file didn't exist on disk (operation fails), else true. Throws an exception if anything fails.
|
||||
*/
|
||||
public boolean setLastModified(IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException;
|
||||
public boolean setLastModified(IProgressMonitor monitor, IRemoteFile folderOrFile, long newDate) throws RemoteFileSecurityException, RemoteFileIOException;
|
||||
|
||||
/**
|
||||
* Set a file to readonly.
|
||||
|
|
Loading…
Add table
Reference in a new issue