summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/CORBA/GIOP
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 23:20:01 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 23:20:01 +0000
commit3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/gnu/CORBA/GIOP
parent7e55c49d7d91ef9f09e93c1100119b1ab3652446 (diff)
downloadppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.tar.gz
ppe42-gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.zip
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/CORBA/GIOP')
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java5
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java (renamed from libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java (renamed from libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java23
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java200
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java88
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java16
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java27
13 files changed, 314 insertions, 133 deletions
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
index f3f35dbaa21..bffb02678aa 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
@@ -47,7 +47,10 @@ import java.util.Set;
/**
* This class contains the codes, used to identify character sets
* in CORBA. These codes are defined in Open Software Foundation (OSF)
- * code set registry
+ * code set registry.
+ *
+ * The name of this class specially sets "OSF" apart if somebody would start
+ * searching Open Software Foundation abbreviation.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
index d884329c440..38039c2ed21 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
@@ -38,15 +38,13 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import org.omg.CORBA.MARSHAL;
import java.io.IOException;
import java.io.OutputStream;
-import java.net.Socket;
-
/**
* The explicit command to close the connection.
*
@@ -60,6 +58,11 @@ import java.net.Socket;
public class CloseMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The singleton close message is typically enough, despite new
* instances may be instantiated if the specific version field
@@ -95,6 +98,7 @@ public class CloseMessage
catch (IOException ex)
{
MARSHAL m = new MARSHAL("Unable to flush the stream");
+ m.minor = Minor.Header;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
index 7f42c07f236..ab565db3797 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.IOR;
import gnu.CORBA.IOR.CodeSets_profile;
@@ -51,7 +51,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class cxCodeSet
+public class CodeSetServiceContext
extends ServiceContext
{
/**
@@ -62,7 +62,7 @@ public class cxCodeSet
/**
* The standard component to include in the messages.
*/
- public static final cxCodeSet STANDARD = new cxCodeSet();
+ public static final CodeSetServiceContext STANDARD = new CodeSetServiceContext();
/**
* The encoding, used to transfer the narrow (1 byte) character data.
@@ -84,13 +84,13 @@ public class cxCodeSet
*
* @param contexts the array of contexts, can be null.
*/
- public static cxCodeSet find(ServiceContext[] contexts)
+ public static CodeSetServiceContext find(ServiceContext[] contexts)
{
if (contexts != null)
for (int i = 0; i < contexts.length; i++)
{
- if (contexts [ i ] instanceof cxCodeSet)
- return (cxCodeSet) contexts [ i ];
+ if (contexts [ i ] instanceof CodeSetServiceContext)
+ return (CodeSetServiceContext) contexts [ i ];
}
return STANDARD;
}
@@ -102,12 +102,12 @@ public class cxCodeSet
* If you take this task, scan 'TODO character encoding' for
* relevant places.
*/
- public static cxCodeSet negotiate(IOR.CodeSets_profile profile)
+ public static CodeSetServiceContext negotiate(IOR.CodeSets_profile profile)
{
if (profile.negotiated != null)
return profile.negotiated;
- cxCodeSet use = new cxCodeSet();
+ CodeSetServiceContext use = new CodeSetServiceContext();
use.char_data =
negotiate(profile.narrow, STANDARD.char_data, CharSets_OSF.ISO8859_1);
@@ -124,9 +124,9 @@ public class cxCodeSet
* Read the context from the given stream. Does not read the
* code sets id.
*/
- public void readContext(cdrInput input)
+ public void readContext(AbstractCdrInput input)
{
- cdrInput encap = input.read_encapsulation();
+ AbstractCdrInput encap = input.read_encapsulation();
char_data = encap.read_ulong();
wide_char_data = encap.read_ulong();
@@ -145,11 +145,11 @@ public class cxCodeSet
* Write the context to the given stream, including the code
* sets id.
*/
- public void write(cdrOutput output)
+ public void write(AbstractCdrOutput output)
{
output.write_ulong(ID);
- cdrOutput enout = output.createEncapsulation();
+ AbstractCdrOutput enout = output.createEncapsulation();
enout.write_long(char_data);
enout.write_ulong(wide_char_data);
diff --git a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
index ba6c1f88d8f..77ea20e38f0 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
@@ -1,4 +1,4 @@
-/* contextSupportingHeader.java --
+/* ContextHandler.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.omg.CORBA.BAD_INV_ORDER;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class contextSupportingHeader
+public abstract class ContextHandler
{
/**
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
index 8d3b3539be5..99942fee359 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import java.io.IOException;
import java.io.OutputStream;
@@ -46,6 +48,7 @@ import java.io.OutputStream;
import java.net.Socket;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
/**
* The error message is sent in response to the message, encoded
@@ -59,6 +62,11 @@ import org.omg.CORBA.MARSHAL;
public class ErrorMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Create a new error message, setting the message field
* to the {@link MESSAGE_ERROR} and the version number to
@@ -73,14 +81,22 @@ public class ErrorMessage
/**
* Send the error message to the given IOR address.
*
- * @param to the IOR address (host and port, other fields
+ * @param ior the IOR address (host and port, other fields
* are not used).
+ *
+ * @param orb the ORB, sending the error message.
*/
- public void send(IOR ior)
+ public void send(IOR ior, ORB orb)
{
try
{
- Socket socket = new Socket(ior.Internet.host, ior.Internet.port);
+ Socket socket;
+
+ if (orb instanceof OrbFunctional)
+ socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
+ ior.Internet.host, ior.Internet.port);
+ else
+ socket = new Socket(ior.Internet.host, ior.Internet.port);
OutputStream socketOutput = socket.getOutputStream();
write(socketOutput);
@@ -90,6 +106,7 @@ public class ErrorMessage
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
index 61c46e11ea4..e1bdb512bfb 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
@@ -1,4 +1,4 @@
-/* MessageHeader.java -- GIOP 1.0 message header.
+/* MessageHeader.java -- GIOP message header.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,33 +38,39 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.Minor;
+import gnu.CORBA.Version;
+import gnu.CORBA.CDR.BigEndianInputStream;
import gnu.CORBA.CDR.BigEndianOutputStream;
import gnu.CORBA.CDR.LittleEndianInputStream;
import gnu.CORBA.CDR.LittleEndianOutputStream;
-import gnu.CORBA.CDR.abstractDataOutputStream;
-import gnu.CORBA.Version;
+import gnu.CORBA.CDR.AbstractDataInput;
+import gnu.CORBA.CDR.AbstractDataOutput;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.IDLEntity;
-import java.io.DataInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-
+import java.net.Socket;
import java.util.Arrays;
-import gnu.CORBA.CDR.BigEndianInputStream;
-import gnu.CORBA.CDR.abstractDataInputStream;
-import java.io.InputStream;
/**
* The GIOP message header.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class MessageHeader
implements IDLEntity
{
/**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
* Request message.
*/
public static final byte REQUEST = 0;
@@ -80,16 +86,15 @@ public class MessageHeader
public static final byte CANCEL_REQUEST = 2;
/**
- * Locate request message, used to check the server ability to
- * process requests for the object reference.
- * This message is also used to get the
+ * Locate request message, used to check the server ability to process
+ * requests for the object reference. This message is also used to get the
* address where the object reference should be sent.
*/
public static final byte LOCATE_REQUEST = 3;
/**
- * Locate reply message, sent in response to the
- * {@link #LocateRequest} message.
+ * Locate reply message, sent in response to the {@link #LocateRequest}
+ * message.
*/
public static final byte LOCATE_REPLY = 4;
@@ -104,8 +109,8 @@ public class MessageHeader
public static final byte MESSAGE_ERROR = 6;
/**
- * The fragment messge, following the previous message that
- * has more fragments flag set. Added in GIOP 1.1
+ * The fragment messge, following the previous message that has more fragments
+ * flag set. Added in GIOP 1.1
*/
public static final byte FRAGMENT = 7;
@@ -117,12 +122,9 @@ public class MessageHeader
/**
* The message type names.
*/
- protected static String[] types =
- new String[]
- {
- "Request", "Reply", "Cancel", "Locate request", "Locate reply",
- "Close connection", "Error", "Fragment"
- };
+ protected static String[] types = new String[] { "Request", "Reply",
+ "Cancel", "Locate request", "Locate reply", "Close connection", "Error",
+ "Fragment" };
/**
* The GIOP version. Initialised to 1.0 .
@@ -154,7 +156,7 @@ public class MessageHeader
/**
* Create an empty message header, corresponding the given version.
- *
+ *
* @param major the major message header version.
* @param minor the minot message header version.
*/
@@ -164,8 +166,8 @@ public class MessageHeader
}
/**
- * Checks if the message is encoded in the Big Endian, most significant
- * byte first.
+ * Checks if the message is encoded in the Big Endian, most significant byte
+ * first.
*/
public boolean isBigEndian()
{
@@ -173,10 +175,18 @@ public class MessageHeader
}
/**
+ * Checks if the message is partial, and more subsequent fragments follow.
+ */
+ public boolean moreFragmentsFollow()
+ {
+ return (flags & 0x2) != 0;
+ }
+
+ /**
* Set the encoding to use.
- *
- * @param use_big_endian if true (default), the Big Endian
- * encoding is used. If false, the Little Endian encoding is used.
+ *
+ * @param use_big_endian if true (default), the Big Endian encoding is used.
+ * If false, the Little Endian encoding is used.
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -196,16 +206,16 @@ public class MessageHeader
/**
* Get the message type as string.
- *
+ *
* @param type the message type as int (the field {@link message_type}).
- *
+ *
* @return the message type as string.
*/
public String getTypeString(int type)
{
try
{
- return types [ type ];
+ return types[type];
}
catch (ArrayIndexOutOfBoundsException ex)
{
@@ -215,10 +225,10 @@ public class MessageHeader
/**
* Creates reply header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.ReplyHeader},
- * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on the version
+ * number in this header.
*/
public ReplyHeader create_reply_header()
{
@@ -230,10 +240,10 @@ public class MessageHeader
/**
* Creates request header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.RequestHeader},
- * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on the version
+ * number in this header.
*/
public RequestHeader create_request_header()
{
@@ -261,24 +271,28 @@ public class MessageHeader
/**
* Read the header from the stream.
- *
+ *
* @param istream a stream to read from.
- *
+ *
* @throws MARSHAL if this is not a GIOP 1.0 header.
*/
public void read(java.io.InputStream istream)
- throws MARSHAL
+ throws MARSHAL
{
try
{
- byte[] xMagic = new byte[ MAGIC.length ];
+ byte[] xMagic = new byte[MAGIC.length];
istream.read(xMagic);
if (!Arrays.equals(xMagic, MAGIC))
- throw new MARSHAL("Not a GIOP message");
+ {
+ MARSHAL m = new MARSHAL("Not a GIOP message");
+ m.minor = Minor.Giop;
+ throw m;
+ }
version = Version.read_version(istream);
- abstractDataInputStream din;
+ AbstractDataInput din;
flags = (byte) istream.read();
@@ -295,6 +309,7 @@ public class MessageHeader
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -302,26 +317,26 @@ public class MessageHeader
/**
* Get the short string summary of the message.
- *
+ *
* @return a short message summary.
*/
public String toString()
{
- return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little") +
- " endian, " + getTypeString(message_type) + ", " + message_size +
- " bytes. ";
+ return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little")
+ + " endian, " + getTypeString(message_type) + ", " + message_size
+ + " bytes. ";
}
/**
* Write the header to stream.
- *
+ *
* @param out a stream to write into.
*/
public void write(java.io.OutputStream out)
{
try
{
- abstractDataOutputStream dout;
+ AbstractDataOutput dout;
if (isBigEndian())
dout = new BigEndianOutputStream(out);
@@ -333,18 +348,99 @@ public class MessageHeader
// Write version number.
version.write((OutputStream) dout);
-
dout.write(flags);
-
dout.write(message_type);
-
dout.writeInt(message_size);
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
}
+
+ /**
+ * Read data, followed by the message header. Handle fragmented messages.
+ *
+ * @param source the data source to read from.
+ * @param service the socket on that the time outs are set. Can be null (no
+ * timeouts are set).
+ * @param to_read the timeout while reading the message.
+ * @param to_pause the timeout for pauses between the message parts.
+ */
+ public byte[] readMessage(InputStream source, Socket service, int to_read,
+ int to_pause)
+ {
+ try
+ {
+ byte[] r = new byte[message_size];
+
+ int n = 0;
+ if (service != null)
+ service.setSoTimeout(to_read);
+
+ reading: while (n < r.length)
+ {
+ n += source.read(r, n, r.length - n);
+ }
+ if (service != null)
+ service.setSoTimeout(to_pause);
+
+ // Read the message remainder if the message is fragmented.
+ if (moreFragmentsFollow())
+ {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream(
+ 2 * r.length);
+ buffer.write(r);
+
+ if (r.length < 10)
+ // Increase the buffer size if the default value (size of the
+ // previous message) is really too small.
+ r = new byte[1024];
+
+ MessageHeader h2 = new MessageHeader();
+
+ do
+ {
+ h2.read(source);
+
+ int dn;
+
+ n = 0;
+ reading: while (n < h2.message_size)
+ {
+ dn = source.read(r, 0, h2.message_size - n);
+
+ if (n == 0 && service != null)
+ service.setSoTimeout(to_read);
+
+ if (n == 0 && version.since_inclusive(1, 2))
+ {
+ // Skip the four byte request id.
+ buffer.write(r, 4, dn - 4);
+ }
+ else
+ buffer.write(r, 0, dn);
+ n = +dn;
+ }
+
+ if (service != null)
+ service.setSoTimeout(to_pause);
+ }
+ while (h2.moreFragmentsFollow());
+ return buffer.toByteArray();
+ }
+ else
+ return r;
+ }
+ catch (IOException ioex)
+ {
+ MARSHAL m = new MARSHAL("Unable to read the message continuation.");
+ m.minor = Minor.Header;
+ m.initCause(ioex);
+ throw m;
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
index f0f409394e6..d1448290331 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
/**
* The header of the standard reply.
@@ -47,7 +47,7 @@ import gnu.CORBA.CDR.cdrOutput;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ReplyHeader
- extends contextSupportingHeader
+ extends ContextHandler
{
/**
* Reply status, if no exception occured.
@@ -121,7 +121,7 @@ public abstract class ReplyHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Returns a short string representation.
@@ -141,5 +141,5 @@ public abstract class ReplyHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
index 17cccb8834a..3cfadfd7867 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.portable.IDLEntity;
@@ -49,7 +49,7 @@ import org.omg.CORBA.portable.IDLEntity;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class RequestHeader
- extends contextSupportingHeader
+ extends ContextHandler
implements IDLEntity
{
/**
@@ -137,7 +137,7 @@ public abstract class RequestHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Return a string representation.
@@ -149,6 +149,6 @@ public abstract class RequestHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
index 29a8ea8ac77..78519510cb7 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_PARAM;
@@ -48,7 +48,7 @@ import org.omg.CORBA.portable.IDLEntity;
/**
* Contains the ORB service data being passed.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class ServiceContext
@@ -59,6 +59,50 @@ public class ServiceContext
*/
private static final long serialVersionUID = 1;
+ /* Standard values for the context_id. */
+ public static final int TransactionService = 0;
+
+ /**
+ * Defines code sets, used to encode wide and narrow characters. Required for
+ * messages with data structures, involving wide characters.
+ */
+ public static final int CodeSets = 1;
+
+ public static final int ChainBypassCheck = 2;
+
+ public static final int ChainBypassInfo = 3;
+
+ public static final int LogicalThreadId = 4;
+
+ public static final int BI_DIR_IIOP = 5;
+
+ public static final int SendingContextRunTime = 6;
+
+ public static final int INVOCATION_POLICIES = 7;
+
+ public static final int FORWARDED_IDENTITY = 8;
+
+ /**
+ * Contains exception details if exception being transferred is other than
+ * System or User exception. javax.rmi uses this context to transfer arbitrary
+ * java exceptions as CORBA value types.
+ */
+ public static final int UnknownExceptionInfo = 9;
+
+ public static final int RTCorbaPriority = 10;
+
+ public static final int RTCorbaPriorityRange = 11;
+
+ public static final int FT_GROUP_VERSION = 12;
+
+ public static final int FT_REQUEST = 13;
+
+ public static final int ExceptionDetailMessage = 14;
+
+ public static final int SecurityAttributeService = 15;
+
+ public static final int ActivityService = 16;
+
/**
* 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
@@ -90,18 +134,18 @@ public class ServiceContext
/**
* Read the context values from the stream.
- *
+ *
* @param istream a stream to read from.
*/
- public static ServiceContext read(cdrInput istream)
+ public static ServiceContext read(AbstractCdrInput istream)
{
int id = istream.read_ulong();
switch (id)
{
- case cxCodeSet.ID:
+ case CodeSetServiceContext.ID:
- cxCodeSet codeset = new cxCodeSet();
+ CodeSetServiceContext codeset = new CodeSetServiceContext();
codeset.readContext(istream);
return codeset;
@@ -117,7 +161,7 @@ public class ServiceContext
/**
* Read a sequence of contexts from the input stream.
*/
- public static ServiceContext[] readSequence(cdrInput istream)
+ public static ServiceContext[] readSequence(AbstractCdrInput istream)
{
int size = istream.read_long();
ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
@@ -128,10 +172,10 @@ public class ServiceContext
/**
* Write the context values into the stream.
- *
+ *
* @param ostream a stream to write the data to.
*/
- public void write(cdrOutput ostream)
+ public void write(AbstractCdrOutput ostream)
{
ostream.write_ulong(context_id);
ostream.write_sequence(context_data);
@@ -140,7 +184,7 @@ public class ServiceContext
/**
* Write the sequence of contexts into the input stream.
*/
- public static void writeSequence(cdrOutput ostream, ServiceContext[] value)
+ public static void writeSequence(AbstractCdrOutput ostream, ServiceContext[] value)
{
ostream.write_long(value.length);
for (int i = 0; i < value.length; i++)
@@ -172,8 +216,7 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
else
cx[exists] = service_context;
}
@@ -205,15 +248,13 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + 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.
*/
@@ -227,8 +268,8 @@ public class ServiceContext
}
/**
- * Find context with the given name in the context array,
- * converting into org.omg.IOP.ServiceContext.
+ * 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)
@@ -240,6 +281,17 @@ public class ServiceContext
}
/**
+ * Find context with the given name in the context array without conversions.
+ */
+ public static ServiceContext find(int ctx_name, ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return cx[i];
+ return null;
+ }
+
+ /**
* Return a string representation.
*/
public String toString()
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
index 27181ca6347..c085c17fb9b 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* The header of the standard reply.
@@ -98,13 +98,13 @@ public class ReplyHeader
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
reply_status = in.read_ulong();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -128,12 +128,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
out.write_ulong(reply_status);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
index 7ede4e5b926..5cf723cbc42 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.portable.IDLEntity;
@@ -112,7 +112,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
@@ -121,7 +121,7 @@ public class RequestHeader
operation = in.read_string();
requesting_principal = in.read_sequence();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -143,7 +143,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
@@ -152,6 +152,6 @@ public class RequestHeader
out.write_string(operation);
out.write_sequence(requesting_principal);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
index c3f51a37b91..3fc1541d9ab 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* GIOP 1.2 reply header.
@@ -56,7 +56,7 @@ public class ReplyHeader
*/
public ReplyHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -89,13 +89,13 @@ public class ReplyHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
request_id = in.read_ulong();
reply_status = in.read_ulong();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -107,12 +107,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
out.write_ulong(reply_status);
gnu.CORBA.GIOP.ServiceContext.writeSequence(out, service_context);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
index d294d006723..6b37b6c676c 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
@@ -38,10 +38,11 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import java.io.IOException;
@@ -58,6 +59,11 @@ import org.omg.CORBA.NO_IMPLEMENT;
public class RequestHeader
extends gnu.CORBA.GIOP.v1_0.RequestHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Indicates that the object is addressed by the object key.
*/
@@ -89,7 +95,7 @@ public class RequestHeader
*/
public RequestHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -123,7 +129,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
try
{
@@ -150,20 +156,23 @@ public class RequestHeader
throw new NO_IMPLEMENT("Object addressing by by IOR addressing info");
default :
- throw new MARSHAL("Unknow addressing method in request, " +
+ MARSHAL m = new MARSHAL("Unknow addressing method in request, " +
AddressingDisposition
);
+ m.minor = Minor.UnsupportedAddressing;
+ throw m;
}
operation = in.read_string();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
// No requesting principal in this new format.
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -186,7 +195,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
@@ -208,6 +217,6 @@ public class RequestHeader
ServiceContext.writeSequence(out, service_context);
// No requesting principal in this new format.
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
OpenPOWER on IntegriCloud