/** * Sets the last-modified time of this file. */ protected void doSetLastModifiedTime(final long modtime) throws Exception { file.getContent().setLastModifiedTime(modtime); }
public Object call() throws Exception { FileObject toFile = root.resolveFile( to.path.string ); toFile.getParent().createFolder(); toFile.copyFrom( from, Selectors.SELECT_SELF ); toFile.getContent().setLastModifiedTime( to.lastModified.toDateTime().toDate().getTime() ); return Unit.unit(); } };
public Object execute(final CommandContext context) throws Exception { assert context != null; FileObject file = resolveFile(context, path); try { if (!file.exists()) { file.createFile(); } file.getContent().setLastModifiedTime(System.currentTimeMillis()); } finally { FileObjects.close(file); } return CommandAction.Result.SUCCESS; } }
public Object execute(final CommandContext context) throws Exception { assert context != null; FileObject file = resolveFile(context, path); try { if (!file.exists()) { file.createFile(); } file.getContent().setLastModifiedTime(System.currentTimeMillis()); } finally { FileObjects.close(file); } return Result.SUCCESS; } }
/** * Handles a single source file. */ protected void handleOutOfDateFile(final FileObject srcFile, final FileObject destFile) throws FileSystemException { if (!tryRename || !srcFile.canRenameTo(destFile)) { super.handleOutOfDateFile(srcFile, destFile); log("Deleting " + srcFile); srcFile.delete(Selectors.SELECT_SELF); } else { log("Rename " + srcFile + " to " + destFile); srcFile.moveTo(destFile); if (!isPreserveLastModified() && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { destFile.getContent().setLastModifiedTime(System.currentTimeMillis()); } } } }
/** * Handles an out-of-date file. */ protected void handleOutOfDateFile(final FileObject srcFile, final FileObject destFile) throws FileSystemException { log("Copying " + srcFile + " to " + destFile); destFile.copyFrom(srcFile, Selectors.SELECT_SELF); if (preserveLastModified && srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED) && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { final long lastModTime = srcFile.getContent().getLastModifiedTime(); destFile.getContent().setLastModifiedTime(lastModTime); } }
getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED)) destFile.getContent().setLastModifiedTime(this.getContent().getLastModifiedTime());