org.jopendocument.util
Class ProductInfo

java.lang.Object
  extended by org.jopendocument.util.ProductInfo

public class ProductInfo
extends java.lang.Object

Useful for defining product wide values, like version, from a property file.

Author:
Sylvain

Field Summary
static java.lang.String NAME
           
static java.lang.String PROPERTIES_NAME
           
static java.lang.String VERSION
           
 
Constructor Summary
ProductInfo(java.util.Map<java.lang.String,java.lang.String> map)
           
ProductInfo(java.util.Properties props)
           
ProductInfo(java.lang.String name)
           
 
Method Summary
static ProductInfo createDefault()
          Create a product info from the default properties file, "/product.properties".
static ProductInfo getInstance()
          If setInstance(ProductInfo) was called with a non-null value, return that ; otherwise use createDefault().
 java.lang.String getName()
           
 java.lang.String getProperty(java.lang.String name)
           
 java.lang.String getProperty(java.lang.String name, java.lang.String def)
           
 java.lang.String getVersion()
           
static void setInstance(ProductInfo i)
          Set the current instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_NAME

public static final java.lang.String PROPERTIES_NAME
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

ProductInfo

public ProductInfo(java.lang.String name)

ProductInfo

public ProductInfo(java.util.Map<java.lang.String,java.lang.String> map)

ProductInfo

public ProductInfo(java.util.Properties props)
Method Detail

getInstance

public static final ProductInfo getInstance()
If setInstance(ProductInfo) was called with a non-null value, return that ; otherwise use createDefault().

Returns:
the current instance, can be null.

setInstance

public static void setInstance(ProductInfo i)
Set the current instance.

Parameters:
i - the new instance, can be null.

createDefault

public static final ProductInfo createDefault()
                                       throws java.io.IOException
Create a product info from the default properties file, "/product.properties".

Returns:
the default properties, or null if they couldn't be found.
Throws:
java.io.IOException - if properties couldn't be loaded.

getProperty

public final java.lang.String getProperty(java.lang.String name)

getProperty

public final java.lang.String getProperty(java.lang.String name,
                                          java.lang.String def)

getName

public final java.lang.String getName()

getVersion

public final java.lang.String getVersion()