Java Doc for ConfigFinder.java in  » Science » Cougaar12_4 » org » cougaar » util » 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 » Science » Cougaar12_4 » org.cougaar.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.cougaar.util.ConfigFinder

All known Subclasses:   org.cougaar.util.jar.JarConfigFinder,
ConfigFinder
public class ConfigFinder (Code)
ConfigFinder provides utilitites to search for a named file in several specified locations, returning the first location where a file by that name is found.

Files are found and opened by the open() method. open() tries to find the file using each of the elements of org.cougaar.config.path. The elements of org.cougaar.config.path are separated by semicolons and interpreted as URLs. The URLs in org.cougaar.config.path are interpreted relative to the directory specified by org.cougaar.install.path. Several special tokens may appear in these URLs:

 $RUNTIME signifies <org.cougaar.runtime.path>
 $SOCIETY signifies <org.cougaar.society.path>
 $INSTALL signifies <org.cougaar.install.path>
 $CONFIG signifies <org.cougaar.config>
 $CWD signifies <user.dir>
 $HOME signifies <user.home>
 $MOD signifies the name of a Cougaar module - a sub-directory of $INSTALL
 
The default value for org.cougaar.config.path is defined in the static variable DEFAULT_CONFIG_PATH: $CWD;\ $RUNTIME/configs/$CONFIG;\ $RUNTIME/configs/common;\ $SOCIETY/configs/$CONFIG;\ $SOCIETY/configs/common;\ $INSTALL/configs/$CONFIG;\ $INSTALL/configs/common

If a value is specified for org.cougaar.config.path that ends with a semicolon, the above default is appended to the specified value. The URLs in org.cougaar.config.path are interpreted relative to $INSTALL. URLs may be absolute in which case some or all of the base URL may be ignored.

By default, $MOD is not set. However, when an object requests a ConfigFinder, it may specify a String value for $MOD. If specified, the search path used is augmented, adding 9 directories to the start of the search path:

  • $RUNTIME/$MOD/configs/$CONFIG
  • $RUNTIME/$MOD/configs
  • $RUNTIME/$MOD/data/$CONFIG
  • $RUNTIME/$MOD/data
  • $SOCIETY/$MOD/configs/$CONFIG
  • $SOCIETY/$MOD/configs
  • $SOCIETY/$MOD/data/$CONFIG
  • $SOCIETY/$MOD/data
  • $INSTALL/$MOD/configs/$CONFIG
  • $INSTALL/$MOD/configs
  • $INSTALL/$MOD/data/$CONFIG
  • $INSTALL/$MOD/data

Enable INFO level logging on org.cougaar.core.util.ConfigFinder to turn on additional information on usage of ConfigFinder.

Inner Class :protected class ConfigResolver implements EntityResolver

Field Summary
final protected  HashMapurlCache
     Cache of the String to URL mappings found.

Constructor Summary
public  ConfigFinder()
    
public  ConfigFinder(String configpath)
    
public  ConfigFinder(String module, String configpath)
    
public  ConfigFinder(String configpath, Map props)
    
public  ConfigFinder(String module, String configpath, Map props)
     Construct a ConfigFinder that will first search within the specified module, and then in the directories on the given search path, using the given Property substitutions.
When searching the given module, we search the following 8 directories (if defined) before any other directories:
  • $RUNTIME/$module/configs/$CONFIG
  • $RUNTIME/$module/configs
  • $RUNTIME/$module/data/$CONFIG
  • $RUNTIME/$module/data
  • $SOCIETY/$module/configs/$CONFIG
  • $SOCIETY/$module/configs
  • $SOCIETY/$module/data/$CONFIG
  • $SOCIETY/$module/data
  • $INSTALL/$module/configs/$CONFIG
  • $INSTALL/$module/configs
  • $INSTALL/$module/data/$CONFIG
  • $INSTALL/$module/data

Parameters:
  module - name of the module to use for module-specific configs.

Method Summary
public  URLfind(String aURL)
     Attempt to find the URL which would be opened by the open method.
public  ListgetConfigPath()
     get the config path as an unmodifiable List of URL instances which describes, in order, the set of base locations searched by this instance of the ConfigFinder.
protected  ConfigResolvergetConfigResolver()
    
public static  ConfigFindergetInstance()
     Return the default static instance of the ConfigFinder, configured using the system properties.
public static  ConfigFindergetInstance(String module)
     Return a new ConfigFinder that uses the system properties for most configuration details, adding the four module-specific directories to the front of the search path.
final protected synchronized  LoggergetLogger()
    
public  FilelocateFile(String aFilename)
     Locate an actual file in the config path.
public  InputStreamopen(String aURL)
     Opens an InputStream to access the named file.
public  DocumentparseXMLConfigFile(String xmlfile)
    
protected  DocumentparseXMLConfigFile(InputStream isstream, String xmlfile)
     parse an XML stream in the context of the current configuration environment.
public  URLresolveName(String logicalName)
     Resolve a logical reference to a URL, e.g.
final protected  StringsubstituteProperties(String s)
     Do variable expansion/substitution on the argument.

Field Detail
urlCache
final protected HashMap urlCache(Code)
Cache of the String to URL mappings found.




Constructor Detail
ConfigFinder
public ConfigFinder()(Code)
Alias for ConfigFinder(null, null, null)



ConfigFinder
public ConfigFinder(String configpath)(Code)
Alias for ConfigFinder(null, path, null)



ConfigFinder
public ConfigFinder(String module, String configpath)(Code)
Alias for ConfigFinder(module, configpath, null)



ConfigFinder
public ConfigFinder(String configpath, Map props)(Code)
Alias for ConfigFinder(null, configpath, props)



ConfigFinder
public ConfigFinder(String module, String configpath, Map props)(Code)
Construct a ConfigFinder that will first search within the specified module, and then in the directories on the given search path, using the given Property substitutions.
When searching the given module, we search the following 8 directories (if defined) before any other directories:
  • $RUNTIME/$module/configs/$CONFIG
  • $RUNTIME/$module/configs
  • $RUNTIME/$module/data/$CONFIG
  • $RUNTIME/$module/data
  • $SOCIETY/$module/configs/$CONFIG
  • $SOCIETY/$module/configs
  • $SOCIETY/$module/data/$CONFIG
  • $SOCIETY/$module/data
  • $INSTALL/$module/configs/$CONFIG
  • $INSTALL/$module/configs
  • $INSTALL/$module/data/$CONFIG
  • $INSTALL/$module/data

Parameters:
  module - name of the module to use for module-specific configs. If null, no module-specific paths are added.
Parameters:
  configpath - configuration path string. If null, defaults to Configuration.getConfigPath();
Parameters:
  props - properties to use for configpath variable substitutions.




Method Detail
find
public URL find(String aURL) throws IOException(Code)
Attempt to find the URL which would be opened by the open method. Note that this must actually attempt to open the various URLs under consideration, so this is not an inexpensive operation.



getConfigPath
public List getConfigPath()(Code)
get the config path as an unmodifiable List of URL instances which describes, in order, the set of base locations searched by this instance of the ConfigFinder. Contrast with Configuration.getConfigPath() which returns the vm's default path.



getConfigResolver
protected ConfigResolver getConfigResolver()(Code)



getInstance
public static ConfigFinder getInstance()(Code)
Return the default static instance of the ConfigFinder, configured using the system properties.



getInstance
public static ConfigFinder getInstance(String module)(Code)
Return a new ConfigFinder that uses the system properties for most configuration details, adding the four module-specific directories to the front of the search path.



getLogger
final protected synchronized Logger getLogger()(Code)



locateFile
public File locateFile(String aFilename)(Code)
Locate an actual file in the config path. This will skip over elements of org.cougaar.config.path that are not file: urls.



open
public InputStream open(String aURL) throws IOException(Code)
Opens an InputStream to access the named file. The file is sought in all the places specified in configPath.
throws:
  IOException - if the resource cannot be found.



parseXMLConfigFile
public Document parseXMLConfigFile(String xmlfile) throws IOException(Code)
Read and parse an XML file somewhere in the configpath *



parseXMLConfigFile
protected Document parseXMLConfigFile(InputStream isstream, String xmlfile)(Code)
parse an XML stream in the context of the current configuration environment. This means that embedded references to relative XML objects must be resolved via the configfinder rather than the stream itself.



resolveName
public URL resolveName(String logicalName) throws MalformedURLException(Code)
Resolve a logical reference to a URL, e.g. will convert "$INSTALL/configs/common/foo.txt" to "file:/opt/cougaar/20030331/configs/common/foo.txt" or somesuch. null if unresolvable.



substituteProperties
final protected String substituteProperties(String s)(Code)
Do variable expansion/substitution on the argument. Essentially calls Configuration.substituteProperties(s, myproperties);



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.