public class SimpleResourceNaming extends Object implements ResourceNamingInterface
ResourceNamingInterface.FileNamingType| Constructor and Description |
|---|
SimpleResourceNaming() |
SimpleResourceNaming(String fileSystemPrefix) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
fixFileName(String name,
String extension)
This method turns a friendly name which could contain all manner of invalid characters for a file name into one
that's more conducive to being a file name.
|
protected String |
fixPath(String originalPathName) |
Map<String,String> |
getDirectoryMap() |
protected String |
getFileNameUniqueIdentifier(String filename,
String extension) |
String |
getFileSystemPrefix() |
boolean |
getUseOriginalPathInTargetName() |
String |
nameResource(org.apache.commons.vfs2.FileObject fileObject,
VariableSpace space,
boolean includeFileName)
Create a (file) name based on the passed FileObject
|
String |
nameResource(String prefix,
String originalFilePath,
String extension,
ResourceNamingInterface.FileNamingType namingType)
Create a (file) name for a resource based on a prefix and an extension.
|
void |
setDirectoryMap(Map<String,String> directoryMap) |
void |
setFileSystemPrefix(String value) |
void |
setUseOriginalPathInTargetName(boolean value) |
public SimpleResourceNaming()
public SimpleResourceNaming(String fileSystemPrefix)
public String nameResource(org.apache.commons.vfs2.FileObject fileObject, VariableSpace space, boolean includeFileName) throws org.apache.commons.vfs2.FileSystemException
ResourceNamingInterfacenameResource in interface ResourceNamingInterfaceincludeFileName - Set to true to just return the path, false to return file name and pathorg.apache.commons.vfs2.FileSystemExceptionpublic String nameResource(String prefix, String originalFilePath, String extension, ResourceNamingInterface.FileNamingType namingType)
ResourceNamingInterfacenameResource in interface ResourceNamingInterfaceprefix - The prefix, usually the name of the object that is being exportedoriginalFilePath - The original path to the file. This will be used in the naming of the resource to ensure that the same
GUID will be returned for the same file.extension - The extension of the filename to be created. For now this also gives a clue as to what kind of data is
being exported and named..namingType - the file naming type to use, in case of DATA_FILE for example, the return value might not be the complete
file, but ratherprotected String getFileNameUniqueIdentifier(String filename, String extension)
protected String fixFileName(String name, String extension)
name - The name to fix up.extension - the requested extension to see if we don't end up with 2 extensions (export of XML to XML)public String getFileSystemPrefix()
public void setFileSystemPrefix(String value)
public boolean getUseOriginalPathInTargetName()
public void setUseOriginalPathInTargetName(boolean value)
public Map<String,String> getDirectoryMap()
getDirectoryMap in interface ResourceNamingInterfaceCopyright © 2018 Hitachi Vantara. All rights reserved.