com.ihr.xbrl.util
Class RSStaticAndUser

java.lang.Object
  extended by com.ihr.xbrl.util.RSStaticAndUser

public class RSStaticAndUser
extends java.lang.Object

This class contains static properties shared between tools that has a GUI etc. Nothing related to XBRL itself but with the user interaction, preferences and this kind of stuff.

The xbrl RS Home directory is where each application stores properties that may be subject to be used by the same application or other application of the same family. For example; the XBRLRepository.properties files stores information about how to open a connection with the XBRL Database. This information may be shared across multiple tools.

The algorithm to obtain the XBRL RS Home directory is the following: 1) The System property xbrl.rs.home is read. If there is no value then 2) The Environment variable XBRLRSHOME is read. If there is no value then 3) The user.home system property is used.

Since:
2.6.8 (added environment variable resolution and xbrl.rs.home system property)
Author:
Ignacio

Field Summary
static java.lang.String longDateDateFormat
          This is the format for dates using ISO8601 representation.
static java.lang.String RSEnvPropHomeDir
          This is the XBRL home directory stored in a system property called xbrl.rs.home.
static java.lang.String RSEnvVarHomeDir
          If this the environment variable that, if defined, its value is used rather than the value of the user.home property of the java virtual machine while obtaining the path of a properties file.
static java.lang.String RSHomeCatalogDir
          This is the directory name under the "all users" installation folder where the catalog is installed
static java.lang.String RSHomeDir
          This is the directory name under the user.home property or XBRLRSHOME environment property where properties files will be stored.
static java.lang.String shortDateDateFormat
          This is the format for short dates across all tools.
 
Constructor Summary
RSStaticAndUser()
           
 
Method Summary
static java.lang.String createRSPropertiesDir()
          Check if the directory for user's properties exists.
static java.lang.String findUserFileName(java.lang.String fileName)
          Searches for a file with file name indicated in the fileName parameter in the following paths in order The path returned by the readUserPath() method The home directory
static java.lang.String getCatalogPath(java.lang.String fileName)
          Calculates all possible path locations where the XBRLCatalogFile may be located
static java.lang.String getEnvCatalogPath(java.lang.String fileName)
          If there is a value set for the XBRLCATALOGPATH variable, this method returns the path indicated by the user in a system variable called XBRLCATALOGPATH concatenated with the name of the XBRL catalog file.
static java.lang.String getUserDefaultTaxonomyPath()
          The processor has a property called XBRL_BASE. that property can be set by the user during initialization of the processor.
static java.lang.String getUserPropertiesFileName(java.lang.String propertiesFileName)
          Prepares a file name in the user's home directory appending the directory for Reporting Standard tools and the file name received as a parameter.
static void setupGUI()
          This method executes common tasks in setting up the GUI for all tools.
static void updateAllProperityFilesToNewLocation(java.io.File from, java.io.File to)
          This method moves all properties files in the from directory to the to directory It is used to help moving property files when a new version is released
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RSHomeDir

public static final java.lang.String RSHomeDir
This is the directory name under the user.home property or XBRLRSHOME environment property where properties files will be stored. This is the last resort reading the XBRL home path.

See Also:
Constant Field Values

RSHomeCatalogDir

public static final java.lang.String RSHomeCatalogDir
This is the directory name under the "all users" installation folder where the catalog is installed

See Also:
Constant Field Values

RSEnvVarHomeDir

public static final java.lang.String RSEnvVarHomeDir
If this the environment variable that, if defined, its value is used rather than the value of the user.home property of the java virtual machine while obtaining the path of a properties file. This is the second last resort.

See Also:
Constant Field Values

RSEnvPropHomeDir

public static final java.lang.String RSEnvPropHomeDir
This is the XBRL home directory stored in a system property called xbrl.rs.home. This is the first resort.

See Also:
Constant Field Values

shortDateDateFormat

public static java.lang.String shortDateDateFormat
This is the format for short dates across all tools.

The idea is to put it here now, make sure it is used elsewhere and then move it into a user configurable property.


longDateDateFormat

public static java.lang.String longDateDateFormat
This is the format for dates using ISO8601 representation.

The idea is to put it here now, make sure it is used elsewhere and then move it into a user configurable property.

Constructor Detail

RSStaticAndUser

public RSStaticAndUser()
Method Detail

getUserPropertiesFileName

public static java.lang.String getUserPropertiesFileName(java.lang.String propertiesFileName)
Prepares a file name in the user's home directory appending the directory for Reporting Standard tools and the file name received as a parameter.

Reporting Standard directory is always "ReportingStandardXBRLTools"

User path is calculated from readUserPath()

Parameters:
propertiesFileName - String, the properties file name
Returns:
Properties file name as a String valid parameter for File
See Also:
readUserPath()

createRSPropertiesDir

public static java.lang.String createRSPropertiesDir()
Check if the directory for user's properties exists. If not then a new one is created.


updateAllProperityFilesToNewLocation

public static void updateAllProperityFilesToNewLocation(java.io.File from,
                                                        java.io.File to)
This method moves all properties files in the from directory to the to directory

It is used to help moving property files when a new version is released

Parameters:
from -
to -

getCatalogPath

public static java.lang.String getCatalogPath(java.lang.String fileName)
Calculates all possible path locations where the XBRLCatalogFile may be located

Parameters:
String - fileName is the file name that will be added to every path. There is no guarantee the file exists.
Returns:
String semicolon ";" separated list of possible locations of the fileName used as a parameter.

getEnvCatalogPath

public static java.lang.String getEnvCatalogPath(java.lang.String fileName)
If there is a value set for the XBRLCATALOGPATH variable, this method returns the path indicated by the user in a system variable called XBRLCATALOGPATH concatenated with the name of the XBRL catalog file. Otherwise, the method returns the empty string.

Returns:
path to the XBRLCatalog.xml file

setupGUI

public static void setupGUI()
This method executes common tasks in setting up the GUI for all tools. JFrame.setDefaultLookAndFeelDecorated(true) UIManager is set to Nimbus if it is found.


getUserDefaultTaxonomyPath

public static java.lang.String getUserDefaultTaxonomyPath()
The processor has a property called XBRL_BASE. that property can be set by the user during initialization of the processor. If that property is not set. A default value is provided. The default value depends on the existence of a value for the XBRLCATALOGPATH environment variable.

If exist, the returned value is ${XBRLCATALOGPATH}/Other.

If it does not exist, the returned value is the path where the executable is running (user.dir) Note. the content of the $XBRLCATALOGPATH variable is converted to a URI. In case it cannot be converted to a URI then it is converted to a File and from the returned file into a URI. in case of any error then the content of the variable is used directly.

Returns:
path to the XBRLCatalog.xml file

findUserFileName

public static java.lang.String findUserFileName(java.lang.String fileName)
Searches for a file with file name indicated in the fileName parameter in the following paths in order
  1. The path returned by the readUserPath() method
  2. The home directory

Parameters:
configurationFileName -
Returns:
null if the file name is not found, the absolute path to the file name if it is found
Since:
2.8.1


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa