de.unihalle.informatik.MiToBo.core.helpers
Class MTBEnvironmentConfig

java.lang.Object
  extended by de.unihalle.informatik.Alida.helpers.ALDEnvironmentConfig
      extended by de.unihalle.informatik.MiToBo.core.helpers.MTBEnvironmentConfig

public class MTBEnvironmentConfig
extends de.unihalle.informatik.Alida.helpers.ALDEnvironmentConfig

This class extends the super class with routines to access ImageJ properties.

Every MiToBo operator and also every class can define properties. To ensure a certain structure of the properties and avoid chaos in property names the properties should commit to the following convention: mitobo.operatorname.property The corresponding environment variable will then be MITOBO_OPERATORNAME_PROPERTY following common Unix/Linux conventions.

Author:
moeller

Constructor Summary
MTBEnvironmentConfig()
           
 
Method Summary
static java.lang.String getConfigValue(java.lang.String _operator, java.lang.String _envVariable)
          This function reads out the value of a given environment property.
static java.lang.String getEnvVarValue(java.lang.String _operator, java.lang.String _envVariable)
          This function reads out the value of a given environment variable.
static java.lang.String getImageJPropValue(java.lang.String plugin, java.lang.String envVariable)
          This function reads out the value of a given ImageJ preference.
static java.lang.String getJVMPropValue(java.lang.String _operator, java.lang.String _envVariable)
          This function reads out the value of a given JVM property.
static void setImageJPref(java.lang.String plugin, java.lang.String envVar, java.lang.String val)
          This functions sets a given property to the specified value.
 
Methods inherited from class de.unihalle.informatik.Alida.helpers.ALDEnvironmentConfig
getConfigValue, getJVMPropValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTBEnvironmentConfig

public MTBEnvironmentConfig()
Method Detail

getConfigValue

public static java.lang.String getConfigValue(java.lang.String _operator,
                                              java.lang.String _envVariable)
This function reads out the value of a given environment property.

Here the default prefix "mitobo" is assumed. It is combined with operator and environment variable name in this order.

Parameters:
_operator - Name of the operator.
_envVariable - Name of the property.
Returns:
Value of property, NULL if not existing.

getEnvVarValue

public static java.lang.String getEnvVarValue(java.lang.String _operator,
                                              java.lang.String _envVariable)
This function reads out the value of a given environment variable.

Default prefix is "mitobo".

Parameters:
_operator - Name of operator, ignored if null.
_envVariable - Name of the variable.
Returns:
Value of property, NULL if not existing.

getImageJPropValue

public static java.lang.String getImageJPropValue(java.lang.String plugin,
                                                  java.lang.String envVariable)
This function reads out the value of a given ImageJ preference.

Parameters:
plugin - Name of plugin, ignored if null.
envVariable - Name of the preference.
Returns:
value of property, null if not existing

getJVMPropValue

public static java.lang.String getJVMPropValue(java.lang.String _operator,
                                               java.lang.String _envVariable)
This function reads out the value of a given JVM property.

Default prefix is "mitobo".

Parameters:
_operator - Name of operator, ignored if null.
_envVariable - Name of the property.
Returns:
Value of property, NULL if not existing.

setImageJPref

public static void setImageJPref(java.lang.String plugin,
                                 java.lang.String envVar,
                                 java.lang.String val)
This functions sets a given property to the specified value.

The properties are saved to ~/.imagej/Prefs.txt when the ImageJ gui is properly closed (not killed!) by the user. Note that already defined property are simply overwritten with new values if the method is called on existing properties.

Parameters:
plugin - Name of Mitobo plugin, ignored if null.
envVar - Name of property.
val - Value of property.