Java Doc for Environment.java in  » Groupware » hipergate » com » knowgate » misc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » hipergate » com.knowgate.misc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.knowgate.misc.Environment

Environment
public class Environment (Code)

Reads and keeps in memory properties from .cnf initialization files.


author:
   Sergio Montoro Ten
version:
   3.0


Field Summary
public static  StringDEFAULT_PROFILES_DIR
    


Method Summary
public static  StringgetEnvVar(String sVarName)
    

Get value for an environment variable.

This is not a Pure Java method since it uses the Runtime obeject for calling OS specific shell commands.
Parameters:
  sVarName - Name of the variable to be readed.
public static  StringgetEnvVar(String sVarName, String sDefault)
    

Get value for an environment variable.

This is not a Pure Java method since it uses the Runtime obeject for calling OS specific shell commands.
Parameters:
  sVarName - Name of the variable to be readed.
public static  PropertiesgetProfile(String sProfile)
    

Get a Properties collection from a .CNF file

Property files must be in the directory pointed by a operating system environment variable names KNOWGATE_PROFILES.
public static  StringgetProfilePath(String sProfile, String sVarName)
    
public static  StringgetProfileVar(String sProfile, String sVarName)
    

Get a single property from a .CNF file.

Properties are readed once from disk and then cached in memory.

public static  StringgetProfileVar(String sProfile, String sVarName, String sDefault)
    
public static  SetgetProfileVarSet(String sProfile)
    
public static  SetgetProfilesSet()
    
public static  StringgetTempDir()
    
public static  PropertiesloadProfile(String sProfile, String sPath)
    
public static  voidrefresh()
    
public static  voidsetProfileVar(String sProfile, String sVarName, String sVarValue)
    

Set value for a profile property

Value is change in memory cache but not saved to disk.
public static  voidupdateSystemTime(long lTime)
    

Field Detail
DEFAULT_PROFILES_DIR
public static String DEFAULT_PROFILES_DIR(Code)





Method Detail
getEnvVar
public static String getEnvVar(String sVarName) throws IllegalArgumentException(Code)

Get value for an environment variable.

This is not a Pure Java method since it uses the Runtime obeject for calling OS specific shell commands.
Parameters:
  sVarName - Name of the variable to be readed. Value of variable or null if no environment variable with such name was found.
throws:
  IllegalArgumentException - If there is a Malformed \\uxxxx encoding or any other type of intrinsic error at the environment variables values



getEnvVar
public static String getEnvVar(String sVarName, String sDefault) throws IllegalArgumentException(Code)

Get value for an environment variable.

This is not a Pure Java method since it uses the Runtime obeject for calling OS specific shell commands.
Parameters:
  sVarName - Name of the variable to be readed. Value of variable or sDefault if no environment variable with such name was found.



getProfile
public static Properties getProfile(String sProfile)(Code)

Get a Properties collection from a .CNF file

Property files must be in the directory pointed by a operating system environment variable names KNOWGATE_PROFILES. If KNOWGATE_PROFILES environment variable is not found, the files will be seeked by default on C:\WINNT\ or C:\WINDOWS\ on Window Systems and /etc/ on UNIX systems.
Parameters:
  sProfile - Properties file to read (for example "hipergate.cnf")
since:
   v2.2 The behaviour of this function has changed: it first tries to get KNOWGATE_PROFILES
since:
   from Java environment variables as set on startup "java -DKNOWGATE_PROFILES=..." if there is no
since:
   Java property named KNOWGATE_PROFILES then operating system environment variabled are scanned and
since:
   last if neither is found the default C:\WINNT\ C:\WINDOWS\ or /etc/ is returned



getProfilePath
public static String getProfilePath(String sProfile, String sVarName)(Code)

Get a property from a .CNF file representing a file path.

This method is equivalent to getProfileVar except that a file separator is always appended to the end of the readed value.


Parameters:
  sProfile - .CNF file name
Parameters:
  sVarName - Property Name Value terminated with a file separator or null if no property with such name was found.



getProfileVar
public static String getProfileVar(String sProfile, String sVarName)(Code)

Get a single property from a .CNF file.

Properties are readed once from disk and then cached in memory. If .CNF file is changed, refresh() method must be called for refreshing in-memory cached values.


Parameters:
  sProfile - .CNF file name
Parameters:
  sVarName - Property Name Value of property or null if no property with such name was found.



getProfileVar
public static String getProfileVar(String sProfile, String sVarName, String sDefault)(Code)

Get a single property from a .CNF file.


Parameters:
  sProfile - .CNF file name
Parameters:
  sVarName - Property Name
Parameters:
  sDefault - Default Value Value of property or sDefault if no property with such name was found.



getProfileVarSet
public static Set getProfileVarSet(String sProfile)(Code)
Get names of all properties in a profile
Parameters:
  sProfile - Profile Name Set of property names



getProfilesSet
public static Set getProfilesSet()(Code)
Get a Set with all loaded profiles names Set of profile names



getTempDir
public static String getTempDir() throws IllegalArgumentException(Code)

Get temporary directory

For UNIX Sytems this function always return "/tmp/".
For Windows Systems getTempDir() returns the value set at the environmentvariable "TEMP" or C:\\%WINDIR%\\TEMP\\ if TEMP variable is not set.
throws:
  IllegalArgumentException -



loadProfile
public static Properties loadProfile(String sProfile, String sPath)(Code)

Load a Profile from a Properties file

The loaded Profile is cached in memory and will be returned in future calls to getProfile()

If profile had been already loaded, then it is overwritten.


Parameters:
  sProfile - Profile name, for example "hipergate"
Parameters:
  sPath - Full path to properties file, fo example "/etc/knowgate/hipergate.cnf"



refresh
public static void refresh()(Code)

Refresh in-memory cached properties by re-reading then from disk files.




setProfileVar
public static void setProfileVar(String sProfile, String sVarName, String sVarValue)(Code)

Set value for a profile property

Value is change in memory cache but not saved to disk.
Parameters:
  sProfile - Profile Name
Parameters:
  sVarName - Property Name
Parameters:
  sVarValue - Prioperty Value



updateSystemTime
public static void updateSystemTime(long lTime)(Code)

Update system time

This is an alpha testing method, do not use in production environments.


Parameters:
  lTime - New System Date



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.