Location:  WebCFG documentation > XML specification

File

Type: File
Parent: FileSet, Handler

This element represents the actual config file you want to edit with WebCFG. This file can be on the local system where WebCFG ist installed or on any remote host that is reachable via virtual filesystem. For details about the available protocols see the Apache Commons VFS documentation.

Attributes
Attribute Description Usage
id A unique ID for internal references. required
filename The path to the file on the local disk or on a remote host. For the syntax see the VFS specification or below for some examples. required
templatefilename If the file specified in the filename attribute is not available, the template file will be opened instead and afterwards treated as if it was the wanted file (i.e. it will saved to the filename defined in filename). optional
default-hide Allowed values: true, false

If set to true, nothing will be displayed except the parts that are tagged with @WS hide off.

Defaults to false.
optional
default-readonly Allowed values: true, false

If set to true, no changes can be made to this file. You can enable writing to input forms with @WS readwrite
optional
type Allowed values: property, plain, raw

Defines the type of the config file.

If the file have a property like form (value = key) then chose property.

If it hasn't, chose plain if tags are to be interpreted, otherwise raw.
optional
linefeed Allowed values: auto, dos, unix

Defines the linefeed used to save changes back to the config file.

Defaults to auto if not set.
optional
tab Defines the tab under which this config file should appear. This makes it possible to have several files displayed under one tab. optional
Examples
<fileset>
    		
   <file id="config" type="property" linefeed="unix"		  
      filename="${configdir}/vacation.conf" 
      templatefilename="${template.dir}/vacation.conf"/>
      
   <file id="text" type="plain" linefeed="unix"			  
      filename="${configdir}/vacation.msg" 
      templatefilename="${template.dir}/vacation.msg"/>
      
   <file id="exclude" type="plain" linefeed="unix"		  
      filename="${configdir}/vacation.exclude" 
      templatefilename="${template.dir}/vacation.exclude"/>
      
   <file id="plugin" type="property" linefeed="unix"	  		
      filename="${configdir}/vacation-plugin.conf" 
      templatefilename="${template.dir}/vacation-local.conf"/>
      
</fileset>

This example shows the usage of the various attributes, variables in filenames and how to combine several logically connected configuration files (in this case the vacation configuration on a Linux system) into one metaconfiguration that can be edited in the web frontend.

This example also shows the usage of templates. In the first file element declaration, when the user loads this metaconfiguration, the file ${configdir}/vacation.conf is to be opened. When this fails because the file doesn't exist, the template file ${template.dir}/vacation.msg will be opened instead. Changes made to this file will be written to the actual file ${configdir}/vacation.conf.

Important: If working with templates, make sure to have a loadaction defined that creates possibly needed subdirectories if you can't be sure they already exist!

<fileset>
    		
   <file id="config" type="property" linefeed="unix"		  
      filename="sftp://${user}:${password}@${hostname}/etc/vacation.conf" />
      
   <file id="text" type="plain" linefeed="unix"			  
      filename="ftp://${user}:${password}@${hostname}/etc/vacation.conf" />
      
   <file id="exclude" type="plain" linefeed="unix"		  
      filename="smb://${user}:${password}@${hostname}/etc/vacation.conf" />
      
</fileset>

This example shows how to access files on remote systems through different protocols. For more information about possible protocols see the Apache Commons VFS documentation.


top