summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/CORBA/GIOP
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-23 21:31:04 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-23 21:31:04 +0000
commit947b8814056ea2fba6bbcfab86591f74bffc0311 (patch)
tree3ca4b2e68dc14c3128b9c781d23f1d0b1f2bee49 /libjava/classpath/gnu/CORBA/GIOP
parent49792907376493f0939563eb0219b96a48f1ae3b (diff)
downloadppe42-gcc-947b8814056ea2fba6bbcfab86591f74bffc0311.tar.gz
ppe42-gcc-947b8814056ea2fba6bbcfab86591f74bffc0311.zip
Imported Classpath 0.18.
* sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104586 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/CORBA/GIOP')
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java27
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java39
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java138
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java4
4 files changed, 154 insertions, 54 deletions
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
index 1e0e154f80d..f0f409394e6 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
@@ -41,13 +41,13 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
/**
* The header of the standard reply.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ReplyHeader
+ extends contextSupportingHeader
{
/**
* Reply status, if no exception occured.
@@ -65,9 +65,8 @@ public abstract class ReplyHeader
public static final int SYSTEM_EXCEPTION = 2;
/**
- * Reply status, if the client ORB must re - send
- * the request to another destination. The body
- * contains IOR.
+ * Reply status, if the client ORB must re - send the request to another
+ * destination. The body contains IOR.
*/
public static final int LOCATION_FORWARD = 3;
@@ -84,16 +83,6 @@ public abstract class ReplyHeader
public static final int NEEDS_ADDRESSING_MODE = 5;
/**
- * Empty array, indicating that no service context is available.
- */
- protected static final ServiceContext[] NO_CONTEXT = new ServiceContext[ 0 ];
-
- /**
- * The ORB service data.
- */
- public ServiceContext[] service_context = NO_CONTEXT;
-
- /**
* The status of this reply, holds one of the reply status constants.
*/
public int reply_status;
@@ -110,19 +99,19 @@ public abstract class ReplyHeader
{
switch (reply_status)
{
- case NO_EXCEPTION :
+ case NO_EXCEPTION:
return "ok";
- case USER_EXCEPTION :
+ case USER_EXCEPTION:
return "user exception";
- case SYSTEM_EXCEPTION :
+ case SYSTEM_EXCEPTION:
return "system exception";
- case LOCATION_FORWARD :
+ case LOCATION_FORWARD:
return "moved";
- default :
+ default:
return null;
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
index f2de4e2715b..17cccb8834a 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
@@ -41,7 +41,6 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
import org.omg.CORBA.portable.IDLEntity;
/**
@@ -50,13 +49,13 @@ import org.omg.CORBA.portable.IDLEntity;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class RequestHeader
+ extends contextSupportingHeader
implements IDLEntity
{
/**
- * The currently free request id. This field is incremented
- * each time the new request header is constructed. To facilitate
- * error detection, the first free id is equal to 0x01234567
- * (19088743).
+ * The currently free request id. This field is incremented each time the new
+ * request header is constructed. To facilitate error detection, the first
+ * free id is equal to 0x01234567 (19088743).
*/
private static int freeId = 0x01234567;
@@ -71,23 +70,17 @@ public abstract class RequestHeader
public byte[] object_key;
/**
- * A value identifying the requesting principal.
- * Initialised into a single zero byte.
+ * A value identifying the requesting principal. Initialised into a single
+ * zero byte.
*
* @deprecated by CORBA 2.2.
*/
public byte[] requesting_principal;
/**
- * Contains the ORB service data being passed. Initialised as the
- * zero size array by default.
- */
- public ServiceContext[] service_context = new ServiceContext[ 0 ];
-
- /**
- * This is used to associate the reply message with the
- * previous request message. Initialised each time by the
- * different value, increasing form 1 to Integer.MAX_VALUE.
+ * This is used to associate the reply message with the previous request
+ * message. Initialised each time by the different value, increasing form 1 to
+ * Integer.MAX_VALUE.
*/
public int request_id = getNextId();
@@ -97,10 +90,9 @@ public abstract class RequestHeader
protected boolean response_expected = true;
/**
- * Get next free request id. The value of the free request
- * id starts from 0x02345678, it is incremented each time this
- * function is called and is reset to 1 after reaching
- * Integer.MAX_VALUE.
+ * Get next free request id. The value of the free request id starts from
+ * 0x02345678, it is incremented each time this function is called and is
+ * reset to 1 after reaching Integer.MAX_VALUE.
*
* @return the next free request id.
*/
@@ -126,15 +118,15 @@ public abstract class RequestHeader
public abstract boolean isResponseExpected();
/**
- * Converts an byte array into hexadecimal string values.
- * Used in various toString() methods.
+ * Converts an byte array into hexadecimal string values. Used in various
+ * toString() methods.
*/
public String bytes(byte[] array)
{
StringBuffer b = new StringBuffer();
for (int i = 0; i < array.length; i++)
{
- b.append(Integer.toHexString(array [ i ] & 0xFF));
+ b.append(Integer.toHexString(array[i] & 0xFF));
b.append(" ");
}
return b.toString();
@@ -158,4 +150,5 @@ public abstract class RequestHeader
* @param out a stream to write into.
*/
public abstract void write(cdrOutput out);
+
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
index 7e44bdcea77..29a8ea8ac77 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
@@ -41,7 +41,9 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.portable.IDLEntity;
/**
@@ -53,16 +55,40 @@ public class ServiceContext
implements IDLEntity
{
/**
- * The context data.
+ * Use serialVersionUID for interoperability.
*/
- public byte[] context_data;
+ private static final long serialVersionUID = 1;
/**
- * The context id.
+ * The context id (for instance, 0x1 for code sets context). At the moment of
+ * writing, the OMG defines 16 standard values and provides rules to register
+ * the vendor specific context ids. The range 0-4095 is reserved for the
+ * future standard OMG contexts.
*/
public int context_id;
/**
+ * The context_data.
+ */
+ public byte[] context_data;
+
+ /**
+ * Crete unitialised instance.
+ */
+ public ServiceContext()
+ {
+ }
+
+ /**
+ * Create from omg context.
+ */
+ public ServiceContext(org.omg.IOP.ServiceContext from)
+ {
+ context_id = from.context_id;
+ context_data = from.context_data;
+ }
+
+ /**
* Read the context values from the stream.
*
* @param istream a stream to read from.
@@ -73,13 +99,13 @@ public class ServiceContext
switch (id)
{
- case cxCodeSet.ID :
+ case cxCodeSet.ID:
cxCodeSet codeset = new cxCodeSet();
codeset.readContext(istream);
return codeset;
- default :
+ default:
ServiceContext ctx = new ServiceContext();
ctx.context_id = id;
@@ -94,9 +120,9 @@ public class ServiceContext
public static ServiceContext[] readSequence(cdrInput istream)
{
int size = istream.read_long();
- ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[ size ];
+ ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
for (int i = 0; i < value.length; i++)
- value [ i ] = read(istream);
+ value[i] = read(istream);
return value;
}
@@ -118,7 +144,99 @@ public class ServiceContext
{
ostream.write_long(value.length);
for (int i = 0; i < value.length; i++)
- value [ i ].write(ostream);
+ value[i].write(ostream);
+ }
+
+ /**
+ * Add context to the given array of contexts.
+ */
+ public static void add(org.omg.IOP.ServiceContext[] cx,
+ org.omg.IOP.ServiceContext service_context, boolean replace)
+ {
+ int exists = -1;
+
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == service_context.context_id)
+ exists = i;
+
+ if (exists < 0)
+ {
+ // Add context.
+ org.omg.IOP.ServiceContext[] n = new org.omg.IOP.ServiceContext[cx.length + 1];
+ for (int i = 0; i < cx.length; i++)
+ n[i] = cx[i];
+ n[cx.length] = service_context;
+ }
+ else
+ {
+ // Replace context.
+ if (!replace)
+ throw new BAD_INV_ORDER("Repetetive setting of the context "
+ + service_context.context_id, 15,
+ CompletionStatus.COMPLETED_NO);
+ else
+ cx[exists] = service_context;
+ }
+ }
+
+ /**
+ * Add context to the given array of contexts.
+ */
+ public static ServiceContext[] add(ServiceContext[] cx,
+ org.omg.IOP.ServiceContext service_context, boolean replace)
+ {
+ int exists = -1;
+
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == service_context.context_id)
+ exists = i;
+
+ if (exists < 0)
+ {
+ // Add context.
+ ServiceContext[] n = new ServiceContext[cx.length + 1];
+ for (int i = 0; i < cx.length; i++)
+ n[i] = cx[i];
+ n[cx.length] = new ServiceContext(service_context);
+ return n;
+ }
+ else
+ {
+ // Replace context.
+ if (!replace)
+ throw new BAD_INV_ORDER("Repetetive setting of the context "
+ + service_context.context_id, 15,
+ CompletionStatus.COMPLETED_NO);
+ else
+ cx[exists] = new ServiceContext(service_context);
+ return cx;
+ }
+ }
+
+
+ /**
+ * Find context with the given name in the context array.
+ */
+ public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+ org.omg.IOP.ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return cx[i];
+ throw new BAD_PARAM("No context with id " + ctx_name);
+ }
+
+ /**
+ * Find context with the given name in the context array,
+ * converting into org.omg.IOP.ServiceContext.
+ */
+ public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+ ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return new org.omg.IOP.ServiceContext(ctx_name, cx[i].context_data);
+ throw new BAD_PARAM("No context with id " + ctx_name);
}
/**
@@ -126,6 +244,6 @@ public class ServiceContext
*/
public String toString()
{
- return "ctx "+context_id+", size "+context_data.length;
+ return "ctx " + context_id + ", size " + context_data.length;
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
index ffa45c37bc0..7ede4e5b926 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
@@ -40,11 +40,11 @@ package gnu.CORBA.GIOP.v1_0;
import gnu.CORBA.CDR.cdrInput;
import gnu.CORBA.CDR.cdrOutput;
-
-import org.omg.CORBA.portable.IDLEntity;
import gnu.CORBA.GIOP.ServiceContext;
import gnu.CORBA.GIOP.cxCodeSet;
+import org.omg.CORBA.portable.IDLEntity;
+
/**
* The GIOP 1.0 request message.
*
OpenPOWER on IntegriCloud