public class FileManagerTask extends Object implements OnTask, SupportsRecording
Task.PRE
and Task.POST
task for the basic file
operations such as: copy, move, rename, delete, zip, unzip. The local file
system, ftp and sftp are supported.Task
Modifier and Type | Field and Description |
---|---|
static String |
COMMAND_COPY
The COMMAND_COPY.
|
static String |
COMMAND_COUNT
The COMMAND_COUNT.
|
static String |
COMMAND_DELETE
The COMMAND_DELETE.
|
static String |
COMMAND_MKDIR
The COMMAND_MKDIR.
|
static String |
COMMAND_MOVE
The COMMAND_MOVE.
|
static String |
COMMAND_RENAME
The COMMAND_RENAME.
|
static String |
COMMAND_UNGZIP
The COMMAND_UNGZIP.
|
static String |
COMMAND_UNGZIP_DELETE
The COMMAND_UNGZIP_DELETE.
|
static String |
COMMAND_UNZIP
The COMMAND_UNZIP.
|
static String |
COMMAND_UNZIP_DELETE
The COMMAND_UNZIP_DELETE.
|
static String |
COMMAND_VAR
The COMMAND_VAR.
|
static String |
COMMAND_ZIP
The COMMAND_ZIP.
|
static String |
COMMAND_ZIP_DELETE
The COMMAND_ZIP_DELETE.
|
static String |
DATASET_DESTINATION_FILE
The DESTINATION_FILE.
|
static String |
DATASET_SOURCE_FILE
The SOURCE_FILE.
|
static String |
DEST_CONNECTION_NAME |
static String |
DEST_FOLDER_VAR
The DEST_FOLDER_VAR.
|
static String |
DEST_KEY_FILE_VAR
The DEST KEY_FILE_VAR.
|
static String |
DEST_PARAMS_VAR
The DEST_PARAMS_VAR.
|
static String |
DEST_PASSIVE_MODE_VAR
The DEST_PASSIVE_MODE_VAR.
|
static String |
DEST_PASSPHRASE_VAR
The SOURCE PASSPHRASE_VAR.
|
static String |
DESTINATION_PASSWORD_VAR
The DESTINATION_PASSWORD_VAR.
|
static String |
DESTINATION_PROXY_PORT_VAR
The DESTINATION_PROXY_PORT_VAR.
|
static String |
DESTINATION_PROXY_VAR
The DESTINATION_PROXY_VAR.
|
static String |
DESTINATION_TYPE_VAR
The DESTINATION_TYPE_VAR.
|
static String |
DESTINATION_URL_VAR
The DESTINATION_URL_VAR.
|
static String |
DESTINATION_USER_VAR
The DESTINATION_USER_VAR.
|
static String |
FILE_COUNT_CODE_VAR |
static String |
FILE_COUNT_LANG_VAR
The LANGUAGE VAR.
|
static String |
FILE_COUNT_VAR
The FILE_COUNT_VAR.
|
static String |
FILES_VAR
The FILES_VAR.
|
static String |
FILTER_VAR
The FILE_FILTER_VAR.
|
static String |
IS_FLAT_VAR
The IS_FLAT_VAR.
|
static String |
MAX_FILES_VAR
The MAX_FILES_VAR.
|
static String |
MAX_NUMBER_OF_THRERADS_VAR
The MAX_NUMBER_OF_THERADS_VAR.
|
static String |
ORIGINAL_SOURCE_FILE_EXT |
static String |
ORIGINAL_SOURCE_FILE_NAME |
static String |
SOURCE_CONNECTION_NAME |
static String |
SOURCE_FOLDER_VAR
The SOURCE_FOLDER_VAR.
|
static String |
SOURCE_KEY_FILE_VAR
The SOURCE KEY_FILE_VAR.
|
static String |
SOURCE_PARAMS_VAR
The SOURCE_PARAMS_VAR.
|
static String |
SOURCE_PASSIVE_MODE_VAR
The SOURCE_PASSIVE_MODE_VAR.
|
static String |
SOURCE_PASSPHRASE_VAR
The DEST PASSPHRASE_VAR.
|
static String |
SOURCE_PASSWORD_VAR
The SOURCE_PASSWORD_VAR.
|
static String |
SOURCE_PROXY_PORT_VAR
The SOURCE_PROXY_PORT_VAR.
|
static String |
SOURCE_PROXY_VAR
The SOURCE_PROXY_VAR.
|
static String |
SOURCE_TYPE_VAR
The SOURCE_TYPE_VAR.
|
static String |
SOURCE_URL_VAR
The SOURCE_URL_VAR.
|
static String |
SOURCE_USER_VAR
The SOURCE_USER_VAR.
|
static String |
SPLIT_PROCESSOR_CLASS |
static String |
SUFFIX_VAR
The SUFFIX_VAR.
|
static String |
TO_FILES_VAR
The TO_FILES_VAR.
|
static String |
WAIT_VAR
The WAIT_VAR.
|
static String |
ZIP_FILENAME_VAR
The ZIP_FILENAME_VAR.
|
static String |
ZIP_PASSWORD_VAR
The ZIP_PASSWORD_VAR.
|
Constructor and Description |
---|
FileManagerTask() |
Modifier and Type | Method and Description |
---|---|
static boolean |
delete(Alias alias,
String fileName)
Delete file or resource.
|
static boolean |
delete(EtlConfig config,
String connectionName,
String fileName)
Delete file or resource.
|
TaskResult |
execute(EtlConfig config,
Task task,
DataSet dataSet,
Scenario scenario)
Execute.
|
TaskResult |
executeBeforeEtlTask(EtlConfig config,
Task task,
Scenario scenario)
Executes
task before etl process is started. |
TaskResult |
executeInlineTask(EtlConfig config,
Task task,
long index,
Scenario scenario)
Executes
task for each row of the data set. |
TaskResult |
executePostTask(EtlConfig config,
Task task,
DataSet dataSet,
Scenario scenario)
Executes
task after extract or load finished. |
TaskResult |
executePreTask(EtlConfig config,
Task task,
Scenario scenario)
Executes
task before extract or load started. |
static boolean |
filesExist(Alias alias,
String wildcard)
Check if files exist using given alias and wildcard file name.
|
static boolean |
filesExist(EtlConfig config,
String connectionName,
String wildcard)
Check if files exist using given alias and wildcard file name.
|
static boolean |
fullOrPartialMatch(String name,
Set<String> objects)
Full or partial match.
|
static Alias |
getAlias(EtlConfig config,
String connectionName)
Gets the alias by connection name.
|
String |
getCodeLanguage(Task task)
Gets the code language.
|
Map<String,Object> |
getDefaultValues(Task task)
Gets the default values for the model used to edit task.
|
static String |
getFileName(Alias alias,
String fileName,
boolean createFolder)
Get the fully qualified file name from the given connection and base file
name.
|
static String |
getFileName(EtlConfig config,
String connectionName,
String fileName,
boolean createFolder)
Get the fully qualified file name from the given connection and base file
name.
|
String |
getResourceName(Task task)
Gets the name of the xml file used to create a model for the task editor.
|
String |
getTitle(Task task)
Gets the title.
|
void |
init(EtlConfig config,
Task task)
Initializes task.
|
boolean |
isInlineTask()
Checks if this is inline task.
|
boolean |
isPostTask()
Checks if it is a post task.
|
boolean |
isPreEtlTask()
Checks if it is a pre etl task.
|
boolean |
isPreTask()
Checks if it is a pre task.
|
static List<FileResource> |
list(Alias alias,
String wildcard)
Get the list of files for the connection and wildcard.
|
static List<FileResource> |
list(Alias alias,
String wildcard,
Set<String> excludedObjects,
Set<String> includedObjects)
Get the list of files for the connection and wildcard.
|
static List<FileResource> |
list(EtlConfig config,
String connectionName,
String wildcard)
Get the list of files for the connection and wildcard.
|
static List<FileResource> |
list(EtlConfig config,
String connectionName,
String wildcard,
Set<String> excludedObjects,
Set<String> includedObjects)
Get the list of files for the connection and wildcard.
|
static String |
read(Alias alias,
String fileName)
Read data from the given source.
|
static Object |
read(EtlConfig config,
String connectionName,
String fileName)
Read data from the given source.
|
static InputStream |
readAsStream(Alias alias,
String fileName)
Read data from the given source.
|
static InputStream |
readAsStream(EtlConfig config,
String connectionName,
String fileName)
Read data from the given source.
|
static boolean |
saveTemplate(EtlConfig config,
String connectionName,
String fileName,
Object payload,
boolean createFolder)
Send the template to the given destination.
|
static Alias |
updateAlias(EtlConfig config,
String connectionName,
String fileName)
Update alias url using given file name.
|
static boolean |
write(Alias alias,
String fileName,
Object payload)
Send payload to the given destination.
|
static String |
write(Alias alias,
String fileName,
Object payload,
boolean createFolder)
Send payload to the given destination.
|
static boolean |
write(EtlConfig config,
String connectionName,
String fileName,
Object payload)
Send payload to the given destination.
|
static boolean |
write(EtlConfig config,
String connectionName,
String fileName,
Object payload,
boolean createFolder)
Send payload to the given destination.
|
public static final String ORIGINAL_SOURCE_FILE_NAME
public static final String ORIGINAL_SOURCE_FILE_EXT
public static final String SPLIT_PROCESSOR_CLASS
public static final String SOURCE_CONNECTION_NAME
public static final String DEST_CONNECTION_NAME
public static final String COMMAND_VAR
public static final String SOURCE_TYPE_VAR
public static final String DESTINATION_TYPE_VAR
public static final String SOURCE_URL_VAR
public static final String DESTINATION_URL_VAR
public static final String SOURCE_USER_VAR
public static final String DESTINATION_USER_VAR
public static final String SOURCE_PASSWORD_VAR
public static final String DESTINATION_PASSWORD_VAR
public static final String SOURCE_PROXY_VAR
public static final String DESTINATION_PROXY_VAR
public static final String SOURCE_PROXY_PORT_VAR
public static final String FILE_COUNT_VAR
public static final String FILE_COUNT_LANG_VAR
public static final String FILE_COUNT_CODE_VAR
public static final String DESTINATION_PROXY_PORT_VAR
public static final String MAX_NUMBER_OF_THRERADS_VAR
public static final String SUFFIX_VAR
public static final String MAX_FILES_VAR
public static final String WAIT_VAR
public static final String FILES_VAR
public static final String TO_FILES_VAR
public static final String SOURCE_FOLDER_VAR
public static final String DEST_FOLDER_VAR
public static final String ZIP_FILENAME_VAR
public static final String ZIP_PASSWORD_VAR
public static final String SOURCE_PASSIVE_MODE_VAR
public static final String DEST_PASSIVE_MODE_VAR
public static final String SOURCE_KEY_FILE_VAR
public static final String SOURCE_PASSPHRASE_VAR
public static final String DEST_KEY_FILE_VAR
public static final String DEST_PASSPHRASE_VAR
public static final String FILTER_VAR
public static final String SOURCE_PARAMS_VAR
public static final String DEST_PARAMS_VAR
public static final String IS_FLAT_VAR
public static final String COMMAND_COPY
public static final String COMMAND_MOVE
public static final String COMMAND_COUNT
public static final String COMMAND_RENAME
public static final String COMMAND_DELETE
public static final String COMMAND_ZIP
public static final String COMMAND_UNZIP
public static final String COMMAND_UNGZIP
public static final String COMMAND_ZIP_DELETE
public static final String COMMAND_UNZIP_DELETE
public static final String COMMAND_UNGZIP_DELETE
public static final String COMMAND_MKDIR
public static final String DATASET_SOURCE_FILE
public static final String DATASET_DESTINATION_FILE
public static List<FileResource> list(Alias alias, String wildcard) throws Exception
alias
- the aliaswildcard
- the wildcardException
- in case of any errorpublic static boolean fullOrPartialMatch(String name, Set<String> objects)
name
- the nameobjects
- the objectspublic static List<FileResource> list(Alias alias, String wildcard, Set<String> excludedObjects, Set<String> includedObjects) throws Exception
alias
- the aliaswildcard
- the wildcardException
- in case of any errorpublic static List<FileResource> list(EtlConfig config, String connectionName, String wildcard) throws Exception
config
- the configconnectionName
- the connection namewildcard
- the wildcardException
- in case of any errorpublic static List<FileResource> list(EtlConfig config, String connectionName, String wildcard, Set<String> excludedObjects, Set<String> includedObjects) throws Exception
config
- the configconnectionName
- the connection namewildcard
- the wildcardException
- in case of any errorpublic static boolean filesExist(Alias alias, String wildcard) throws Exception
alias
- the aliaswildcard
- the wildcard file nameException
- in case of any errorpublic static Alias getAlias(EtlConfig config, String connectionName)
config
- the etl configconnectionName
- the connection namepublic static Alias updateAlias(EtlConfig config, String connectionName, String fileName)
config
- the etl configconnectionName
- the connection namefileName
- the file namepublic static boolean filesExist(EtlConfig config, String connectionName, String wildcard) throws Exception
config
- the etl configconnectionName
- the connection namewildcard
- the wildcard file nameException
- in case of any errorpublic static boolean write(EtlConfig config, String connectionName, String fileName, Object payload) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file namepayload
- the payloadException
- in case of any errorpublic static boolean write(EtlConfig config, String connectionName, String fileName, Object payload, boolean createFolder) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file namepayload
- the payloadcreateFolder
- if true and folder does not exist - create the folderException
- in case of any errorpublic static boolean saveTemplate(EtlConfig config, String connectionName, String fileName, Object payload, boolean createFolder) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file namepayload
- the payloadcreateFolder
- if true and folder does not exist - create the folderException
- in case of any errorpublic static boolean write(Alias alias, String fileName, Object payload) throws Exception
alias
- the destination aliasfileName
- the file namepayload
- the payloadException
- in case of any errorpublic static String write(Alias alias, String fileName, Object payload, boolean createFolder) throws Exception
alias
- the destination aliasfileName
- the file namepayload
- the payloadcreateFolder
- create folder if true and folder doesn't existException
- in case of any errorpublic static String getFileName(EtlConfig config, String connectionName, String fileName, boolean createFolder) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file namecreateFolder
- if true creates a a folder if it does not existException
- in case of any errorpublic static String getFileName(Alias alias, String fileName, boolean createFolder) throws Exception
alias
- the aliasfileName
- the file namecreateFolder
- the create folderException
- in case of any errorpublic static Object read(EtlConfig config, String connectionName, String fileName) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file nameException
- in case of any errorpublic static InputStream readAsStream(EtlConfig config, String connectionName, String fileName) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file nameException
- in case of any errorpublic static String read(Alias alias, String fileName) throws Exception
alias
- the destination aliasfileName
- the file nameException
- in case of any errorpublic static InputStream readAsStream(Alias alias, String fileName) throws Exception
alias
- the destination aliasfileName
- the file nameException
- in case of any errorpublic static boolean delete(EtlConfig config, String connectionName, String fileName) throws Exception
config
- the etl configconnectionName
- the connection namefileName
- the file nameException
- in case of any errorpublic static boolean delete(Alias alias, String fileName) throws Exception
alias
- the destination aliasfileName
- the file nameException
- in case of any errorpublic TaskResult executeBeforeEtlTask(EtlConfig config, Task task, Scenario scenario) throws Exception
OnTask
task
before etl process is started.executeBeforeEtlTask
in interface OnTask
config
- the etl configtask
- the task to executescenario
- the scenarioException
- in case of any errorpublic TaskResult executeInlineTask(EtlConfig config, Task task, long index, Scenario scenario) throws Exception
OnTask
task
for each row of the data set.executeInlineTask
in interface OnTask
config
- the etl configtask
- the task to executeindex
- the current row numberscenario
- the scenarioException
- in case of any errorpublic TaskResult executePostTask(EtlConfig config, Task task, DataSet dataSet, Scenario scenario) throws Exception
OnTask
task
after extract or load finished.executePostTask
in interface OnTask
config
- the etl configtask
- the task to executedataSet
- the data setscenario
- the scenarioException
- in case of any errorpublic TaskResult execute(EtlConfig config, Task task, DataSet dataSet, Scenario scenario) throws Exception
config
- the configtask
- the taskdataSet
- the data setscenario
- the scenarioException
- the exceptionpublic TaskResult executePreTask(EtlConfig config, Task task, Scenario scenario) throws Exception
OnTask
task
before extract or load started.executePreTask
in interface OnTask
config
- the etl configtask
- the task to executescenario
- the scenarioException
- in case of any errorpublic Map<String,Object> getDefaultValues(Task task)
OnTask
getDefaultValues
in interface OnTask
task
- the taskpublic String getResourceName(Task task)
OnTask
getResourceName
in interface OnTask
task
- the taskpublic void init(EtlConfig config, Task task) throws Exception
OnTask
public boolean isInlineTask()
OnTask
isInlineTask
in interface OnTask
public boolean isPostTask()
OnTask
isPostTask
in interface OnTask
public boolean isPreEtlTask()
OnTask
isPreEtlTask
in interface OnTask
public boolean isPreTask()
OnTask
public String getTitle(Task task)
OnTask
public String getCodeLanguage(Task task)
OnTask
getCodeLanguage
in interface OnTask
task
- the taskCopyright © 2010-2020 Toolsverse. All Rights Reserved.