FileDocCategorySizeDatePackage
FileResolverImpl.javaAPI DocJava SE 5 API2193Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.resolver

FileResolverImpl

public class FileResolverImpl extends Object implements com.sun.corba.se.spi.resolver.Resolver

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private File
file
private Properties
savedProps
private long
fileModified
Constructors Summary
public FileResolverImpl(com.sun.corba.se.spi.orb.ORB orb, File file)


          
    
	this.orb = orb ;
	this.file = file ;
	savedProps = new Properties() ;
    
Methods Summary
private voidcheck()
Checks the lastModified() timestamp of the file and optionally re-reads the Properties object from the file if newer.

	if (file == null)
	    return;

	long lastMod = file.lastModified();
	if (lastMod > fileModified) {
	    try {
		FileInputStream fileIS = new FileInputStream(file);
		savedProps.clear();
		savedProps.load(fileIS);
		fileIS.close();
		fileModified = lastMod;
	    } catch (java.io.FileNotFoundException e) {
		System.err.println( CorbaResourceUtil.getText(
		    "bootstrap.filenotfound", file.getAbsolutePath()));
	    } catch (java.io.IOException e) {
		System.err.println( CorbaResourceUtil.getText(
		    "bootstrap.exception",
		    file.getAbsolutePath(), e.toString()));
	    }
	}
    
public java.util.Setlist()

	check() ;

	Set result = new HashSet() ;

	// Obtain all the keys from the property object
	Enumeration theKeys = savedProps.propertyNames();
	while (theKeys.hasMoreElements()) {
	    result.add( theKeys.nextElement() ) ;
	}

	return result ;
    
public org.omg.CORBA.Objectresolve(java.lang.String name)

	check() ;
	String stringifiedObject = savedProps.getProperty( name ) ;
	if (stringifiedObject == null) {
	    return null;
	}
	return orb.string_to_object( stringifiedObject ) ;