Skip to content
Snippets Groups Projects
Commit 9fd6dd4c authored by felmer's avatar felmer
Browse files

DMV-13 Some FileStore methods become IFileStore methods. Obscure inner class...

DMV-13 Some FileStore methods become IFileStore methods. Obscure inner class ExtendedFileStore removed. Javadoc added to IFileStore methods.

SVN: 6076
parent dae3a9e5
No related branches found
No related tags found
No related merge requests found
...@@ -77,12 +77,12 @@ public abstract class FileStore implements IFileStore ...@@ -77,12 +77,12 @@ public abstract class FileStore implements IFileStore
} }
} }
protected final File getPath() public final File getPath()
{ {
return fileWithHighwaterMark.getFile(); return fileWithHighwaterMark.getFile();
} }
protected final String tryGetHost() public final String tryGetHost()
{ {
return hostOrNull; return hostOrNull;
} }
...@@ -204,26 +204,4 @@ public abstract class FileStore implements IFileStore ...@@ -204,26 +204,4 @@ public abstract class FileStore implements IFileStore
return builder.toHashCode(); return builder.toHashCode();
} }
//
// Helper classes
//
public static abstract class ExtendedFileStore extends FileStore implements IExtendedFileStore
{
protected ExtendedFileStore(final FileWithHighwaterMark path, final String hostOrNull,
final boolean remote, final String kind, final IFileSysOperationsFactory factory)
{
super(path, hostOrNull, remote, kind, factory);
}
//
// IExtendedFileStore
//
public abstract boolean createNewFile(StoreItem item);
public abstract File tryMoveLocal(StoreItem sourceItem, File destinationDir,
String newFilePrefix);
}
} }
\ No newline at end of file
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package ch.systemsx.cisd.datamover.filesystem.intf; package ch.systemsx.cisd.datamover.filesystem.intf;
import java.io.File;
import ch.systemsx.cisd.common.exceptions.Status; import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher; import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher;
import ch.systemsx.cisd.common.logging.ISimpleLogger; import ch.systemsx.cisd.common.logging.ISimpleLogger;
...@@ -41,7 +43,23 @@ public interface IFileStore extends ISelfTestable ...@@ -41,7 +43,23 @@ public interface IFileStore extends ISelfTestable
* share and mounted via NFS or CIFS. * share and mounted via NFS or CIFS.
*/ */
public boolean isRemote(); public boolean isRemote();
/**
* Returns the path of this file store.
*/
public File getPath();
/**
* Tries to return the host.
*
* @return <code>null</code> if {@link #isRemote()} return <code>false</code>.
*/
public String tryGetHost();
/**
* Returns <code>true</code> if this file store is the parent directory of
* the specified file store.
*/
public boolean isParentDirectory(IFileStore child); public boolean isParentDirectory(IFileStore child);
/** /**
...@@ -54,6 +72,9 @@ public interface IFileStore extends ISelfTestable ...@@ -54,6 +72,9 @@ public interface IFileStore extends ISelfTestable
*/ */
public String tryCheckDirectoryFullyAccessible(final long timeOutMillis); public String tryCheckDirectoryFullyAccessible(final long timeOutMillis);
/**
* Returns <code>true</code> if the specified store item exists in this file store.
*/
public boolean exists(StoreItem item); public boolean exists(StoreItem item);
/** /**
...@@ -86,6 +107,9 @@ public interface IFileStore extends ISelfTestable ...@@ -86,6 +107,9 @@ public interface IFileStore extends ISelfTestable
*/ */
public StoreItem[] tryListSortByLastModified(ISimpleLogger loggerOrNull); public StoreItem[] tryListSortByLastModified(ISimpleLogger loggerOrNull);
/**
* Deletes the specified item from this store.
*/
public Status delete(StoreItem item); public Status delete(StoreItem item);
/** /**
...@@ -102,6 +126,11 @@ public interface IFileStore extends ISelfTestable ...@@ -102,6 +126,11 @@ public interface IFileStore extends ISelfTestable
// which could be used in java.io.File constructor. // which could be used in java.io.File constructor.
public String getLocationDescription(StoreItem item); public String getLocationDescription(StoreItem item);
/**
* Returns this file store as an extended file store if possible.
*
* @return <code>null</code> if this file store can not be returned as an extended file store.
*/
public IExtendedFileStore tryAsExtended(); public IExtendedFileStore tryAsExtended();
/** /**
......
...@@ -37,14 +37,13 @@ import ch.systemsx.cisd.datamover.filesystem.intf.IFileSysOperationsFactory; ...@@ -37,14 +37,13 @@ import ch.systemsx.cisd.datamover.filesystem.intf.IFileSysOperationsFactory;
import ch.systemsx.cisd.datamover.filesystem.intf.IPathMover; import ch.systemsx.cisd.datamover.filesystem.intf.IPathMover;
import ch.systemsx.cisd.datamover.filesystem.intf.IPathRemover; import ch.systemsx.cisd.datamover.filesystem.intf.IPathRemover;
import ch.systemsx.cisd.datamover.filesystem.intf.IStoreCopier; import ch.systemsx.cisd.datamover.filesystem.intf.IStoreCopier;
import ch.systemsx.cisd.datamover.filesystem.intf.FileStore.ExtendedFileStore;
/** /**
* An {@link IFileStore} implementation for local stores. * An {@link IFileStore} implementation for local stores.
* *
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
public class FileStoreLocal extends ExtendedFileStore public class FileStoreLocal extends FileStore implements IExtendedFileStore
{ {
private static final Logger machineLog = private static final Logger machineLog =
LogFactory.getLogger(LogCategory.MACHINE, FileStoreLocal.class); LogFactory.getLogger(LogCategory.MACHINE, FileStoreLocal.class);
...@@ -64,10 +63,6 @@ public class FileStoreLocal extends ExtendedFileStore ...@@ -64,10 +63,6 @@ public class FileStoreLocal extends ExtendedFileStore
this.highwaterMarkWatcher = new HighwaterMarkWatcher(file.getHighwaterMark()); this.highwaterMarkWatcher = new HighwaterMarkWatcher(file.getHighwaterMark());
} }
//
// ExtendedFileStore
//
public final Status delete(final StoreItem item) public final Status delete(final StoreItem item)
{ {
return remover.remove(getChildFile(item)); return remover.remove(getChildFile(item));
...@@ -122,7 +117,6 @@ public class FileStoreLocal extends ExtendedFileStore ...@@ -122,7 +117,6 @@ public class FileStoreLocal extends ExtendedFileStore
return this; return this;
} }
@Override
public final boolean createNewFile(final StoreItem item) public final boolean createNewFile(final StoreItem item)
{ {
try try
...@@ -137,7 +131,6 @@ public class FileStoreLocal extends ExtendedFileStore ...@@ -137,7 +131,6 @@ public class FileStoreLocal extends ExtendedFileStore
} }
} }
@Override
public final File tryMoveLocal(final StoreItem sourceItem, final File destinationDir, public final File tryMoveLocal(final StoreItem sourceItem, final File destinationDir,
final String newFilePrefix) final String newFilePrefix)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment