Package org.pentaho.di.resource
Class SimpleResourceNaming
java.lang.Object
org.pentaho.di.resource.SimpleResourceNaming
- All Implemented Interfaces:
ResourceNamingInterface
- Direct Known Subclasses:
SequenceResourceNaming
,UUIDResourceNaming
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pentaho.di.resource.ResourceNamingInterface
ResourceNamingInterface.FileNamingType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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
protected String
getFileNameUniqueIdentifier
(String filename, String extension) static int
boolean
nameResource
(String prefix, String originalFilePath, String extension, ResourceNamingInterface.FileNamingType namingType) Create a (file) name for a resource based on a prefix and an extension.nameResource
(org.apache.commons.vfs2.FileObject fileObject, org.pentaho.di.core.variables.VariableSpace space, boolean includeFileName) Create a (file) name based on the passed FileObjectvoid
setDirectoryMap
(Map<String, String> directoryMap) void
setFileSystemPrefix
(String value) void
setUseOriginalPathInTargetName
(boolean value)
-
Constructor Details
-
SimpleResourceNaming
public SimpleResourceNaming() -
SimpleResourceNaming
-
-
Method Details
-
getParameterNr
public static int getParameterNr() -
nameResource
public String nameResource(org.apache.commons.vfs2.FileObject fileObject, org.pentaho.di.core.variables.VariableSpace space, boolean includeFileName) throws org.apache.commons.vfs2.FileSystemException Description copied from interface:ResourceNamingInterface
Create a (file) name based on the passed FileObject- Specified by:
nameResource
in interfaceResourceNamingInterface
includeFileName
- Set to true to just return the path, false to return file name and path- Returns:
- String The file name with the path set as a variable. If pathOnly is set to true then the file name will be left out.
- Throws:
org.apache.commons.vfs2.FileSystemException
-
nameResource
public String nameResource(String prefix, String originalFilePath, String extension, ResourceNamingInterface.FileNamingType namingType) Description copied from interface:ResourceNamingInterface
Create a (file) name for a resource based on a prefix and an extension.- Specified by:
nameResource
in interfaceResourceNamingInterface
- Parameters:
prefix
- 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 rather- Returns:
- The filename, typically including a GUID, but always the same when given the same prefix and extension as input.
-
getFileNameUniqueIdentifier
-
fixPath
-
fixFileName
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.- Parameters:
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)- Returns:
-
getFileSystemPrefix
-
setFileSystemPrefix
-
getUseOriginalPathInTargetName
public boolean getUseOriginalPathInTargetName() -
setUseOriginalPathInTargetName
public void setUseOriginalPathInTargetName(boolean value) -
getDirectoryMap
- Specified by:
getDirectoryMap
in interfaceResourceNamingInterface
- Returns:
- the directoryMap
-
setDirectoryMap
- Parameters:
directoryMap
- the directoryMap to set
-