| /////////////////////////////////////////////////////////////// |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| /////////////////////////////////////////////////////////////// |
| |
| [[library-fileconfig,FileConfig Library]] |
| = FileConfig = |
| |
| [devstatus] |
| -------------- |
| source=libraries/fileconfig/dev-status.xml |
| -------------- |
| |
| The FileConfig library provide a service for accessing application-specific directories. |
| |
| A lot of the Zestâ„¢ Libraries and Extensions make use of this library to locate files. |
| |
| include::../../build/docs/buildinfo/artifact.txt[] |
| |
| == Usage == |
| |
| [snippet,java] |
| ---- |
| source=libraries/fileconfig/src/main/java/org/qi4j/library/fileconfig/FileConfiguration.java |
| tag=fileconfig |
| ---- |
| |
| To use it you simply need to use the FileConfigurationAssembler in your application assembly: |
| |
| [snippet,java] |
| ---- |
| source=libraries/fileconfig/src/test/java/org/qi4j/library/fileconfig/FileConfigurationTest.java |
| tag=simple |
| ---- |
| |
| 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.qi4j.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: |
| |
| [snippet,java] |
| ---- |
| source=libraries/fileconfig/src/test/java/org/qi4j/library/fileconfig/FileConfigurationTest.java |
| tag=override |
| ---- |
| |
| |
| And finally, to get the FileConfiguration Service in your application code, simply use the following: |
| |
| [source,java] |
| ---- |
| @Service FileConfiguration fileconfig; |
| ---- |
| |