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/10/28 04:00:22 UTC

svn commit: r329036 [6/7] - in /geronimo/trunk/sandbox/freeorb: ./ geronimo-orb/ geronimo-orb/src/ geronimo-orb/src/main/ geronimo-orb/src/main/java/ geronimo-orb/src/main/java/org/ geronimo-orb/src/main/java/org/apache/ geronimo-orb/src/main/java/org/...

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/InputStreamBase.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/InputStreamBase.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/InputStreamBase.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/InputStreamBase.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,278 @@
+/**
+ *
+ * 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.io;
+
+import java.io.IOException;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.ClientDelegate;
+import org.apache.geronimo.corba.PlainObject;
+import org.apache.geronimo.corba.ior.InternalIOR;
+import org.apache.geronimo.corba.util.IntegerToObjectHashMap;
+import org.apache.geronimo.corba.util.IntegerToObjectMap;
+
+
+public abstract class InputStreamBase extends org.omg.CORBA_2_3.portable.InputStream {
+
+    /**
+     * returns the logical current stream position
+     */
+    public abstract int __stream_position();
+
+    /**
+     * Return our ORB implementation
+     */
+    protected abstract AbstractORB __orb();
+
+    public ORB orb() {
+        return __orb();
+    }
+
+    private IntegerToObjectMap valueMap;
+    private CharConverter char_converter;
+    private CharConverter wchar_converter;
+
+    IntegerToObjectMap __get_value_map() {
+        if (valueMap == null) {
+            valueMap = new IntegerToObjectHashMap();
+        }
+        return valueMap;
+    }
+
+    private void __register_value(int pos, Object value) {
+        __get_value_map().put(pos, value);
+    }
+
+    private Object __lookup_value(int pos) {
+        return __get_value_map().get(pos);
+    }
+
+
+    public short read_ushort() {
+        return read_short();
+    }
+
+    public int read_ulong() {
+        return read_long();
+    }
+
+    public final long read_ulonglong() {
+        return read_longlong();
+    }
+
+    public final float read_float() {
+        return Float.intBitsToFloat(read_long());
+    }
+
+    public final double read_double() {
+        return Double.longBitsToDouble(read_longlong());
+    }
+
+    public final boolean read_boolean() {
+        return read_octet() == 0 ? false : true;
+    }
+
+    public final char read_char() {
+        CharConverter converter = __get_char_converter();
+        return converter.read_char(this);
+    }
+
+    protected void __set_char_converter(CharConverter converter) {
+        this.char_converter = converter;
+    }
+
+    protected void __set_wchar_converter(CharConverter converter) {
+        this.wchar_converter = converter;
+    }
+
+    private CharConverter __get_char_converter() {
+        if (char_converter == null) {
+            char_converter = __orb().get_char_converter(getGIOPVersion());
+        }
+
+        return char_converter;
+    }
+
+    public final char read_wchar() {
+        CharConverter converter = __get_wchar_converter();
+        return converter.read_char(this);
+    }
+
+    private CharConverter __get_wchar_converter() {
+        if (wchar_converter == null) {
+            wchar_converter = __orb().get_wchar_converter(getGIOPVersion());
+        }
+
+        return wchar_converter;
+    }
+
+    public final String read_string() {
+        int tag = read_long();
+        int tag_position = __stream_position() - 4;
+        if (tag == -1) {
+            int off = read_long();
+            int pos = tag_position + off;
+            return (String) __lookup_value(pos);
+        } else {
+            int pos = tag_position;
+            CharConverter converter = __get_char_converter();
+            String value = converter.read_string(this, tag);
+            __register_value(pos, value);
+            return value;
+        }
+    }
+
+
+    public final String read_wstring() {
+        int tag = read_long();
+        int tag_position = __stream_position() - 4;
+        if (tag == -1) {
+            int off = read_long();
+            int pos = tag_position + off;
+            return (String) __lookup_value(pos);
+        } else {
+            int pos = tag_position;
+            CharConverter converter = __get_wchar_converter();
+            String value = converter.read_string(this, tag);
+            __register_value(pos, value);
+            return value;
+        }
+    }
+
+    public final void read_boolean_array(boolean[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_boolean();
+        }
+    }
+
+    public final void read_char_array(char[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_char();
+        }
+    }
+
+    public final void read_wchar_array(char[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_wchar();
+        }
+    }
+
+    public final void read_short_array(short[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_short();
+        }
+    }
+
+    public final void read_ushort_array(short[] value, int offset, int length) {
+        read_short_array(value, offset, length);
+    }
+
+    public final void read_long_array(int[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_long();
+        }
+    }
+
+    public final void read_ulong_array(int[] value, int offset, int length) {
+        read_long_array(value, offset, length);
+    }
+
+    public final void read_longlong_array(long[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_longlong();
+        }
+    }
+
+    public final void read_ulonglong_array(long[] value, int offset, int length) {
+        read_longlong_array(value, offset, length);
+    }
+
+    public final void read_float_array(float[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_float();
+        }
+    }
+
+    public final void read_double_array(double[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_double();
+        }
+    }
+
+    public final void read_any_array(org.omg.CORBA.Any[] value, int offset,
+                                     int length)
+    {
+        for (int i = 0; i < length; i++) {
+            value[i + offset] = read_any();
+        }
+    }
+
+    public final Any read_any() {
+        org.omg.CORBA.Any any = new org.freeorb.AnyImpl(__orb());
+        any.read_value(this, read_TypeCode());
+        return any;
+    }
+
+    public final TypeCode read_TypeCode() {
+        return org.freeorb.TypeCodeUtil.read(this, this, new java.util.HashMap());
+    }
+
+    public void read_octet_array(byte[] data, int off, int len) {
+        for (int i = 0; i < len; i++) {
+            data[i + off] = read_octet();
+        }
+    }
+
+    public final org.omg.CORBA.Object read_Object() {
+        InternalIOR ior = InternalIOR.read(__orb(), this);
+        ClientDelegate del = new ClientDelegate(ior);
+        ObjectImpl result = new PlainObject();
+        result._set_delegate(del);
+        return result;
+    }
+
+    public EncapsulationInputStream __open_encapsulation() {
+        int len = read_long();
+        byte[] data = new byte[len];
+        read_octet_array(data, 0, len);
+        return new EncapsulationInputStream(__orb(), data);
+    }
+
+    public void __close_encapsulation(EncapsulationInputStream encap) {
+
+    }
+
+    protected abstract GIOPVersion getGIOPVersion();
+
+    protected SystemException translate_exception(IOException e) {
+        SystemException result;
+
+        result = new MARSHAL(e.getMessage());
+        result.initCause(e);
+
+        return result;
+    }
+
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MessageHeader.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MessageHeader.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MessageHeader.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MessageHeader.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,43 @@
+/**
+ *
+ * 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.io;
+
+
+public class MessageHeader {
+
+    private int kind;
+    private int requestID;
+    private GIOPVersion version;
+
+    public int getMessageKind() {
+        return kind;
+    }
+
+    public int getRequestID() {
+        return requestID;
+    }
+
+    public boolean getFragmentsFollow() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public GIOPVersion getGIOPVersion() {
+        return version;
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MinorCodes.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MinorCodes.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MinorCodes.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/MinorCodes.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,28 @@
+/**
+ *
+ * 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.io;
+
+public abstract class MinorCodes {
+
+    public static final int FREEORB_ID = 0x12345 << 12;
+    public static final int BAD_MAGIC = 1 | FREEORB_ID;
+    public static final int BAD_MAJOR = 2 | FREEORB_ID;
+    public static final int BAD_MINOR = 3 | FREEORB_ID;
+    public static final int END_OF_ENCAPSULATION = 4 | FREEORB_ID;
+
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/OutputStreamBase.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/OutputStreamBase.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/OutputStreamBase.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/OutputStreamBase.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,346 @@
+/**
+ *
+ * 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.io;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.ClientDelegate;
+import org.apache.geronimo.corba.TypeCodeUtil;
+
+
+public abstract class OutputStreamBase extends OutputStream implements
+                                                            org.omg.CORBA.DataOutputStream
+{
+
+    private CharConverter char_writer;
+
+    private CharConverter wchar_writer;
+
+    private ValueWriter value_writer;
+
+    public abstract AbstractORB __orb();
+
+    public ORB orb() {
+        return __orb();
+    }
+
+    public InputStream create_input_stream() {
+        throw new NO_RESOURCES();
+    }
+
+    public void write_boolean(boolean value) {
+        write_octet(value ? (byte) 1 : (byte) 0);
+    }
+
+    public void write_char(char value) {
+        CharConverter char_converter = __get_char_converter();
+        char_converter.write_char(this, value);
+    }
+
+    private CharConverter __get_char_converter() {
+        if (char_writer == null) {
+            char_writer = __orb().get_char_converter(getGIOPVersion());
+        }
+        return char_writer;
+    }
+
+    private CharConverter __get_wchar_converter() {
+        if (wchar_writer == null) {
+            wchar_writer = __orb().get_char_converter(getGIOPVersion());
+        }
+        return wchar_writer;
+    }
+
+    private GIOPVersion getGIOPVersion() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void write(int value) throws IOException {
+        try {
+            write_octet((byte) value);
+        }
+        catch (SystemException e) {
+            IOException ex = new IOException();
+            ex.initCause(e);
+            throw ex;
+        }
+    }
+
+    public void write_wchar(char value) {
+        CharConverter char_converter = __get_wchar_converter();
+        char_converter.write_char(this, value);
+    }
+
+    public void write_ushort(short value) {
+        write_short(value);
+    }
+
+    public void write_ulong(int value) {
+        write_long(value);
+    }
+
+    public void write_ulonglong(long value) {
+        write_longlong(value);
+    }
+
+    public void write_float(float value) {
+        write_long(Float.floatToIntBits(value));
+    }
+
+    public void write_double(double value) {
+        write_longlong(Double.doubleToLongBits(value));
+    }
+
+    public void write_string(String value) {
+        __get_char_converter().write_string(this, value);
+    }
+
+    public void write_wstring(String value) {
+        __get_wchar_converter().write_string(this, value);
+    }
+
+    public void write_boolean_array(boolean[] value, int offset, int length) {
+        for (int i = 0; i < length; i++) {
+            write_boolean(value[offset + i]);
+        }
+    }
+
+    public void write_char_array(char[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_char(value[i]);
+        }
+    }
+
+    public void write_wchar_array(char[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_wchar(value[i]);
+        }
+    }
+
+    public void write_octet_array(byte[] value, int offset, int length) {
+        try {
+            write(value, offset, length);
+        }
+        catch (IOException e) {
+            throw translate_exception(e);
+        }
+    }
+
+    public void write_short_array(short[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_short(value[i]);
+        }
+    }
+
+    public void write_ushort_array(short[] value, int offset, int length) {
+        write_short_array(value, offset, length);
+    }
+
+    public void write_long_array(int[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_long(value[i]);
+        }
+    }
+
+    public void write_ulong_array(int[] value, int offset, int length) {
+        write_long_array(value, offset, length);
+    }
+
+    public void write_longlong_array(long[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_longlong(value[i]);
+        }
+    }
+
+    public void write_ulonglong_array(long[] value, int offset, int length) {
+        write_longlong_array(value, offset, length);
+    }
+
+    public void write_float_array(float[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_float(value[i]);
+        }
+    }
+
+    public void write_double_array(double[] value, int offset, int length) {
+        for (int i = offset; i < offset + length; i++) {
+            write_double(value[i]);
+        }
+    }
+
+    public void write_Object(Object value) {
+        if (value == null) {
+            // write null IOR
+            write_string("");
+            write_ulong(0);
+        } else {
+            if (value instanceof LocalObject)
+                throw new org.omg.CORBA.MARSHAL("cannot marshal local object");
+
+            ClientDelegate delegate = (ClientDelegate) ((org.omg.CORBA.portable.ObjectImpl) value)
+                    ._get_delegate();
+
+            delegate.getInternalIOR().write(this);
+        }
+    }
+
+    public void write_TypeCode(TypeCode value) {
+
+        if (value == null) {
+            throw new org.omg.CORBA.BAD_TYPECODE("null typecode");
+        }
+
+        try {
+            TypeCodeUtil.write(this, value, new HashMap());
+
+        }
+        catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+            throw new org.omg.CORBA.BAD_TYPECODE(ex.getMessage());
+
+        }
+        catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+            throw new org.omg.CORBA.BAD_TYPECODE(ex.getMessage());
+        }
+    }
+
+    public void write_any(Any value) {
+        write_TypeCode(value.type());
+        value.write_value(this);
+    }
+
+    protected SystemException translate_exception(IOException e) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public abstract int __stream_position();
+
+    //
+    // org.omg.CORBA_2_3.portable.OutputStream
+    //
+
+    ValueWriter getValueWriter() {
+        if (value_writer == null) {
+            value_writer = new ValueWriter(this);
+        }
+        return value_writer;
+    }
+
+    public void write_value(java.io.Serializable value) {
+        getValueWriter().writeValue(value, (String) null);
+    }
+
+    public void write_value(java.io.Serializable value, String id) {
+        getValueWriter().writeValue(value, id);
+    }
+
+    public void write_value(java.io.Serializable value, Class clz) {
+        getValueWriter().writeValue(value, (String) null);
+    }
+
+    public void write_value(java.io.Serializable value,
+                            org.omg.CORBA.portable.BoxedValueHelper helper)
+    {
+        getValueWriter().writeValue(value, helper);
+    }
+
+    public void write_abstract_interface(java.lang.Object value) {
+        if (value == null) {
+            write_boolean(false);
+            write_long(0);
+
+        } else if (value instanceof org.omg.CORBA.Object) {
+            write_boolean(true);
+            write_Object((org.omg.CORBA.Object) value);
+
+        } else if (value instanceof java.io.Serializable) {
+
+            //
+            // We select on Serializable first, since CORBA stubs are
+            // serializable, an that allows RMI/CORBA stubs to be
+            // passed around without requiring narrow.
+            //
+
+            write_boolean(false);
+            write_value((Serializable) value);
+
+        } else {
+            throw new org.omg.CORBA.MARSHAL("not a valid abstract object: "
+                                            + value.getClass().getName());
+        }
+    }
+
+    //
+    // DataOutputStream
+    //
+
+    public String[] _truncatable_ids() {
+        throw new org.omg.CORBA.NO_IMPLEMENT();
+    }
+
+    public void write_Abstract(java.lang.Object value) {
+        write_abstract_interface(value);
+    }
+
+    public void write_Value(java.io.Serializable value) {
+        write_value(value);
+    }
+
+    public void write_any_array(org.omg.CORBA.Any[] anies, int off, int len) {
+        for (int i = 0; i < len; i++) {
+            write_any(anies[i + off]);
+        }
+    }
+
+    // align output to the given size
+    public abstract void align(int i);
+
+    public void __fatal(String string) {
+        __orb().fatal(string);
+    }
+
+    public javax.rmi.CORBA.ValueHandler getValueHandler() {
+        return __orb().getValueHandler();
+    }
+
+    public EncapsulationOutputStream __open_encapsulation() {
+        return new EncapsulationOutputStream(__orb());
+    }
+
+    public void __close_encapsulation(EncapsulationOutputStream eout) {
+        try {
+            eout.writeTo(this);
+        }
+        catch (IOException e) {
+            throw translate_exception(e);
+        }
+    }
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/SSLClientConnectionFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/SSLClientConnectionFactory.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/SSLClientConnectionFactory.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/SSLClientConnectionFactory.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,31 @@
+/**
+ *
+ * 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.io;
+
+import org.apache.geronimo.corba.ior.IIOPTransportSpec;
+
+
+public class SSLClientConnectionFactory extends TCPClientConnectionFactory
+        implements ClientConnectionFactory
+{
+
+    public SSLClientConnectionFactory(IIOPTransportSpec transport) {
+        super(transport);
+        // TODO Auto-generated constructor stub
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TCPClientConnectionFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TCPClientConnectionFactory.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TCPClientConnectionFactory.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TCPClientConnectionFactory.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,40 @@
+/**
+ *
+ * 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.io;
+
+import org.apache.geronimo.corba.ior.IIOPTransportSpec;
+
+
+public class TCPClientConnectionFactory implements ClientConnectionFactory {
+
+    private final IIOPTransportSpec transport;
+
+    public TCPClientConnectionFactory(IIOPTransportSpec transport) {
+        this.transport = transport;
+    }
+
+    public ClientConnection getConnection() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public IIOPTransportSpec getTransportSpec() {
+        return transport;
+    }
+
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TLSClientConnectionFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TLSClientConnectionFactory.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TLSClientConnectionFactory.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/TLSClientConnectionFactory.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,31 @@
+/**
+ *
+ * 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.io;
+
+import org.apache.geronimo.corba.ior.IIOPTransportSpec;
+
+
+public class TLSClientConnectionFactory extends SSLClientConnectionFactory
+        implements ClientConnectionFactory
+{
+
+    public TLSClientConnectionFactory(IIOPTransportSpec transport) {
+        super(transport);
+        // TODO Auto-generated constructor stub
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ValueWriter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ValueWriter.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ValueWriter.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ValueWriter.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,510 @@
+/**
+ *
+ * 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.io;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import javax.rmi.CORBA.ValueHandler;
+
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.StreamableValue;
+import org.omg.CORBA.portable.ValueBase;
+
+import org.apache.geronimo.corba.channel.MarkHandler;
+import org.apache.geronimo.corba.channel.OutputChannelMarker;
+
+
+/**
+ * This class is not done.
+ */
+public class ValueWriter {
+
+    static final int TAG_VALUE = 0x7fffff00;
+
+    static final int TAG_CODEBASE_PRESENT = 1;
+
+    static final int TAG_SINGLE_ID_PRESENT = 2;
+
+    static final int TAG_MULTI_ID_PRESENT = 6;
+
+    static final int TAG_CHUNKED = 8;
+
+    static String[] EMPTY_SARR = new String[0];
+
+    private boolean isSet(int value, int bits) {
+        return (value & bits) == bits;
+    }
+
+    private Map instanceTable = new IdentityHashMap();
+
+    /**
+     * indirection table for value headers �15.3.4.3
+     */
+    private Map valueInfoTable = new HashMap();
+
+    private final OutputStreamBase out;
+
+    private OutputChannelMarker chunkMark;
+
+    private boolean currentValueIsChunked;
+
+    private int chunkingLevel;
+
+    private int startPosOfCurrentChunk;
+
+    private int lastEndTagPos;
+
+    private ValueHandler valueHandler;
+
+    private int valueOfLastEndTag;
+
+    public ValueWriter(OutputStreamBase out) {
+        this.out = out;
+    }
+
+    static class IDArray implements Serializable {
+
+        String[] ids;
+
+        int hashCode;
+
+        IDArray(String[] ids) {
+            this.ids = ids;
+
+            hashCode = 0;
+            for (int i = 0; i < ids.length; i++)
+                hashCode ^= ids[i].hashCode();
+        }
+
+        public int hashCode() {
+            return hashCode;
+        }
+
+        public boolean equals(Object other) {
+
+            if (!(other instanceof IDArray) || other == null)
+                return false;
+
+            return java.util.Arrays.equals(ids, ((IDArray) other).ids);
+        }
+    }
+
+    public void writeValue(java.io.Serializable value, String repositoryID) {
+        if (value == null) {
+            out.write_long(0);
+            return;
+        }
+
+        if (write_indirection(instanceTable, value)) {
+            return;
+        }
+
+        boolean isStreamable = (value instanceof StreamableValue);
+        boolean isCustom = (value instanceof CustomMarshal);
+
+        if (!(isStreamable || isCustom)) {
+            BoxedValueHelper helper = getHelper(value, null);
+            if (helper == null) {
+                writeRMIValue(value, repositoryID);
+            } else {
+                writeValue(value, helper);
+            }
+            return;
+        }
+
+        ValueBase base = (ValueBase) value;
+        String[] ids = base._truncatable_ids();
+        String valueID = ids[0];
+        boolean isTruncatable = ids.length > 1;
+
+        boolean sameType = false; // (valueID.equals (repositoryID));
+
+        boolean isChunked = (isCustom | (isTruncatable & !sameType));
+
+        int tag;
+
+        if (!sameType || (chunkingLevel > 1 && isTruncatable)) {
+
+            if (isTruncatable) {
+                tag = TAG_VALUE | TAG_MULTI_ID_PRESENT;
+
+            } else {
+                tag = TAG_VALUE | TAG_SINGLE_ID_PRESENT;
+
+                if (ids.length > 1) {
+                    ids = new String[1];
+                    ids[0] = valueID;
+                }
+            }
+        } else {
+            tag = TAG_VALUE;
+            ids = EMPTY_SARR;
+        }
+
+        // System.out.println ("write_value (1) "+repositoryID);
+
+        int pos = startValue(tag, ids, null, isChunked);
+        instanceTable.put(value, new Integer(pos));
+
+        if (isStreamable) {
+            ((StreamableValue) value)._write(out);
+        } else {
+            ((CustomMarshal) value).marshal(out);
+        }
+
+        endValue();
+    }
+
+    private void writeRMIValue(java.io.Serializable value, String id) {
+
+        if (value instanceof java.lang.String) {
+            org.omg.CORBA.WStringValueHelper.write(out, (String) value);
+            return;
+        }
+
+        if (valueHandler == null) {
+            valueHandler = out.getValueHandler();
+        }
+
+        //
+        // Needs writeReplace?
+        //
+        java.io.Serializable repValue = valueHandler.writeReplace(value);
+
+        //
+        // Repeat base checks if value was replaced
+        //
+        if (value != repValue) {
+            if (repValue == null) {
+                out.write_long(0);
+                return;
+            }
+
+            if (write_indirection(instanceTable, repValue)) {
+                return;
+            }
+
+            value = repValue;
+        }
+
+        //
+        // Get the class object for the value
+        //
+        Class clz = value.getClass();
+
+        //
+        // 0x7fffff00 + SINGLE_ID
+        //
+        int tag = TAG_VALUE | TAG_SINGLE_ID_PRESENT;
+
+        String codebase = javax.rmi.CORBA.Util.getCodebase(clz);
+        if (codebase != null && codebase.length() != 0)
+            tag |= TAG_CODEBASE_PRESENT;
+
+        //
+        // Determine the repository ID
+        //
+        String[] ids = new String[1];
+        ids[0] = valueHandler.getRMIRepositoryID(clz);
+
+        //
+        // Determine if chunked encoding is needed
+        //
+        // TODO: this was always true in Trifork codebase, find out why!
+
+        boolean isChunked = valueHandler.isCustomMarshaled(clz);
+
+        // System.out.println ("write_value (2) "+ids[0]);
+
+        int pos = startValue(tag, ids, codebase, isChunked);
+        instanceTable.put(value, new Integer(pos));
+        valueHandler.writeValue(out, value);
+        endValue();
+    }
+
+    public void writeValue(Serializable value, BoxedValueHelper helper) {
+
+        if (value == null) {
+            out.write_long(0);
+            return;
+        }
+
+        if (write_indirection(instanceTable, value)) {
+            return;
+        }
+
+        if (helper == null) {
+            helper = getHelper(value, null);
+        }
+
+        if (helper == null)
+            throw new org.omg.CORBA.MARSHAL("Can't locate helper");
+
+        String[] ids = new String[1];
+        ids[0] = helper.get_id();
+        int tag = TAG_VALUE | TAG_SINGLE_ID_PRESENT;
+
+        // System.out.println ("write_value (3) "+ids[0]);
+
+        int pos = startValue(tag, ids, null, false);
+        instanceTable.put(value, new Integer(pos));
+        helper.write_value(out, value);
+        endValue();
+
+    }
+
+    private int startValue(int tag, String[] ids, String codebase,
+                           boolean forceChunk)
+    {
+
+        currentValueIsChunked |= forceChunk;
+
+        if (currentValueIsChunked) {
+            tag |= TAG_CHUNKED;
+            chunkingLevel += 1;
+
+            //
+            // Since chunks cannot be nested, we need to finish off
+            // the previous chunk before we can start...
+            //
+            if ((chunkingLevel > 1) && (chunkMark != null))
+                endChunk();
+
+            // TODO: understand why we need to write a chunk end here.
+            // the next thing written to the output stream is a value
+            // tag, and that should be fine as an chunk-end-marker
+        }
+
+        out.write_long(tag);
+        int startPos = out.__stream_position() - 4;
+
+        if (isSet(tag, TAG_CODEBASE_PRESENT)) {
+            write_value_metadata_string(codebase);
+        }
+
+        if (isSet(tag, TAG_MULTI_ID_PRESENT)) {
+
+            IDArray idlist = new IDArray(ids);
+            if (!write_indirection(valueInfoTable, idlist)) {
+                out.align(4);
+                valueInfoTable
+                        .put(idlist, new Integer(out.__stream_position()));
+                out.write_long(ids.length);
+
+                for (int i = 0; i < ids.length; i++) {
+                    write_value_metadata_string(ids[i]);
+                }
+            }
+
+        } else if (isSet(tag, TAG_SINGLE_ID_PRESENT)) {
+
+            write_value_metadata_string(ids[0]);
+        }
+
+        if (currentValueIsChunked) {
+
+            //
+            // start the next chunk as soon as anything is written
+            // to the stream
+            //
+            lastEndTagPos = 0;
+
+            startChunk();
+        }
+
+        return startPos;
+    }
+
+    void endValue() {
+
+        if (!currentValueIsChunked)
+            return;
+
+        //
+        // We need to make sure no chunks are started in the middle of
+        // writing the end tag, and if we need to have a chunk here.
+        //
+
+        if (false && lastEndTagPos > 0 && out.__stream_position() == lastEndTagPos + 4) {
+
+            // if we just terminated the previous value (which must
+            // then have been nested inside the current value), then
+            // we simply step back one and write the new end tag.
+
+            valueOfLastEndTag++;
+
+            //
+            // TODO: figure a way to rewrite the last end-tag
+            buf.pos = lastEndTagPos;
+
+            if (log.isDebugEnabled()) {
+                log.debug("rewriting endTag" + valueOfLastEndTag
+                          + ", chunkingLevel=" + chunkingLevel);
+            }
+
+            out.write_long(valueOfLastEndTag);
+
+        } else {
+
+            // end the current chunk
+            endChunk();
+
+            //
+            // Write the end tag and remember where it is
+            //
+            valueOfLastEndTag = -chunkingLevel;
+
+            out.write_long(valueOfLastEndTag);
+            if (chunkingLevel > 1)
+                lastEndTagPos = out.__stream_position() - 4;
+        }
+
+        //
+        // At the end of a chunked value, we must have ended the chunk
+        // inside the value, i.e., right after a value we must never
+        // be inside a chunk.
+        //
+        if (startPosOfCurrentChunk != 0)
+            out.__fatal("startPosOfCurrentChunk is " + startPosOfCurrentChunk
+                        + "; there should be no chunk here!");
+
+        if (chunkingLevel == 1) {
+            currentValueIsChunked = false;
+            lastEndTagPos = 0;
+            valueOfLastEndTag = 0;
+        }
+
+        chunkingLevel -= 1;
+    }
+
+    private void write_value_metadata_string(String string) {
+        if (!write_indirection(valueInfoTable, string)) {
+            out.align(4);
+            valueInfoTable.put(string, new Integer(out.__stream_position()));
+            out.write_string(string);
+        }
+    }
+
+    MarkHandler chunkHandler = new MarkHandler() {
+        public void bufferFull(OutputChannelMarker state) throws IOException {
+
+            // end the chunk by writing the size at the start of the chunk.
+            // endChunk will call state.release()
+            endChunk();
+
+            // start a new chunk here //
+            // TODO: outer mark handler needs to be run first...
+            startChunk();
+        }
+    };
+
+    private void startChunk() {
+        if (currentValueIsChunked == false)
+            out.__fatal("not chunked");
+
+        out.align(4);
+        chunkMark = out.mark(chunkHandler);
+        startPosOfCurrentChunk = out.__stream_position();
+        out.write_long(0);
+    }
+
+    private void endChunk() {
+        if (currentValueIsChunked == false)
+            out.__fatal("not chunked");
+
+        // compute chunk size
+        int size = out.__stream_position() - startPosOfCurrentChunk;
+
+        // TODO: align chunk size? That which follows a chunk must
+        // be a 4-byte integer (chunk end marker) so we will do the
+        // alignment...
+        size += out.computeAlignment(size, 4);
+
+        try {
+            chunkMark.putInt(0, size);
+        }
+        catch (IOException e) {
+            throw out.translate_exception(e);
+        }
+
+        chunkMark.release();
+        chunkMark = null;
+    }
+
+    private boolean write_indirection(Map table, Serializable value) {
+        Integer pos = (Integer) table.get(value);
+        if (pos == null) {
+            return false;
+        }
+
+        out.write_long(-1);
+        int off = pos.intValue() - out.__stream_position();
+        out.write_long(off);
+
+        return true;
+    }
+
+    private BoxedValueHelper getHelper(Serializable value,
+                                       String id)
+    {
+        Class helper = null;
+
+        // TODO: Cache this info somewhere (contextclassloader)?
+
+        try {
+            String name = value.getClass().getName() + "Helper";
+            Class c = Util.classForName(name);
+            if (BoxedValueHelper.class.isAssignableFrom(c))
+                helper = c;
+        }
+        catch (ClassNotFoundException ex) {
+            // ignore //
+        }
+
+        if (helper == null && id != null) {
+            try {
+                String name = Util.idToClassName(id) + "Helper";
+                helper = Util.classForName(name);
+            }
+            catch (ClassNotFoundException ex) {
+                // ignore //
+            }
+        }
+
+        if (helper != null) {
+            try {
+                return (BoxedValueHelper) helper.newInstance();
+            }
+            catch (ClassCastException ex) {
+                // ignore //
+            }
+            catch (InstantiationException ex) {
+                // ignore //
+            }
+            catch (IllegalAccessException ex) {
+                // ignore //
+            }
+        }
+
+        return null;
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/AlternateIIOPComponent.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/AlternateIIOPComponent.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/AlternateIIOPComponent.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/AlternateIIOPComponent.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,86 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.IIOP.Version;
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+
+
+public class AlternateIIOPComponent extends Component {
+
+    private IIOPTransportSpec saddr;
+    private final AbstractORB orb;
+    private final String host;
+    private final int port;
+    private InetAddress addr;
+
+    public AlternateIIOPComponent(AbstractORB orb, String host, int port) {
+        this.orb = orb;
+        this.host = host;
+        this.port = port;
+    }
+
+    public int tag() {
+        return TAG_ALTERNATE_IIOP_ADDRESS.value;
+    }
+
+    protected void write_content(OutputStream eo) {
+        eo.write_string(host);
+        eo.write_short((short) port);
+    }
+
+    public IIOPTransportSpec getInetTransport() throws UnknownHostException {
+        if (saddr == null) {
+            saddr = new IIOPTransportSpec(getVersion(), getAddress(), getPort());
+        }
+        return saddr;
+    }
+
+    private Version getVersion() {
+        return orb.getIIOPVersion();
+    }
+
+    private InetAddress getAddress() throws UnknownHostException {
+        if (addr == null) {
+            addr = orb.getAddress(getHost());
+        }
+        return addr;
+    }
+
+    private String getHost() {
+        return host;
+    }
+
+    private int getPort() {
+        return port;
+    }
+
+    public static Component read(AbstractORB orb, byte[] data) {
+        EncapsulationInputStream in = new EncapsulationInputStream(orb, data);
+        String host = in.read_string();
+        int port = in.read_short() & 0xffff;
+        return new AlternateIIOPComponent(orb, host, port);
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CodeSetsComponent.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CodeSetsComponent.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CodeSetsComponent.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CodeSetsComponent.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,50 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CONV_FRAME.CodeSetComponentInfo;
+import org.omg.CONV_FRAME.CodeSetComponentInfoHelper;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.IOP.TAG_CODE_SETS;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+
+
+public class CodeSetsComponent extends Component {
+
+    private final CodeSetComponentInfo info;
+
+    public CodeSetsComponent(CodeSetComponentInfo info) {
+        this.info = info;
+    }
+
+    public int tag() {
+        return TAG_CODE_SETS.value;
+    }
+
+    public static Component read(AbstractORB orb, byte[] data) {
+        InputStream eis = new EncapsulationInputStream(orb, data);
+        return new CodeSetsComponent(CodeSetComponentInfoHelper.read(eis));
+    }
+
+    protected void write_content(OutputStream eo) {
+        CodeSetComponentInfoHelper.write(eo, info);
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Component.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Component.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Component.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Component.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,50 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CSIIOP.TAG_CSI_SEC_MECH_LIST;
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS;
+import org.omg.IOP.TAG_CODE_SETS;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public abstract class Component extends TaggedValue {
+
+
+    public static Component read(AbstractORB orb, int tag, byte[] data) {
+
+        switch (tag) {
+            case TAG_CODE_SETS.value:
+                return CodeSetsComponent.read(orb, data);
+
+            case org.omg.IOP.TAG_ORB_TYPE.value:
+                return ORBTypeComponent.read(orb, data);
+
+            case TAG_ALTERNATE_IIOP_ADDRESS.value:
+                return AlternateIIOPComponent.read(orb, data);
+
+            case TAG_CSI_SEC_MECH_LIST.value:
+                return SecurityMechanismListComponent.read(orb, data);
+
+            default:
+                return new UnknownComponent(tag, data);
+        }
+    }
+
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CompoundSecurityMechanism.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CompoundSecurityMechanism.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CompoundSecurityMechanism.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/CompoundSecurityMechanism.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,70 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+
+import org.omg.CSIIOP.CompoundSecMech;
+import org.omg.CSIIOP.TAG_TLS_SEC_TRANS;
+import org.omg.IIOP.Version;
+import org.omg.SSLIOP.TAG_SSL_SEC_TRANS;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public class CompoundSecurityMechanism {
+
+    private final CompoundSecMech mech;
+
+    private final AbstractORB orb;
+
+    private IIOPTransportSpec[] transport;
+
+    public CompoundSecurityMechanism(AbstractORB orb, CompoundSecMech mech) {
+        this.orb = orb;
+        this.mech = mech;
+    }
+
+    public int getTransportTag() {
+        return mech.transport_mech.tag;
+    }
+
+    public IIOPTransportSpec[] getTransports(InetAddress profileAddress, Version version) {
+        if (transport == null) {
+            switch (getTransportTag()) {
+                case TAG_TLS_SEC_TRANS.value: {
+                    transport = TLSSecureTransport.read(orb,
+                                                        mech.transport_mech.component_data, this);
+                    break;
+                }
+                case TAG_SSL_SEC_TRANS.value: {
+                    if (profileAddress != null) {
+                        transport = new IIOPTransportSpec[]{SSLSecureTransport.read(
+                                orb, profileAddress, version,
+                                mech.transport_mech.component_data, this)};
+                        break;
+                    }
+                }
+                default:
+                    transport = new IIOPTransportSpec[0];
+            }
+        }
+
+        return transport;
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/GIOPTransportSpec.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/GIOPTransportSpec.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/GIOPTransportSpec.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/GIOPTransportSpec.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,25 @@
+/**
+ *
+ * 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.ior;
+
+import org.apache.geronimo.corba.io.GIOPVersion;
+
+
+public abstract class GIOPTransportSpec {
+
+    abstract GIOPVersion getGIOPVersion();
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPProfile.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPProfile.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPProfile.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPProfile.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,145 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.IIOP.ProfileBody_1_0;
+import org.omg.IIOP.ProfileBody_1_0Helper;
+import org.omg.IIOP.Version;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedComponentSeqHelper;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+import org.apache.geronimo.corba.io.EncapsulationOutputStream;
+
+
+public class IIOPProfile extends Profile {
+
+    byte[] bytes;
+
+    ProfileBody_1_0 body;
+    TaggedComponent[] tagged_components;
+    Component[] components;
+    private final AbstractORB orb;
+    private IIOPTransportSpec saddr;
+
+    IIOPProfile(AbstractORB orb) {
+        super();
+        this.orb = orb;
+    }
+
+    public int tag() {
+        return TAG_INTERNET_IOP.value;
+    }
+
+    public Version getVersion() {
+        return body.iiop_version;
+    }
+
+    public byte[] getObjectKey() {
+        return body.object_key;
+    }
+
+    public int getComponentCount() {
+        if (tagged_components == null) {
+            return 0;
+        } else {
+            return tagged_components.length;
+        }
+    }
+
+    public int getTag(int idx) {
+        return tagged_components[idx].tag;
+    }
+
+    public TaggedComponent getTaggedComponent(int idx) {
+        return tagged_components[idx];
+    }
+
+    public Component getComponent(int idx) {
+
+        if (components == null) {
+            components = new Component[getComponentCount()];
+        }
+
+        if (components[idx] == null) {
+            components[idx] = Component.read(orb, tagged_components[idx].tag,
+                                             tagged_components[idx].component_data);
+        }
+
+        return components[idx];
+    }
+
+
+    public static Profile read(AbstractORB orb, byte[] data) {
+
+        EncapsulationInputStream ein = new EncapsulationInputStream(orb, data);
+        IIOPProfile result = new IIOPProfile(orb);
+        result.body = ProfileBody_1_0Helper.read(ein);
+        if (result.body.iiop_version.major == 1
+            && result.body.iiop_version.minor >= 1)
+        {
+            result.tagged_components = TaggedComponentSeqHelper.read(ein);
+        }
+
+        result.bytes = data;
+        return result;
+    }
+
+    public IIOPTransportSpec getInetTransport() throws UnknownHostException {
+        if (saddr == null) {
+            saddr = new IIOPTransportSpec(getVersion(), getAddress(), getPort());
+        }
+        return saddr;
+    }
+
+    public InetAddress getAddress() throws UnknownHostException {
+        return orb.getAddress(body.host);
+    }
+
+    public String getHost() {
+        return body.host;
+    }
+
+    public int getPort() {
+        return (body.port & 0xffff);
+    }
+
+    protected void write_content(OutputStream eo) {
+        ProfileBody_1_0Helper.write(eo, body);
+        if (body.iiop_version.major == 1 && body.iiop_version.minor > 0) {
+            TaggedComponentSeqHelper.write(eo, tagged_components);
+        }
+    }
+
+    protected byte[] get_encapsulation_bytes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    protected void write_content(EncapsulationOutputStream eo) {
+        // TODO Auto-generated method stub
+
+    }
+
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPTransportSpec.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPTransportSpec.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPTransportSpec.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/IIOPTransportSpec.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,110 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+import org.omg.IIOP.Version;
+
+import org.apache.geronimo.corba.io.GIOPVersion;
+
+
+public class IIOPTransportSpec extends GIOPTransportSpec {
+
+    public static final String PROTO_TCP = "tcp";
+    public static final String PROTO_SSL = "ssl";
+    public static final String PROTO_TLS = "tls";
+
+    InetSocketAddress addr;
+    private CompoundSecurityMechanism securityMechanism;
+    private final Version version;
+
+    IIOPTransportSpec(org.omg.IIOP.Version version, InetSocketAddress addr) {
+        this.version = version;
+        this.addr = addr;
+    }
+
+    public IIOPTransportSpec(org.omg.IIOP.Version version, InetSocketAddress addr2, CompoundSecurityMechanism mechanism) {
+        this(version, addr2);
+        securityMechanism = mechanism;
+    }
+
+    public IIOPTransportSpec(org.omg.IIOP.Version version, InetAddress address, int port) {
+        this(version, new InetSocketAddress(address, port));
+    }
+
+    public InetAddress getAddress() {
+        return addr.getAddress();
+    }
+
+    public boolean equals(Object other) {
+        if (other instanceof IIOPTransportSpec) {
+            IIOPTransportSpec io = (IIOPTransportSpec) other;
+
+            if (!getAddress().equals(io.getAddress())) {
+                return false;
+            }
+            if (!protocol().equals(io.protocol())) {
+                return false;
+            }
+            if (getIIOPVersion().major != io.getIIOPVersion().major) {
+                return false;
+            }
+            if (getIIOPVersion().minor != io.getIIOPVersion().minor) {
+                return false;
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    public int hashCode() {
+        return getAddress().hashCode() + protocol().hashCode() + getIIOPVersion().minor;
+    }
+
+    public GIOPVersion getGIOPVersion() {
+        return GIOPVersion.get(getIIOPVersion());
+    }
+
+    private Version getIIOPVersion() {
+        return version;
+    }
+
+    public String protocol() {
+        return PROTO_TCP;
+    }
+
+    public void setSecurityMechanism(CompoundSecurityMechanism mech) {
+        this.securityMechanism = mech;
+    }
+
+    public CompoundSecurityMechanism getSecurityMechanism() {
+        return securityMechanism;
+    }
+
+    public int getPort() {
+        return addr.getPort();
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return addr;
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InetTransport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InetTransport.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InetTransport.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InetTransport.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,64 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+
+public class InetTransport {
+
+    InetSocketAddress addr;
+    private CompoundSecurityMechanism securityMechanism;
+
+    InetTransport(InetSocketAddress addr) {
+        this.addr = addr;
+    }
+
+    public InetTransport(InetSocketAddress addr2, CompoundSecurityMechanism mechanism) {
+        this(addr2);
+        securityMechanism = mechanism;
+    }
+
+    public InetTransport(InetAddress address, int port) {
+        this(new InetSocketAddress(address, port));
+    }
+
+    public InetAddress getAddress() {
+        return addr.getAddress();
+    }
+
+    public String protocol() {
+        return "tcp";
+    }
+
+    public void setSecurityMechanism(CompoundSecurityMechanism mech) {
+        this.securityMechanism = mech;
+    }
+
+    public CompoundSecurityMechanism getSecurityMechanism() {
+        return securityMechanism;
+    }
+
+    public int getPort() {
+        return addr.getPort();
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return addr;
+    }
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalIOR.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalIOR.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalIOR.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalIOR.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,95 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+import org.omg.IOP.IOR;
+import org.omg.IOP.IORHelper;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.ClientDelegate;
+
+
+public class InternalIOR {
+
+    static final boolean DIRECT = true;
+
+    IOR ior;
+
+    Profile[] profiles;
+
+    public final AbstractORB orb;
+
+    public InternalIOR(AbstractORB orb, IOR ior) {
+        this.orb = orb;
+        this.ior = ior;
+    }
+
+    public static InternalIOR read(AbstractORB orb, InputStream in) {
+        return new InternalIOR(orb, IORHelper.read(in));
+    }
+
+    public int getProfileCount() {
+        return ior.profiles.length;
+    }
+
+
+    public Profile getProfile(int idx) {
+
+        if (profiles == null) {
+            profiles = new Profile[getProfileCount()];
+        }
+
+        if (profiles[idx] == null) {
+            profiles[idx] = Profile.read(orb, ior.profiles[idx].tag,
+                                         ior.profiles[idx].profile_data);
+        }
+
+        return profiles[idx];
+    }
+
+    public static InternalIOR extract(Object forward) {
+        if (forward instanceof ObjectImpl) {
+            Delegate del = ((ObjectImpl) forward)._get_delegate();
+            if (del instanceof ClientDelegate) {
+                return ((ClientDelegate) del).getInternalIOR();
+            }
+        }
+
+        // todo: better exception here?
+        throw new NO_IMPLEMENT();
+    }
+
+    public int profileTag(int i) {
+        return ior.profiles[i].tag;
+    }
+
+    public String getType() {
+        return ior.type_id;
+    }
+
+    public void write(OutputStream out) {
+        // TODO: reconstruct IOR if changed
+        IORHelper.write(out, ior);
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContextList.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContextList.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContextList.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalServiceContextList.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,28 @@
+/**
+ *
+ * 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.ior;
+
+import org.apache.geronimo.corba.io.OutputStreamBase;
+
+
+public class InternalServiceContextList {
+
+    public void write(OutputStreamBase out) {
+        out.write_long(0);
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalTargetAddress.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalTargetAddress.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalTargetAddress.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/InternalTargetAddress.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,84 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public abstract class InternalTargetAddress {
+
+    private AbstractORB orb;
+
+    static class ObjectKeyAddress extends InternalTargetAddress {
+
+        byte[] key;
+
+        public void writeObjectKey(OutputStream out) {
+            OctetSeqHelper.write(out, key);
+        }
+
+        public void write(OutputStream out) {
+            out.write_short((short) 0);
+            writeObjectKey(out);
+        }
+    }
+
+    static class ProfileAddress extends InternalTargetAddress {
+
+        IIOPProfile key;
+
+        public void writeObjectKey(OutputStream out) {
+            OctetSeqHelper.write(out, key.getObjectKey());
+        }
+
+        public void write(OutputStream out) {
+            out.write_short((short) 1);
+            key.write(out);
+        }
+    }
+
+    static class IORAddressingInfoAddress extends InternalTargetAddress {
+
+        InternalIOR ior;
+        int selected;
+
+        public void writeObjectKey(OutputStream out) {
+            IIOPProfile profile = (IIOPProfile) ior.getProfile(selected);
+            OctetSeqHelper.write(out, profile.getObjectKey());
+        }
+
+        public void write(OutputStream out) {
+            out.write_short((short) 2);
+            out.write_long(selected);
+            ior.write(out);
+        }
+    }
+
+    /**
+     * write just the object-key part of the target address (for GIOP 1.0 and 1.1)
+     */
+    public abstract void writeObjectKey(OutputStream out);
+
+    /**
+     * Write the full target address including discriminator
+     */
+    public abstract void write(OutputStream out);
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/MultiComponentProfile.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/MultiComponentProfile.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/MultiComponentProfile.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/MultiComponentProfile.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,95 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.IOP.TAG_MULTIPLE_COMPONENTS;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedComponentSeqHelper;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+
+
+public class MultiComponentProfile extends Profile {
+
+    private TaggedComponent[] tagged_components;
+
+    private Component[] components;
+
+    private final AbstractORB orb;
+
+    private byte[] data;
+
+    public MultiComponentProfile(AbstractORB orb, byte[] data) {
+        this.orb = orb;
+        this.data = data;
+    }
+
+
+    public static Profile read(AbstractORB orb, byte[] data) {
+
+        EncapsulationInputStream ein2 = new EncapsulationInputStream(orb, data);
+        MultiComponentProfile result = new MultiComponentProfile(orb, data);
+        result.tagged_components = TaggedComponentSeqHelper.read(ein2);
+        return result;
+    }
+
+    public int tag() {
+        return TAG_MULTIPLE_COMPONENTS.value;
+    }
+
+    int getComponentCount() {
+        if (tagged_components == null) {
+            return 0;
+        } else {
+            return tagged_components.length;
+        }
+    }
+
+    public int getTag(int idx) {
+        return tagged_components[idx].tag;
+    }
+
+    public TaggedComponent getTaggedComponent(int idx) {
+        return tagged_components[idx];
+    }
+
+    public Component getComponent(int idx) {
+
+        if (components == null) {
+            components = new Component[getComponentCount()];
+        }
+
+        if (components[idx] == null) {
+            components[idx] = Component.read(orb, tagged_components[idx].tag,
+                                             tagged_components[idx].component_data);
+        }
+
+        return components[idx];
+    }
+
+    protected void write_content(OutputStream eo) {
+        TaggedComponentSeqHelper.write(eo, tagged_components);
+    }
+
+
+    protected byte[] get_encapsulation_bytes() {
+        return data;
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/ORBTypeComponent.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/ORBTypeComponent.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/ORBTypeComponent.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/ORBTypeComponent.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,49 @@
+/**
+ *
+ * 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.ior;
+
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.IOP.TAG_ORB_TYPE;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+
+
+public class ORBTypeComponent extends Component {
+
+    private final int orbtype;
+
+    public ORBTypeComponent(int orbtype) {
+        this.orbtype = orbtype;
+    }
+
+    public int tag() {
+        return TAG_ORB_TYPE.value;
+    }
+
+    public static Component read(AbstractORB orb, byte[] data) {
+        InputStream is = new EncapsulationInputStream(orb, data);
+        return new ORBTypeComponent(is.read_long());
+    }
+
+    protected void write_content(OutputStream eo) {
+        eo.write_long(orbtype);
+    }
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Profile.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Profile.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Profile.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/Profile.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,66 @@
+/**
+ *
+ * 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.ior;
+
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TAG_MULTIPLE_COMPONENTS;
+import org.omg.IOP.TaggedComponent;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public abstract class Profile extends TaggedValue {
+
+    public Profile() {
+    }
+
+    /**
+     * write content including tag
+     */
+    public void write(OutputStream out) {
+        out.write_long(tag());
+        OctetSeqHelper.write(out, get_encapsulation_bytes());
+    }
+
+    protected abstract byte[] get_encapsulation_bytes();
+
+    public static Profile read(AbstractORB orb, int tag, byte[] data) {
+
+        switch (tag) {
+            case TAG_INTERNET_IOP.value:
+                return IIOPProfile.read(orb, data);
+
+            case TAG_MULTIPLE_COMPONENTS.value:
+                return MultiComponentProfile.read(orb, data);
+
+            default:
+                return new UnknownProfile(tag, data);
+        }
+    }
+
+
+    abstract int getComponentCount();
+
+    public abstract int getTag(int idx);
+
+    public abstract TaggedComponent getTaggedComponent(int idx);
+
+    public abstract Component getComponent(int idx);
+
+}

Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/SSLSecureTransport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/SSLSecureTransport.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/SSLSecureTransport.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/ior/SSLSecureTransport.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,57 @@
+/**
+ *
+ * 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.ior;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.IIOP.Version;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.io.EncapsulationInputStream;
+
+
+public class SSLSecureTransport extends SecureInetTransport {
+
+    SSLSecureTransport(Version version, InetSocketAddress addr, short target_requires,
+                       short target_supports, CompoundSecurityMechanism mechanism)
+    {
+        super(version, addr, target_requires, target_supports, mechanism);
+        // TODO Auto-generated constructor stub
+    }
+
+    public static SecureInetTransport read(AbstractORB orb, InetAddress profile,
+                                           Version version, byte[] component_data, CompoundSecurityMechanism mechanism)
+    {
+
+        InputStream is = new EncapsulationInputStream(orb, component_data);
+        org.omg.SSLIOP.SSL ssl = org.omg.SSLIOP.SSLHelper.read(is);
+
+        InetSocketAddress addr = new InetSocketAddress(profile, ssl.port & 0xffff);
+        SSLSecureTransport trans = new SSLSecureTransport(version, addr,
+                                                          ssl.target_requires, ssl.target_supports, mechanism);
+
+        return trans;
+
+    }
+
+    public String protocol() {
+        return PROTO_SSL;
+    }
+
+}