Filesystem Adapter Reference
Stereotype Attributes
Directory Alias
Attribute | Description | Allowed Values / Example | |
---|---|---|---|
Name | Specify a name for the alias. | any string | |
Standard | |||
directory | Specify a path to a directory. | tmp/Export | |
fileEncoding | Specify the default encoding be used with the directory. This default encoding can be overwritten on adapter calls, using a dynamic encoding parameter, e.g. on Filesystem adapter calls reading lines, or with the Flat File adapter. | Refer to Charset Definitions for possible values. | |
default, when empty | iso-8859-1 | ||
Designer default | utf-8 |
File Alias
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
Name | Specify a name for the alias. | any string | |
Standard | |||
file | Specify name and path of the file you want to access. | tmp/Export/ProductExport.txt | |
encoding | Specify the encoding of the file. | Refer to Charset Definitions for possible values. | |
default, when empty | iso-8859-1 | ||
Designer default | utf-8 | ||
resource | This attribute currently cannot be used in Designer context. |
File System Adapter
Attribute | Description | Allowed Values |
---|---|---|
alias | Specify the File or Directory alias the adapter should use to establish the connection. | any valid File or Directory alias |
action |
The adapter action derives from the used operation. Do not configure this. | |
mode | If you are using an append operation, you need to select the corresponding mode. See append operation for detailed information. | append (default), overwrite |
Filesystem Adapter File Operations
append Operation
You can use the append operation with two modes:
append
If the mode is empty or append, the content stored in data will be appended to the end of the file specified in name. If the file does not exist, it will be created.overwrite
If mode is overwrite, the file specified in name will be overwritten with the content stored in data. If the file does not exist, it will be created.
overwrite will only be applied to the first append. For all subsequent appends (e.g. in a loop), the mode will be switched to append automatically.
append ( data : Blob, name : String, length : Integer )
Name | Type | Direction | Description |
---|---|---|---|
data | Blob | in | Content you want to write to the file. |
name | String | in | Fully qualified file name of the file you want to write, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
length | Integer | in | Length (in Bytes) of the data you want to append, if you want to only write part of the Blob. |
close Operation
close ( name : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to close, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
copy Operation
copy ( source : String, traget : String
Name | Type | Direction | Description |
---|---|---|---|
source | String | in | Fully qualified file name of the file you want to copy, including the path. |
target | String | in | Fully qualified file name of the target file, including the path. |
When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.
read Operation
read ( name : String, position : Integer, length.in : Integer, data : Blob, length.out : Integer )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to read, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
position | Integer | in | Position (in Bytes) from which you want to start reading the file. |
length.in | Integer | in | Length (in Bytes) of the snippet of the file you want to read. The actual length of the read data is given back (e.g. on file end). |
data | Blob | out | Content that has been read. |
length.out | Integer | out | Length (in Bytes) of the snippet of the file you want to read. The actual length of the read data is given back (e.g. on file end). |
readLine Operation
readLine ( name : String, encoding : String, length : Integer, line : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to read, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
encoding | String | in | Encoding of the file. Default encoding is iso-8859-1. |
length | Integer | out | Length (in Bytes) of the line that has been read. On file end, length is 0. |
line | String | out | File content of the line that has been read. On file end, line is NULL. |
remove Operation
remove ( name : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to remove, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
rename Operation
readLine ( name : String, newName : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to rename, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
newName | String | in | New name you want to rename the file to. We recommend to provide a fully qualified file name (including the path). |
status Operation
status ( name : String, size : Integer, type : String, accessTime : DateTime, creationTime : DateTime, modificationTime : DateTime )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file/directory you want to read, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
size | Integer | out | Size of the file in Bytes. size is meaningless for directories, as it is not the combined size of all contained files and subfolders, but rather some constant defined by the operating system (e.g. 0 or 4096). |
type | String | out | Type of accessed element (File or Directory). |
accessTime | DateTime | out | Timestamp when the file/directory was accessed for the last time. |
creationTime | DateTime | out | Timestamp when the file/directory was created. |
modificationTime | DateTime | out | Timestamp when the file/directory was modified for the last time. |
write Operation
write ( data : Blob, name : String, position : Integer, length : Integer )
Name | Type | Direction | Description |
---|---|---|---|
data | Blob | in | Content you want to write to the file. |
name | String | in | Fully qualified file name of the file you want to write, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
position | Integer | in | Position (in Bytes) from which you want to start writing the file. |
length | Integer | in | Length (in Bytes) of the data you want to write, if you want to only write part of the Blob. |
Filesystem Adapter Directory Operations
createDirectory Operation
createDirectory ( name : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the directory you want to create, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
readDirectory Operation
readDirectory ( name : String, entries : String[] )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified path to the directory you want to read. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
entries | Array of String | out | readDirectory returns an array of String containing the names of the content elements. The array elements do not contain the directory prefix (path). |
remove Operation
You can only remove an empty directory with the remove operation. In case the directory contains files or subfolders, use removeRecursively (see below).
remove ( name : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the directory you want to remove, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
removeRecursively Operation
removeRecursively ( name : String )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the top node of the directory tree you want to remove, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
status Operation
status ( name : String, type : String, size : Integer, accessTime : DateTime, creationTime : DateTime, modificationTime : DateTime )
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file/directory you want to read, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
size | Integer | out | Size of the file in Bytes. size is meaningless for directories, as it is not the combined size of all contained files and subfolders, but rather some constant defined by the operating system (e.g. 0 or 4096). |
type | String | out | Type of accessed element (File or Directory). |
accessTime | DateTime | out | Timestamp when the file/directory was accessed for the last time. |
creationTime | DateTime | out | Timestamp when the file/directory was created. |
modificationTime | DateTime | out | Timestamp when the file/directory was modified for the last time. |
FilesystemAdapter_ProductExport_Example
Click here to download a simple example model that shows the usage of the Filesystem adapter in Scheer PAS Designer.
Related Pages: