Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
This commit is contained in:
@@ -38,12 +38,12 @@ exception statement from your version. */
|
||||
|
||||
package gnu.CORBA;
|
||||
|
||||
import gnu.CORBA.CDR.cdrBufInput;
|
||||
import gnu.CORBA.CDR.cdrBufOutput;
|
||||
import gnu.CORBA.CDR.cdrInput;
|
||||
import gnu.CORBA.CDR.cdrOutput;
|
||||
import gnu.CORBA.CDR.BufferredCdrInput;
|
||||
import gnu.CORBA.CDR.BufferedCdrOutput;
|
||||
import gnu.CORBA.CDR.AbstractCdrInput;
|
||||
import gnu.CORBA.CDR.AbstractCdrOutput;
|
||||
import gnu.CORBA.GIOP.CharSets_OSF;
|
||||
import gnu.CORBA.GIOP.cxCodeSet;
|
||||
import gnu.CORBA.GIOP.CodeSetServiceContext;
|
||||
|
||||
import org.omg.CORBA.BAD_PARAM;
|
||||
import org.omg.CORBA.CompletionStatus;
|
||||
@@ -59,6 +59,8 @@ import org.omg.IOP.TaggedProfileHelper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.zip.Adler32;
|
||||
|
||||
/**
|
||||
* The implementaton of the Interoperable Object Reference (IOR). IOR can be
|
||||
@@ -174,16 +176,16 @@ public class IOR
|
||||
* The negotiated coding result for this IOR. Saves time, requred for
|
||||
* negotiation computations.
|
||||
*/
|
||||
public cxCodeSet negotiated;
|
||||
public CodeSetServiceContext negotiated;
|
||||
|
||||
/**
|
||||
* Read the code set profile information from the given input stream.
|
||||
*
|
||||
* @param profile a stream to read from.
|
||||
*/
|
||||
public void read(cdrInput profile)
|
||||
public void read(AbstractCdrInput profile)
|
||||
{
|
||||
cdrBufInput encapsulation = profile.read_encapsulation();
|
||||
BufferredCdrInput encapsulation = profile.read_encapsulation();
|
||||
narrow.read(encapsulation);
|
||||
wide.read(encapsulation);
|
||||
}
|
||||
@@ -201,9 +203,9 @@ public class IOR
|
||||
*
|
||||
* @param profile a stream to write into.
|
||||
*/
|
||||
public void write(cdrOutput profile)
|
||||
public void write(AbstractCdrOutput profile)
|
||||
{
|
||||
cdrOutput encapsulation = profile.createEncapsulation();
|
||||
AbstractCdrOutput encapsulation = profile.createEncapsulation();
|
||||
narrow.write(encapsulation);
|
||||
wide.write(encapsulation);
|
||||
try
|
||||
@@ -274,13 +276,13 @@ public class IOR
|
||||
/**
|
||||
* Write the internet profile (except the heading tag.
|
||||
*/
|
||||
public void write(cdrOutput out)
|
||||
public void write(AbstractCdrOutput out)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Need to write the Internet profile into the separate
|
||||
// stream as we must know the size in advance.
|
||||
cdrOutput b = out.createEncapsulation();
|
||||
AbstractCdrOutput b = out.createEncapsulation();
|
||||
|
||||
version.write(b);
|
||||
b.write_string(host);
|
||||
@@ -310,6 +312,7 @@ public class IOR
|
||||
catch (Exception e)
|
||||
{
|
||||
MARSHAL m = new MARSHAL("Unable to write Internet profile.");
|
||||
m.minor = Minor.IOR;
|
||||
m.initCause(e);
|
||||
throw m;
|
||||
}
|
||||
@@ -392,7 +395,7 @@ public class IOR
|
||||
buf.write(cx);
|
||||
}
|
||||
|
||||
cdrBufInput cdr = new cdrBufInput(buf.toByteArray());
|
||||
BufferredCdrInput cdr = new BufferredCdrInput(buf.toByteArray());
|
||||
|
||||
r._read(cdr);
|
||||
return r;
|
||||
@@ -411,7 +414,7 @@ public class IOR
|
||||
* @param c a stream to read from.
|
||||
* @throws IOException if the stream throws it.
|
||||
*/
|
||||
public void _read(cdrInput c)
|
||||
public void _read(AbstractCdrInput c)
|
||||
throws IOException, BAD_PARAM
|
||||
{
|
||||
int endian;
|
||||
@@ -433,13 +436,13 @@ public class IOR
|
||||
* If the stream contains a null value, the Id and Internet fields become
|
||||
* equal to null. Otherwise Id contains some string (possibly empty).
|
||||
*
|
||||
* Id is checked for null in cdrInput that then returns null instead of
|
||||
* Id is checked for null in AbstractCdrInput that then returns null instead of
|
||||
* object.
|
||||
*
|
||||
* @param c a stream to read from.
|
||||
* @throws IOException if the stream throws it.
|
||||
*/
|
||||
public void _read_no_endian(cdrInput c)
|
||||
public void _read_no_endian(AbstractCdrInput c)
|
||||
throws IOException, BAD_PARAM
|
||||
{
|
||||
Id = c.read_string();
|
||||
@@ -456,7 +459,7 @@ public class IOR
|
||||
for (int i = 0; i < n_profiles; i++)
|
||||
{
|
||||
int tag = c.read_long();
|
||||
cdrBufInput profile = c.read_encapsulation();
|
||||
BufferredCdrInput profile = c.read_encapsulation();
|
||||
|
||||
if (tag == Internet_profile.TAG_INTERNET_IOP)
|
||||
{
|
||||
@@ -515,7 +518,7 @@ public class IOR
|
||||
* Write this IOR record to the provided CDR stream. This procedure writes the
|
||||
* zero (Big Endian) marker first.
|
||||
*/
|
||||
public void _write(cdrOutput out)
|
||||
public void _write(AbstractCdrOutput out)
|
||||
{
|
||||
// Always use Big Endian.
|
||||
out.write(0);
|
||||
@@ -528,7 +531,7 @@ public class IOR
|
||||
* The null value is written as defined in OMG specification (zero length
|
||||
* string, followed by an empty set of profiles).
|
||||
*/
|
||||
public static void write_null(cdrOutput out)
|
||||
public static void write_null(AbstractCdrOutput out)
|
||||
{
|
||||
// Empty Id string.
|
||||
out.write_string("");
|
||||
@@ -541,7 +544,7 @@ public class IOR
|
||||
* Write this IOR record to the provided CDR stream. The procedure writed data
|
||||
* in Big Endian, but does NOT add any endian marker to the beginning.
|
||||
*/
|
||||
public void _write_no_endian(cdrOutput out)
|
||||
public void _write_no_endian(AbstractCdrOutput out)
|
||||
{
|
||||
// Write repository id.
|
||||
out.write_string(Id);
|
||||
@@ -595,7 +598,7 @@ public class IOR
|
||||
*/
|
||||
public String toStringifiedReference()
|
||||
{
|
||||
cdrBufOutput out = new cdrBufOutput();
|
||||
BufferedCdrOutput out = new BufferedCdrOutput();
|
||||
|
||||
_write(out);
|
||||
|
||||
@@ -675,7 +678,7 @@ public class IOR
|
||||
TaggedComponent[] present;
|
||||
if (profile.profile_data.length > 0)
|
||||
{
|
||||
cdrBufInput in = new cdrBufInput(profile.profile_data);
|
||||
BufferredCdrInput in = new BufferredCdrInput(profile.profile_data);
|
||||
|
||||
present = new TaggedComponent[in.read_long()];
|
||||
|
||||
@@ -687,7 +690,7 @@ public class IOR
|
||||
else
|
||||
present = new TaggedComponent[0];
|
||||
|
||||
cdrBufOutput out = new cdrBufOutput(profile.profile_data.length
|
||||
BufferedCdrOutput out = new BufferedCdrOutput(profile.profile_data.length
|
||||
+ component.component_data.length
|
||||
+ 8);
|
||||
|
||||
@@ -715,4 +718,51 @@ public class IOR
|
||||
// The future supported tagged profiles should be added here.
|
||||
throw new BAD_PARAM("Unsupported profile type " + profile.tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for equality.
|
||||
*/
|
||||
public boolean equals(Object x)
|
||||
{
|
||||
if (x instanceof IOR)
|
||||
{
|
||||
boolean keys;
|
||||
boolean hosts = true;
|
||||
|
||||
IOR other = (IOR) x;
|
||||
|
||||
if (Internet==null || other.Internet==null)
|
||||
return Internet == other.Internet;
|
||||
|
||||
if (key != null && other.key != null)
|
||||
keys = Arrays.equals(key, other.key);
|
||||
else
|
||||
keys = key == other.key;
|
||||
|
||||
if (Internet != null && Internet.host != null)
|
||||
if (other.Internet != null && other.Internet.host != null)
|
||||
hosts = other.Internet.host.equals(Internet.host);
|
||||
|
||||
return keys & hosts && Internet.port==other.Internet.port;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hashcode of this IOR.
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
Adler32 adler = new Adler32();
|
||||
if (key != null)
|
||||
adler.update(key);
|
||||
if (Internet != null)
|
||||
{
|
||||
if (Internet.host != null)
|
||||
adler.update(Internet.host.getBytes());
|
||||
adler.update(Internet.port);
|
||||
}
|
||||
return (int) adler.getValue();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user