You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/02/19 15:49:39 UTC
cvs commit: jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel package.html DefaultLoader.java
mcconnell 02/02/19 06:49:39
Modified: apps/enterprise/orb/src/java/org/apache/orb
DefaultORBFactory.java DefaultORBFactory.xinfo
ORBInitContext.java
apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel
DefaultLoader.java
Added: apps/enterprise/orb/src/java/org/apache/orb
DefaultORBFactory.xml
ORBFactoryRuntimeException.java
apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel
package.html
Removed: apps/enterprise/orb/src/java/org/apache/orb ORB.xinfo
Log:
no message
Revision Changes Path
1.2 +42 -11 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.java
Index: DefaultORBFactory.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultORBFactory.java 11 Feb 2002 14:47:15 -0000 1.1
+++ DefaultORBFactory.java 19 Feb 2002 14:49:39 -0000 1.2
@@ -9,6 +9,7 @@
import java.io.File;
import java.net.URL;
+import java.io.InputStream;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.LogEnabled;
@@ -22,6 +23,7 @@
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.phoenix.Block;
import org.apache.avalon.phoenix.BlockContext;
@@ -33,23 +35,24 @@
* <p><table border="1" cellpadding="3" cellspacing="0" width="100%">
* <tr bgcolor="#ccccff">
* <td colspan="2"><b><code>DefaultORBFactory</code>Lifecycle Phases</b></td>
- * <tr><td width="20%"></td><td><b>Description</b></td></tr>
+ * <tr><td width="20%"><b>Phase</b></td><td><b>Description</b></td></tr>
* <tr>
- * <td width="20%"><b>Contextualizable</b></td>
+ * <td width="20%">Contextualizable</td>
* <td>
* The <code>Context</code> value passed to the <code>ORBFactory</code> during this phase
- * provides the runtime execution context including the root application directory.</td></tr>
+ * provides the runtime execution context.</td></tr>
* <tr>
- * <td width="20%"><b>Configurable</b></td>
+ * <td width="20%">Configurable</td>
* <td>
* The configuration phase handles the internalization of a static configuration data
- * including ORB bootstrap properties.
+ * including ORB default properties.
* </td></tr>
- * <tr><td width="20%"><b>Initalizable</b></td>
+ * <tr><td width="20%">Initalizable</td>
* <td>
- * Signals completion of the Contextualization and Configuration phases.
+ * Signals completion of the Contextualization and Configuration phases enabling the factory
+ * to prepare for handling of ORB creation requests.
* </td></tr>
- * <tr><td width="20%"><b>Disposable</b></td>
+ * <tr><td width="20%">Disposable</td>
* <td>
* Local cleanup of state memebers.
* </td></tr>
@@ -59,7 +62,7 @@
*/
public class DefaultORBFactory extends AbstractLogEnabled
-implements Block, Contextualizable, Configurable, Initializable, Disposable, ORBFactoryService
+implements Block, LogEnabled, Contextualizable, Configurable, Initializable, Disposable, ORBFactoryService
{
//=================================================================
@@ -124,7 +127,11 @@
public void configure( final Configuration config )
throws ConfigurationException
{
- this.m_config = config;
+ Configuration defaults = loadConfiguration("org/apache/orb/DefaultORBFactory.xml");
+ m_config = new CascadingConfiguration( config, defaults );
+ if( getLogger().isDebugEnabled() ) getLogger().debug(
+ "configuration (children: "
+ + m_config.getChildren().length + ")" );
}
//=================================================================
@@ -222,7 +229,7 @@
catch ( Throwable e )
{
final String error = "ORB initialization failure.";
- throw new CascadingRuntimeException( error, e );
+ throw new ORBFactoryRuntimeException( error, e );
}
}
@@ -238,6 +245,30 @@
m_config = null;
m_context = null;
m_root = null;
+ }
+
+ //=================================================================
+ // utilities
+ //=================================================================
+
+ /**
+ * Returns the default configuration resource.
+ */
+ private Configuration loadConfiguration( String path )
+ throws ConfigurationException
+ {
+ try
+ {
+ DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder( );
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream( path );
+ if( is == null ) throw new Exception(
+ "Could not find the configuration resource \"" + path + "\"" );
+ return builder.build( is );
+ }
+ catch( Throwable e )
+ {
+ throw new ConfigurationException("Unexpected excetion while loading configration.", e );
+ }
}
}
1.2 +1 -0 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.xinfo
Index: DefaultORBFactory.xinfo
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.xinfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultORBFactory.xinfo 11 Feb 2002 14:47:15 -0000 1.1
+++ DefaultORBFactory.xinfo 19 Feb 2002 14:49:39 -0000 1.2
@@ -23,5 +23,6 @@
<service name="org.apache.orb.ORBFactoryService" version="1.0" />
</services>
+
</blockinfo>
1.2 +8 -0 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/ORBInitContext.java
Index: ORBInitContext.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/ORBInitContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ORBInitContext.java 11 Feb 2002 14:47:15 -0000 1.1
+++ ORBInitContext.java 19 Feb 2002 14:49:39 -0000 1.2
@@ -119,6 +119,14 @@
}
/**
+ * Returns the base configuration.
+ */
+ public Configuration getConfiguration()
+ {
+ return m_config;
+ }
+
+ /**
* Returns an initializer configuration based on a supplied
* initializer class name.
* @param name the name of the initalizer class
1.1 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.xml
Index: DefaultORBFactory.xml
===================================================================
<?xml version="1.0"?>
<!--
config.xml
Copyright 2000-2001 OSM SARL All Rights Reserved.
This configuration is the proprietary information of OSM SARL.
Use is subject to license terms.
@author Stephen McConnell <ma...@osm.net>
@version 1.0 24 DEC 2000
-->
<!--
ORB Factory default configuration.
-->
<config>
<!--
The following properties constitute default properties that will be
added to the Properties instance supplied as an argument to the ORB init
function.
-->
<property name="openorb.ORBLoader" value="org.apache.orb.CORBA.kernel.DefaultLoader" />
<property name="openorb.debug" value="0" />
<property name="openorb.debug.ShowStackTrace" value="false"/>
<property name="openorb.defaultInitRef" value="corbaname:rir:#InitialReferences" />
<property name="openorb.server.enable" value="true"/>
<property name="openorb.server.alias" value=""/>
<property name="openorb.server.maxQueueSize" value="0x7FFFFFFF" />
<property name="openorb.server.maxManagerHeldRequests" value="0x7FFFFFFF" />
<property name="openorb.server.minThreadPoolSize" value="2"/>
<property name="openorb.server.maxThreadPoolSize" value="10"/>
<property name="openorb.server.reapCloseDelay" value="600000"/>
<property name="openorb.server.serverManagerClass" value="org.openorb.net.ServerManagerImpl"/>
<property name="openorb.client.reapPauseDelay" value="120000"/>
<property name="openorb.client.enable" value="true"/>
<property name="openorb.client.clientManagerClass" value="org.openorb.net.ClientManagerImpl"/>
<property name="openorb.pi.ORBInitInfoClass" value="org.openorb.PI.OpenORBInitInfo" />
<property name="openorb.pi. ServerManagerClass" value="org.openorb.PI.SimpleServerManager" />
<property name="openorb.pi.ClientManagerClass" value="org.openorb.PI.SimpleClientManager" />
<property name="openorb.pi.IORManagerClass" value="org.openorb.PI.SimpleIORManager" />
<property name="openorb.dynany.enable" value="true" />
<property name="openorb.kernel.ORBConnectorClass" value="org.openorb.CORBA.kernel.OpenORBConnector" />
<property name="openorb.defaultInitRef" value=""/>
<property name="openorb.debug" value="0"/>
<property name="openorb.useStaticThreadGroup" value="false"/>
<property name="iiop.hostname" value=""/>
<property name="iiop.publishIP" value="auto"/>
<property name="iiop.listenAddress" value="0.0.0.0"/>
<property name="iiop.port" value="0"/>
<property name="iiop.allowBidir" value="true"/>
<property name="iiop.biDirOnlyServer" value="false"/>
<property name="iiop.CDRInputStreamClass" value="org.openorb.iiop.CDRInputStream"/>
<property name="iiop.CDROutputStreamClass" value="org.openorb.iiop.CDROutputStream"/>
<property name="iiop.IIOPTransportServerInitializerClass"
value="org.openorb.iiop.IIOPTransportServerInitializer"/>
<property name="iiop.TransportClientInitializerClass"
value="org.openorb.iiop.IIOPTransportClientInitializer"/>
<!--
The following initializer elements define the logging sub-catagory to be
be assigned for the initalization object. If the initalizer implements the
Composable interace, the element will be passed as a Configuration instance
under the compose operation.
-->
<initializer class="org.openorb.iiop.IIOPProtocolInitializer" name="iiop"/>
<initializer class="org.openorb.adapter.poa.POAInitializer" name="poa"/>
</config>
1.1 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/ORBFactoryRuntimeException.java
Index: ORBFactoryRuntimeException.java
===================================================================
/*
* ORBFactoryRuntimeException.java
*
* Created on March 28, 2001, 0:39 AM
*/
package org.apache.orb;
import java.io.StringWriter;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import org.apache.avalon.framework.CascadingRuntimeException;
/**
* The <code>InternalException</code> may be thrown by an Appliance
* as a result of an unexpected internal exception during process
* execution.
*
* @author mcconnell
* @version 1.0
*/
public class ORBFactoryRuntimeException extends CascadingRuntimeException {
/**
* Construct a new <code>PipelineRuntimeException</code> instance with the
* supplied message parameter and a null value for the cause exception.
*
* @param message Message summarising the exception.
*/
public ORBFactoryRuntimeException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>PipelineRuntimeException</code> instance with the
* supplied message parameter and a supplied cause exception.
*
* @param message The detail message for this exception.
* @param cause the root cause of the exception
*/
public ORBFactoryRuntimeException( final String message, final Throwable cause )
{
super( message, cause );
}
}
1.4 +35 -7 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel/DefaultLoader.java
Index: DefaultLoader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel/DefaultLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultLoader.java 11 Feb 2002 14:47:15 -0000 1.3
+++ DefaultLoader.java 19 Feb 2002 14:49:39 -0000 1.4
@@ -120,11 +120,6 @@
_orb.enableLogging( m_logger.getChildLogger( "" + System.identityHashCode( this ) ) );
m_logger.debug("loading orb");
- // load the properties and the list of initializers
- Configurator conf = new Configurator( args, properties );
-
- _properties = conf.getProperties();
-
// create the orb init info.
ORBInitInfo init_info;
@@ -139,10 +134,19 @@
if( properties instanceof ORBInitContext )
{
- load_initializers( cargs, conf.getInitializers(), (ORBInitContext)properties );
+ //load_initializers( cargs, conf.getInitializers(), (ORBInitContext)properties );
+
+ ORBInitContext context = (ORBInitContext) properties;
+ Configuration c = context.getConfiguration();
+ Configurator conf = new Configurator( args, getPropertiesFromConfiguration( c ) );
+ _properties = conf.getProperties();
+ load_initializers( cargs, conf.getInitializers(), context );
}
else
{
+ // load the properties and the list of initializers
+ Configurator conf = new Configurator( args, properties );
+ _properties = conf.getProperties();
load_initializers( cargs, conf.getInitializers() );
}
@@ -177,6 +181,30 @@
init_info.post_init();
}
+ private java.util.Properties getPropertiesFromConfiguration( Configuration config )
+ throws ConfigurationException
+ {
+ java.util.Properties p = new java.util.Properties();
+
+ Configuration[] props = config.getChildren("property");
+ for( int i=0; i<props.length; i++ )
+ {
+ Configuration property = props[i];
+ p.setProperty( property.getAttribute("name"), property.getAttribute("value") );
+ }
+
+ Configuration[] inits = config.getChildren("initializer");
+ for( int i=0; i<inits.length; i++ )
+ {
+ Configuration init = inits[i];
+ String name = init.getAttribute("class");
+ p.setProperty(
+ "org.omg.PortableInterceptor.ORBInitializerClass." + name, name );
+ }
+
+ return p;
+ }
+
/**
* This operation is used to display an OpenORB configuration.
*/
@@ -489,7 +517,7 @@
logger = context.getBaseLogger();
base = context.getBaseContext();
if( logger != null ) if( logger.isDebugEnabled() ) logger.debug(
- "loading " + cls_names.length + " initializers" );
+ "handling " + cls_names.length + " initializers" );
}
for ( int i = 0; i < cls_names.length; ++i )
1.1 jakarta-avalon-cornerstone/apps/enterprise/orb/src/java/org/apache/orb/CORBA/kernel/package.html
Index: package.html
===================================================================
<body>
<p>
ORB loader incorporating component based management of initializers,
log enablement, configuration and contextualization of the ORB and
supporting services based on the Avalon component model.
</p>
</body>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>