Skip to content

Empire Configuration Files

clarkparsia edited this page Mar 22, 2011 · 5 revisions

Empire supports two configuration file formats, XML and Properties. If you wanted to add support for another file format, you will need to implement the com.clarkparsia.empire.config.io.ConfigReader interface, and then set the system property “empire.config.reader” to the fully qualified class name of your implementation and Empire will use this reader on startup. The default reader is the Empire Java Properties format and this will be used when a different reader is not specified.

The configuration file consists of two basic parts, the global properties and the persistence context(s). Global properties are used to control the overall behavior of the application or make properties available to all persistence contexts. Individual persistence context configurations are used to specify the parameters needed to create a connection to the database used by the named context.

The Empire configuration is read at startup; if the system property “empire.configuration.file” is set, the file path which is the value of that property is used. If that property is not set, Empire will look in the default location for its configuration file: ‘empire.configuration’ Empire will check the root of the jar file, as well as the user.dir for this file. If the file is in a different location, you need to specify the aforementioned system property.

Earlier versions of Empire checked, in order, the following file names are read (the path is assumed to be rooted at the working directory ‘user.dir’ of the application): “empire.config”, “empire.properties’”, “empire.config.properties”, “empire.xml”, and “empire.config.xml”. These are still checked, but this is considered deprecated in v0.7 and will not be supported by v0.9.

Here’s an example of an Empire configuration in properties format:


# here we specify the fully qualified class name of the Annotation index provider.
# Can be excluded and the default will be used.
annotation.provider = com.clarkparsia.empire.util.PropertiesAnnotationProvider

# here are the global configuration properties which are passed to each persistence context
property=value
other_property=other value

# named contexts start prefixed with 0 and must at least have a name & a factory 
# property so they can be referenced (by name) in the application code
0.name = context1
0.factory = sesame
# the following are factory implementation/context specific properties
0.url = http://localhost:8080/openrdf-sesame/
0.repo = mem-rdf-db

# Here's another persistence context.
1.name = context2
1.factory = jena
1.files = file://foo, file://bar, file://baz

And an example of the same configuration in the simple XML format:


<empire>
<annotationProvider>com.clarkparsia.empire.util.PropertiesAnnotationProvider</annotationProvider>
<property>value</property>
<other_property>other value</other_property>
<unit>
<name>context1</name>
<factory>sesame</factory>
<url>http://localhost:8080/openrdf-sesame/</url>
<repo>mem-rdf-db</repo>
</unit>
<unit>
<name>context2</name>
<factory>jena</factory>
<files>file://foo, file://bar, file://baz</files>
</unit>
</empire>
Clone this wiki locally