Service File

from file import File

Port NameLocationProtocolInterfaces
iplocalFileInterface

List of Available Interfaces

FileInterface

Operation NameInput TypeOutput TypeFaultsDescription
convertFromBase64ToBinaryValuestringraw
IOException3#IOExceptionType
deprecated, please use base64ToRaw@Converter()() from converter.iol
convertFromBinaryToBase64Valuerawstring-deprecated, please use rawToBase64@Converter()() from converter.iol
copyDirCopyDirRequestbool
FileNotFoundundefined
IOExceptionundefined

it copies a source directory into a destination one
deleteDeleteRequestbool
IOException3#IOExceptionType
deleteDirstringbool
IOException3#IOExceptionType

it deletes a directory recursively removing all its contents
existsstringbool-
it tests if the specified file or directory exists or not.
getFileSeparatorvoidstring-
getMimeTypestringstring
FileNotFoundFileNotFoundType
getParentPathstringstring
InvalidPathException0#JavaExceptionType

Constructs the path to the parent directory.
Can be used to construct paths that does not exist so long as the path uses the system's filesystem path conventions.
Throws a InvalidPathException fault if input path is not a recognized system path or if the parent has no parent.
getRealServiceDirectoryvoidstring
IOException3#IOExceptionType
Returns the real filesystem directory (following links) from which the service has been launched
getRealServiceFileNamevoidstring
IOException3#IOExceptionType
Returns the name of the real file (following links) from which the service has been launched
getServiceDirectoryvoidstring
IOException3#IOExceptionType
Returns the filesystem directory from which the service has been launched
getServiceFileNamevoidstring-Returns the name of the file from which the service has been launched
getServiceParentPathvoidstring-Returns the parent path of the service
getSizeanyint-
The size of any basic type variable.
- raw: buffer size
- void: 0
- boolean: 1
- integer types: int 4, long 8
- double: 8
- string: size in the respective platform encoding, on ASCII and latin1
equal to the string's length, on Unicode (UTF-8 etc.) >= string's length
isDirectorystringbool
FileNotFoundFileNotFoundType
IOException3#IOExceptionType

it returns if a filename is a directory or not. False if the file does not exist.
listListRequestListResponse
IOException3#IOExceptionType
mkdirstringbool-

it creates the directory specified in the request root. Returns true if the directory has been
created with success, false otherwise
readFileReadFileRequestundefined
FileNotFoundFileNotFoundType
IOException3#IOExceptionType

Reads some file's content into a Jolie structure

Supported formats (ReadFileRequest.format):
- text (the default)
- base64 (same as binary but afterwards base64-encoded)
- binary
- xml
- xml_store (a type-annotated XML format)
- properties (Java properties file)
- json

Child values: text, base64 and binary only populate the return's base value, the other formats fill in the child values as well.
- xml, xml_store: the XML root node will costitute a return's child value, the rest is filled in recursively
- properties: each property is represented by a child value
- json: each attribute corresponds to a child value, the default values (attribute "$" or singular value) are saved as the base values, nested arrays get mapped with the "" helper childs (e.g. a[i][j] -> a.[i]._[j]), the rest is filled in recursively
renameRenameRequestvoid
IOException3#IOExceptionType
setMimeTypeFilestringvoid
IOException3#IOExceptionType
toAbsolutePathstringstring
InvalidPathException0#JavaExceptionType

Constructs an absolute path to the target file or directory.
Can be used to construct an absolute path for new files that does not exist yet.
Throws a InvalidPathException fault if input is a relative path is not system recognized path.
writeFileWriteFileRequestvoid
FileNotFoundFileNotFoundType
IOException3#IOExceptionType

Writes a Jolie structure out to an external file

Supported formats (WriteFileRequest.format):
- text (the default if base value not of type raw)
- binary (the default if base value of type raw)
- xml
- xml_store (a type-annotated XML format)
- json


Child values: text and binary only consider the content's (WriteFileRequest.content) base value, the other formats look at the child values as well.
- xml, xml_store: the XML root node will costitute the content's only child value, the rest gets read out recursively
- json: each child value corresponds to an attribute, the base values are saved as the default values (attribute "$" or singular value), the "" helper childs disappear (e.g. a.[i]._[j] -> a[i][j]), the rest gets read out recursively

when format is xml and a schema is defined, the resulting xml follows the schema constraints.
Use "@NameSpace" in order to enable root element identification in the schema by specifing the namespace of the root.
Use "@Prefix" for forcing a prefix in an element.
Use "@ForceAttribute" for forcing an attribute in an element even if it is not defined in the corresponding schema

Types

CopyDirRequest: from: the source directory to copy to: the target directory to copy into
Type Declaration
void {
  from[1,1]: string // 
  to[1,1]: string // 
}
DeleteRequest:
Type Declaration
string {
  isRegex[0,1]: int // 
}
FileNotFoundType:
Type Declaration
WeakJavaExceptionType
IOExceptionType:
Type Declaration
JavaExceptionType
IOExceptionType:
Type Declaration
IOExceptionType
JavaExceptionType:
Type Declaration
string {
  stackTrace[1,1]: string // 
}
JavaExceptionType:
Type Declaration
JavaExceptionType
ListRequest:
Type Declaration
void {
  regex[0,1]: string // 
  dirsOnly[0,1]: bool // 
  directory[1,1]: string // 
  recursive[0,1]: bool // 
  order[0,1]: void {
    byname[0,1]: bool // 
  } // 
  info[0,1]: bool // 
}
ListResponse:
Type Declaration
void {
  result[0,1]: string {
    info[0,1]: void {
      size[1,1]: long // 
      absolutePath[1,1]: string // 
      lastModified[1,1]: long // 
      isDirectory[1,1]: bool // 
      isHidden[1,1]: bool // 
    } // 
  } // 
}
ReadFileRequest:
Type Declaration
void {
  filename[1,1]: string // 
  format[0,1]: string {
    skipMixedText[0,1]: bool // 
    charset[0,1]: string // 
    stream[0,1]: bool //  if format is "yaml" and this is true, the file is read as a stream of multiple YAML documents which will be returned as a "documents" array in the response
  } // 
}
RenameRequest:
Type Declaration
void {
  filename[1,1]: string // 
  to[1,1]: string // 
}
WeakJavaExceptionType:
Type Declaration
any {
  stackTrace[0,1]: string // 
}
WriteFileRequest:
Type Declaration
void {
  filename[1,1]: string // 
  format[0,1]: string {
    schema[0,1]: string // 
    indent[0,1]: bool // 
    doctype_system[0,1]: string // 
    encoding[0,1]: string // 
  } // 
  content[1,1]: undefined // 
  append[0,1]: int // 
}