org.cert.cc.util
Class PropertiesManager

java.lang.Object
  extended by org.cert.cc.util.PropertiesManager

public final class PropertiesManager
extends Object

PropertiesManager is a simple wrapper around a Properties specified by a .properties file location.

A separate PropertiesManager instance should be used for each properties file. By re-creating PropertiesManager each invocation allows the file to be changed without the need to restart JIRA. Once PropertiesManager has been instantiated, it will hold onto the properties.

© 2010 Carnegie Mellon University

Author:
Steve Scholnick

Field Summary
static File PARENT_COMMON_DIRECTORY
           
 
Constructor Summary
PropertiesManager(File resourcePath)
          Constructor
PropertiesManager(String resourcePath)
          Constructor
 
Method Summary
 String getProperty(String key)
          Returns the value based on the key.
 String getText(ProjectActionSupport action, String key)
          Wrapper method that does what ProjectActionSupport.getText does.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARENT_COMMON_DIRECTORY

public static final File PARENT_COMMON_DIRECTORY
Constructor Detail

PropertiesManager

public PropertiesManager(File resourcePath)
Constructor

Parameters:
resourcePath - Full path to the properties file

PropertiesManager

public PropertiesManager(String resourcePath)
Constructor

Parameters:
resourcePath - Full path to the properties file
Method Detail

getText

public String getText(ProjectActionSupport action,
                      String key)
Wrapper method that does what ProjectActionSupport.getText does. This method expands upon this in allowing the retrieval of properties even when called without ProjectActionSupport initialized. This is useful in the case when a property is needed internally and does not have an User.

Parameters:
action - ProjectActionSupport if available. If not leave it as null.
key - String representing the property name to look up a value for.
Returns:
String The value returned from the properties file. If it can not be found it will return the key. This keeps with the way that the getText method in ProjectActionSupport works.

getProperty

public String getProperty(String key)
Returns the value based on the key.

Parameters:
key - Property key
Returns:
Value or null


Copyright © 2012 Carnegie Mellon University