Methods Summary |
---|
protected void | checkPropertyDefaults()
String host =
resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
if ((host == null) || (host.equals("")))
setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
configurationHostName );
String serverHost =
resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;
if (serverHost == null ||
serverHost.equals("") ||
serverHost.equals("0.0.0.0") ||
serverHost.equals("::") ||
serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
{
setProperty(ORBConstants.SERVER_HOST_PROPERTY,
localHostName);
setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
ORBConstants.LISTEN_ON_ALL_INTERFACES);
}
|
private void | checkSetParserCalled()
if (!setParserCalled)
throw new IllegalStateException( "setParser not called." ) ;
|
protected abstract void | collect()
|
private void | doProperties(java.util.Properties props)
PropertyCallback callback = new PropertyCallback() {
public String get(String name) {
return props.getProperty(name);
}
} ;
findPropertiesByName( propertyNames.iterator(), callback ) ;
findPropertiesByPrefix( propertyPrefixes,
makeIterator( props.propertyNames()), callback );
|
private java.lang.String | findMatchingPropertyName(java.util.Set names, java.lang.String suffix)
Iterator iter = names.iterator() ;
while (iter.hasNext()) {
String name = (String)(iter.next()) ;
if (name.endsWith( suffix ))
return name ;
}
return null ;
|
private void | findPropertiesByName(java.util.Iterator names, com.sun.corba.se.impl.orb.PropertyCallback getProperty)
while (names.hasNext()) {
String name = (String)(names.next()) ;
String value = getProperty.get( name ) ;
if (value != null)
setProperty( name, value ) ;
}
|
private void | findPropertiesByPrefix(java.util.Set prefixes, java.util.Iterator propertyNames, com.sun.corba.se.impl.orb.PropertyCallback getProperty)
while (propertyNames.hasNext()) {
String name = (String)(propertyNames.next()) ;
Iterator iter = prefixes.iterator() ;
while (iter.hasNext()) {
String prefix = (String)(iter.next()) ;
if (name.startsWith( prefix )) {
String value = getProperty.get( name ) ;
// Note: do a put even if value is null since just
// the presence of the property may be significant.
setProperty( name, value ) ;
}
}
}
|
protected void | findPropertiesFromApplet(java.applet.Applet app)
// Cannot use propertyPrefixes here, since there is no
// way to fetch properties by prefix from an Applet.
if (app == null)
return;
PropertyCallback callback = new PropertyCallback() {
public String get(String name) {
return app.getParameter(name);
}
} ;
findPropertiesByName( propertyNames.iterator(), callback ) ;
// Special Case:
//
// Convert any applet parameter relative URLs to an
// absolute URL based on the Document Root. This is so HTML
// URLs can be kept relative which is sometimes useful for
// managing the Document Root layout.
PropertyCallback URLCallback = new PropertyCallback() {
public String get( String name ) {
String value = resultProps.getProperty(name);
if (value == null)
return null ;
try {
URL url = new URL( app.getDocumentBase(), value ) ;
return url.toExternalForm() ;
} catch (java.net.MalformedURLException exc) {
// Just preserve the original (malformed) value:
// the error will be handled later.
return value ;
}
}
} ;
findPropertiesByName( URLPropertyNames.iterator(),
URLCallback ) ;
|
protected void | findPropertiesFromArgs(java.lang.String[] params)
if (params == null)
return;
// All command-line args are of the form "-ORBkey value".
// The key is mapped to <prefix>.ORBkey.
String name ;
String value ;
for ( int i=0; i<params.length; i++ ) {
value = null ;
name = null ;
if ( params[i] != null && params[i].startsWith("-ORB") ) {
String argName = params[i].substring( 1 ) ;
name = findMatchingPropertyName( propertyNames, argName ) ;
if (name != null)
if ( i+1 < params.length && params[i+1] != null ) {
value = params[++i];
}
}
if (value != null) {
setProperty( name, value ) ;
}
}
|
protected void | findPropertiesFromFile()
final Properties fileProps = getFileProperties() ;
if (fileProps==null)
return ;
doProperties( fileProps ) ;
|
protected void | findPropertiesFromProperties()
if (originalProps == null)
return;
doProperties( originalProps ) ;
|
protected void | findPropertiesFromSystem()
Set normalNames = getCORBAPrefixes( propertyNames ) ;
Set prefixNames = getCORBAPrefixes( propertyPrefixes ) ;
PropertyCallback callback = new PropertyCallback() {
public String get(String name) {
return getSystemProperty(name);
}
} ;
findPropertiesByName( normalNames.iterator(), callback ) ;
findPropertiesByPrefix( prefixNames,
getSystemPropertyNames(), callback ) ;
|
private java.util.Set | getCORBAPrefixes(java.util.Set prefixes)
Set result = new HashSet() ;
Iterator iter = prefixes.iterator() ;
while (iter.hasNext()) {
String element = (String)(iter.next()) ;
if (hasCORBAPrefix( element ))
result.add( element ) ;
}
return result ;
|
private java.util.Properties | getFileProperties()
Properties defaults = new Properties() ;
String javaHome = getSystemProperty( "java.home" ) ;
String fileName = javaHome + File.separator + "lib" + File.separator +
"orb.properties" ;
getPropertiesFromFile( defaults, fileName ) ;
Properties results = new Properties( defaults ) ;
String userHome = getSystemProperty( "user.home" ) ;
fileName = userHome + File.separator + "orb.properties" ;
getPropertiesFromFile( results, fileName ) ;
return results ;
|
public java.util.Properties | getProperties()
checkSetParserCalled() ;
return resultProps ;
|
private void | getPropertiesFromFile(java.util.Properties props, java.lang.String fileName)
try {
File file = new File( fileName ) ;
if (!file.exists())
return ;
FileInputStream in = new FileInputStream( file ) ;
try {
props.load( in ) ;
} finally {
in.close() ;
}
} catch (Exception exc) {
// if (ORBInitDebug)
// dprint( "ORB properties file " + fileName + " not found: " +
// exc) ;
}
|
private static java.lang.String | getSystemProperty(java.lang.String name)
return (String)AccessController.doPrivileged(
new GetPropertyAction(name));
|
private static java.util.Iterator | getSystemPropertyNames()
// This will not throw a SecurityException because this
// class was loaded from rt.jar using the bootstrap classloader.
Enumeration enumeration = (Enumeration)
AccessController.doPrivileged(
new PrivilegedAction() {
public java.lang.Object run() {
return System.getProperties().propertyNames();
}
}
);
return makeIterator( enumeration ) ;
|
private boolean | hasCORBAPrefix(java.lang.String prefix)
return prefix.startsWith( ORBConstants.ORG_OMG_PREFIX ) ||
prefix.startsWith( ORBConstants.SUN_PREFIX ) ||
prefix.startsWith( ORBConstants.SUN_LC_PREFIX ) ||
prefix.startsWith( ORBConstants.SUN_LC_VERSION_PREFIX ) ;
|
public boolean | initialHostIsLocal()
checkSetParserCalled() ;
return localHostName.equals( resultProps.getProperty(
ORBConstants.INITIAL_HOST_PROPERTY ) ) ;
|
public abstract boolean | isApplet()
|
private static java.util.Iterator | makeIterator(java.util.Enumeration enumeration)
return new Iterator() {
public boolean hasNext() { return enumeration.hasMoreElements() ; }
public Object next() { return enumeration.nextElement() ; }
public void remove() { throw new UnsupportedOperationException() ; }
} ;
|
public void | setParser(com.sun.corba.se.spi.orb.PropertyParser parser)
Iterator iter = parser.iterator() ;
while (iter.hasNext()) {
ParserAction pa = (ParserAction)(iter.next()) ;
if (pa.isPrefix())
propertyPrefixes.add( pa.getPropertyName() ) ;
else
propertyNames.add( pa.getPropertyName() ) ;
}
collect() ;
setParserCalled = true ;
|
private void | setProperty(java.lang.String name, java.lang.String value)
if( name.equals( ORBConstants.ORB_INIT_REF_PROPERTY ) ) {
// Value is <name>=<URL>
StringTokenizer st = new StringTokenizer( value, "=" ) ;
if (st.countTokens() != 2)
throw new IllegalArgumentException() ;
String refName = st.nextToken() ;
String refValue = st.nextToken() ;
resultProps.setProperty( name + "." + refName, refValue ) ;
} else {
resultProps.setProperty( name, value ) ;
}
|