Class StoredFilePathStrategy
- Direct Known Subclasses:
StoredFilePathStrategyComponentFolders
,StoredFilePathStrategyHashSubFolders
,StoredFilePathStrategySingleFolder
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StoredFilePathStrategy
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 final StoredFilePathStrategy
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 final StoredFilePathStrategy
Store all the stored files in a single folder, using the SOP Instance UID as the filename.protected static String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StoredFilePathStrategy
Get the default strategy.makeAlternativeStoredFilePath
(File savedInstancesFolder, String alternativeSubfolder, String sopInstanceUID) Generate an alternative path to where to store a file based on its SOP Instance UID.makeReliableStoredFilePathWithFoldersCreated
(File savedInstancesFolder, String sopInstanceUID) Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.makeReliableStoredFilePathWithFoldersCreated
(File savedInstancesFolder, String alternativeSubfolder, String sopInstanceUID) Generate a path to where to store a file based on its SOP Instance UID and assure its reliability.makeStoredFilePath
(File savedInstancesFolder, String sopInstanceUID) Generate a path to where to store a file based on its SOP Instance UID.makeStoredFilePath
(String sopInstanceUID) Generate a path to where to store a file based on its SOP Instance UID.protected void
-
Field Details
-
BYSOPINSTANCEUIDINSINGLEFOLDER
Store all the stored files in a single folder, using the SOP Instance UID as the filename.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
defaultAlternativeSubfolder
-
-
Constructor Details
-
StoredFilePathStrategy
protected StoredFilePathStrategy()
-
-
Method Details
-
getDefaultStrategy
Get the default strategy.
- Returns:
- the default strategy (which is BYSOPINSTANCEUIDINSINGLEFOLDER)
-
makeStoredFilePath
Generate a path to where to store a file based on its SOP Instance UID.
- Parameters:
sopInstanceUID
- the SOP Instance UID of the instance to be saved- Returns:
- the path to the file, which may contain nested sub-folders
-
makeStoredFilePath
Generate a path to where to store a file based on its SOP Instance UID.
- Parameters:
savedInstancesFolder
- the folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be saved- Returns:
- the path to the file in the specified folder, which may contain nested sub-folders
-
makeAlternativeStoredFilePath
public File makeAlternativeStoredFilePath(File savedInstancesFolder, String alternativeSubfolder, 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).
- Parameters:
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 saved- Returns:
- the path to the file in the specified folder and alternate sub-folder
-
makeReliableStoredFilePathWithFoldersCreated
public File makeReliableStoredFilePathWithFoldersCreated(File savedInstancesFolder, String alternativeSubfolder, 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).
- Parameters:
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 saved- Returns:
- the path to the file in the specified folder, which may contain nested sub-folders
-
makeReliableStoredFilePathWithFoldersCreated
public File makeReliableStoredFilePathWithFoldersCreated(File savedInstancesFolder, 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).
- Parameters:
savedInstancesFolder
- the folder in which to save the instancesopInstanceUID
- the SOP Instance UID of the instance to be saved- Returns:
- the path to the file in the specified folder, which may contain nested sub-folders
-
test
-