public class UuidFileNamingStrategy extends AbstractFileNamingStrategy
FileNamingStrategy
which uses an uuid.Constructor and Description |
---|
UuidFileNamingStrategy()
Instantiates a new uuid file naming strategy using
an
UUID . |
UuidFileNamingStrategy(java.lang.String uuid)
Instantiates a new uuid file naming strategy using
a given uuid string.
|
UuidFileNamingStrategy(java.lang.String uuid,
boolean enabled)
Instantiates a new uuid file naming strategy using
a given uuid string.
|
Modifier and Type | Method and Description |
---|---|
UuidFileNamingStrategy |
createInstance()
Creates a new instance of
FileNamingStrategy . |
java.lang.String |
getUuid() |
org.apache.hadoop.fs.Path |
init(org.apache.hadoop.fs.Path path)
Initialises a starting state of a strategy.
|
void |
next()
This method should be called to prepare next filename in case
strategy doesn't know how to do it automatically.
|
org.apache.hadoop.fs.Path |
resolve(org.apache.hadoop.fs.Path path)
Resolve a current file path denoted by this strategy.
|
void |
setPrefix(java.lang.String prefix)
Sets the prefix preceding uuid part.
|
void |
setUuid(java.lang.String uuid) |
getCodecInfo, getOrder, isEnabled, reset, setCodecInfo, setEnabled, setOrder
public UuidFileNamingStrategy()
UUID
.public UuidFileNamingStrategy(java.lang.String uuid)
uuid
- the uuid stringpublic UuidFileNamingStrategy(java.lang.String uuid, boolean enabled)
uuid
- the uuid stringenabled
- the enabledpublic org.apache.hadoop.fs.Path resolve(org.apache.hadoop.fs.Path path)
FileNamingStrategy
path
- the pathpublic org.apache.hadoop.fs.Path init(org.apache.hadoop.fs.Path path)
FileNamingStrategy
Path
and
remove its own handled part if possible. Returned Path
is then passed into next strategy for it to able to
do its own initialisation logic.
Path
passed to this method may be null indicating
that no further processing should be done or simply we don't
have information about the initialised path.
init
in interface FileNamingStrategy
init
in class AbstractFileNamingStrategy
path
- the pathpublic void next()
FileNamingStrategy
public UuidFileNamingStrategy createInstance()
FileNamingStrategyFactory
FileNamingStrategy
.createInstance
in interface FileNamingStrategyFactory<FileNamingStrategy>
createInstance
in class AbstractFileNamingStrategy
public void setUuid(java.lang.String uuid)
public java.lang.String getUuid()
public void setPrefix(java.lang.String prefix)
prefix
- the new prefix