code
docs
tests
The FileConfig library provide a service for accessing application-specific directories.
A lot of the Polygene™ Libraries and Extensions make use of this library to locate files.
Table 26. Artifact
| Group ID | Artifact ID | Version |
|---|---|---|
org.apache.polygene.libraries | org.apache.polygene.library.fileconfig | 3.0.0 |
public interface FileConfiguration
{
[...snip...]
File configurationDirectory();
File dataDirectory();
File temporaryDirectory();
File cacheDirectory();
File logDirectory();
}
To use it you simply need to use the FileConfigurationAssembler in your application assembly:
new FileConfigurationAssembler().assemble( module );
These will default to the platform settings, but can be overridden manually, either one-by-one or as a whole.
You can override defaults by adding org.apache.polygene.library.fileconfig.FileConfiguration_OS.properties files to your classpath where OS is one of win, mac or unix.
You can also override all properties definitions at assembly time by setting a FileConfigurationOverride object as meta info of this service:
FileConfigurationOverride override = new FileConfigurationOverride()
.withConfiguration( confDir )
.withData( dataDir )
.withTemporary( tempDir )
.withCache( cacheDir )
.withLog( logDir );
new FileConfigurationAssembler().withOverride( override ).assemble( module );
And finally, to get the FileConfiguration Service in your application code, simply use the following:
@Service FileConfiguration fileconfig;