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 [5/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/csi/gssup/GSSUPPolicyValueHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHelper.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHelper.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHelper.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,96 @@
+/**
+ *
+ * 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.csi.gssup;
+
+public class GSSUPPolicyValueHelper {
+
+ private static org.omg.CORBA.TypeCode _type = org.omg.CORBA.ORB
+ .init()
+ .create_struct_tc(
+ GSSUPPolicyValueHelper.id(),
+ "GSSUPPolicyValue",
+ new org.omg.CORBA.StructMember[]{
+ new org.omg.CORBA.StructMember(
+ "mode",
+ org.omg.CORBA.ORB
+ .init()
+ .create_enum_tc(
+ org.omg.Security.RequiresSupportsHelper
+ .id(),
+ "RequiresSupports",
+ new String[]{
+ "SecRequires",
+ "SecSupports"}),
+ null),
+ new org.omg.CORBA.StructMember("domain",
+ org.omg.CORBA.ORB.init()
+ .create_string_tc(0), null)});
+
+ public GSSUPPolicyValueHelper() {
+ }
+
+ public static void insert(org.omg.CORBA.Any any, GSSUPPolicyValue s) {
+ any.type(type());
+ write(any.create_output_stream(), s);
+ }
+
+ public static GSSUPPolicyValue extract(org.omg.CORBA.Any any) {
+ return read(any.create_input_stream());
+ }
+
+ public static org.omg.CORBA.TypeCode type() {
+ return _type;
+ }
+
+ public String get_id() {
+ return id();
+ }
+
+ public org.omg.CORBA.TypeCode get_type() {
+ return type();
+ }
+
+ public void write_Object(org.omg.CORBA.portable.OutputStream out,
+ java.lang.Object obj)
+ {
+ throw new RuntimeException(" not implemented");
+ }
+
+ public java.lang.Object read_Object(org.omg.CORBA.portable.InputStream in) {
+ throw new RuntimeException(" not implemented");
+ }
+
+ public static String id() {
+ return "IDL:com/trifork/eas/api/csi/GSSUPPolicyValue:1.0";
+ }
+
+ public static GSSUPPolicyValue read(
+ org.omg.CORBA.portable.InputStream in)
+ {
+ GSSUPPolicyValue result = new GSSUPPolicyValue();
+ result.mode = org.omg.Security.RequiresSupportsHelper.read(in);
+ result.domain = in.read_string();
+ return result;
+ }
+
+ public static void write(org.omg.CORBA.portable.OutputStream out,
+ GSSUPPolicyValue s)
+ {
+ org.omg.Security.RequiresSupportsHelper.write(out, s.mode);
+ out.write_string(s.domain);
+ }
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHolder.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHolder.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/GSSUPPolicyValueHolder.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.csi.gssup;
+
+final public class GSSUPPolicyValueHolder
+ implements org.omg.CORBA.portable.Streamable
+{
+
+ public GSSUPPolicyValue value;
+
+ public GSSUPPolicyValueHolder() {
+ }
+
+ public GSSUPPolicyValueHolder(GSSUPPolicyValue initial) {
+ value = initial;
+ }
+
+ public org.omg.CORBA.TypeCode _type() {
+ return GSSUPPolicyValueHelper.type();
+ }
+
+ public void _read(org.omg.CORBA.portable.InputStream _in) {
+ value = GSSUPPolicyValueHelper.read(_in);
+ }
+
+ public void _write(org.omg.CORBA.portable.OutputStream _out) {
+ GSSUPPolicyValueHelper.write(_out, value);
+ }
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/SecGSSUPPolicy.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/SecGSSUPPolicy.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/SecGSSUPPolicy.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/csi/gssup/SecGSSUPPolicy.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,27 @@
+/**
+ *
+ * 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.csi.gssup;
+
+/**
+ * Generated by the JacORB IDL compiler
+ * from an IDL const definition
+ */
+
+public interface SecGSSUPPolicy {
+
+ int value = 8080;
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/EnvironmentImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/EnvironmentImpl.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/EnvironmentImpl.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/EnvironmentImpl.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.dii;
+
+public class EnvironmentImpl
+ extends org.omg.CORBA.Environment
+{
+
+ Exception ex;
+
+ public Exception exception() {
+ return ex;
+ }
+
+ public void exception(java.lang.Exception ex) {
+ this.ex = ex;
+ }
+
+ public void clear() {
+ ex = null;
+ }
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/ExceptionListImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/ExceptionListImpl.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/ExceptionListImpl.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/ExceptionListImpl.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.dii;
+
+import java.util.ArrayList;
+
+
+public class ExceptionListImpl
+ extends org.omg.CORBA.ExceptionList
+{
+
+ ArrayList list = new ArrayList();
+
+ public int count() {
+ return list.size();
+ }
+
+ public void add(org.omg.CORBA.TypeCode tc) {
+ list.add(tc);
+ }
+
+ public org.omg.CORBA.TypeCode item(int idx)
+ throws org.omg.CORBA.Bounds
+ {
+ if (idx < 0 || idx >= list.size())
+ throw new org.omg.CORBA.Bounds();
+
+ return (org.omg.CORBA.TypeCode) list.get(idx);
+ }
+
+ public void remove(int idx)
+ throws org.omg.CORBA.Bounds
+ {
+ if (idx < 0 || idx >= list.size())
+ throw new org.omg.CORBA.Bounds();
+
+ list.remove(idx);
+ }
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NVListImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NVListImpl.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NVListImpl.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NVListImpl.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,83 @@
+/**
+ *
+ * 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.dii;
+
+import org.apache.geronimo.corba.ORB;
+
+
+public class NVListImpl
+ extends org.omg.CORBA.NVList
+{
+
+ java.util.ArrayList entries;
+ ORB orb;
+
+ public NVListImpl(ORB orb, int length) {
+ this.orb = orb;
+ entries = new java.util.ArrayList(length);
+ }
+
+ public int count() {
+ return entries.size();
+ }
+
+ public org.omg.CORBA.NamedValue add(int flags) {
+ return add_value("", orb.create_any(), flags);
+ }
+
+ public org.omg.CORBA.NamedValue add_item(java.lang.String name,
+ int flags)
+ {
+ return add_value(name, orb.create_any(), flags);
+ }
+
+ public org.omg.CORBA.NamedValue add_value(java.lang.String name,
+ org.omg.CORBA.Any value,
+ int flags)
+ {
+ if (value == null) {
+ throw new org.omg.CORBA.BAD_PARAM();
+ }
+
+ NamedValueImpl nv = new NamedValueImpl(name, value, flags);
+ entries.add(nv);
+ return nv;
+ }
+
+ public org.omg.CORBA.NamedValue item(int idx)
+ throws org.omg.CORBA.Bounds
+ {
+ if (idx < 0 || idx >= count()) {
+ throw new org.omg.CORBA.Bounds();
+ }
+
+ return (NamedValueImpl) entries.get(idx);
+ }
+
+ public void remove(int idx)
+ throws org.omg.CORBA.Bounds
+ {
+ if (idx < 0 || idx >= count()) {
+ throw new org.omg.CORBA.Bounds();
+ }
+
+ entries.remove(idx);
+ }
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NamedValueImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NamedValueImpl.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NamedValueImpl.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/NamedValueImpl.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,46 @@
+/**
+ *
+ * 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.dii;
+
+public class NamedValueImpl
+ extends org.omg.CORBA.NamedValue
+{
+
+ String name;
+ int flags;
+ org.omg.CORBA.Any value;
+
+ public NamedValueImpl(String name, org.omg.CORBA.Any value, int flags) {
+ this.name = name;
+ this.value = value;
+ this.flags = flags;
+ }
+
+ public String name() {
+ return name;
+ }
+
+ public org.omg.CORBA.Any value() {
+ return value;
+ }
+
+ public int flags() {
+ return flags;
+ }
+}
+
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/RequestImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/RequestImpl.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/RequestImpl.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/dii/RequestImpl.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,343 @@
+/**
+ *
+ * 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.dii;
+
+import org.omg.CORBA.ARG_IN;
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import org.apache.geronimo.corba.ORB;
+import org.apache.geronimo.corba.RepositoryID;
+
+
+public class RequestImpl
+ extends org.omg.CORBA.Request
+{
+
+ org.omg.CORBA.portable.ObjectImpl target;
+ String operation;
+ NVListImpl arguments;
+ NamedValueImpl response;
+ ORB orb;
+ org.omg.CORBA.Context ctx;
+ ExceptionListImpl exceptions;
+ EnvironmentImpl env;
+ org.omg.CORBA.ContextList contexts;
+
+ public RequestImpl(ORB orb,
+ org.omg.CORBA.portable.ObjectImpl target,
+ String operation)
+ {
+ this(orb,
+ target,
+ operation,
+ null,
+ (NVListImpl) orb.create_list(3),
+ new NamedValueImpl("",
+ orb.create_any(),
+ ARG_OUT.value));
+ }
+
+ public RequestImpl(ORB orb,
+ org.omg.CORBA.portable.ObjectImpl target,
+ String operation,
+ org.omg.CORBA.Context ctx,
+ NVListImpl arg_list,
+ NamedValueImpl result)
+ {
+ this.orb = orb;
+ this.target = target;
+ this.operation = operation;
+ this.arguments = arg_list;
+ this.ctx = ctx;
+ this.response = result;
+ this.exceptions = (ExceptionListImpl) orb.create_exception_list();
+ this.env = (EnvironmentImpl) orb.create_environment();
+ }
+
+ public RequestImpl(ORB orb,
+ org.omg.CORBA.portable.ObjectImpl target,
+ String operation,
+ org.omg.CORBA.Context ctx,
+ NVListImpl arg_list,
+ NamedValueImpl result,
+ ExceptionListImpl exceptions,
+ org.omg.CORBA.ContextList contexts)
+ {
+ this.orb = orb;
+ this.target = target;
+ this.operation = operation;
+ this.arguments = arg_list;
+ this.ctx = ctx;
+ this.response = result;
+ this.exceptions = exceptions;
+ this.env = (EnvironmentImpl) orb.create_environment();
+ this.contexts = contexts;
+ }
+
+ public org.omg.CORBA.Object target() {
+ return target;
+ }
+
+ public java.lang.String operation() {
+ return operation;
+ }
+
+ public NVList arguments() {
+ return arguments;
+ }
+
+ void arguments(NVList arg_list) {
+ if (arg_list instanceof NVListImpl) {
+ this.arguments = (NVListImpl) arg_list;
+ } else {
+ throw new org.omg.CORBA.BAD_PARAM("foreign NVList");
+ }
+ }
+
+ public NamedValue result() {
+ if (response == null) {
+ throw new org.omg.CORBA.NO_RESPONSE();
+ }
+
+ return response;
+ }
+
+
+ public org.omg.CORBA.Environment env() {
+ return env;
+ }
+
+ public org.omg.CORBA.ExceptionList exceptions() {
+ return exceptions;
+ }
+
+ public org.omg.CORBA.ContextList contexts() {
+ return contexts;
+ }
+
+ public org.omg.CORBA.Context ctx() {
+ return ctx;
+ }
+
+ public void ctx(org.omg.CORBA.Context ctx) {
+ this.ctx = ctx;
+ }
+
+ public org.omg.CORBA.Any add_in_arg() {
+ NamedValue nv = arguments.add(ARG_IN.value);
+ return nv.value();
+ }
+
+ public org.omg.CORBA.Any add_named_in_arg(java.lang.String name) {
+ NamedValue nv = arguments.add_item(name, ARG_IN.value);
+ return nv.value();
+ }
+
+ public org.omg.CORBA.Any add_inout_arg() {
+ NamedValue nv = arguments.add(ARG_INOUT.value);
+ return nv.value();
+ }
+
+ public org.omg.CORBA.Any add_named_inout_arg(java.lang.String name) {
+ NamedValue nv = arguments.add_item(name, ARG_INOUT.value);
+ return nv.value();
+ }
+
+ public org.omg.CORBA.Any add_out_arg() {
+ NamedValue nv = arguments.add(ARG_OUT.value);
+ return nv.value();
+ }
+
+ public org.omg.CORBA.Any add_named_out_arg(java.lang.String name) {
+ NamedValue nv = arguments.add_item(name, ARG_OUT.value);
+ return nv.value();
+ }
+
+ public void set_return_type(org.omg.CORBA.TypeCode tc) {
+ return_value().type(tc);
+ }
+
+ public org.omg.CORBA.Any return_value() {
+ return result().value();
+ }
+
+ public void invoke() {
+ invoke(true);
+ }
+
+ public void send_oneway() {
+ invoke(false);
+ }
+
+ private void invoke(boolean responseExpected) {
+ REMARSHAL:
+ do {
+ OutputStream out = (OutputStream)
+ target._request(operation, responseExpected);
+
+ for (int i = 0; i < arguments.count(); i++) {
+ NamedValue nv = null;
+
+ try {
+ nv = arguments.item(i);
+ }
+ catch (org.omg.CORBA.Bounds ex) {
+ throw new org.omg.CORBA.INTERNAL("concurrent modification");
+ }
+
+ switch (nv.flags()) {
+ case ARG_IN.value:
+ case ARG_INOUT.value:
+ Any value = nv.value();
+ value.write_value(out);
+ }
+ }
+
+ InputStream in = null;
+ try {
+ in = (InputStream) target._invoke(out);
+
+ if (!responseExpected) {
+ return;
+ }
+
+ org.omg.CORBA.Any return_value = return_value();
+ TypeCode tc = return_value.type();
+ if (return_value != null && tc != null) {
+ // create return value
+ return_value.read_value(in, tc);
+ }
+
+ for (int i = 0; i < arguments.count(); i++) {
+ NamedValue nv = null;
+
+ try {
+ nv = arguments.item(i);
+ }
+ catch (org.omg.CORBA.Bounds ex) {
+ throw new org.omg.CORBA.INTERNAL("concurrent modification");
+ }
+
+ switch (nv.flags()) {
+ case ARG_OUT.value:
+ case ARG_INOUT.value:
+ org.omg.CORBA.Any value = nv.value();
+ value.read_value(in, value.type());
+ }
+ }
+
+ }
+ catch (org.omg.CORBA.portable.RemarshalException _exception) {
+ continue REMARSHAL;
+
+ }
+ catch (org.omg.CORBA.portable.UnknownException uex) {
+
+ Throwable e = uex.originalEx;
+ String exname = e.getClass().getName();
+
+ for (int i = 0; i < exceptions.count(); i++) {
+ TypeCode ex_tc = null;
+ try {
+ ex_tc = exceptions.item(i);
+ }
+ catch (org.omg.CORBA.Bounds ex) {
+ throw new org.omg.CORBA.INTERNAL("concurrent modification");
+ }
+
+ String expected;
+ try {
+ expected = RepositoryID.idToClassName(ex_tc.id());
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ throw new org.omg.CORBA.BAD_PARAM("bad exception type");
+ }
+
+ if (exname.equals(expected)) {
+ env.exception((Exception) e);
+ return;
+ }
+ }
+
+ env.exception(uex);
+
+ }
+ catch (org.omg.CORBA.portable.ApplicationException aex) {
+
+ InputStream ex_in = (InputStream) aex.getInputStream();
+ String ex_id = aex.getId();
+
+ for (int i = 0; i < exceptions.count(); i++) {
+ TypeCode ex_tc = null;
+ try {
+ ex_tc = exceptions.item(i);
+ }
+ catch (org.omg.CORBA.Bounds ex) {
+ throw new org.omg.CORBA.INTERNAL("concurrent modification");
+ }
+
+ boolean match = false;
+ try {
+ match = ex_id.equals(ex_tc.id());
+ }
+ catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
+ throw new org.omg.CORBA.BAD_PARAM("bad exception type");
+ }
+
+ if (match) {
+ Any ex_val = orb.create_any();
+ ex_val.read_value(ex_in, ex_tc);
+ env.exception(new org.omg.CORBA.UnknownUserException(ex_val));
+ return;
+ }
+ }
+
+ env.exception(new org.omg.CORBA.UnknownUserException());
+
+ }
+ finally {
+ target._releaseReply(in);
+ }
+ }
+ while (false);
+ }
+
+ public void send_deferred() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ public boolean poll_response() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ public void get_response()
+ throws org.omg.CORBA.WrongTransaction
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPInputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPInputStream.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPInputStream.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPInputStream.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,211 @@
+/**
+ *
+ * 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.giop;
+
+import java.io.IOException;
+import java.nio.ByteOrder;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.channel.InputChannel;
+import org.apache.geronimo.corba.io.GIOPVersion;
+import org.apache.geronimo.corba.io.InputStreamBase;
+
+
+public class GIOPInputStream extends InputStreamBase {
+
+ int size_of_previous_fragments;
+ int position;
+
+ int limit;
+
+ private final InputChannel ch;
+
+ private InputController controller;
+
+ private AbstractORB orb;
+
+ private GIOPVersion version;
+ private int message_start;
+
+ protected GIOPInputStream(InputController controller, InputChannel ch) {
+ this.controller = controller;
+ this.ch = ch;
+ }
+
+ public void limit(int limit) {
+ this.limit = limit;
+ }
+
+ public void setMessageStart(int position) {
+ this.message_start = position;
+ }
+
+ public int position() {
+ return position;
+ }
+
+ /**
+ * ensure that there are
+ */
+ private void check(int size) {
+ if (position + size > limit) {
+ size_of_previous_fragments += limit - message_start;
+ controller.getNextFragment(this);
+ }
+ }
+
+ private int availableHere() {
+ return limit - position;
+ }
+
+ public void align(int align) throws IOException {
+ if (align > 1) {
+ int incr = position() & (align - 1);
+ if (incr != 0)
+ skip(align - incr);
+ }
+ }
+
+ public int read(byte[] data, int off, int len) throws IOException {
+
+ if (len == 0) {
+ return 0;
+ }
+
+ // assert that there is at least one byte available
+ check(1);
+
+ int howmany = Math.min(len, availableHere());
+
+ int read_bytes = ch.read(data, off, howmany);
+ if (read_bytes != -1) {
+ position += read_bytes;
+ }
+
+ return read_bytes;
+ }
+
+ public void read_octet_array(byte[] data, int off, int len) {
+ do {
+ int howmany;
+ try {
+ howmany = read(data, off, len);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ off += howmany;
+ len -= howmany;
+ }
+ while (len != 0);
+ }
+
+ public byte read_octet() {
+ check(1);
+
+ byte result;
+ try {
+ result = ch.readByte();
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+
+ position += 1;
+ return result;
+ }
+
+ public short read_short() {
+ short result;
+ try {
+ align(2);
+ check(2);
+ result = ch.readShort();
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ position += 2;
+ return result;
+ }
+
+ public int read_long() {
+ int result;
+ try {
+ align(4);
+ check(4);
+ result = ch.readInt();
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ position += 4;
+ return result;
+ }
+
+ public long read_longlong() {
+ long result;
+ try {
+ align(8);
+ result = ch.readLong();
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ position += 8;
+ return result;
+ }
+
+ public void skip(int count) throws IOException {
+ ch.skip(count);
+ position += count;
+ }
+
+ public boolean isClosed() {
+ return ch.isClosed();
+ }
+
+ public void relinquish() {
+ ch.relinquish();
+ }
+
+ public void setOrder(ByteOrder order) {
+ ch.setOrder(order);
+ }
+
+ public void position(int i) {
+ position = i;
+ }
+
+ public void controller(InputController controller) {
+ this.controller = controller;
+ }
+
+ public int __stream_position() {
+ return size_of_previous_fragments + position - message_start;
+ }
+
+ protected AbstractORB __orb() {
+ return orb;
+ }
+
+ protected GIOPVersion getGIOPVersion() {
+ return version;
+ }
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPMessageTransport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPMessageTransport.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPMessageTransport.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPMessageTransport.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,337 @@
+/**
+ *
+ * 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.giop;
+
+import java.io.IOException;
+import java.nio.ByteOrder;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.GIOP.MsgType_1_1;
+
+import org.apache.geronimo.corba.ORB;
+import org.apache.geronimo.corba.channel.InputHandler;
+import org.apache.geronimo.corba.channel.Transport;
+import org.apache.geronimo.corba.io.GIOPVersion;
+import org.apache.geronimo.corba.ior.InternalServiceContextList;
+import org.apache.geronimo.corba.ior.InternalTargetAddress;
+
+
+public class GIOPMessageTransport implements InputHandler {
+
+ static final byte SYNC_NONE = 0;
+ static final byte SYNC_WITH_TRANSPORT = 1;
+ static final byte SYNC_WITH_SERVER = 2;
+ static final byte SYNC_WITH_TARGET = 3;
+
+
+ public boolean isAssignedHere(RequestID id) {
+ return id.isAssignedHere(isClient);
+ }
+
+ static final int GIOP_MAGIC = ('G' << 24) | ('I' << 16) | ('O' << 8) | 'P';
+
+ static final int POIG_MAGIC = ('P' << 24) | ('O' << 16) | ('I' << 8) | 'G';
+
+ int next_request_id = 2;
+
+ RequestID giop_1_1_request_id = new RequestID(0);
+
+ public class MessageHeader implements InputController {
+
+ GIOPInputStream in;
+
+ private byte major;
+
+ private byte minor;
+
+ private byte flags;
+
+ private byte type;
+
+ private int size;
+
+ private boolean hasMoreFragments;
+
+ private RequestID requestID;
+
+ private int message_start;
+
+ public MessageHeader() {
+ }
+
+ public void process(Transport transport) {
+ in = new GIOPInputStream(this, transport.getInputChannel());
+
+ try {
+ in.position(0); // reset alignment
+ int magic = in.read_long();
+ switch (magic) {
+ case GIOP_MAGIC:
+ case POIG_MAGIC:
+ // THAT's OK!
+ break;
+
+ default:
+ sendErrorAndClose();
+ return;
+ }
+
+ this.major = in.read_octet();
+ this.minor = in.read_octet();
+
+ this.flags = in.read_octet();
+ this.type = in.read_octet();
+
+ boolean littleEndian = ((flags & 1) == 1);
+ in.setOrder(littleEndian ? ByteOrder.LITTLE_ENDIAN
+ : ByteOrder.BIG_ENDIAN);
+
+ this.size = in.read_long();
+ in.limit(size + 12);
+
+ this.hasMoreFragments = false;
+ if (minor > 0) {
+ hasMoreFragments = ((flags & 2) == 2);
+ }
+
+ switch (type) {
+ case MsgType_1_1._Fragment:
+
+ if (minor == 2) {
+ this.requestID = new RequestID(in.read_long());
+
+ // this position counts as the start of this
+ // message with respect to calculation of the
+ // stream position
+ this.message_start = in.position();
+ transport.signalResponse(requestID, this);
+
+ } else if (minor == 1) {
+
+ this.message_start = in.position();
+
+ // in GIOP 1.1 the there is no FragmentHeader, so
+ // we need to "guess", that the incoming fragment
+ // is the same as that read by a previosus message
+ this.requestID = giop_1_1_request_id;
+
+ // reset the guess
+ if (!hasMoreFragments) {
+ giop_1_1_request_id = new RequestID(0);
+ }
+
+ transport.signalResponse(this.requestID, this);
+
+ } else {
+ // todo: send message error
+ throw new INTERNAL();
+ }
+ return;
+
+ case MsgType_1_1._Reply:
+ if (minor == 2) {
+ this.requestID = new RequestID(in.read_long());
+ transport.signalResponse(requestID, this);
+
+ } else if (minor == 1) {
+ // here we can have a problem, because the requestID may
+ // not be there
+ in.mark(in.available());
+ try {
+ int count = in.read_long();
+ for (int i = 0; i < count; i++) {
+ int len = in.read_long();
+ in.skip(len);
+ }
+ this.requestID = new RequestID(in.read_long());
+ }
+ finally {
+ in.reset();
+ }
+
+ } else if (minor == 0) {
+
+ }
+ return;
+
+ case MsgType_1_1._Request:
+
+ this.requestID = new RequestID(in.read_long());
+ transport.signalResponse(requestID, this);
+ return;
+
+ }
+
+ }
+ catch (IOException e) {
+ sendErrorAndClose();
+ }
+
+ }
+
+ private void sendErrorAndClose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void getNextFragment(GIOPInputStream channel) {
+
+ if (!hasMoreFragments) {
+ // big problem //
+
+ }
+
+ MessageHeader handler = (MessageHeader) transport
+ .waitForResponse(requestID);
+
+ channel.position(handler.message_start);
+ channel.setMessageStart(handler.message_start);
+ channel.limit(handler.size + 12);
+ channel.controller(handler);
+ }
+
+ }
+
+ private Transport transport;
+
+ private boolean isClient;
+
+ private final ORB orb;
+
+ GIOPMessageTransport(ORB orb, Transport transport, boolean isClient)
+ throws IOException
+ {
+ this.orb = orb;
+ this.transport = transport;
+ this.isClient = isClient;
+
+ if (isClient) {
+ next_request_id = 2;
+ } else {
+ next_request_id = 1;
+ }
+
+ transport.setInputHandler(this);
+ }
+
+ public void inputAvailable(Transport transport) {
+
+ // there is a new message available //
+ new MessageHeader().process(transport);
+
+ }
+
+ /**
+ * this will write
+ */
+ GIOPOutputStream startRequest(GIOPVersion version,
+ InternalTargetAddress targetAddress,
+ InternalServiceContextList contextList, byte response_flags,
+ String operation, byte[] principal) throws IOException
+ {
+
+ RequestID requestID = getNextRequestID();
+ GIOPOutputStream out = new GIOPOutputStream(orb, transport
+ .getOutputChannel(), version);
+
+ // this will write a GIOP message header
+ out.beginGIOPStream(MsgType_1_1._Request, requestID);
+
+ // add stuff like character encoding, and
+ // sending context rumtine service contexts...
+ add_outgoing_system_contexts(contextList);
+
+ // now write the request
+
+ switch (version.minor) {
+ case 0:
+ case 1:
+ // Write RequestHeader_1_1
+ {
+ contextList.write(out);
+ out.write_long(requestID.value());
+ switch (response_flags) {
+ case SYNC_NONE:
+ case SYNC_WITH_TRANSPORT:
+ out.write_boolean(false);
+ break;
+ case SYNC_WITH_SERVER:
+ case SYNC_WITH_TARGET:
+ out.write_boolean(true);
+ break;
+ }
+ out.skip(3);
+ targetAddress.writeObjectKey(out);
+ if (principal == null) {
+ out.write_long(0);
+ } else {
+ out.write_long(principal.length);
+ out.write_octet_array(principal, 0, principal.length);
+ }
+ }
+
+ case 2:
+ // Write RequestHeader_1_2
+ {
+ out.write_long(requestID.value());
+ out.write_octet(response_flags);
+ out.skip(3); // can be dropped, target address aligns anyway
+ targetAddress.write(out);
+ out.write_string(operation);
+ contextList.write(out);
+ break;
+ }
+ }
+
+ return out;
+ }
+
+ // add stuff like character encoding, and
+ // sending context rumtine service contexts...
+ private void add_outgoing_system_contexts(InternalServiceContextList contextList) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private RequestID getNextRequestID() {
+ int id;
+ synchronized (this) {
+ id = next_request_id;
+ next_request_id += 1;
+ }
+ RequestID result = new RequestID(id);
+ return result;
+ }
+
+ GIOPInputStream waitForResponse(RequestID requestID) {
+
+ MessageHeader header = (MessageHeader) transport
+ .waitForResponse(requestID);
+
+ GIOPInputStream result = new GIOPInputStream(header, transport
+ .getInputChannel());
+
+ result.limit(header.size + 12);
+ result.position(header.message_start);
+ result.setMessageStart(header.message_start);
+
+ // now read rest of response header //
+
+ return result;
+ }
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPOutputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPOutputStream.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPOutputStream.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/GIOPOutputStream.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,339 @@
+/**
+ *
+ * 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.giop;
+
+import java.io.IOException;
+
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.GIOP.MsgType_1_1;
+
+import org.apache.geronimo.corba.AbstractORB;
+import org.apache.geronimo.corba.channel.MarkHandler;
+import org.apache.geronimo.corba.channel.OutputChannel;
+import org.apache.geronimo.corba.channel.OutputChannelMarker;
+import org.apache.geronimo.corba.io.GIOPVersion;
+import org.apache.geronimo.corba.io.OutputStreamBase;
+
+
+public class GIOPOutputStream extends OutputStreamBase {
+
+ final OutputChannel ch;
+
+ private int pos_in_giop_message;
+
+ private final GIOPVersion version;
+
+ private final AbstractORB orb;
+
+ boolean message_finished;
+
+ private OutputChannelMarker mark;
+
+ private RequestID requestID;
+
+ private int fragment_start;
+
+ private int bytes_in_previous_fragments;
+
+ protected GIOPOutputStream(AbstractORB orb, OutputChannel ch,
+ GIOPVersion version)
+ {
+ this.orb = orb;
+ this.ch = ch;
+ this.version = version;
+ }
+
+ class FragmentHandler implements MarkHandler {
+
+ public void bufferFull(OutputChannelMarker state) throws IOException {
+ complete_message(state);
+ if (!message_finished) {
+ begin_fragment();
+ }
+ }
+
+ void begin_fragment() throws IOException {
+
+ // reset position and mark
+ pos_in_giop_message = 0;
+
+ // mark this as the beginning og a GIOP message
+ // so that we can rewrite the size info later
+ ch.mark(this);
+
+ if (version.minor == 2) {
+
+ // write new header
+ ch.writeInt(GIOPMessageTransport.GIOP_MAGIC);
+ ch.writeInt(0x01020000 | MsgType_1_1._Fragment);
+
+ // write empty size
+ ch.writeInt(0);
+
+ // write requestID (FragmentHeader)
+ ch.writeInt(requestID.value());
+
+ pos_in_giop_message = 16;
+ fragment_start = 16;
+
+ } else if (version.minor == 1) {
+
+ // write new header
+ ch.writeInt(GIOPMessageTransport.GIOP_MAGIC);
+ ch.writeInt(0x01010000 | MsgType_1_1._Fragment);
+
+ // write empty size
+ ch.writeInt(0);
+
+ // GIOP 1.1 fragments have no fragment header
+ // TODO: make sure we let noone else send fragments
+ // until this fragment is finished
+
+ pos_in_giop_message = 12;
+ fragment_start = 12;
+
+ } else {
+ //
+ // we cannot send fragments in GIOP 1.0
+
+ throw new org.omg.CORBA.INTERNAL();
+ }
+
+ }
+
+ }
+
+ //
+ public void beginGIOPStream(int message_type, RequestID requestID) {
+
+ this.requestID = requestID;
+ this.pos_in_giop_message = 0;
+ this.message_finished = false;
+ this.mark = ch.mark(new FragmentHandler());
+
+ byte flags = 0;
+
+ write_long(GIOPMessageTransport.GIOP_MAGIC);
+ write_octet((byte) version.major);
+ write_octet((byte) version.minor);
+ write_octet(flags);
+ write_octet((byte) message_type);
+
+ // message size
+ write_long(0);
+ }
+
+ public void finishGIOPStream() {
+ if (message_finished) {
+ throw new IllegalStateException();
+ }
+
+ message_finished = true;
+ try {
+ complete_message(mark);
+
+ // push message through transport layer
+ ch.flush();
+
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+
+ // relinquish the right to write to the underlying transport;
+ // this will let other threads write a message
+ ch.relinquish();
+ }
+
+ public void close() {
+ if (message_finished) {
+ return;
+ }
+ finishGIOPStream();
+ }
+
+ /**
+ * rewrite the message header to reflect message size and the hasMoreFragments bit
+ */
+ private void complete_message(OutputChannelMarker state) throws IOException {
+
+ boolean lastFragment = message_finished;
+
+ // write "has_more_fragments"
+ if (!lastFragment) {
+ state.putByte(6, (byte) 2);
+ } else {
+ state.putByte(6, (byte) 0);
+ }
+
+ // write size
+ int padding = 0;
+ int minor = version.minor;
+
+ switch (minor) {
+ case 0:
+ // big trouple! What do we do?
+ // the buffer has run full, but in GIOP 1.0
+ // messages cannot be fragmented. We're out
+ // of luck here, really.
+
+ // convert pending message into a close request, and
+ // thrown an error condition. In a future version,
+ // we might consider adding a dynamic buffer in this
+ // case to swallow the rest of the input stream...
+ state.putByte(7, (byte) MsgType_1_1._CloseConnection);
+ state.putInt(8, 0); // size zero
+ ch.close();
+ state.release();
+
+ throw new NO_RESOURCES();
+
+ case 1:
+ // GIOP 1.1 fragments are not padded in the end.
+ padding = 0;
+ break;
+
+ case 2:
+ // GIOP 1.2
+ if (!lastFragment) {
+ padding = computeAlignment(pos_in_giop_message, 8);
+ }
+ }
+
+ // actually write the size into the GIOP header
+ state.putInt(8, pos_in_giop_message + padding - 12);
+
+ // let the underlying buffer flush contents (makes space for more
+ // fragments)
+ state.release();
+
+ // now that the output stream has been released, we can
+ // write the padding needed for framented messages in GIOP 1.2
+ if (padding != 0) {
+ ch.skip(padding);
+ pos_in_giop_message += padding;
+ }
+
+ bytes_in_previous_fragments += (pos_in_giop_message - fragment_start);
+ pos_in_giop_message = 0;
+ fragment_start = 0;
+ }
+
+ public int computeAlignment(int pos, int align) {
+ if (align > 1) {
+ int incr = pos & (align - 1);
+ if (incr != 0) {
+ return align - incr;
+ }
+ }
+ return 0;
+ }
+
+ public void align(int align) {
+
+ try {
+ int skip = computeAlignment(pos_in_giop_message, align);
+ if (skip != 0) {
+ skip(skip);
+ }
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+
+ }
+
+ public void write(byte[] data, int off, int len) throws IOException {
+ ch.write(data, off, len);
+ pos_in_giop_message += len;
+ }
+
+ public void skip(int count) throws IOException {
+ ch.skip(count);
+ pos_in_giop_message += count;
+ }
+
+ public OutputChannelMarker mark(MarkHandler handler) {
+ return ch.mark(handler);
+ }
+
+ public void flush() throws IOException {
+ ch.flush();
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return version;
+ }
+
+ public AbstractORB __orb() {
+ return orb;
+ }
+
+ public void write(int value) throws IOException {
+ ch.write(value);
+ pos_in_giop_message += 1;
+ }
+
+ public void write_octet(byte value) {
+ try {
+ ch.write(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ pos_in_giop_message += 1;
+ }
+
+ public void write_short(short value) {
+ align(2);
+ try {
+ ch.writeShort(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ pos_in_giop_message += 2;
+ }
+
+ public void write_long(int value) {
+ align(4);
+ try {
+ ch.writeInt(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ pos_in_giop_message += 4;
+ }
+
+ public void write_longlong(long value) {
+ align(8);
+ try {
+ ch.writeLong(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ pos_in_giop_message += 8;
+ }
+
+ public int __stream_position() {
+ return bytes_in_previous_fragments + (pos_in_giop_message
+ - fragment_start);
+ }
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/InputController.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/InputController.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/InputController.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/InputController.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,24 @@
+/**
+ *
+ * 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.giop;
+
+
+public interface InputController {
+
+ void getNextFragment(GIOPInputStream channel);
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/RequestID.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/RequestID.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/RequestID.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/giop/RequestID.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,53 @@
+/**
+ *
+ * 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.giop;
+
+class RequestID {
+
+ final int id;
+
+ RequestID(int id) {
+ this.id = id;
+ }
+
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (other instanceof RequestID) {
+ RequestID req = (RequestID) other;
+ return req.id == id;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return id;
+ }
+
+ public int value() {
+ return id;
+ }
+
+ boolean isAssignedHere(boolean hereIsClient) {
+ boolean is_even = ((id & 1) == 0);
+ return hereIsClient & is_even;
+ }
+}
\ No newline at end of file
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/CharConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/CharConverter.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/CharConverter.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/CharConverter.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 interface CharConverter {
+
+ /**
+ * write a char with this converter
+ */
+ void write_char(OutputStreamBase out, char value);
+
+ /**
+ * write a string with this converter
+ */
+ void write_string(OutputStreamBase out, String value);
+
+ /**
+ * read a single char
+ */
+ char read_char(InputStreamBase base);
+
+ /**
+ * read a string. Parameter first_long is the first 4bytes of the read representation.
+ */
+ String read_string(InputStreamBase stream, int first_long);
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnection.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnection.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnection.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnection.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,21 @@
+/**
+ *
+ * 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 interface ClientConnection {
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnectionFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnectionFactory.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnectionFactory.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/ClientConnectionFactory.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;
+
+import org.apache.geronimo.corba.ior.IIOPTransportSpec;
+
+
+public interface ClientConnectionFactory {
+
+ ClientConnection getConnection();
+
+ IIOPTransportSpec getTransportSpec();
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultConnectionManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultConnectionManager.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultConnectionManager.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/DefaultConnectionManager.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,174 @@
+/**
+ *
+ * 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.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import EDU.oswego.cs.dl.util.concurrent.SyncMap;
+import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
+import org.omg.CSIIOP.TAG_CSI_SEC_MECH_LIST;
+import org.omg.CSIIOP.TAG_TLS_SEC_TRANS;
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.SSLIOP.TAG_SSL_SEC_TRANS;
+
+import org.apache.geronimo.corba.ConnectionManager;
+import org.apache.geronimo.corba.InvocationProfile;
+import org.apache.geronimo.corba.ORB;
+import org.apache.geronimo.corba.ior.AlternateIIOPComponent;
+import org.apache.geronimo.corba.ior.CompoundSecurityMechanism;
+import org.apache.geronimo.corba.ior.IIOPProfile;
+import org.apache.geronimo.corba.ior.IIOPTransportSpec;
+import org.apache.geronimo.corba.ior.InternalIOR;
+import org.apache.geronimo.corba.ior.SecurityMechanismListComponent;
+
+
+public class DefaultConnectionManager implements ConnectionManager {
+
+ private final ORB orb;
+
+ SyncMap connectionFactories = new SyncMap(new HashMap(),
+ new WriterPreferenceReadWriteLock());
+
+ public DefaultConnectionManager(ORB orb) {
+ this.orb = orb;
+ }
+
+ public InvocationProfile[] getInvocationProfiles(InternalIOR ior) {
+
+ List profs = new ArrayList();
+
+ for (int i = 0; i < ior.getProfileCount(); i++) {
+ if (ior.profileTag(i) == TAG_INTERNET_IOP.value) {
+ getInvocationProfilesForOneProfile(profs, (IIOPProfile) ior
+ .getProfile(i));
+ }
+
+ }
+
+ InvocationProfile[] result = new InvocationProfile[profs.size()];
+ profs.toArray(result);
+ return result;
+
+ }
+
+ private void getInvocationProfilesForOneProfile(List profs,
+ IIOPProfile profile)
+ {
+
+ boolean add_default_profile = true;
+
+ for (int i = 0; i < profile.getComponentCount(); i++) {
+ switch (profile.getTag(i)) {
+ case TAG_ALTERNATE_IIOP_ADDRESS.value:
+ AlternateIIOPComponent aiiopc = (AlternateIIOPComponent) profile
+ .getComponent(i);
+ try {
+ addProfile(profs, profile, aiiopc.getInetTransport());
+ }
+ catch (UnknownHostException e) {
+ // ignore -- we don't know this host //
+ }
+ break;
+
+ case TAG_CSI_SEC_MECH_LIST.value:
+ SecurityMechanismListComponent secmeclist = (SecurityMechanismListComponent) profile
+ .getComponent(i);
+
+ for (int j = 0; j < secmeclist.getMechanismCount(); j++) {
+
+ CompoundSecurityMechanism mech = secmeclist
+ .getSecurityMechanism(j);
+
+ IIOPTransportSpec pt = null;
+ switch (mech.getTransportTag()) {
+ case TAG_SSL_SEC_TRANS.value:
+ case TAG_TLS_SEC_TRANS.value:
+ try {
+ pt = profile.getInetTransport();
+ }
+ catch (UnknownHostException e) {
+ // ignore //
+ }
+ IIOPTransportSpec[] transports = mech.getTransports(pt
+ .getAddress(), profile.getVersion());
+ for (int k = 0; k < transports.length; k++) {
+ addProfile(profs, profile, transports[k]);
+ }
+
+ if (pt != null && pt.getPort() != 0) {
+ IIOPTransportSpec it = new IIOPTransportSpec(
+ profile.getVersion(),
+ pt.getSocketAddress(), mech);
+ addProfile(profs, profile, it);
+ add_default_profile = false;
+ }
+
+ }
+ }
+ }
+
+ }
+
+ if (add_default_profile && profile.getPort() != 0) {
+ try {
+ addProfile(profs, profile, profile.getInetTransport());
+ }
+ catch (UnknownHostException e) {
+ // ignore -- we don't know this host //
+ }
+
+ }
+
+ }
+
+ private void addProfile(List profs, IIOPProfile profile,
+ IIOPTransportSpec transport)
+ {
+
+ ClientConnectionFactory endpoint = getClientEndpoint(transport);
+
+ InvocationProfile ip = new IIOPInvocationProfile(profile, endpoint);
+
+ profs.add(ip);
+
+ }
+
+ private ClientConnectionFactory getClientEndpoint(
+ IIOPTransportSpec transport)
+ {
+ ClientConnectionFactory ccf = (ClientConnectionFactory) connectionFactories
+ .get(transport);
+
+ if (ccf == null) {
+ String protocol = transport.protocol();
+ if (IIOPTransportSpec.PROTO_TCP.equals(protocol)) {
+ ccf = new TCPClientConnectionFactory(transport);
+ } else if (IIOPTransportSpec.PROTO_SSL.equals(protocol)) {
+ ccf = new SSLClientConnectionFactory(transport);
+ } else if (IIOPTransportSpec.PROTO_TLS.equals(protocol)) {
+ ccf = new TLSClientConnectionFactory(transport);
+ }
+ }
+
+ return ccf;
+ }
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationInputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationInputStream.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationInputStream.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationInputStream.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,154 @@
+/**
+ *
+ * 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.omg.CORBA.MARSHAL;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public class EncapsulationInputStream extends InputStreamBase {
+
+ private int pos;
+
+ private final boolean little_endian;
+
+ private final GIOPVersion version;
+
+ private final AbstractORB orb;
+
+ private final byte[] data;
+
+ private final int off;
+
+ private final int len;
+
+ public EncapsulationInputStream(AbstractORB orb, GIOPVersion version,
+ CharConverter charConverter,
+ CharConverter wCharConverter, byte[] data, int off, int len)
+ {
+ this.orb = orb;
+ this.version = version;
+ this.__set_char_converter(charConverter);
+ this.__set_wchar_converter(wCharConverter);
+ this.data = data;
+ this.off = off;
+ this.len = len;
+
+ this.little_endian = read_boolean();
+ }
+
+ public EncapsulationInputStream(AbstractORB orb, byte[] data) {
+ this(orb, data, 0, data.length);
+ }
+
+ public EncapsulationInputStream(AbstractORB orb, byte[] data, int off, int len) {
+ this(orb, GIOPVersion.V1_0, orb.get_char_converter(GIOPVersion.V1_0),
+ orb.get_wchar_converter(GIOPVersion.V1_0), data, off, len);
+ }
+
+ public int __stream_position() {
+ return pos;
+ }
+
+ public AbstractORB __orb() {
+ return orb;
+ }
+
+ protected void __check(int size, int align) {
+ int padding = pos & (align - 1);
+ if (pos + padding + size > len) {
+ throw new MARSHAL();
+ }
+ pos += padding;
+ }
+
+ public int available() {
+ return pos - len;
+ }
+
+ protected GIOPVersion getGIOPVersion() {
+ return version;
+ }
+
+ public byte read_octet() {
+ __check(1, 1);
+ return data[off + pos++];
+ }
+
+ public short read_short() {
+ __check(2, 2);
+
+ return read2();
+ }
+
+ private short read2() {
+ short value;
+ if (little_endian) {
+ value = (short) (read1() | (read1() << 8));
+ } else {
+ value = (short) ((read1() << 8) | read1());
+ }
+
+ return value;
+ }
+
+ private int read1() {
+ return (data[off + pos++] & 0xff);
+ }
+
+ public int read_long() {
+ __check(4, 4);
+
+ return read4();
+ }
+
+ private int read4() {
+ int value;
+ if (little_endian) {
+ value = read1() | (read1() << 8) | (read1() << 16)
+ | (read1() << 24);
+ } else {
+ value = (read1() << 24) | (read1() << 16) | (read1() << 8)
+ | read1();
+ }
+
+ return value;
+ }
+
+ public long read_longlong() {
+
+ __check(8, 8);
+
+ long value;
+ if (little_endian) {
+ value = read4() | (((long) read4()) << 32);
+ } else {
+ value = (((long) read4()) << 32) | read4();
+ }
+
+ return value;
+
+ }
+
+ public EncapsulationInputStream __open_encapsulation() {
+ int encap_len = read_long();
+ return new EncapsulationInputStream(__orb(), data, pos, encap_len);
+ }
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationOutputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationOutputStream.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationOutputStream.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/EncapsulationOutputStream.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,134 @@
+/**
+ *
+ * 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.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.geronimo.corba.AbstractORB;
+
+
+public class EncapsulationOutputStream extends OutputStreamBase {
+
+ private final AbstractORB orb;
+ private ByteArrayOutputStream barr;
+ private DataOutputStream dout;
+
+ public EncapsulationOutputStream(AbstractORB orb) {
+ this.orb = orb;
+ this.barr = new java.io.ByteArrayOutputStream();
+ this.dout = new java.io.DataOutputStream(barr);
+
+ // big-edian marker
+ write_boolean(false);
+ }
+
+ public AbstractORB __orb() {
+ return orb;
+ }
+
+ public int __stream_position() {
+ return dout.size();
+ }
+
+ public int computeAlignment(int pos, int align) {
+ if (align > 1) {
+ int incr = pos & (align - 1);
+ if (incr != 0) {
+ return align - incr;
+ }
+ }
+ return 0;
+ }
+
+ public void align(int align) {
+
+ try {
+ int skip = computeAlignment(__stream_position(), align);
+ if (skip != 0) {
+ skip(skip);
+ }
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ }
+
+ public static final byte[] SKIP_BUFFER = new byte[8];
+
+ private void skip(int skip) throws IOException {
+ while (skip > 0) {
+ int bytes = Math.min(SKIP_BUFFER.length, skip);
+ write(SKIP_BUFFER, 0, bytes);
+ skip -= bytes;
+ }
+ }
+
+ public void write(byte[] data, int off, int len) throws IOException {
+ dout.write(data, off, len);
+ }
+
+ public void write(int value) throws IOException {
+ dout.write(value);
+ }
+
+ public void write_octet(byte value) {
+ try {
+ dout.writeByte(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ }
+
+ public void write_short(short value) {
+ try {
+ align(2);
+ dout.writeShort(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ }
+
+ public void write_long(int value) {
+ try {
+ align(4);
+ dout.writeInt(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ }
+
+ public void write_longlong(long value) {
+ try {
+ align(8);
+ dout.writeLong(value);
+ }
+ catch (IOException e) {
+ throw translate_exception(e);
+ }
+ }
+
+ public void writeTo(OutputStream out) throws IOException {
+ barr.writeTo(out);
+ }
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/FilterInputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/FilterInputStream.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/FilterInputStream.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/FilterInputStream.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,65 @@
+/**
+ *
+ * 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.apache.geronimo.corba.AbstractORB;
+
+
+public class FilterInputStream extends InputStreamBase {
+
+ private final InputStreamBase base;
+
+ FilterInputStream(InputStreamBase base) {
+ this.base = base;
+ }
+
+ protected AbstractORB __orb() {
+ return base.__orb();
+ }
+
+ public void close() throws IOException {
+ base.close();
+ }
+
+ public int __stream_position() {
+ return base.__stream_position();
+ }
+
+ protected GIOPVersion getGIOPVersion() {
+ return base.getGIOPVersion();
+ }
+
+ public byte read_octet() {
+ return base.read_octet();
+ }
+
+ public short read_short() {
+ return base.read_short();
+ }
+
+ public int read_long() {
+ return base.read_long();
+ }
+
+ public long read_longlong() {
+ return base.read_longlong();
+ }
+
+
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/GIOPVersion.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/GIOPVersion.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/GIOPVersion.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/GIOPVersion.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,62 @@
+/**
+ *
+ * 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.omg.IIOP.Version;
+
+
+public final class GIOPVersion {
+
+ private GIOPVersion(int i, int j) {
+ this.major = i;
+ this.minor = j;
+ }
+
+ public final int major;
+ public final int minor;
+
+ public static final GIOPVersion V1_0 = new GIOPVersion(1, 0);
+ public static final GIOPVersion V1_1 = new GIOPVersion(1, 1);
+ public static final GIOPVersion V1_2 = new GIOPVersion(1, 2);
+
+ public int hashCode() {
+ return major * 10 + minor;
+ }
+
+ public boolean equals(Object other) {
+ if (other instanceof GIOPVersion) {
+ GIOPVersion o = (GIOPVersion) other;
+ return major == o.major && minor == o.minor;
+ }
+
+ return false;
+ }
+
+ public static GIOPVersion get(Version version) {
+ return get(version.major, version.minor);
+ }
+
+ private static GIOPVersion get(int major2, int minor2) {
+ if (major2 == 1) {
+ if (minor2 == 0) return V1_0;
+ if (minor2 == 1) return V1_1;
+ if (minor2 == 2) return V1_2;
+ }
+
+ return new GIOPVersion(major2, minor2);
+ }
+}
Added: geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/IIOPInvocationProfile.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/IIOPInvocationProfile.java?rev=329036&view=auto
==============================================================================
--- geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/IIOPInvocationProfile.java (added)
+++ geronimo/trunk/sandbox/freeorb/geronimo-orb/src/main/java/org/apache/geronimo/corba/io/IIOPInvocationProfile.java Thu Oct 27 19:00:06 2005
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.InvocationProfile;
+import org.apache.geronimo.corba.giop.GIOPOutputStream;
+import org.apache.geronimo.corba.ior.IIOPProfile;
+
+
+public class IIOPInvocationProfile implements InvocationProfile {
+
+ public IIOPInvocationProfile(IIOPProfile profile, ClientConnectionFactory endpoint) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public GIOPOutputStream startRequest() {
+
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}