Fields Summary |
---|
public static final byte[] | IDL_IDENTIFIER_CHARS |
private static final long | serialVersionUID |
private static String | defaultServerURL |
private static boolean | useCodebaseOnly |
private static IdentityHashtable | classToRepStr |
private static IdentityHashtable | classIDLToRepStr |
private static IdentityHashtable | classSeqToRepStr |
private static IdentityHashtable | repStrToByteArray |
private static Hashtable | repStrToClass |
private String | repId |
private boolean | isSupportedFormat |
private String | typeString |
private String | versionString |
private boolean | isSequence |
private boolean | isRMIValueType |
private boolean | isIDLType |
private String | completeClassName |
private String | unqualifiedName |
private String | definedInId |
private Class | clazz |
private String | suid |
private String | actualSuid |
private long | suidLong |
private long | actualSuidLong |
private static final String | kSequenceKeyword |
private static final String | kValuePrefix |
private static final String | kIDLPrefix |
private static final String | kIDLNamePrefix |
private static final String | kIDLClassnamePrefix |
private static final String | kSequencePrefix |
private static final String | kCORBAPrefix |
private static final String | kArrayPrefix |
private static final int | kValuePrefixLength |
private static final int | kIDLPrefixLength |
private static final int | kSequencePrefixLength |
private static final String | kInterfaceHashCode |
private static final String | kInterfaceOnlyHashStr |
private static final String | kExternalizableHashStr |
public static final int | kInitialValueTag |
public static final int | kNoTypeInfo |
public static final int | kSingleRepTypeInfo |
public static final int | kPartialListTypeInfo |
public static final int | kChunkedMask |
public static final int | kPreComputed_StandardRMIUnchunked |
public static final int | kPreComputed_CodeBaseRMIUnchunked |
public static final int | kPreComputed_StandardRMIChunked |
public static final int | kPreComputed_CodeBaseRMIChunked |
public static final int | kPreComputed_StandardRMIUnchunked_NoRep |
public static final int | kPreComputed_CodeBaseRMIUnchunked_NoRep |
public static final int | kPreComputed_StandardRMIChunked_NoRep |
public static final int | kPreComputed_CodeBaseRMIChunked_NoRep |
public static final String | kWStringValueVersion |
public static final String | kWStringValueHash |
public static final String | kWStringStubValue |
public static final String | kWStringTypeStr |
public static final String | kWStringValueRepID |
public static final String | kAnyRepID |
public static final String | kClassDescValueHash |
public static final String | kClassDescStubValue |
public static final String | kClassDescTypeStr |
public static final String | kClassDescValueRepID |
public static final String | kObjectValueHash |
public static final String | kObjectStubValue |
public static final String | kSequenceValueHash |
public static final String | kPrimitiveSequenceValueHash |
public static final String | kSerializableValueHash |
public static final String | kSerializableStubValue |
public static final String | kExternalizableValueHash |
public static final String | kExternalizableStubValue |
public static final String | kRemoteValueHash |
public static final String | kRemoteStubValue |
public static final String | kRemoteTypeStr |
public static final String | kRemoteValueRepID |
public static final Hashtable | kSpecialArrayTypeStrings |
public static final Hashtable | kSpecialCasesRepIDs |
public static final Hashtable | kSpecialCasesStubValues |
public static final Hashtable | kSpecialCasesVersions |
public static final Hashtable | kSpecialCasesClasses |
public static final Hashtable | kSpecialCasesArrayPrefix |
public static final Hashtable | kSpecialPrimitives |
private static final byte[] | ASCII_HEXUsed to convert ascii to hex. |
public static final RepositoryIdCache | cache |
public static final String | kjava_rmi_Remote |
public static final String | korg_omg_CORBA_Object |
public static final Class[] | kNoParamTypes |
public static final Object[] | kNoArgs |
Methods Summary |
---|
public static int | computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding)
int value_tag = kInitialValueTag;
if (codeBasePresent)
value_tag = value_tag | 0x00000001;
value_tag = value_tag | typeInfo;
if (chunkedEncoding)
value_tag = value_tag | kChunkedMask;
return value_tag;
|
private static java.lang.String | convertFromISOLatin1(java.lang.String name)Convert strings with ISO Latin 1 escape sequences back to original strings.
Section 5.5.7 of OBV spec.
int index = -1;
StringBuffer buf = new StringBuffer(name);
while ((index = buf.toString().indexOf("\\U")) != -1){
String str = "0000" + buf.toString().substring(index+2, index+6);
// Convert Hexadecimal
byte[] buffer = new byte[(str.length() - 4) / 2];
for (int i=4, j=0; i < str.length(); i +=2, j++) {
buffer[j] = (byte)((Utility.hexOf(str.charAt(i)) << 4) & 0xF0);
buffer[j] |= (byte)((Utility.hexOf(str.charAt(i+1)) << 0) & 0x0F);
}
buf = new StringBuffer(delete(buf.toString(), index, index+6));
buf.insert(index, (char)buffer[1]);
}
return buf.toString();
|
public static java.lang.String | convertToISOLatin1(java.lang.String name)Convert strings with illegal IDL identifier characters.
Section 5.5.7 of OBV spec.
int length = name.length();
if (length == 0) {
return name;
}
StringBuffer buffer = null;
for (int i = 0; i < length; i++) {
char c = name.charAt(i);
if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) {
// We gotta convert. Have we already started?
if (buffer == null) {
// No, so get set up...
buffer = new StringBuffer(name.substring(0,i));
}
// Convert the character into the IDL escape syntax...
buffer.append(
"\\U" +
(char)ASCII_HEX[(c & 0xF000) >>> 12] +
(char)ASCII_HEX[(c & 0x0F00) >>> 8] +
(char)ASCII_HEX[(c & 0x00F0) >>> 4] +
(char)ASCII_HEX[(c & 0x000F)]);
} else {
if (buffer != null) {
buffer.append(c);
}
}
}
if (buffer != null) {
name = buffer.toString();
}
return name;
|
public static java.lang.String | createForAnyType(java.lang.Class type)Createa a repository ID for the type if it is either a java type
or an IDL type.
try{
if (type.isArray())
return createSequenceRepID(type);
else if (IDLEntity.class.isAssignableFrom(type))
{
try{
return getIdFromHelper(type);
}
catch(Throwable t) {
return createForIDLType(type, 1, 0);
}
}
else return createForJavaType(type);
}
catch(com.sun.corba.se.impl.io.TypeMismatchException e){
return null;
}
|
public static java.lang.String | createForIDLType(java.lang.Class ser, int major, int minor)Creates a repository ID for an IDL Java Type.
synchronized (classIDLToRepStr){
String repid = (String)classIDLToRepStr.get(ser);
if (repid != null)
return repid;
repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.",'/") +
":" + major + "." + minor;
classIDLToRepStr.put(ser, repid);
return repid;
}
|
public static java.lang.String | createForJavaType(java.io.Serializable ser)Creates a repository ID for a normal Java Type.
synchronized (classToRepStr) {
String repid = createForSpecialCase(ser);
if (repid != null)
return repid;
Class clazz = ser.getClass();
repid = (String)classToRepStr.get(clazz);
if (repid != null)
return repid;
repid = kValuePrefix + convertToISOLatin1(clazz.getName()) +
createHashString(clazz);
classToRepStr.put(clazz, repid);
repStrToClass.put(repid, clazz);
return repid;
}
|
public static java.lang.String | createForJavaType(java.lang.Class clz)Creates a repository ID for a normal Java Type.
synchronized (classToRepStr){
String repid = createForSpecialCase(clz);
if (repid != null)
return repid;
repid = (String)classToRepStr.get(clz);
if (repid != null)
return repid;
repid = kValuePrefix + convertToISOLatin1(clz.getName()) +
createHashString(clz);
classToRepStr.put(clz, repid);
repStrToClass.put(repid, clz);
return repid;
}
|
public static java.lang.String | createForSpecialCase(java.lang.Class clazz)
if (clazz.isArray()){
return createSequenceRepID(clazz);
}
else {
return (String)kSpecialCasesRepIDs.get(clazz);
}
|
public static java.lang.String | createForSpecialCase(java.io.Serializable ser)
Class clazz = ser.getClass();
if (clazz.isArray()){
return createSequenceRepID(ser);
}
else
return createForSpecialCase(clazz);
|
private static java.lang.String | createHashString(java.io.Serializable ser)
return createHashString(ser.getClass());
|
private static java.lang.String | createHashString(java.lang.Class clazz)
if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))
return kInterfaceHashCode;
//ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
long actualLong = ObjectStreamClass.getActualSerialVersionUID(clazz);
String hash = null;
if (actualLong == 0)
hash = kInterfaceOnlyHashStr;
else if (actualLong == 1)
hash = kExternalizableHashStr;
else
hash = Long.toHexString(actualLong).toUpperCase();
while(hash.length() < 16){
hash = "0" + hash;
}
long declaredLong = ObjectStreamClass.getSerialVersionUID(clazz);
String declared = null;
if (declaredLong == 0)
declared = kInterfaceOnlyHashStr;
else if (declaredLong == 1)
declared = kExternalizableHashStr;
else
declared = Long.toHexString(declaredLong).toUpperCase();
while (declared.length() < 16){
declared = "0" + declared;
}
hash = hash + ":" + declared;
return ":" + hash;
|
public static java.lang.String | createSequenceRepID(java.lang.Object ser)Creates a repository ID for a sequence. This is for expert users only as
this method assumes the object passed is an array. If passed an object
that is not an array, it will produce a rep id for a sequence of zero
length. This would be an error.
return createSequenceRepID(ser.getClass());
|
public static java.lang.String | createSequenceRepID(java.lang.Class clazz)Creates a repository ID for a sequence. This is for expert users only as
this method assumes the object passed is an array. If passed an object
that is not an array, it will produce a malformed rep id.
synchronized (classSeqToRepStr){
String repid = (String)classSeqToRepStr.get(clazz);
if (repid != null)
return repid;
Class originalClazz = clazz;
Class type = null;
int numOfDims = 0;
while ((type = clazz.getComponentType()) != null) {
numOfDims++;
clazz = type;
}
if (clazz.isPrimitive())
repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash;
else {
StringBuffer buf = new StringBuffer();
buf.append(kValuePrefix);
while(numOfDims-- > 0) {
buf.append("[");
}
buf.append("L");
buf.append(convertToISOLatin1(clazz.getName()));
buf.append(";");
buf.append(createHashString(clazz));
repid = buf.toString();
}
classSeqToRepStr.put(originalClazz,repid);
return repid;
}
|
private static java.lang.String | delete(java.lang.String str, int from, int to)
return str.substring(0, from) + str.substring(to, str.length());
|
public static long | fromHex(java.lang.String hexNumber)
if (hexNumber.startsWith("0x"))
return Long.valueOf(hexNumber.substring(2), 16).longValue();
else return Long.valueOf(hexNumber, 16).longValue();
|
public final java.lang.String | getActualSerialVersionUID()
return actualSuid;
|
public final long | getActualSerialVersionUIDAsLong()
return actualSuidLong;
|
public final java.lang.Class | getAnyClassFromType()
try {
return getClassFromType();
} catch (ClassNotFoundException cnfe) {
Class clz = (Class)repStrToClass.get(repId);
if (clz != null)
return clz;
else
throw cnfe;
}
|
public static byte[] | getByteArray(java.lang.String repStr)
synchronized (repStrToByteArray){
return (byte[]) repStrToByteArray.get(repStr);
}
|
public final java.lang.Class | getClassFromType()
if (clazz != null)
return clazz;
Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
if (specialCase != null){
clazz = specialCase;
return specialCase;
}
else
{
try{
return Util.loadClass(getClassName(), null, null);
}
catch(ClassNotFoundException cnfe){
if (defaultServerURL != null) {
try{
return getClassFromType(defaultServerURL);
}
catch(MalformedURLException mue){
throw cnfe;
}
}
else throw cnfe;
}
}
|
public final java.lang.Class | getClassFromType(java.lang.Class expectedType, java.lang.String codebase)
if (clazz != null)
return clazz;
Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
if (specialCase != null){
clazz = specialCase;
return specialCase;
} else {
ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader());
return Utility.loadClassOfType(getClassName(),
codebase,
expectedTypeClassLoader,
expectedType,
expectedTypeClassLoader);
}
|
public final java.lang.Class | getClassFromType(java.lang.String url)
return Util.loadClass(getClassName(), url, null);
|
public final java.lang.String | getClassName()
if (isRMIValueType)
return typeString;
else if (isIDLType)
return completeClassName;
else return null;
|
public final java.lang.String | getDefinedInId()
if (definedInId == null){
getUnqualifiedName();
}
return definedInId;
|
private static java.lang.String | getIdFromHelper(java.lang.Class clazz)
try {
Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
clazz.getClassLoader(), clazz, clazz.getClassLoader());
Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
return (String)idMethod.invoke(null, kNoArgs);
}
catch(java.lang.ClassNotFoundException cnfe)
{
throw new org.omg.CORBA.MARSHAL(cnfe.toString());
}
catch(java.lang.NoSuchMethodException nsme)
{
throw new org.omg.CORBA.MARSHAL(nsme.toString());
}
catch(java.lang.reflect.InvocationTargetException ite)
{
throw new org.omg.CORBA.MARSHAL(ite.toString());
}
catch(java.lang.IllegalAccessException iae)
{
throw new org.omg.CORBA.MARSHAL(iae.toString());
}
|
public final java.lang.String | getRepositoryId()
return repId;
|
public final java.lang.String | getSerialVersionUID()
return suid;
|
public final long | getSerialVersionUIDAsLong()
return suidLong;
|
public static java.lang.String | getServerURL()
return defaultServerURL;
|
public static int | getTypeInfo(int value_tag)
return (value_tag & 0x00000006);
|
public final java.lang.String | getTypeString()
return typeString;
|
public final java.lang.String | getUnqualifiedName()
if (unqualifiedName == null){
String className = getClassName();
int index = className.lastIndexOf('.");
if (index == -1){
unqualifiedName = className;
definedInId = "IDL::1.0";
}
else {
unqualifiedName = className.substring(index);
definedInId = "IDL:" + className.substring(0, index).replace('.",'/") + ":1.0";
}
}
return unqualifiedName;
|
public final java.lang.String | getVersionString()
return versionString;
|
com.sun.corba.se.impl.util.RepositoryId | init(java.lang.String aRepId)
this.repId = aRepId;
// Special case for remote
if (aRepId.length() == 0) {
clazz = java.rmi.Remote.class;
typeString = "";
isRMIValueType = true;
suid = kInterfaceOnlyHashStr;
return this;
} else if (aRepId.equals(kWStringValueRepID)) {
clazz = java.lang.String.class;
typeString = kWStringTypeStr;
isIDLType = true;
// fix where Attempting to obtain a FullValueDescription
// for an RMI value type with a String field causes an exception.
completeClassName = "java.lang.String";
versionString = kWStringValueVersion;
return this;
} else {
String repId = convertFromISOLatin1(aRepId);
int firstIndex = repId.indexOf(':") ;
if (firstIndex == -1)
throw new IllegalArgumentException( "RepsitoryId must have the form <type>:<body>" ) ;
int secondIndex = repId.indexOf( ':", firstIndex + 1 ) ;
if (secondIndex == -1)
versionString = "" ;
else
versionString = repId.substring(secondIndex) ;
if (repId.startsWith(kIDLPrefix)) {
typeString =
repId.substring(kIDLPrefixLength, repId.indexOf(':", kIDLPrefixLength));
isIDLType = true;
if (typeString.startsWith(kIDLNamePrefix))
completeClassName = kIDLClassnamePrefix +
typeString.substring(kIDLNamePrefix.length()).replace('/",'.");
else
completeClassName = typeString.replace('/",'.");
} else if (repId.startsWith(kValuePrefix)) {
typeString =
repId.substring(kValuePrefixLength, repId.indexOf(':", kValuePrefixLength));
isRMIValueType = true;
if (versionString.indexOf('.") == -1) {
actualSuid = versionString.substring(1);
suid = actualSuid; // default if not explicitly specified
if (actualSuid.indexOf(':") != -1){
// we have a declared hash also
int pos = actualSuid.indexOf(':")+1;
// actualSuid = suid.substring(pos);
// suid = suid.substring(0, pos-1);
suid = actualSuid.substring(pos);
actualSuid = actualSuid.substring(0, pos-1);
}
} else {
// _REVISIT_ : Special case version failure ?
}
} else {
isSupportedFormat = false;
typeString = "" ;
}
if (typeString.startsWith(kSequencePrefix)) {
isSequence = true;
}
return this;
}
|
public static boolean | isAbstractBase(java.lang.Class clazz)
return (clazz.isInterface() &&
IDLEntity.class.isAssignableFrom(clazz) &&
(!ValueBase.class.isAssignableFrom(clazz)) &&
(!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));
|
public static boolean | isAnyRequired(java.lang.Class clazz)
return ((clazz == java.lang.Object.class) ||
(clazz == java.io.Serializable.class) ||
(clazz == java.io.Externalizable.class));
|
public static boolean | isChunkedEncoding(int value_tag)
return ((value_tag & kChunkedMask) != 0);
|
public static boolean | isCodeBasePresent(int value_tag)
return ((value_tag & 0x00000001) == 1);
|
public final boolean | isIDLType()
return isIDLType;
|
public final boolean | isRMIValueType()
return isRMIValueType;
|
public final boolean | isSequence()
return isSequence;
|
public final boolean | isSupportedFormat()
return isSupportedFormat;
|
private static java.lang.String | replace(java.lang.String target, java.lang.String arg, java.lang.String source)
int i = 0;
i = target.indexOf(arg);
while(i != -1)
{
String left = target.substring(0, i);
String right = target.substring(i+arg.length());
target = new String(left+source+right);
i = target.indexOf(arg);
}
return target;
|
public static void | setByteArray(java.lang.String repStr, byte[] repStrBytes)
synchronized (repStrToByteArray){
repStrToByteArray.put(repStr, repStrBytes);
}
|
public final java.lang.String | toString()
return repId;
|
public static boolean | useFullValueDescription(java.lang.Class clazz, java.lang.String repositoryID)Checks to see if the FullValueDescription should be retrieved.
String clazzRepIDStr = createForAnyType(clazz);
if (clazzRepIDStr.equals(repositoryID))
return false;
RepositoryId targetRepid;
RepositoryId clazzRepid;
synchronized(cache) {
// to avoid race condition where multiple threads could be
// accessing this method, and their access to the cache may
// be interleaved giving unexpected results
targetRepid = cache.getId(repositoryID);
clazzRepid = cache.getId(clazzRepIDStr);
}
//ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){
if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) {
String mssg = "Mismatched serialization UIDs : Source (Rep. ID" +
clazzRepid + ") = " +
clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID +
") = " + targetRepid.getSerialVersionUID();
//com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg);
throw new IOException(mssg);
}
else {
return true;
}
}
else {
throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")");
}
|