FITECH Laboratories spacer
graphic Company graphic Products graphic Support graphic Customers graphic Partners
The Power of Choice
spacer » Buy graphic » Try graphic » Map graphic » Contact graphic
spacer
spacer
xTier™
Overview
xTier Services
Business Case
Documentation
F.A.Q.
Buy xTier™
Try xTier™
Professional Services
graphic
spacer xTier
spacer
fs
Product: xTier™/LWC 2.3
Other Docs: n/a
spacer
 support@fitechlabs.com
 Download
 Buy
 Depends: log
 Related: n/a
xTier™ Navigator:
cache cluster config email i18n
ioc info jmx jndi security
log marshal objpool os fs
tx uidgen workflow jobs
db startup jms grid

Description
The purpose of 'fs' service is to simplify different file system operations. This service includes number of well-known and often practiced usage patterns for working with file system resources. Main functional areas of this service include:

  • Copying, moving, deleting files and directories.
  • Searching files with different search criteria’s, such as file filter, filename filter, filename pattern using wildcard search (‘*’ and ‘?’ symbols), regular expression patterns, search in files content, including SOUNDEX search.
  • Abilities to read and modify file permissions and attributes – ’read’, ’write’, and ’execute’ permissions, ’archive’, ’system’, and ’hidden’, attributes.
  • Special directories operation - cleaning directory, recursive directory 'touch', getting directory size.
  • Ability to get location of a class.
  • Simplified abilities to read and write binary and character files.
  • Object/file tracking. File can be registered for tracking with some marker object. When marker object is reclaimed by garbage collector, service performs special callback. User implementation of callback interface may perform any operation with tracked file, for example delete file when object which had used this file was garbage collected.

 Top

Configuration
'fs' service does not have any configuration and therefore does not have associated XML configuration file.

 Top

Examples
Usage of 'fs' service follows the standard pattern of using xTier™ service: you need to obtain an instance of xTier™ kernel that serves as a service registry. Once you have xTier™ kernel you can get an instance of any service, in our case the 'fs' service. Once the service instance is obtained the service API can be used.

'fs' service has a long list of methods that can be functionally grouped as follows:

  • File & directory copy/delete/move utilities.
  • File & directory cleaning and other utilities.
  • Path & filename utilities.
  • File & file content search utilities.
  • File & directory attributed utilities.
  • Closing utilities.
  • File/object tracking utilities.
  • Input/output stream utilities.
  • Miscellaneous utilities.
Following is an code snippet example of usage for 'fs' service demonstrates copying of test file:

1//Service instance.
2FsService fs = XtierKernel.getInstance().fs();
3        
4File testDir = new File("testDir");
5        
6testDir.mkdirs();
7        
8File srcFile = new File(testDir, "testFile.txt");
9        
10// Writes string to file.
11fs.writeStr2File(srcFile, "This is test file content.", 
12    System.getProperty("file.encoding"), true);
13        
14File destFile = new File(testDir, "testFile2.txt");
15        
16// Copy file.
17fs.cp(srcFile, destFile, true);

 Download xTier™ for full examples and documentation.

 Top

spacer