You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ad...@apache.org on 2005/12/02 08:59:10 UTC
svn commit: r351623 [1/4] - in /geronimo/trunk/sandbox/freeorb/geronimo-orb:
./ src/main/java/org/apache/geronimo/corba/
src/main/java/org/apache/geronimo/corba/channel/
src/main/java/org/apache/geronimo/corba/channel/nio/
src/main/java/org/apache/gero...
Author: adc
Date: Thu Dec 1 23:58:55 2005
New Revision: 351623
URL: http://svn.apache.org/viewcvs?rev=351623&view=rev
Log:
PR: GERONIMO-1233
Submitted by: Kresten Krab Thorup
Added:
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/LocationForwardException.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ServerManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/codeset/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/codeset/CharConverter.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/codeset/DefaultCharConverter.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/codeset/DefaultWCharConverter.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPHelper.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/UserExceptionInputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultClientConnection.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalExceptionDetailMessage.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContext.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/URLManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/URLParser.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/server/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/server/DefaultServerManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/server/POA.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/server/POAManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/server/ServantObject.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/util/HexUtil.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/idl/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/idl/HelloObject.idl
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/test/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/test/CorbaTestSuite.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/test/G2SHelloWorldTest.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/test/HelloObjectServant.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/test/HelloWorldTest.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/RemoteTest.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/RemoteTestCase.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/RemoteTestUtil.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/TestAgent.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/TestAgentManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/TestDriver.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/TestDriverImpl.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/VMController.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/test/java/org/apache/geronimo/corba/testframework/VMControllerImpl.java
Modified:
geronimo/trunk/sandbox/freeorb/geronimo-orb/pom.xml
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/AbstractORB.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientDelegate.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientInvocation.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ConnectionManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfile.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfileSelector.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ORB.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/PlainObject.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/FilterInputChannel.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/InputChannel.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/OutputChannel.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingBuffer.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingByteBuffer.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/SocketTransportBase.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/Transport.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOSocketTransport.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOTransportManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/ParticipationExecutor.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPInputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPMessageTransport.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPOutputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/RequestID.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/CharConverter.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnection.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnectionFactory.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultConnectionManager.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationInputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationOutputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/FilterInputStream.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/GIOPVersion.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/IIOPInvocationProfile.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/InputStreamBase.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MinorCodes.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/OutputStreamBase.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/SSLClientConnectionFactory.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TCPClientConnectionFactory.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TLSClientConnectionFactory.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ValueWriter.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPProfile.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalIOR.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContextList.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalTargetAddress.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Profile.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/SecurityMechanismListComponent.java
geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/TaggedValue.java
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/pom.xml?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/pom.xml (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/pom.xml Thu Dec 1 23:58:55 2005
@@ -1,58 +1,120 @@
<project>
- <parent>
- <groupId>org.apache.geronimo</groupId>
- <artifactId>geronimo</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
+ <parent>
<groupId>org.apache.geronimo</groupId>
- <artifactId>geronimo-orb</artifactId>
- <name>Geronimo :: CORBA ORB</name>
+ <artifactId>geronimo</artifactId>
<version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <dependencies>
+ </parent>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
-
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-spec-corba</artifactId>
- <version>2.3-rc4</version>
- </dependency>
-
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>geronimo-orb</artifactId>
+ <name>Geronimo :: CORBA ORB</name>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-spec-corba</artifactId>
+ <version>2.3-rc4</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>maven-idlj-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ <goal>generate-test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>test-compile</phase>
+ <configuration>
+ <tasks>
+ <rmic base="target/test-classes" includes="**/TestDriverImpl.class, **/VMControllerImpl.class"/>
+ </tasks>
+ </configuration>
+
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include implementation="java.lang.String">**/CorbaTestSuite.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>maven-idlj-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ <goal>generate-test</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <debug>true</debug>
+ <packagePrefixes>
+ <packagePrefix>
+ <type>corba</type>
+ <prefix>org.apache.geronimo</prefix>
+ </packagePrefix>
+ </packagePrefixes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/AbstractORB.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/AbstractORB.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/AbstractORB.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/AbstractORB.java Thu Dec 1 23:58:55 2005
@@ -24,185 +24,182 @@
import org.omg.CORBA_2_3.ORB;
import org.omg.IIOP.Version;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.corba.codeset.CharConverter;
+import org.apache.geronimo.corba.codeset.DefaultCharConverter;
+import org.apache.geronimo.corba.codeset.DefaultWCharConverter;
import org.apache.geronimo.corba.dii.EnvironmentImpl;
import org.apache.geronimo.corba.dii.ExceptionListImpl;
import org.apache.geronimo.corba.dii.NamedValueImpl;
-import org.apache.geronimo.corba.io.CharConverter;
import org.apache.geronimo.corba.io.GIOPVersion;
+/**
+ * This class holds implementations of methods that should be there
+ * for both the real orb (class ORB in this package) and the singleton orb
+ * (class SingletonORB) in this package.
+ * */
public abstract class AbstractORB extends ORB {
- /**
- * Public no-arg constructor
- */
- public AbstractORB() {
- }
-
- public org.omg.CORBA.NamedValue create_named_value(String name,
- org.omg.CORBA.Any value, int flags)
- {
- return new NamedValueImpl(name, value, flags);
- }
-
- public org.omg.CORBA.ExceptionList create_exception_list() {
- return new ExceptionListImpl();
- }
-
- public org.omg.CORBA.Environment create_environment() {
- return new EnvironmentImpl();
- }
-
-
- final public org.omg.CORBA.TypeCode create_struct_tc(String id,
- String name, org.omg.CORBA.StructMember[] members)
- {
- return TypeCodeUtil.create_struct_tc(id, name, members);
- }
-
- final public org.omg.CORBA.TypeCode create_union_tc(String id, String name,
- org.omg.CORBA.TypeCode discriminator_type,
- org.omg.CORBA.UnionMember[] members)
- {
- return TypeCodeUtil.create_union_tc(id, name, discriminator_type,
- members);
- }
-
- final public org.omg.CORBA.TypeCode create_enum_tc(String id, String name,
- String[] members)
- {
- return TypeCodeUtil.create_enum_tc(id, name, members);
- }
-
- final public org.omg.CORBA.TypeCode create_alias_tc(String id, String name,
- org.omg.CORBA.TypeCode original_type)
- {
- return TypeCodeUtil.create_alias_tc(id, name, original_type);
- }
-
- final public org.omg.CORBA.TypeCode create_exception_tc(String id,
- String name, org.omg.CORBA.StructMember[] members)
- {
- return TypeCodeUtil.create_exception_tc(id, name, members);
- }
-
- final public org.omg.CORBA.TypeCode create_interface_tc(String id,
- String name)
- {
- return TypeCodeUtil.create_interface_tc(id, name);
- }
-
- final public org.omg.CORBA.TypeCode create_string_tc(int bound) {
- return TypeCodeUtil.create_string_tc(bound);
- }
-
- final public org.omg.CORBA.TypeCode create_wstring_tc(int bound) {
- return TypeCodeUtil.create_wstring_tc(bound);
- }
-
- final public org.omg.CORBA.TypeCode create_fixed_tc(short digits,
- short scale)
- {
- return TypeCodeUtil.create_fixed_tc(digits, scale);
- }
-
- final public org.omg.CORBA.TypeCode create_sequence_tc(int bound,
- org.omg.CORBA.TypeCode element_type)
- {
- return TypeCodeUtil.create_sequence_tc(bound, element_type);
- }
-
- /**
- * @deprecated
- */
- final public org.omg.CORBA.TypeCode create_recursive_sequence_tc(int bound,
- int offset)
- {
- return TypeCodeUtil.create_recursive_sequence_tc(bound, offset);
- }
-
- final public org.omg.CORBA.TypeCode create_array_tc(int length,
- org.omg.CORBA.TypeCode element_type)
- {
- return TypeCodeUtil.create_array_tc(length, element_type);
- }
-
- final public org.omg.CORBA.TypeCode create_value_tc(String id, String name,
- short type_modifier, org.omg.CORBA.TypeCode concrete_base,
- org.omg.CORBA.ValueMember[] members)
- {
- return TypeCodeUtil.create_value_tc(id, name, type_modifier,
- concrete_base, members);
- }
-
- final public org.omg.CORBA.TypeCode create_value_box_tc(String id,
- String name, org.omg.CORBA.TypeCode boxed_type)
- {
- return TypeCodeUtil.create_value_box_tc(id, name, boxed_type);
- }
-
- final public org.omg.CORBA.TypeCode create_native_tc(String id, String name) {
- return TypeCodeUtil.create_native_tc(id, name);
- }
-
- final public org.omg.CORBA.TypeCode create_recursive_tc(String id) {
- return TypeCodeUtil.create_recursive_tc(id);
- }
-
- final public org.omg.CORBA.TypeCode create_abstract_interface_tc(String id,
- String name)
- {
- return TypeCodeUtil.create_abstract_interface_tc(id, name);
- }
-
- final public org.omg.CORBA.TypeCode get_primitive_tc(
- org.omg.CORBA.TCKind kind)
- {
- return TypeCodeUtil.get_primitive_tc(kind);
- }
-
-
- public org.omg.CORBA.Any create_any() {
- return new AnyImpl(this);
- }
-
- public GIOPVersion getGIOPVersion() {
- return GIOPVersion.V1_2;
- }
-
- public Version getIIOPVersion() {
- GIOPVersion v = getGIOPVersion();
- return new Version((byte) v.major, (byte) v.minor);
- }
-
- public CharConverter get_char_converter(GIOPVersion version) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public CharConverter get_wchar_converter(GIOPVersion version) {
- // TODO Auto-generated method stub
- return null;
- }
-
- private static final DNSCache DNS_CACHE = new DNSCache();
-
- public final InetAddress getAddress(String host) throws UnknownHostException {
- return DNS_CACHE.getAddress(host);
- }
-
- public void fatal(String string) {
- // TODO Auto-generated method stub
-
- }
-
- private static ValueHandler valueHandler;
-
- public javax.rmi.CORBA.ValueHandler getValueHandler() {
- if (valueHandler == null) {
- valueHandler = Util.createValueHandler();
- }
- return valueHandler;
- }
+ static private Log log = LogFactory.getLog(AbstractORB.class);
+
+ protected AbstractORB() {
+ }
+
+ public org.omg.CORBA.NamedValue create_named_value(String name,
+ org.omg.CORBA.Any value, int flags) {
+ return new NamedValueImpl(name, value, flags);
+ }
+
+ public org.omg.CORBA.ExceptionList create_exception_list() {
+ return new ExceptionListImpl();
+ }
+
+ public org.omg.CORBA.Environment create_environment() {
+ return new EnvironmentImpl();
+ }
+
+ final public org.omg.CORBA.TypeCode create_struct_tc(String id,
+ String name, org.omg.CORBA.StructMember[] members) {
+ return TypeCodeUtil.create_struct_tc(id, name, members);
+ }
+
+ final public org.omg.CORBA.TypeCode create_union_tc(String id, String name,
+ org.omg.CORBA.TypeCode discriminator_type,
+ org.omg.CORBA.UnionMember[] members) {
+ return TypeCodeUtil.create_union_tc(id, name, discriminator_type,
+ members);
+ }
+
+ final public org.omg.CORBA.TypeCode create_enum_tc(String id, String name,
+ String[] members) {
+ return TypeCodeUtil.create_enum_tc(id, name, members);
+ }
+
+ final public org.omg.CORBA.TypeCode create_alias_tc(String id, String name,
+ org.omg.CORBA.TypeCode original_type) {
+ return TypeCodeUtil.create_alias_tc(id, name, original_type);
+ }
+
+ final public org.omg.CORBA.TypeCode create_exception_tc(String id,
+ String name, org.omg.CORBA.StructMember[] members) {
+ return TypeCodeUtil.create_exception_tc(id, name, members);
+ }
+
+ final public org.omg.CORBA.TypeCode create_interface_tc(String id,
+ String name) {
+ return TypeCodeUtil.create_interface_tc(id, name);
+ }
+
+ final public org.omg.CORBA.TypeCode create_string_tc(int bound) {
+ return TypeCodeUtil.create_string_tc(bound);
+ }
+
+ final public org.omg.CORBA.TypeCode create_wstring_tc(int bound) {
+ return TypeCodeUtil.create_wstring_tc(bound);
+ }
+
+ final public org.omg.CORBA.TypeCode create_fixed_tc(short digits,
+ short scale) {
+ return TypeCodeUtil.create_fixed_tc(digits, scale);
+ }
+
+ final public org.omg.CORBA.TypeCode create_sequence_tc(int bound,
+ org.omg.CORBA.TypeCode element_type) {
+ return TypeCodeUtil.create_sequence_tc(bound, element_type);
+ }
+
+ /**
+ * @deprecated
+ */
+ final public org.omg.CORBA.TypeCode create_recursive_sequence_tc(int bound,
+ int offset) {
+ return TypeCodeUtil.create_recursive_sequence_tc(bound, offset);
+ }
+
+ final public org.omg.CORBA.TypeCode create_array_tc(int length,
+ org.omg.CORBA.TypeCode element_type) {
+ return TypeCodeUtil.create_array_tc(length, element_type);
+ }
+
+ final public org.omg.CORBA.TypeCode create_value_tc(String id, String name,
+ short type_modifier, org.omg.CORBA.TypeCode concrete_base,
+ org.omg.CORBA.ValueMember[] members) {
+ return TypeCodeUtil.create_value_tc(id, name, type_modifier,
+ concrete_base, members);
+ }
+
+ final public org.omg.CORBA.TypeCode create_value_box_tc(String id,
+ String name, org.omg.CORBA.TypeCode boxed_type) {
+ return TypeCodeUtil.create_value_box_tc(id, name, boxed_type);
+ }
+
+ final public org.omg.CORBA.TypeCode create_native_tc(String id, String name) {
+ return TypeCodeUtil.create_native_tc(id, name);
+ }
+
+ final public org.omg.CORBA.TypeCode create_recursive_tc(String id) {
+ return TypeCodeUtil.create_recursive_tc(id);
+ }
+
+ final public org.omg.CORBA.TypeCode create_abstract_interface_tc(String id,
+ String name) {
+ return TypeCodeUtil.create_abstract_interface_tc(id, name);
+ }
+
+ final public org.omg.CORBA.TypeCode get_primitive_tc(
+ org.omg.CORBA.TCKind kind) {
+ return TypeCodeUtil.get_primitive_tc(kind);
+ }
+
+ public org.omg.CORBA.Any create_any() {
+ return new AnyImpl(this);
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_2;
+ }
+
+ public Version getIIOPVersion() {
+ GIOPVersion v = getGIOPVersion();
+ return new Version((byte) v.major, (byte) v.minor);
+ }
+
+ public CharConverter get_char_converter(GIOPVersion version) {
+ return DefaultCharConverter.getInstance(version);
+ }
+
+ public CharConverter get_wchar_converter(GIOPVersion version) {
+ return DefaultWCharConverter.getInstance(version);
+ }
+
+ private static final DNSCache DNS_CACHE = new DNSCache();
+
+ public final InetAddress getAddress(String host)
+ throws UnknownHostException {
+ return DNS_CACHE.getAddress(host);
+ }
+
+ public void fatal(String string) {
+ log.fatal(string);
+ }
+
+ public void fatal(String string, Throwable ex) {
+ log.fatal(string, ex);
+ }
+
+ public void fatal(Throwable ex) {
+ log.fatal("fatal error in GeronimoORB", ex);
+ }
+
+ private static ValueHandler valueHandler;
+
+ public javax.rmi.CORBA.ValueHandler getValueHandler() {
+ if (valueHandler == null) {
+ valueHandler = Util.createValueHandler();
+ }
+ return valueHandler;
+ }
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientDelegate.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientDelegate.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientDelegate.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientDelegate.java Thu Dec 1 23:58:55 2005
@@ -16,13 +16,22 @@
*/
package org.apache.geronimo.corba;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.NVList;
-import org.omg.CORBA.NamedValue;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.corba.dii.ExceptionListImpl;
+import org.apache.geronimo.corba.dii.NVListImpl;
+import org.apache.geronimo.corba.dii.NamedValueImpl;
+import org.apache.geronimo.corba.dii.RequestImpl;
+import org.apache.geronimo.corba.io.InputStreamBase;
+import org.apache.geronimo.corba.io.OutputStreamBase;
+import org.apache.geronimo.corba.ior.InternalIOR;
+import org.apache.geronimo.corba.server.POA;
+import org.apache.geronimo.corba.server.ServantObject;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.LocalObject;
import org.omg.CORBA.Object;
-import org.omg.CORBA.Request;
+import org.omg.CORBA.Policy;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -30,155 +39,412 @@
import org.omg.CORBA_2_3.portable.Delegate;
import org.omg.IOP.IOR;
-import org.apache.geronimo.corba.ior.InternalIOR;
+public class ClientDelegate extends Delegate {
+ private static final Log log = LogFactory.getLog(ClientDelegate.class);
-public class ClientDelegate extends Delegate {
+ private final ORB orb;
- private final ORB orb;
- private InternalIOR ior;
+ private InternalIOR ior;
- private InvocationProfileSelector profileManager;
+ private InvocationProfileSelector profileManager;
- public ClientDelegate(InternalIOR ior) {
- this.ior = ior;
- this.orb = (ORB) ior.orb;
- }
+ private final Policy[] policies;
- ClientDelegate(ORB orb, IOR ior) {
- this(new InternalIOR(orb, ior));
- }
+ private POA poa;
- //
- //
- //
+ private byte[] oid;
- public boolean is_local(org.omg.CORBA.Object self) {
- // TODO: implement
- return false;
- }
+ private boolean certainlyRemote;
- public OutputStream request(org.omg.CORBA.Object self, String operation,
- boolean responseExpected)
- {
+ private ServantObject servantObject;
+ private InternalIOR orig_ior;
- while (true) {
+ private ThreadLocal retryState;
- InvocationProfileSelector manager = getProfileSelector();
+ /* @deprecated */
+ public ClientDelegate(InternalIOR ior) {
+ this(ior, null);
+ }
- try {
+ public ClientDelegate(InternalIOR ior, Policy[] policies) {
+ this.ior = ior;
+ this.policies = policies;
+ this.orb = (ORB) ior.orb;
+ }
- // process client interceptor (pre-marshal) and write
- // RequestHeader to output stream.
+ public ClientDelegate(ORB orb, IOR ior) {
+ this(new InternalIOR(orb, ior), orb.getPolicies());
+ }
- OutputStream result = manager.setupRequest(operation,
- responseExpected);
+ ClientDelegate(ORB orb, IOR ior, Policy[] policies) {
+ this(new InternalIOR(orb, ior), policies);
+ }
- return result;
+ //
+ //
+ //
- }
- catch (org.omg.PortableInterceptor.ForwardRequest ex) {
+ public ClientDelegate(ORB orb, POA poa, byte[] oid, String repository_id,
+ Policy[] policies) {
+ this.orb = orb;
+ this.policies = policies;
+ this.poa = poa;
+ this.oid = oid;
+ }
- setIOR(InternalIOR.extract(ex.forward));
+ public boolean is_local(org.omg.CORBA.Object self) {
+
+ if (log.isDebugEnabled ()) {
+ log.debug ("is_local "+self);
+ }
+
+ if(certainlyRemote) {
+ if (log.isDebugEnabled ()) {
+ log.debug ("is_local ==> false [certainlyRemote == true]");
+ }
- continue;
+ return false;
+ }
+ if(servantObject != null && !servantObject.isDeactivated()) {
+ if (log.isDebugEnabled ()) {
+ log.debug ("is_local ==> true [servantObject != null]");
}
+ return true;
}
- }
- private void setIOR(InternalIOR ior) {
- this.ior = ior;
- this.profileManager = null;
- }
+ int count = 0;
+ while(true)
+ {
+ try {
+ servantObject = orb.__getServerManager().getServantObject(getIOR(), policies);
+ break;
+
+ } catch (LocationForwardException lex) {
+
+ ior = lex.getIor ();
+ if (lex.isPermanent ()) {
+ orig_ior = ior;
+ }
+
+ profileManager.reset();
+ certainlyRemote = false;
+
+ }
+
+ if (count++ == 100)
+ throw new org.omg.CORBA.COMM_FAILURE ("More than 100 successive forwards?");
+ }
+
+ if(servantObject != null) {
+ setRetry (true);
+
+ if (log.isDebugEnabled ()) {
+ log.debug ("is_local ==> true [found local servant]");
+ }
+ return true;
- private InvocationProfileSelector getProfileSelector() {
- if (this.profileManager == null) {
- this.profileManager = orb.createInvocationProfileSelector(this);
+ } else {
+
+ if (log.isDebugEnabled ()) {
+ log.debug ("is_local ==> false [no local servant]");
+ }
+
+ certainlyRemote = true;
}
- return profileManager;
- }
- public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
- throws ApplicationException, RemarshalException
- {
- // TODO: implement
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
+ return false;
- public void releaseReply(org.omg.CORBA.Object self, InputStream input) {
- // TODO: implement
- throw new org.omg.CORBA.NO_IMPLEMENT();
- }
- public Object get_interface_def(Object self) {
- // TODO Auto-generated method stub
- return null;
- }
+ }
- public Object duplicate(Object obj) {
- // TODO Auto-generated method stub
- return null;
- }
+ public OutputStream request(org.omg.CORBA.Object self, String operation,
+ boolean responseExpected) {
- public void release(Object obj) {
- // TODO Auto-generated method stub
+ while (true) {
- }
+ InvocationProfileSelector manager = getProfileSelector();
- public boolean is_a(Object obj, String repository_id) {
- // TODO Auto-generated method stub
- return false;
- }
+ try {
- public boolean non_existent(Object obj) {
- // TODO Auto-generated method stub
- return false;
- }
+ // process client interceptor (pre-marshal) and write
+ // RequestHeader to output stream.
- public boolean is_equivalent(Object obj, Object other) {
- // TODO Auto-generated method stub
- return false;
- }
+ OutputStreamBase result = manager.setupRequest(operation,
+ responseExpected);
- public int hash(Object obj, int max) {
- // TODO Auto-generated method stub
- return 0;
- }
+ if (result.getClientInvocation() == null) {
+ throw new INTERNAL();
+ }
- public Request request(Object obj, String operation) {
- // TODO Auto-generated method stub
- return null;
- }
+ return result;
- public Request create_request(Object obj, Context ctx, String operation,
- NVList arg_list, NamedValue result)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ } catch (org.omg.PortableInterceptor.ForwardRequest ex) {
+
+ setIOR(InternalIOR.extract(ex.forward));
+
+ continue;
+
+ }
+
+ }
+ }
+
+ private void setIOR(InternalIOR ior) {
+ this.ior = ior;
+ this.profileManager = null;
+ }
+
+ private InvocationProfileSelector getProfileSelector() {
+ if (this.profileManager == null) {
+ this.profileManager = orb.createInvocationProfileSelector(this);
+ }
+ return profileManager;
+ }
+
+ /**
+ * Method invocation sequence, step 2.
+ *
+ * this method is responsible for finishing the output stream and
+ * relinquishing the underlying channel to let other threads do invocations
+ * on the same GIOPMessageTransport.
+ *
+ */
+ public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
+ throws ApplicationException, RemarshalException {
+ OutputStreamBase out = (OutputStreamBase) output;
+
+ ClientInvocation inv = out.getClientInvocation();
+
+ if (inv == null) {
+ throw new BAD_INV_ORDER("OutputStream from wrong context");
+ }
+
+ InputStream in = inv.invoke(this, out);
+
+ inv.checkException();
- public Request create_request(Object obj, Context ctx, String operation,
- NVList arg_list, NamedValue result, ExceptionList exclist,
- ContextList ctxlist)
+ return in;
+ }
+
+ public void releaseReply(org.omg.CORBA.Object self, InputStream input) {
+ InputStreamBase in = (InputStreamBase) input;
+
+ if (in == null)
+ return;
+
+ ClientInvocation inv = in.getClientInvocation();
+
+ if (inv == null)
+ return;
+
+ inv.releaseReply(in);
+ }
+
+ public Object get_interface_def(Object self) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object duplicate(Object obj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void release(Object obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean is_a(Object self, String rid) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("is_a " + rid);
+ }
+
+ if (rid.equals("IDL:omg.org/CORBA/Object:1.0")) {
+ if (log.isDebugEnabled()) {
+ log.debug("is_a org.omg.CORBA.Object => true");
+ }
+
+ return true;
+ }
+
+ org.omg.CORBA.portable.ObjectImpl obj = (org.omg.CORBA.portable.ObjectImpl) self;
+ String[] ids = obj._ids();
+ for (int i = 0; i < ids.length; i++) {
+ if (log.isDebugEnabled()) {
+ log.debug("is_a ids[" + i + "] =" + ids[i]);
+ }
+
+ if (ids[i].equals(rid))
+ return true;
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("is_a ior.type_id =" + getIOR().getType());
+ }
+
+ if (rid.equals(getIOR().getType()))
+ return true;
+
+ while (true) {
+ if (!is_local(self)) {
+ OutputStream out = null;
+ InputStream in = null;
+
+ if (log.isDebugEnabled()) {
+ log.debug("invoking remote _is_a");
+ }
+
+ try {
+ out = (OutputStream) request(self, "_is_a", true);
+ out.write_string(rid);
+ in = (InputStream) invoke(self, out);
+ boolean result = in.read_boolean();
+
+ if (log.isDebugEnabled()) {
+ log.debug("invoking remote _is_a => " + result);
+ }
+
+ return result;
+
+ } catch (org.omg.CORBA.portable.ApplicationException ex) {
+ orb.fatal("unexpected exception from invoking is_a", ex);
+
+ } catch (org.omg.CORBA.portable.RemarshalException ex) {
+ continue;
+
+ } finally {
+ releaseReply(self, in);
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("invoking local _is_a");
+ }
+
+ ServantObject so = (ServantObject) servant_preinvoke(self,
+ "_is_a", null);
+
+ if (so == null)
+ continue;
+
+ try {
+ org.omg.PortableServer.Servant servant = so.original_servant;
+
+ boolean result = servant._is_a(rid);
+
+ if (log.isDebugEnabled()) {
+ log.debug("invoking local _is_a => " + result);
+ }
+
+ return result;
+ } finally {
+ servant_postinvoke(self, so);
+ }
+ }
+ }
+ }
+
+ public boolean non_existent(Object obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean is_equivalent(Object self, Object other) {
+ if (other == null)
+ return false;
+
+ if (self == other)
+ return true;
+
+ if (self instanceof LocalObject || other instanceof LocalObject)
+ return false;
+
+ org.omg.CORBA.portable.ObjectImpl otherObject = (org.omg.CORBA.portable.ObjectImpl) other;
+
+ ClientDelegate delegate = (ClientDelegate) otherObject._get_delegate();
+ if (delegate == this)
+ return true;
+
+ synchronized (this) {
+ return getIOR().equals(delegate.getIOR());
+ }
+ }
+
+ public int hash(Object obj, int max) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public org.omg.CORBA.Request create_request(org.omg.CORBA.Object self,
+ org.omg.CORBA.Context ctx, String operation,
+ org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result) {
+ return new RequestImpl(orb, (org.omg.CORBA.portable.ObjectImpl) self,
+ operation, ctx, (NVListImpl) arg_list, (NamedValueImpl) result);
+ }
+
+ public org.omg.CORBA.Request create_request(org.omg.CORBA.Object self,
+ org.omg.CORBA.Context ctx, String operation,
+ org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result,
+ org.omg.CORBA.ExceptionList excepts,
+ org.omg.CORBA.ContextList contexts) {
+ return new RequestImpl(orb, (org.omg.CORBA.portable.ObjectImpl) self,
+ operation, ctx, (NVListImpl) arg_list, (NamedValueImpl) result,
+ (ExceptionListImpl) excepts, contexts);
+ }
+
+ public org.omg.CORBA.Request request(org.omg.CORBA.Object self,
+ String operation) {
+ return new RequestImpl(orb, (org.omg.CORBA.portable.ObjectImpl) self,
+ operation);
+ }
+
+ public InternalIOR getInternalIOR() {
+ return ior;
+ }
+
+ public ORB getORB() {
+ return orb;
+ }
+
+ public InternalIOR getIOR() {
+ return ior;
+ }
+
+ private synchronized void setRetry (boolean value)
{
- // TODO Auto-generated method stub
- return null;
- }
+ if (retryState == null && value == true)
+ return;
+
+ if (retryState == null)
+ retryState = new ThreadLocal();
- public InternalIOR getInternalIOR() {
- return ior;
+ if (value == true)
+ retryState.set (null);
+ else
+ retryState.set (this);
}
- public ORB getORB() {
- return orb;
+ private synchronized boolean getRetry ()
+ {
+ if (retryState == null)
+ return true;
+
+ return retryState.get () == null;
}
- public InternalIOR getIOR() {
- return ior;
+ private synchronized boolean getAndSetRetry (boolean value)
+ {
+ boolean result = getRetry ();
+ if (result != value)
+ setRetry (value);
+ return result;
}
+
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientInvocation.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientInvocation.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientInvocation.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ClientInvocation.java Thu Dec 1 23:58:55 2005
@@ -18,9 +18,19 @@
import java.util.List;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.GIOP.ReplyStatusType_1_2;
import org.omg.PortableInterceptor.ForwardRequest;
+import org.apache.geronimo.corba.giop.GIOPMessageTransport;
import org.apache.geronimo.corba.giop.GIOPOutputStream;
+import org.apache.geronimo.corba.giop.RequestID;
+import org.apache.geronimo.corba.io.GIOPVersion;
+import org.apache.geronimo.corba.io.InputStreamBase;
+import org.apache.geronimo.corba.io.OutputStreamBase;
+import org.apache.geronimo.corba.ior.InternalServiceContextList;
public class ClientInvocation implements Invocation {
@@ -32,7 +42,12 @@
/** */
private final InvocationProfile profile;
- private List requestServiceContextList;
+ private RequestID requestID;
+ private InternalServiceContextList iscl;
+ private InternalServiceContextList respose_scl;
+ private ReplyStatusType_1_2 reply_status;
+ private SystemException systemException;
+ private ApplicationException userException;
public ClientInvocation(InvocationProfileSelector manager,
String operation,
@@ -44,6 +59,7 @@
this.operation = operation;
this.responseExpected = responseExpected;
this.profile = profile;
+ this.iscl = new InternalServiceContextList();
}
ClientDelegate getDelegate() {
@@ -54,7 +70,85 @@
public GIOPOutputStream startRequest()
throws ForwardRequest
{
- return profile.startRequest();
+ return profile.startRequest(this);
}
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public byte getResponseFlags() {
+ if (responseExpected) {
+ return GIOPMessageTransport.SYNC_WITH_TARGET;
+ } else {
+ return GIOPMessageTransport.SYNC_NONE;
+ }
+ }
+
+ public InputStream invoke(ClientDelegate delegate, OutputStreamBase out) {
+ InputStreamBase in = profile.invoke(this, delegate, out);
+ if (in != null) {
+ in.setClientInvocation(this);
+ }
+ return in;
+ }
+
+ public boolean isResponseExpected() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ public void setRequestID(RequestID requestID) {
+ this.requestID = requestID;
+ }
+
+ public InternalServiceContextList getRequestServiceContextList() {
+ return iscl;
+ }
+
+ public RequestID getRequestID() {
+ return requestID;
+ }
+
+ public void releaseReply(InputStreamBase in) {
+ profile.releaseReply(in);
+ }
+
+ public void setResposeServiceContextList (InternalServiceContextList scl) {
+ this.respose_scl = scl;
+ }
+
+ public void setReplyStatus(ReplyStatusType_1_2 reply_status) {
+ this.reply_status = reply_status;
+ }
+
+ public ReplyStatusType_1_2 getReplyStatus() {
+ return reply_status;
+ }
+
+ public void setSystemException(SystemException sex) {
+ this.systemException = sex;
+ this.reply_status = ReplyStatusType_1_2.SYSTEM_EXCEPTION;
+ }
+
+ public void setUserException(ApplicationException aex) {
+ this.userException = aex;
+ this.reply_status = ReplyStatusType_1_2.USER_EXCEPTION;
+ }
+
+ public void checkException() throws ApplicationException {
+ if (this.systemException != null) {
+ throw systemException;
+ }
+
+ if (userException != null) {
+ throw userException;
+ }
+
+ }
+
+ public InternalServiceContextList getReplyServiceContextList() {
+ return respose_scl;
+ }
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ConnectionManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ConnectionManager.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ConnectionManager.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ConnectionManager.java Thu Dec 1 23:58:55 2005
@@ -18,7 +18,11 @@
import org.apache.geronimo.corba.ior.InternalIOR;
-
+/** A connection manager can translate an IOR into a series of InvocationProfiles.
+ *
+ * an InvocationProfile is a profile from the IOR paired with the means needed to
+ * connect to the object (i.e. some kind of client connection factory).
+ * */
public interface ConnectionManager {
InvocationProfile[] getInvocationProfiles(InternalIOR ior);
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfile.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfile.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfile.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfile.java Thu Dec 1 23:58:55 2005
@@ -17,10 +17,17 @@
package org.apache.geronimo.corba;
import org.apache.geronimo.corba.giop.GIOPOutputStream;
-
+import org.apache.geronimo.corba.io.InputStreamBase;
+import org.apache.geronimo.corba.io.OutputStreamBase;
+import org.omg.CORBA.portable.InputStream;
public interface InvocationProfile {
- GIOPOutputStream startRequest();
+ GIOPOutputStream startRequest(ClientInvocation invocation);
+
+ InputStreamBase invoke(ClientInvocation invocation, ClientDelegate delegate,
+ OutputStreamBase out);
+
+ void releaseReply(InputStreamBase in);
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfileSelector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfileSelector.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfileSelector.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/InvocationProfileSelector.java Thu Dec 1 23:58:55 2005
@@ -20,6 +20,7 @@
import org.omg.CORBA.portable.OutputStream;
import org.apache.geronimo.corba.giop.GIOPOutputStream;
+import org.apache.geronimo.corba.io.OutputStreamBase;
public class InvocationProfileSelector {
@@ -46,7 +47,7 @@
return orb;
}
- public OutputStream setupRequest(String operation, boolean responseExpected)
+ public OutputStreamBase setupRequest(String operation, boolean responseExpected)
throws org.omg.PortableInterceptor.ForwardRequest
{
while (true) {
@@ -55,7 +56,10 @@
try {
- GIOPOutputStream out = invocation.startRequest();
+ OutputStreamBase out = invocation.startRequest();
+
+ out.setClientInvocation(invocation);
+
return out;
}
@@ -92,5 +96,9 @@
public ClientDelegate getDelegate() {
return delegate;
}
+
+ public void reset() {
+ currentProfile = 0;
+ }
}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/LocationForwardException.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/LocationForwardException.java?rev=351623&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/LocationForwardException.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/LocationForwardException.java Thu Dec 1 23:58:55 2005
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.corba;
+
+import org.apache.geronimo.corba.ior.InternalIOR;
+
+public class LocationForwardException extends Exception {
+
+ private final InternalIOR ior;
+ private final boolean isPermanent;
+
+ public LocationForwardException(InternalIOR ior, boolean isPermanent) {
+ this.ior = ior;
+ this.isPermanent = isPermanent;
+ }
+
+ public InternalIOR getIor() {
+ return ior;
+ }
+
+ public boolean isPermanent() {
+ return isPermanent;
+ }
+
+}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ORB.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ORB.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ORB.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ORB.java Thu Dec 1 23:58:55 2005
@@ -17,117 +17,164 @@
package org.apache.geronimo.corba;
import java.applet.Applet;
+import java.io.IOException;
import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.corba.dii.NVListImpl;
+import org.apache.geronimo.corba.io.DefaultConnectionManager;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+import org.apache.geronimo.corba.io.InputStreamBase;
+import org.apache.geronimo.corba.ior.InternalIOR;
+import org.apache.geronimo.corba.ior.URLManager;
+import org.apache.geronimo.corba.server.DefaultServerManager;
+import org.apache.geronimo.corba.server.ServantObject;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.NVList;
-import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.Object;
+import org.omg.CORBA.Policy;
import org.omg.CORBA.Request;
+import org.omg.CORBA.TRANSIENT;
import org.omg.CORBA.WrongTransaction;
+import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.portable.OutputStream;
-import org.apache.geronimo.corba.dii.NVListImpl;
-import org.apache.geronimo.corba.io.DefaultConnectionManager;
-import org.apache.geronimo.corba.io.EncapsulationInputStream;
-import org.apache.geronimo.corba.io.InputStreamBase;
-import org.apache.geronimo.corba.ior.InternalIOR;
-
+import EDU.oswego.cs.dl.util.concurrent.Executor;
+import EDU.oswego.cs.dl.util.concurrent.ThreadedExecutor;
public class ORB extends AbstractORB {
- private DefaultConnectionManager cm;
+ private static final Log log = LogFactory.getLog(ORB.class);
+
+ private DefaultConnectionManager cm;
- protected void set_parameters(String[] args, Properties props) {
- // TODO Auto-generated method stub
+ private URLManager urlManager = new URLManager(this);
- }
+ private Executor executor;
- protected void set_parameters(Applet app, Properties props) {
- // TODO Auto-generated method stub
-
- }
-
- public String[] list_initial_services() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Object resolve_initial_references(String object_name)
- throws InvalidName
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String object_to_string(Object obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Object string_to_object(String str) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public NVList create_list(int count) {
- return new NVListImpl(this, count);
- }
-
- public ContextList create_context_list() {
- throw new NO_IMPLEMENT();
- }
-
- public Context get_default_context() {
- throw new NO_IMPLEMENT();
- }
-
- public OutputStream create_output_stream() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void send_multiple_requests_oneway(Request[] req) {
- // TODO Auto-generated method stub
-
- }
-
- public void send_multiple_requests_deferred(Request[] req) {
- // TODO Auto-generated method stub
-
- }
-
- public boolean poll_next_response() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public Request get_next_response() throws WrongTransaction {
- // TODO Auto-generated method stub
- return null;
- }
-
- public synchronized ConnectionManager getConnectionManager() {
- if (cm == null) {
- cm = new DefaultConnectionManager(this);
- }
- return cm;
- }
-
- public InvocationProfileSelector createInvocationProfileSelector(
- ClientDelegate delegate)
- {
- return new InvocationProfileSelector(this, delegate);
- }
-
- public InvocationProfile[] getInvocationProfiles(InternalIOR ior) {
- return getConnectionManager().getInvocationProfiles(ior);
- }
-
- public InputStreamBase getEncapsulationInputStream(byte[] component_data) {
- return new EncapsulationInputStream(this, component_data);
- }
+ private ServerManager sm;
+
+ protected void set_parameters(String[] args, Properties props) {
+ sm = new DefaultServerManager(this);
+
+ if (cm == null) {
+ try {
+ cm = new DefaultConnectionManager(this);
+ } catch (IOException e) {
+ e.printStackTrace();
+ TRANSIENT t = new TRANSIENT();
+ t.initCause(e);
+ throw t;
+ }
+ }
+ }
+
+ protected void set_parameters(Applet app, Properties props) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String[] list_initial_services() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object resolve_initial_references(String object_name)
+ throws InvalidName {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String object_to_string(Object obj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object string_to_object(String str) {
+ return urlManager.createObject(str);
+ }
+
+ public NVList create_list(int count) {
+ return new NVListImpl(this, count);
+ }
+
+ public ContextList create_context_list() {
+ throw new NO_IMPLEMENT();
+ }
+
+ public Context get_default_context() {
+ throw new NO_IMPLEMENT();
+ }
+
+ public OutputStream create_output_stream() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void send_multiple_requests_oneway(Request[] req) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void send_multiple_requests_deferred(Request[] req) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean poll_next_response() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Request get_next_response() throws WrongTransaction {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public synchronized ConnectionManager getConnectionManager() {
+ return cm;
+ }
+
+ public InvocationProfileSelector createInvocationProfileSelector(
+ ClientDelegate delegate) {
+ return new InvocationProfileSelector(this, delegate);
+ }
+
+ public InvocationProfile[] getInvocationProfiles(InternalIOR ior) {
+ return getConnectionManager().getInvocationProfiles(ior);
+ }
+
+ public InputStreamBase getEncapsulationInputStream(byte[] component_data) {
+ return new EncapsulationInputStream(this, component_data);
+ }
+
+ public void __checkDestroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /** return a string that is the host name to use as "localhost". */
+ public String getLocalHost() {
+ // TODO Auto-generated method stub
+ return "localhost";
+ }
+
+ public Policy[] getPolicies() {
+ return new Policy[0];
+ }
+
+ public Executor getExecutor() {
+ if (executor == null) {
+ executor = new ThreadedExecutor();
+ }
+ return executor;
+ }
+
+ public ServerManager __getServerManager() {
+ return sm;
+ }
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/PlainObject.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/PlainObject.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/PlainObject.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/PlainObject.java Thu Dec 1 23:58:55 2005
@@ -21,7 +21,15 @@
public class PlainObject extends ObjectImpl {
- ClientDelegate __get_delegate() {
+ public PlainObject() {
+
+ }
+
+ public PlainObject(ClientDelegate delegate) {
+ _set_delegate(delegate);
+ }
+
+ ClientDelegate __get_delegate() {
return (ClientDelegate) _get_delegate();
}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ServerManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ServerManager.java?rev=351623&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ServerManager.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ServerManager.java Thu Dec 1 23:58:55 2005
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.corba;
+
+import org.apache.geronimo.corba.ior.InternalIOR;
+import org.apache.geronimo.corba.server.ServantObject;
+import org.omg.CORBA.Policy;
+
+/** The ServerManager owns the POA structure */
+public interface ServerManager {
+
+ /** find a servant object for this IOR */
+ ServantObject getServantObject(InternalIOR ior, Policy[] policies)
+ throws LocationForwardException;
+
+}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/FilterInputChannel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/FilterInputChannel.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/FilterInputChannel.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/FilterInputChannel.java Thu Dec 1 23:58:55 2005
@@ -64,4 +64,8 @@
ch.relinquish();
}
+ public ByteOrder getOrder() {
+ return ch.getOrder();
+ }
+
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/InputChannel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/InputChannel.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/InputChannel.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/InputChannel.java Thu Dec 1 23:58:55 2005
@@ -49,4 +49,6 @@
public abstract void setOrder(ByteOrder order);
+ public abstract ByteOrder getOrder();
+
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/OutputChannel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/OutputChannel.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/OutputChannel.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/OutputChannel.java Thu Dec 1 23:58:55 2005
@@ -19,7 +19,7 @@
import java.io.IOException;
import java.io.OutputStream;
-
+/** for now, this is always big endian writing */
public abstract class OutputChannel extends OutputStream {
public abstract void writeByte(byte b) throws IOException;
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingBuffer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingBuffer.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingBuffer.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingBuffer.java Thu Dec 1 23:58:55 2005
@@ -150,13 +150,19 @@
RingBuffer.this.setByteOrderForGet(order);
}
+ public ByteOrder getOrder() {
+ return RingBuffer.this.getByteOrderForGet();
+ }
+
};
public OutputChannel getOutputChannel() {
return outputView;
}
- protected abstract void setByteOrderForGet(ByteOrder order);
+ protected abstract ByteOrder getByteOrderForGet();
+
+ protected abstract void setByteOrderForGet(ByteOrder order);
protected abstract void relinquishInput();
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingByteBuffer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingByteBuffer.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingByteBuffer.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/RingByteBuffer.java Thu Dec 1 23:58:55 2005
@@ -34,6 +34,7 @@
import java.util.List;
import org.apache.geronimo.corba.concurrency.IOSemaphoreClosedException;
+import org.apache.geronimo.corba.util.HexUtil;
/**
@@ -424,6 +425,10 @@
byteBuffer.order(order);
}
+ protected ByteOrder getByteOrderForGet() {
+ return byteBuffer.order();
+ }
+
protected int getInt() throws IOException {
ensureGetSpace(4);
int result;
@@ -639,6 +644,7 @@
public AsyncMarkState(MarkHandler handler) {
this.handler = handler;
+ this.position = nextPutPos;
}
public void release() {
@@ -671,6 +677,7 @@
nextPutPos = incr(position, idx);
RingByteBuffer.this.putByte(b);
nextPutPos = oldPut;
+ permits -= 1;
}
public void putInt(int idx, int b) throws IOException {
@@ -678,6 +685,7 @@
nextPutPos = incr(position, idx);
RingByteBuffer.this.putInt(b);
nextPutPos = oldPut;
+ permits -= 4;
}
public void putLong(int idx, long b) throws IOException {
@@ -685,6 +693,7 @@
nextPutPos = incr(position, idx);
RingByteBuffer.this.putLong(b);
nextPutPos = oldPut;
+ permits -= 8;
}
}
@@ -750,20 +759,18 @@
int count;
+ HexUtil.printHex(System.out, "S: ", buffers);
+
try {
if (buffers.length == 1) {
count = chan.write(buffers[0]);
} else {
count = (int) chan.write(buffers);
}
-
- }
- catch (ChannelClosedException ex) {
+ } catch (ChannelClosedException ex) {
close();
count = 0;
-
- }
- catch (InterruptedIOException ex) {
+ } catch (InterruptedIOException ex) {
count = ex.bytesTransferred;
}
@@ -970,7 +977,22 @@
long after = System.currentTimeMillis();
System.out.println("" + new Date() + " did read " + count
+ " bytes OF " + bufsize + " TOOK " + (after - before) + " ms");
-
+/*
+ int length = count;
+ for (int i = buffers.length-1; i >- 0; i--) {
+ int bufsz = buffers[i].position();
+ if (length > bufsz) {
+ buffers[i].position(0);
+ length -= bufsz;
+ } else {
+ buffers[i].position(bufsz-length);
+ break;
+ }
+ }
+
+ HexUtil.printHex(System.out, "R:", buffers);
+*/
+
if (count == -1) {
closePutEnd();
return true;
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/SocketTransportBase.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/SocketTransportBase.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/SocketTransportBase.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/SocketTransportBase.java Thu Dec 1 23:58:55 2005
@@ -25,279 +25,258 @@
import org.apache.geronimo.corba.channel.nio.ParticipationExecutor;
-
public abstract class SocketTransportBase extends Transport {
- static protected final int RCV_BUFFER_SIZE = getIntProperty("org.freeorb.rcv_buffer_size", 64 * 1024);
-
- static protected final int SND_BUFFER_SIZE = getIntProperty("org.freeorb.snd_buffer_size", 64 * 1024);
-
- protected InputHandler handler;
+ static protected final int RCV_BUFFER_SIZE = getIntProperty(
+ "org.freeorb.rcv_buffer_size", 64 * 1024);
- protected Thread inputWorker;
+ static protected final int SND_BUFFER_SIZE = getIntProperty(
+ "org.freeorb.snd_buffer_size", 64 * 1024);
- protected Sync inputWorkerLock = new Mutex();
-
- protected RingByteBuffer receiveBuffer;
-
- protected RingByteBuffer sendBuffer;
-
- protected Semaphore outputWorkerLock = new Semaphore(1);
-
- protected Thread outputWorker;
-
- protected TransportManager manager;
-
- private ParticipationExecutor executor;
-
- protected Socket sock;
-
- protected SocketTransportBase(TransportManager manager, InputHandler handler, Socket sock) {
- this.manager = manager;
- this.handler = handler;
- this.executor = new ParticipationExecutor(manager.getExecutor());
- this.sock = sock;
-
- this.receiveBuffer = allocateReceiveBuffer(RCV_BUFFER_SIZE);
- this.sendBuffer = allocateSendBuffer(SND_BUFFER_SIZE);
- }
-
-
- protected abstract RingByteBuffer allocateSendBuffer(int bufferSize);
-
- protected abstract RingByteBuffer allocateReceiveBuffer(int bufferSize);
-
-
- private static int getIntProperty(String string, int defaultValue) {
- try {
- return Integer.parseInt(System.getProperty(string, ""));
- }
- catch (NumberFormatException ex) {
- return defaultValue;
- }
- }
-
- public void releaseOutputChannel() {
- if (outputWorker == Thread.currentThread()) {
-
- try {
- sendBuffer.flush();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
-
- outputWorker = null;
- outputWorkerLock.release();
- }
- }
-
- /**
- * wait for the output channel to become available
- */
- public OutputChannel getOutputChannel() {
-
- do {
- try {
- outputWorkerLock.acquire();
- }
- catch (InterruptedException e) {
- continue;
- }
- }
- while (false);
-
- assertEquals(outputWorker, null);
-
- outputWorker = Thread.currentThread();
- return sendBuffer.getOutputChannel();
- }
-
- public InputChannel getInputChannel() {
- LOOP:
- do {
- try {
- inputWorkerLock.acquire();
- }
- catch (InterruptedException e) {
- continue LOOP;
- }
- }
- while (false);
-
- try {
-
- if (inputWorker == null) {
- inputWorker = Thread.currentThread();
-
- } else if (inputWorker != Thread.currentThread()) {
- throw new IllegalStateException(
- "only the designated input worker can do that");
- }
-
- }
- finally {
- inputWorkerLock.release();
- }
-
- return receiveBuffer.getInputChannel();
- }
-
- /**
- * this runnable is started when input is available
- */
- protected final Runnable processInput = new Runnable() {
- public void run() {
-
- assertEquals(inputWorker, null);
-
- inputWorker = Thread.currentThread();
- try {
- inputWorkerLock.release();
- handler.inputAvailable(SocketTransportBase.this);
- }
- catch (Error e) {
- e.printStackTrace();
- }
- catch (RuntimeException e) {
- e.printStackTrace();
- }
- finally {
- releaseOutputChannel();
- unsetInputWorker();
- }
- }
- };
-
- /**
- * to be called when something is added to the input buffer
- */
- protected void processAvailableInput() throws InterruptedException {
- inputWorkerLock.acquire();
-
- // is there someone processing input?
- // if not, then we need to start a new
- // input processor
-
- if (inputWorker == null && !receiveBuffer.isEmpty()
- && handler != null)
- {
- executor.execute(processInput);
- } else {
- inputWorkerLock.release();
- }
- }
-
-
- public void releaseInputChannel() {
- unsetInputWorker();
- }
-
- void unsetInputWorker() {
-
- Thread.interrupted();
-
- do {
- try {
- inputWorkerLock.acquire();
- }
- catch (InterruptedException e) {
- continue;
- }
- }
- while (false);
-
- if (inputWorker == Thread.currentThread()) {
- inputWorker = null;
- if (!receiveBuffer.isEmpty() && handler != null) {
- // we're done with this request, but there
- // is a new request (partially) available
-
- do {
- try {
- executor.execute(processInput);
- }
- catch (InterruptedException e) {
- continue;
- }
- }
- while (false);
- } else {
- // we're done with this request and there is
- // no more input
- inputWorkerLock.release();
- }
- } else {
- // response was given to another thread via signalResponse
- inputWorkerLock.release();
- }
-
- }
-
- void registerResponse(Object key) {
-
- }
-
- public Object waitForResponse(Object key) {
-
- do {
- try {
- inputWorkerLock.acquire();
- }
- catch (InterruptedException e) {
- continue;
- }
- }
- while (false);
-
- if (inputWorker == Thread.currentThread()) {
- inputWorker = null;
- }
- inputWorkerLock.release();
-
- Object value = executor.participate(key);
-
- inputWorker = Thread.currentThread();
- inputWorkerLock.release(); // {22}
-
- return value;
- }
-
- public void signalResponse(Object key, Object value) {
- assertEquals(inputWorker, Thread.currentThread());
-
- // this lock is released at {22}, when the
- // relevant participant reaquires control
- do {
- try {
- inputWorkerLock.acquire();
- }
- catch (InterruptedException e) {
- continue;
- }
- }
- while (false);
-
- inputWorker = null;
- executor.release(key, value);
- }
-
-
- public void setInputHandler(InputHandler handler) {
- this.handler = handler;
- }
-
-
- private void assertEquals(Object o1, Object o2) {
- if (o1 != o2) {
- throw new IllegalStateException("assertion failed");
- }
- }
-
-
- public void close() throws IOException {
- sock.close();
- }
+ protected InputHandler handler;
+ protected Thread inputWorker;
+
+ protected Sync inputWorkerLock = new Mutex();
+
+ protected RingByteBuffer receiveBuffer;
+
+ protected RingByteBuffer sendBuffer;
+
+ protected Semaphore outputWorkerLock = new Semaphore(1);
+
+ protected Thread outputWorker;
+
+ protected TransportManager manager;
+
+ private ParticipationExecutor executor;
+
+ protected Socket sock;
+
+ protected SocketTransportBase(TransportManager manager,
+ InputHandler handler, Socket sock) {
+ this.manager = manager;
+ this.handler = handler;
+ this.executor = new ParticipationExecutor(manager.getExecutor());
+ this.sock = sock;
+
+ this.receiveBuffer = allocateReceiveBuffer(RCV_BUFFER_SIZE);
+ this.sendBuffer = allocateSendBuffer(SND_BUFFER_SIZE);
+ }
+
+ protected abstract RingByteBuffer allocateSendBuffer(int bufferSize);
+
+ protected abstract RingByteBuffer allocateReceiveBuffer(int bufferSize);
+
+ private static int getIntProperty(String string, int defaultValue) {
+ try {
+ return Integer.parseInt(System.getProperty(string, ""));
+ } catch (NumberFormatException ex) {
+ return defaultValue;
+ }
+ }
+
+ public void releaseOutputChannel() {
+ if (outputWorker == Thread.currentThread()) {
+
+ try {
+ sendBuffer.flush();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ outputWorker = null;
+ outputWorkerLock.release();
+ }
+ }
+
+ /**
+ * wait for the output channel to become available
+ */
+ public OutputChannel getOutputChannel() {
+
+ do {
+ try {
+ outputWorkerLock.acquire();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ } while (false);
+
+ assertEquals(outputWorker, null);
+
+ outputWorker = Thread.currentThread();
+ return sendBuffer.getOutputChannel();
+ }
+
+ public InputChannel getInputChannel() {
+ LOOP: do {
+ try {
+ inputWorkerLock.acquire();
+ } catch (InterruptedException e) {
+ continue LOOP;
+ }
+ } while (false);
+
+ try {
+
+ if (inputWorker == null) {
+ inputWorker = Thread.currentThread();
+
+ } else if (inputWorker != Thread.currentThread()) {
+ throw new IllegalStateException(
+ "only the designated input worker can do that");
+ }
+
+ } finally {
+ inputWorkerLock.release();
+ }
+
+ return receiveBuffer.getInputChannel();
+ }
+
+ /**
+ * this runnable is started when input is available
+ */
+ protected final Runnable processInput = new Runnable() {
+ public void run() {
+
+ assertEquals(inputWorker, null);
+
+ inputWorker = Thread.currentThread();
+ try {
+ inputWorkerLock.release();
+ handler.inputAvailable(SocketTransportBase.this);
+ } catch (Error e) {
+ e.printStackTrace();
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ } finally {
+ releaseOutputChannel();
+ unsetInputWorker();
+ }
+ }
+ };
+
+ /**
+ * to be called when something is added to the input buffer
+ */
+ protected void processAvailableInput() throws InterruptedException {
+ inputWorkerLock.acquire();
+
+ // is there someone processing input?
+ // if not, then we need to start a new
+ // input processor
+
+ if (inputWorker == null && !receiveBuffer.isEmpty() && handler != null) {
+ executor.execute(processInput);
+ } else {
+ inputWorkerLock.release();
+ }
+ }
+
+ public void releaseInputChannel() {
+ unsetInputWorker();
+ }
+
+ void unsetInputWorker() {
+
+ Thread.interrupted();
+
+ do {
+ try {
+ inputWorkerLock.acquire();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ } while (false);
+
+ if (inputWorker == Thread.currentThread()) {
+ inputWorker = null;
+ if (!receiveBuffer.isEmpty() && handler != null) {
+ // we're done with this request, but there
+ // is a new request (partially) available
+
+ do {
+ try {
+ executor.execute(processInput);
+ } catch (InterruptedException e) {
+ continue;
+ }
+ } while (false);
+ } else {
+ // we're done with this request and there is
+ // no more input
+ inputWorkerLock.release();
+ }
+ } else {
+ // response was given to another thread via signalResponse
+ inputWorkerLock.release();
+ }
+
+ }
+
+ public void registerResponse(Object key) {
+ executor.create(key);
+ }
+
+ public Object waitForResponse(Object key) {
+
+ do {
+ try {
+ inputWorkerLock.acquire();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ } while (false);
+
+ if (inputWorker == Thread.currentThread()) {
+ inputWorker = null;
+ }
+ inputWorkerLock.release();
+
+ Object value = null;
+ try {
+ value = executor.participate(key);
+ } catch (InterruptedException e) {
+ // TODO: dont ignore
+ }
+
+ inputWorker = Thread.currentThread();
+ inputWorkerLock.release(); // {22}
+
+ return value;
+ }
+
+ public void signalResponse(Object key, Object value) {
+ assertEquals(inputWorker, Thread.currentThread());
+
+ // this lock is released at {22}, when the
+ // relevant participant reaquires control
+ do {
+ try {
+ inputWorkerLock.acquire();
+ } catch (InterruptedException e) {
+ continue;
+ }
+ } while (false);
+
+ inputWorker = null;
+ executor.release(key, value);
+ }
+
+ public void setInputHandler(InputHandler handler) {
+ this.handler = handler;
+ }
+
+ private void assertEquals(Object o1, Object o2) {
+ if (o1 != o2) {
+ throw new IllegalStateException("assertion failed");
+ }
+ }
+
+ public void close() throws IOException {
+ sock.close();
+ }
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/Transport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/Transport.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/Transport.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/Transport.java Thu Dec 1 23:58:55 2005
@@ -50,4 +50,8 @@
public abstract void setInputHandler(InputHandler handler);
+ public void registerResponse(Object object) {
+ // TODO Auto-generated method stub
+ }
+
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOSocketTransport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOSocketTransport.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOSocketTransport.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOSocketTransport.java Thu Dec 1 23:58:55 2005
@@ -178,8 +178,8 @@
try {
sendBuffer.writeTo(chan);
- if (sendBuffer.isClosed() && sendBuffer.isEmpty()) {
- removeInterest(SelectionKey.OP_WRITE, "output closed");
+ if (sendBuffer.isClosed() || sendBuffer.isEmpty()) {
+ removeInterest(SelectionKey.OP_WRITE, "output closed/empty");
}
}
Modified: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOTransportManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOTransportManager.java?rev=351623&r1=351622&r2=351623&view=diff
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOTransportManager.java (original)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/channel/nio/AsyncNIOTransportManager.java Thu Dec 1 23:58:55 2005
@@ -37,7 +37,7 @@
private final Executor executor;
- AsyncNIOTransportManager(Executor executor) throws IOException {
+ public AsyncNIOTransportManager(Executor executor) throws IOException {
this(executor, SelectorProvider.provider());
}