Difference between revisions of "Filemanager-call"

From GreenVulcano Wiki
Jump to: navigation, search
({{VULCON}} / {{GVCONSOLE}} Configuration)
({{VULCON}} / {{GVCONSOLE}} Configuration)
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
#Deletion of one or more file whose name corresponds to a regular expression
 
#Deletion of one or more file whose name corresponds to a regular expression
 
#Rename a file
 
#Rename a file
#Moving of one or more files, whose name corresponds to a regular expression,from a directory source to a destination directory
+
#Moving of one or more files, whose name corresponds to a regular expression, from a directory source to a destination directory
#Copy of one or more files, whose name corresponds to a regular expression,from source directory to a destination directory
+
#Copy of one or more files, whose name corresponds to a regular expression, from source directory to a destination directory
#ZIP compress of one or more files, whose name corresponds to a regular expression,from a source directory to a ZIP file in a destination directory
+
#ZIP compress of one or more files, whose name corresponds to a regular expression, from a source directory to a ZIP file in a destination directory
 
#Decompression of ZIP file from a directory source to a target directory
 
#Decompression of ZIP file from a directory source to a target directory
 
#Check existence of one or more files whose name corresponds to a given regular expression
 
#Check existence of one or more files whose name corresponds to a given regular expression
Line 13: Line 13:
  
 
=={{VULCON}} / {{GVCONSOLE}} Configuration==
 
=={{VULCON}} / {{GVCONSOLE}} Configuration==
''filemanager-call'' is the operation that must be configured into {{L_VULCON}} or  {{L_GVCONSOLE}} [[System section]], to execute files operations.
+
 
 +
''filemanager-call'' is the operation that must be configured into {{L_VULCON}} or  {{L_GVCONSOLE}} [[System]] section, to execute files operations.
  
 
In order to configure an operation ''filemanager-call'' might be defined the following fields:
 
In order to configure an operation ''filemanager-call'' might be defined the following fields:
Line 27: Line 28:
  
 
The ''filemanager-call'' element must contain at least one of the following '''FileCommands''':
 
The ''filemanager-call'' element must contain at least one of the following '''FileCommands''':
* [[FileSearchCommand]]
+
* [[Filemanager-call#FileSearchCommand|FileSearchCommand]]
* [[FileMoveCommand]]
+
* [[Filemanager-call#FileMoveCommand|FileMoveCommand]]
* [[FileDeleteCommand]]
+
* [[Filemanager-call#FileDeleteCommand|FileDeleteCommand]]
* [[FileCopyCommand]]
+
* [[Filemanager-call#FileCopyCommand|FileCopyCommand]]
* [[FileZipCommand]]
+
* [[Filemanager-call#FileZipCommand|FileZipCommand]]
* [[FileUnZipCommand]]
+
* [[Filemanager-call#FileUnZipCommand|FileUnZipCommand]]
 +
 
 +
This subelements represent the sequence of file operations to be performed.
 +
 
 +
 
 +
Note that operations are carried out in the order they are configured.  An error in one of the critical operations will terminate the execution of the entire sequence.
  
 
===FileSearchCommand===
 
===FileSearchCommand===
Line 54: Line 60:
 
| returnFullPath || optional || If true the found files are inserted in list with full path. Default false.
 
| returnFullPath || optional || If true the found files are inserted in list with full path. Default false.
 
|-
 
|-
| isCritical || optional || If true an internal error interrupt the command sequence. Default true
+
| isCritical || optional || If true an internal error interrupts the command sequence. Default true
 
|}
 
|}
  
 
On completion of and in the absence of errors are set the following properties of [[GVBuffer]] output:
 
On completion of and in the absence of errors are set the following properties of [[GVBuffer]] output:
1) GVFM_FIND_FILES_NUM Number of files found (>= 0)
+
#GVFM_FIND_FILES_NUM Number of files found (>= 0)
2) GVFM_FIND_FILES_LIST List of names of found files, separated by ','. Set only if the value of field ''GVFM_FIND_FILES_NUM'' is greater than 0.
+
#GVFM_FIND_FILES_LIST List of names of found files, separated by ','. Set only if the value of field ''GVFM_FIND_FILES_NUM'' is greater than 0.
Both the name of the file and the directory can be static or contain [[placeholders]] that are replaced at runtime.
+
 
 +
Both the name of the file and directory can be static or contain [[placeholders]] that are replaced at runtime.
  
 
===FileMoveCommand===
 
===FileMoveCommand===
Line 79: Line 86:
 
|-
 
|-
 
| filePattern || optional || File name to move. Can be a regular expression. Is used only if ''sourcePath'' is a directory, and if empty the filter is ignored
 
| filePattern || optional || File name to move. Can be a regular expression. Is used only if ''sourcePath'' is a directory, and if empty the filter is ignored
 +
|-
 
| isCritical || optional || If true an internal error interrupt the command sequence. Default true
 
| isCritical || optional || If true an internal error interrupt the command sequence. Default true
 
|}
 
|}
Line 102: Line 110:
 
| filePattern || optional || File name to remove. Can be a regular expression. Is used only if ''targetPath'' is a directory, and if empty the filter is ignored
 
| filePattern || optional || File name to remove. Can be a regular expression. Is used only if ''targetPath'' is a directory, and if empty the filter is ignored
 
|-
 
|-
| isCritical || optional || If true an internal error interrupt the command sequence. Default true
+
| isCritical || optional || If true an internal error interrupts the command sequence. Default true
 
|}
 
|}
  
 
Both the file name and directory can be static or contain [[placeholders]] that are replaced at runtime.
 
Both the file name and directory can be static or contain [[placeholders]] that are replaced at runtime.
 +
 
After the replacement of the placeholder, the value of ''filename'' may contain a regular expression, in which case, will erase all files in the specified directory whose name is consistent with the corresponding pattern.
 
After the replacement of the placeholder, the value of ''filename'' may contain a regular expression, in which case, will erase all files in the specified directory whose name is consistent with the corresponding pattern.
  
 
===FileCopyCommand===
 
===FileCopyCommand===
  
To copy a files from a specific directory add "'''FileCopyCommand'''" element.
+
To copy a files from a specific directory add a "'''FileCopyCommand'''" element.
 +
 
 +
The following table shows its attributes:
 +
{|class="gvtable"
 +
! Attribute !! Type !! Description
 +
|-
 +
| type || fixed || This attribute must assume the value '''file-command'''.
 +
|-
 +
| class || fixed || This attribute must assume the value '''it.greenvulcano.gvesb.virtual.file.command.GVCopy'''.
 +
|-
 +
| sourcePath || required || Absolute path of the file/directory to copy.
 +
|-
 +
| targetPath || required || Absolute path of the destination file/directory.
 +
|-
 +
| filePattern || optional || File name to copy. Can be a regular expression. Is used only if ''sourcePath'' is a directory, and if empty the filter is ignored.
 +
|}
 +
 
 +
The file name, the source and destination directory names can be static or contain [[placeholders]] that are replaced at runtime.
  
#sourcePath: Absolute path of the file/directory to copy.
+
After the replacement of the placeholder, the value of the ''filename'' may contain a regular expression, in which case, all files of the source directory, whose name is in accordance with the corresponding pattern will be copied to the destination directory. If the destination directory already contains files with the same name, they will be overwritten.
#targetPath:  Absolute path of the destination file/directory.
 
#filePattern:  File name to copy. Can be a regular espression.Is used only if sourcePath is a directory, and if empty the filter is ignored.
 
#isCritical: If true an internal error interrupt the command sequence. Default true
 
  
 
===FileZipCommand===
 
===FileZipCommand===
  
To compress one or more files add "'''FileZipCommand'''" element and define the following fieds:
+
To compress one or more files add "'''FileZipCommand'''" element and define the following fields:
#sourcePath: Absolute path of the source directory
+
 
#filePattern: File name to zip. Can be a regular espression. Is used only if sourcePath is a directory,and if empty the filter is ignored
+
The following table shows its attributes:
#targetPath: Absolute path of the destination directory
+
{|class="gvtable"
#zipFileName: Name of the zip file
+
! Attribute !! Type !! Description
#isCritical: If true an internal error interrupt the command sequence. Default true.
+
|-
 +
| type || fixed || This attribute must assume the value '''file-command'''.
 +
|-
 +
| class || fixed || This attribute must assume the value '''it.greenvulcano.gvesb.virtual.file.command.GVZip'''.
 +
|-
 +
| sourcePath || required || Absolute path of the source directory
 +
|-
 +
| filePattern || optional || File name to zip. Can be a regular expression. Is used only if ''sourcePath'' is a directory,and if empty the filter is ignored
 +
|-
 +
| targetPath || required || Absolute path of the destination directory
 +
|-
 +
| zipFileName || required || Name of the zip file
 +
|-
 +
| isCritical || optional || If true an internal error interrupts the command sequence. Default true.
 +
|}
 +
 
 +
The file name, the source and destination directory names can be static or contain [[placeholders]] that are replaced at runtime.
  
 +
If the destination directory already has a ZIP file with the same name, it will be overwritten.
  
 
===FileUnZipCommand===
 
===FileUnZipCommand===
  
To Unpacking the contents of a Zip file add "'''FileUnZipCommand'''" element and define the following fieds:
+
To Unpacking the contents of a Zip file add a "'''FileUnZipCommand'''" element.
#sourcePath: Absolute path of the source directory
+
 
#zipFileName: Name of the zip file
+
The following table shows its attributes:
#targetPath: Absolute path of the destination directory
+
{|class="gvtable"
#isCritical: If true an internal error interrupt the command sequence. Default true.
+
! Attribute !! Type !! Description
 +
|-
 +
| type || fixed || This attribute must assume the value '''file-command'''.
 +
|-
 +
| class || fixed || This attribute must assume the value '''it.greenvulcano.gvesb.virtual.file.command.GVUnZip'''.
 +
|-
 +
| sourcePath || required || Absolute path of the source directory.
 +
|-
 +
| zipFileName || required || Name of the zip file.
 +
|-
 +
| targetPath || required || Absolute path of the destination directory.
 +
|-
 +
| isCritical || optional || If true an internal error interrupts the command sequence. Default true.
 +
|}
 +
 
 +
==How To==
 +
 
 +
From the {{L_VULCON}} Core view:
 +
# Create a new System and Channel if you do not want to use one among those already presents.
 +
# Right click the element Channel you created (or selected) -> Insert after (or Insert before) -> Filemanager-call
 +
# Set the parameter ''name''
 +
# Expand the filemanager-call element. The will be present a FileCommands element containing a FileSearchCommand
 +
# If your service requires a FileSearchCommand, set its attributes. Otherwise, right click on it -> Change to and select the file command that you need.
 +
 
 +
Package {{GVESB}} includes the preconfigured Service [[TestFileAttachment]] that shows the use of ''Filemanager-call'' [[plugins|plugin]].

Latest revision as of 10:28, 27 February 2012

Definition

This plug-in allows you to perform a sequence of file operations on the local filesystem. The operations allowed are:

  1. Deletion of one or more file whose name corresponds to a regular expression
  2. Rename a file
  3. Moving of one or more files, whose name corresponds to a regular expression, from a directory source to a destination directory
  4. Copy of one or more files, whose name corresponds to a regular expression, from source directory to a destination directory
  5. ZIP compress of one or more files, whose name corresponds to a regular expression, from a source directory to a ZIP file in a destination directory
  6. Decompression of ZIP file from a directory source to a target directory
  7. Check existence of one or more files whose name corresponds to a given regular expression

GreenVulcano® ESB provides two different tools, GV Console® and VulCon®, to configure all supported plug-ins in GV services.

VulCon / GV Console Configuration

filemanager-call is the operation that must be configured into VulCon® or GV Console® System section, to execute files operations.

In order to configure an operation filemanager-call might be defined the following fields:

Attribute Type Description
type fixed This attribute must assume the value call.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.reader.FileManagerCall.
name required Operation name. Used in the Flow section to associate workflow nodes to VCL operations.

The filemanager-call element must contain at least one of the following FileCommands:

This subelements represent the sequence of file operations to be performed.


Note that operations are carried out in the order they are configured. An error in one of the critical operations will terminate the execution of the entire sequence.

FileSearchCommand

To execute a search file operation add a "FileSearchCommand" element.

This operation checks if one or more files, whose name conforms to a given regular expression, exists within the specified directory.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVSearch.
sourcePath required Absolute path of the directory to search in.
filePattern required File name to search for. Can be a regular expression.
returnFullPath optional If true the found files are inserted in list with full path. Default false.
isCritical optional If true an internal error interrupts the command sequence. Default true

On completion of and in the absence of errors are set the following properties of GVBuffer output:

  1. GVFM_FIND_FILES_NUM Number of files found (>= 0)
  2. GVFM_FIND_FILES_LIST List of names of found files, separated by ','. Set only if the value of field GVFM_FIND_FILES_NUM is greater than 0.

Both the name of the file and directory can be static or contain placeholders that are replaced at runtime.

FileMoveCommand

To move and/or rename a file or directory add a "FileMoveCommand" element.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVMove.
sourcePath required Absolute path of the directory to move
targetPath required Absolute path of the destination file/directory
filePattern optional File name to move. Can be a regular expression. Is used only if sourcePath is a directory, and if empty the filter is ignored
isCritical optional If true an internal error interrupt the command sequence. Default true

The file name, the source and destination directory names can be static or contain placeholders that are replaced at runtime.

After the replacement of the placeholder, the value of the filename may contain a regular expression, in which case, all files of the source directory, whose name is in accordance with the corresponding pattern will be moved to the destination directory. If the destination directory already contains files with the same name, they will be overwritten.

FileDeleteCommand

To remove a files from a specific directory add "FileDeleteCommand" element.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVDelete.
targetPath: required Absolute path of the file/directory to remove.
filePattern optional File name to remove. Can be a regular expression. Is used only if targetPath is a directory, and if empty the filter is ignored
isCritical optional If true an internal error interrupts the command sequence. Default true

Both the file name and directory can be static or contain placeholders that are replaced at runtime.

After the replacement of the placeholder, the value of filename may contain a regular expression, in which case, will erase all files in the specified directory whose name is consistent with the corresponding pattern.

FileCopyCommand

To copy a files from a specific directory add a "FileCopyCommand" element.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVCopy.
sourcePath required Absolute path of the file/directory to copy.
targetPath required Absolute path of the destination file/directory.
filePattern optional File name to copy. Can be a regular expression. Is used only if sourcePath is a directory, and if empty the filter is ignored.

The file name, the source and destination directory names can be static or contain placeholders that are replaced at runtime.

After the replacement of the placeholder, the value of the filename may contain a regular expression, in which case, all files of the source directory, whose name is in accordance with the corresponding pattern will be copied to the destination directory. If the destination directory already contains files with the same name, they will be overwritten.

FileZipCommand

To compress one or more files add "FileZipCommand" element and define the following fields:

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVZip.
sourcePath required Absolute path of the source directory
filePattern optional File name to zip. Can be a regular expression. Is used only if sourcePath is a directory,and if empty the filter is ignored
targetPath required Absolute path of the destination directory
zipFileName required Name of the zip file
isCritical optional If true an internal error interrupts the command sequence. Default true.

The file name, the source and destination directory names can be static or contain placeholders that are replaced at runtime.

If the destination directory already has a ZIP file with the same name, it will be overwritten.

FileUnZipCommand

To Unpacking the contents of a Zip file add a "FileUnZipCommand" element.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value file-command.
class fixed This attribute must assume the value it.greenvulcano.gvesb.virtual.file.command.GVUnZip.
sourcePath required Absolute path of the source directory.
zipFileName required Name of the zip file.
targetPath required Absolute path of the destination directory.
isCritical optional If true an internal error interrupts the command sequence. Default true.

How To

From the VulCon® Core view:

  1. Create a new System and Channel if you do not want to use one among those already presents.
  2. Right click the element Channel you created (or selected) -> Insert after (or Insert before) -> Filemanager-call
  3. Set the parameter name
  4. Expand the filemanager-call element. The will be present a FileCommands element containing a FileSearchCommand
  5. If your service requires a FileSearchCommand, set its attributes. Otherwise, right click on it -> Change to and select the file command that you need.

Package GreenVulcano® ESB includes the preconfigured Service TestFileAttachment that shows the use of Filemanager-call plugin.