This project has retired. For details please refer to its Attic page.
FileConfig Starter Template for Bootstrap
Overview
Scripting
Alarms
Circuit Breaker
Constraints
FileConfig
HTTP
Invocation Cache
JMX
Locking
Logging
OSGi
RDF
ReST Client
ReST - HATEOAS Primer
ReST Common
ReST Server
Restlet Support
Servlet
Shiro Security
Shiro Web Security
Spring Integration
SQL
UID
UoWFile

FileConfig

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 IDArtifact IDVersion

org.apache.polygene.libraries

org.apache.polygene.library.fileconfig

0


Usage

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;