wt.util
Class ClassPathRepository

java.lang.Object
  extended bywt.util.ClassPathRepository

public class ClassPathRepository
extends Object


Field Summary
private static String versionID
           
 
Constructor Summary
ClassPathRepository()
           
 
Method Summary
static PropertiesMap getPropertiesMap(String filename)
          Read in a file of properties and load into a newly constructed PropertiesMap.
static Object getSerializedObject(Class the_class, String filename)
          Read in an instance of a class that has been serialized to a file.
static Object getSerializedObject(String filename)
          Read in an instance of a class that has been serialized to a file.
static Object getSerializedObject(String classname, String type)
          Read in an instance of a class that has been serialized to a file.
private static InputStream openResource(Class the_class, String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values
Constructor Detail

ClassPathRepository

public ClassPathRepository()
Method Detail

getPropertiesMap

public static PropertiesMap getPropertiesMap(String filename)
                                      throws IOException,
                                             ClassNotFoundException
Read in a file of properties and load into a newly constructed PropertiesMap. The file is read as a resource of the current WTContext object.
   Example Usage:
  	propertiesMap = ClassPathRepository.getPropertiesMap( "descendentRegistry.properties" )
  
  
  

Parameters:
filename - - name of the properties file, including the portion of the directory corresponds to a package in the classpath
Returns:
The instance of PropertiesMap that contains the loaded properties.
Throws:
IOException
ClassNotFoundException
See Also:
PropertiesMap, WTContext.getResourceAsStream(java.lang.String)

getSerializedObject

public static Object getSerializedObject(Class the_class,
                                         String filename)
                                  throws IOException,
                                         ClassNotFoundException
Read in an instance of a class that has been serialized to a file. The file is read as a resource of the current WTContext object.
   Example Usage:
  	stringInfo = ClassPathRepository.getSerializedObject( String.class, "String.info" )
  
  	This would read an object that had been serialized to a file named "String.info"
		in the same directory as String.class.
  
  

Parameters:
filename - - filename of the serialized object, including the portion of the directory corresponds to a package in the classpath
Returns:
The instance of the class that was serialized. The class may be any class.
Throws:
IOException
ClassNotFoundException
See Also:
WTContext.getResourceAsStream(java.lang.String)

getSerializedObject

public static Object getSerializedObject(String filename)
                                  throws IOException,
                                         ClassNotFoundException
Read in an instance of a class that has been serialized to a file. The file is read as a resource of the current WTContext object.
   Example Usage:
  	stringInfo = ClassPathRepository.getSerializedObject( "java/lang/String.info" )
  
  	This would read an object that had been serialized to a file named "String.info"
		in the same directory as String.class.
  
  

Parameters:
filename - - filename of the serialized object, including the portion of the directory corresponds to a package in the classpath
Returns:
The instance of the class that was serialized. The class may be any class.
Throws:
IOException
ClassNotFoundException
See Also:
WTContext.getSystemResourceAsStream(java.lang.String)

getSerializedObject

public static Object getSerializedObject(String classname,
                                         String type)
                                  throws IOException,
                                         ClassNotFoundException
Read in an instance of a class that has been serialized to a file. The file is read as a resource of the current WTContext object.
   Example Usage:
  	stringInfo = ClassPathRepository.getSerializedObject( "java.lang.String", "info" )
  
  	This would read an object that had been serialized to a file named "String.info"
		in the same directory as String.class.
  
  

Parameters:
classname - - the fully qualified name of the class that the object belongs to, but is not necessarily an instance of
type - - the file extension of the serialized object
Returns:
The instance of the class that was serialized. The class may be any class.
Throws:
IOException
ClassNotFoundException
See Also:
WTContext.getSystemResourceAsStream(java.lang.String)

openResource

private static InputStream openResource(Class the_class,
                                        String filename)