SyntaxHighlighter

Saturday, March 9, 2013

jUDDI Dev HowTo: Add a new configuration element

As a noob jUDDI developer, I've found there's a few basic things that haven't been documented that may make someone else's life a bit easier. Without further ado, here's a simple how-to guide for adding new configuration elements to jUDDI (server side)
  1. Add your property to the actual property files
    I simply did a file search for juddiv3.properties and only modified
    the ones that were under version control. As of 3.1.4, the require
    files are at
    juddi-core-openjpa/src/test/resources
    juddiv3-war/src/main/webapp/WEB-INF/classes
    juddiv3-samples/src/main/webapp/WEB-INF/classes

    Simply add a new line towards the bottom with whatever you need.
  2. Within the juddi-core project, locate the class org.apache.juddi.config.Property. Despite its name, it's actually a constants interface class. Add your own custom property name here. Here's an example of one I just added for enforcing the registration of tModels before using them as well as a few other things.
    public final static String JUDDI_ENFORCE_REFERENTIAL_INTEGRITY = "juddi.validation.enforceReferentialIntegrity";
  3. jUDDI uses the Apache Commons Configuration API. Example:
    AppConfig.getConfiguration().getBoolean(Property.JUDDI_ENFORCE_REFERENTIAL_INTEGRITY">);
    Be sure to change it to the correct data type for whatever you're using.
  4. You're now ready to use it somewhere. In the following example, we are defaulting to a value of false.
                boolean checkRef = false;
                try {
                    checkRef = AppConfig.getConfiguration().getBoolean(Property.JUDDI_ENFORCE_REFERENTIAL_INTEGRITY);
                } catch (ConfigurationException ex) {
                    log.warn("Error caught reading " + Property.JUDDI_ENFORCE_REFERENTIAL_INTEGRITY + " from config file", ex);
                }
    
    Now you're ready to go test it!

  5. Finally, make new Issue in the issue tracker. Then make a SVN patch, attach it and eventually a commiter will either comment back on it or add it to the baseline,

No comments:

Post a Comment