Package com.sun.corba.ee.impl.misc
Class ORBUtility
java.lang.Object
com.sun.corba.ee.impl.misc.ORBUtility
Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ThreadLocal
<LinkedList<Byte>> private static final Hashtable
private static StructMember[]
private static OMGSystemException
private static ValueHandler
private static ORBUtilSystemException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
bytesToInt
(byte[] array, int offset) Unmarshal a byte array to an integer.static byte
chooseEncodingVersion
(ORB orb, IOR ior, GIOPVersion gv) static String
classNameOf
(String repositoryId) Get the class name corresponding to a particular repository Id.static int
compareVersion
(int[] v1, int[] v2) Compare two version arrays.static int
compareVersion
(String v1, String v2) Compare two version strings.private static String
compressClassName
(String name) static String[]
concatenateStringArrays
(String[] arr1, String[] arr2) static ValueHandler
Gets the ValueHandler from Util.createValueHandler.static ValueHandler
createValueHandler
(ORB orb) Creates the correct ValueHandler.static void
static void
void
static void
static void
dprintTrace
(Object obj, String msg) static String
dumpBinary
(byte[] data) private static void
dumpBinary
(StringBuffer sbuf, ByteBuffer buffer) static SystemException
private static String
static String
formatStringArray
(String[] a) static byte[]
Given some hex data, extract it and put it into a byte buffer.static byte[]
getByteBufferArray
(ByteBuffer byteBuffer) static String
static byte
static byte
Returns the maximum stream format version supported by our ValueHandler.private static TypeCode
getSystemExceptionTypeCode
(ORB orb, String repID, String name) static String
getThreadName
(Thread thr) static int
hexOf
(char x) Converts an Ascii Character into Hexadecimal digitstatic void
insertSystemException
(SystemException ex, Any any) Static method for writing a CORBA standard exception to an Any.static void
intToBytes
(int value, byte[] array, int offset) Marshal an integer to a byte array.static boolean
isForeignORB
(ORB orb) Returns true if it was accurately determined that the remote ORB is a foreign (non-JavaSoft) ORB.static boolean
isPrintable
(char c) static boolean
isSystemException
(String repositoryId) Return true if this repositoryId is a SystemException.private static boolean
isSystemExceptionTypeCode
(TypeCode type, ORB orb) static ClientDelegate
makeClientDelegate
(IOR ior) static Object
makeObjectReference
(IOR ior) This method is used to create untyped object references.static SocketChannel
Utility method for working around leak in SocketChannel.open( SocketAddress ) method.static String
static int[]
parseVersion
(String version) Parse a version string such as "1.1.6" or "jdk1.2fcs" into a version array of integers {1, 1, 6} or {1, 2}.static void
static void
printBuffer
(String msg, ByteBuffer buffer, PrintStream ps) Print the contents of the buffer out to the PrintStream in hex and ASCII.private static void
printStackTrace
(StackTraceElement[] trace) static void
pushEncVersionToThreadLocalState
(byte value) static SystemException
Static method for reading a CORBA standard exception from a stream.static String
repositoryIdOf
(String name) Get the repository id corresponding to a particular class.static void
private static StructMember[]
static void
throwNotSerializableForCorba
(String className) Throws the CORBA equivalent of a java.io.NotSerializableException Duplicated from util/Utility for Pure ORB reasons.static void
writeSystemException
(SystemException ex, OutputStream strm) Static method for writing a CORBA standard exception to a stream.
-
Field Details
-
encVersionThreadLocal
-
wrapper
-
omgWrapper
-
members
-
vhandler
-
exceptionClassNames
-
exceptionRepositoryIds
-
-
Constructor Details
-
ORBUtility
private ORBUtility()
-
-
Method Details
-
openSocketChannel
Utility method for working around leak in SocketChannel.open( SocketAddress ) method.- Parameters:
sa
- address to connect to- Returns:
- The opened channel
- Throws:
IOException
- If an I/O error occurs- See Also:
-
pushEncVersionToThreadLocalState
public static void pushEncVersionToThreadLocalState(byte value) -
popEncVersionFromThreadLocalState
public static void popEncVersionFromThreadLocalState() -
getEncodingVersion
public static byte getEncodingVersion() -
getByteBufferArray
-
chooseEncodingVersion
- Parameters:
orb
- The ORBior
- Interoperable object referencegv
- The maximum GIOP version supported- Returns:
- the Java serialization encoding version.
-
systemExceptionMembers
-
getSystemExceptionTypeCode
-
isSystemExceptionTypeCode
-
insertSystemException
Static method for writing a CORBA standard exception to an Any.- Parameters:
ex
- Exception to writeany
- The Any to write the SystemException into.
-
extractSystemException
-
createValueHandler
Gets the ValueHandler from Util.createValueHandler.- Returns:
- gets the ValueHandler
-
createValueHandler
Creates the correct ValueHandler. The parameter is ignored- Parameters:
orb
- ignored- Returns:
- The correct ValueHandler
- See Also:
-
isForeignORB
Returns true if it was accurately determined that the remote ORB is a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this will return false.- Parameters:
orb
- ORB to test- Returns:
- If the ORB is foreign
-
bytesToInt
public static int bytesToInt(byte[] array, int offset) Unmarshal a byte array to an integer. Assume the bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+3] is the least-significant-byte.- Parameters:
array
- The array of bytes.offset
- The offset from which to start unmarshalling.- Returns:
- Unmarshalled integer
-
intToBytes
public static void intToBytes(int value, byte[] array, int offset) Marshal an integer to a byte array. The bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+3] is the least-significant-byte.- Parameters:
value
- Integer to marshalarray
- The array of bytes.offset
- The offset from which to start marshalling.
-
hexOf
public static int hexOf(char x) Converts an Ascii Character into Hexadecimal digit- Parameters:
x
- ASCII character to convert- Returns:
- Hexadecimal digit
-
writeSystemException
Static method for writing a CORBA standard exception to a stream.- Parameters:
ex
- Exception to write to streamstrm
- The OutputStream to use for marshaling.
-
readSystemException
Static method for reading a CORBA standard exception from a stream.- Parameters:
strm
- The InputStream to use for unmarshalling.- Returns:
- Exception in stream
-
classNameOf
Get the class name corresponding to a particular repository Id. This is used by the system to unmarshal (instantiate) the appropriate exception class for an marshaled as the value of its repository Id.- Parameters:
repositoryId
- The repository Id for which we want a class name.- Returns:
- Corresponding class name
-
isSystemException
Return true if this repositoryId is a SystemException.- Parameters:
repositoryId
- The repository Id to check.- Returns:
- if ID is a SystemException
-
repositoryIdOf
Get the repository id corresponding to a particular class. This is used by the system to write the appropriate repository id for a system exception.- Parameters:
name
- The class name of the system exception.- Returns:
- Repository ID
-
parseVersion
Parse a version string such as "1.1.6" or "jdk1.2fcs" into a version array of integers {1, 1, 6} or {1, 2}. A string of "n." or "n..m" is equivalent to "n.0" or "n.0.m" respectively.- Parameters:
version
- Java version- Returns:
- Array of version parts
-
compareVersion
public static int compareVersion(int[] v1, int[] v2) Compare two version arrays. Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2.- Parameters:
v1
- first versionv2
- second version- Returns:
- 1, 0 or -1 if v1 is greater than, equal to, or less than v2.
-
compareVersion
Compare two version strings. Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2.- Parameters:
v1
- first version stringv2
- second version string- Returns:
- 1, 0 or -1 if v1 is greater than, equal to, or less than v2.
- See Also:
-
compressClassName
-
getThreadName
-
formatStackTraceElement
-
printStackTrace
-
dprint
-
dprint
-
dprint
-
dprintTrace
-
dprint
-
concatenateStringArrays
-
throwNotSerializableForCorba
Throws the CORBA equivalent of a java.io.NotSerializableException Duplicated from util/Utility for Pure ORB reasons. There are two reasons for this: 1) We can't introduce dependencies on the util version from outside of the io/util packages since it will not exist in the pure ORB build running on JDK 1.3.x. 2) We need to pick up the correct minor code from OMGSystemException.- Parameters:
className
- Class that is notinvalid reference
Serializable
-
getMaxStreamFormatVersion
public static byte getMaxStreamFormatVersion()Returns the maximum stream format version supported by our ValueHandler.- Returns:
- he maximum stream format version
-
makeClientDelegate
-
makeObjectReference
This method is used to create untyped object references.- Parameters:
ior
- object to make reference of- Returns:
- Object pointing to the IOR
-
setDaemon
-
operationNameAndRequestId
-
isPrintable
public static boolean isPrintable(char c) -
getBuffer
Given some hex data, extract it and put it into a byte buffer. The data must follow the following structure:- All characters in a line after a "#" are ignored.
- All non-whitespace characters before a "#" are treated as hex data.
- All whitespace is ignored.
- Only whitespace and 0-9a-fA-F may occur before a "#" in any line.
- Each data line must contain an even number of non-whitespace characters.
- Parameters:
data
- data to extract- Returns:
- byte array containing the data
-
dumpBinary
-
dumpBinary
-
printBuffer
Print the contents of the buffer out to the PrintStream in hex and ASCII.- Parameters:
msg
- The message to use as the header for this displaybuffer
- The ByteBuffer containing the data. The contents from 0 to buffer.position() are printed out. Remember to set position!ps
- The PrintStream to use for the display.
-
getClassSecurityInfo
-
formatStringArray
-