2.4. Plugin Configuration

Because Kodo JDO is a highly customizable environment, many configuration properties relate to the creation and configuration of system plugins. Plugin properties have a constructor-like syntax that allows you to specify both what class to use for the plugin and how to configure the bean properties of the instantiated plugin instance. The easiest way to describe the plugin syntax is by example:

Kodo has a pluggable L2 caching mechanism that is controlled by the kodo.DataCache configuration property. Suppose that you have created a new class, com.xyz.MyDataCache, that you want Kodo to use for caching. You've made instances of MyDataCache configurable via two methods, setCacheSize(int size) and setRemoteHost(String host). The sample properties file line below shows how you would tell Kodo to use an instance of your custom plugin with a max size of 1000 and a remote host of cacheserver.

kodo.DataCache: com.xyz.MyDataCache(CacheSize=1000, RemoteHost="cacheserver")

As you can see, plugin properties take a class name, followed by a comma-separated list of values for the plugin's bean properties in parentheses. Kodo will match each named property to a "setter" method in the instantiated plugin instance, and invoke the method with the given value (after converting the value to the right type, of course). The first letter of the property names can be in either upper or lower case. The following would also have been valid:

kodo.DataCache: com.xyz.MyDataCache(cacheSize=1000, remoteHost="cacheserver")

If you do not need to pass any property settings to a plugin, you can just name the class to use:

kodo.DataCache: com.xyz.MyDataCache

Similarly, if the plugin has a default class that you do not want to change, you can simply specify a list of property settings, without a class name. For example, Kodo's query cache companion to the data cache has a default implementation suitable to most users, but you still might want to change the query cache's size (it has a CacheSize property for this purpose):

kodo.QueryCache: CacheSize=1000

Finally, many of Kodo's built-in options for plugins have short alias names that you can use in place of the full class name. The data cache property, for example, has an available alias of true for the standard cache implementation:

kodo.DataCache: true

The standard cache implementation class also has a CacheSize property, so to both use the standard implementation and configure the size:

kodo.DataCache: true(CacheSize=1000)

The remainder of this chapter reviews the set of configuration properties Kodo JDO recognizes.