public abstract class StoredFilePathStrategy
extends java.lang.Object
This is an abstract class to support creating path names for how to organize the folders and files for stored composite instances based on their SOP Instance UID.
Concrete subclasses implement various different strategies, which may be instantiated themselves, or accessed by the enumerated fields in this class.
The choices may be passed as arguments to constructors of StorageSOPClassSCPDispatcher
.
Methods are provided to generate pathnames based on the supplied UID, as well as to create any sub-folders required and generate altrernative path names if the existing path name is alreayd in use for some other purpose.
Modifier and Type | Field and Description |
---|---|
static StoredFilePathStrategy |
BYSOPINSTANCEUIDCOMPONENTFOLDERS
Store all the stored files in a hierarchy of folders using successive numeric components
of the SOP Instance UID as the folder name and the SOP Instance UID as the filename within the most deeply nested folder.
|
static StoredFilePathStrategy |
BYSOPINSTANCEUIDHASHSUBFOLDERS
Store all the stored files in a hierarchy of folders using successive decimal digits of the hashcode
of the SOP Instance UID as the folder name and the SOP Instance UID as the filename within the most deeply nested folder.
|
static StoredFilePathStrategy |
BYSOPINSTANCEUIDINSINGLEFOLDER
Store all the stored files in a single folder, using the SOP Instance UID as the filename.
|
protected static java.lang.String |
defaultAlternativeSubfolder |
Modifier | Constructor and Description |
---|---|
protected |
StoredFilePathStrategy() |
Modifier and Type | Method and Description |
---|---|
static StoredFilePathStrategy |
getDefaultStrategy()
Get the default strategy.
|
java.io.File |
makeAlternativeStoredFilePath(java.io.File savedInstancesFolder,
java.lang.String alternativeSubfolder,
java.lang.String sopInstanceUID)
Generate an alternative path to where to store a file based on its SOP Instance UID.
|
java.io.File |
makeReliableStoredFilePathWithFoldersCreated(java.io.File savedInstancesFolder,
java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.
|
java.io.File |
makeReliableStoredFilePathWithFoldersCreated(java.io.File savedInstancesFolder,
java.lang.String alternativeSubfolder,
java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.
|
java.io.File |
makeStoredFilePath(java.io.File savedInstancesFolder,
java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID.
|
java.lang.String |
makeStoredFilePath(java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID.
|
protected void |
test(java.lang.String[] arg) |
public static final StoredFilePathStrategy BYSOPINSTANCEUIDCOMPONENTFOLDERS
Store all the stored files in a hierarchy of folders using successive numeric components of the SOP Instance UID as the folder name and the SOP Instance UID as the filename within the most deeply nested folder.
StoredFilePathStrategyComponentFolders
public static final StoredFilePathStrategy BYSOPINSTANCEUIDHASHSUBFOLDERS
Store all the stored files in a hierarchy of folders using successive decimal digits of the hashcode of the SOP Instance UID as the folder name and the SOP Instance UID as the filename within the most deeply nested folder.
StoredFilePathStrategyHashSubFolders
public static final StoredFilePathStrategy BYSOPINSTANCEUIDINSINGLEFOLDER
Store all the stored files in a single folder, using the SOP Instance UID as the filename.
StoredFilePathStrategySingleFolder
protected static java.lang.String defaultAlternativeSubfolder
public static final StoredFilePathStrategy getDefaultStrategy()
Get the default strategy.
public java.io.File makeAlternativeStoredFilePath(java.io.File savedInstancesFolder, java.lang.String alternativeSubfolder, java.lang.String sopInstanceUID)
Generate an alternative path to where to store a file based on its SOP Instance UID.
Use when the normal path is already occupied by something other than a file (such as a folder).
savedInstancesFolder
- the folder in which to save the instancealternativeSubfolder
- the alternate sub-folder with the saved instance folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be savedpublic java.io.File makeReliableStoredFilePathWithFoldersCreated(java.io.File savedInstancesFolder, java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.
Includes creating any necessary parent folders if they do not already exist, and using an alternate path or name (in a default alternative sub-folder) if a desired file name already exists as something else (such as a folder).
savedInstancesFolder
- the folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be savedpublic java.io.File makeReliableStoredFilePathWithFoldersCreated(java.io.File savedInstancesFolder, java.lang.String alternativeSubfolder, java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.
Includes creating any necessary parent folders if they do not already exist, and using an alternate path or name if a desired file name already exists as something else (such as a folder).
savedInstancesFolder
- the folder in which to save the instancealternativeSubfolder
- the alternate sub-folder with the saved instance folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be savedpublic java.io.File makeStoredFilePath(java.io.File savedInstancesFolder, java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID.
savedInstancesFolder
- the folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be savedpublic java.lang.String makeStoredFilePath(java.lang.String sopInstanceUID)
Generate a path to where to store a file based on its SOP Instance UID.
sopInstanceUID
- the SOP Instance UID of the instance to be savedprotected void test(java.lang.String[] arg)