1.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/TagSupport.java Mon Jul 29 09:07:49 2002 +0000
1.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/TagSupport.java Tue Jul 30 23:10:20 2002 +0000
1.3 @@ -54,6 +54,10 @@
1.4 return getTypePrefix(type) + "." + substName;
1.5 }
1.6
1.7 + public static String getTypeFullName(StorableObject storable, int type) {
1.8 + return getTypeFullName(storable) + (type == CLASS ? "Class" : "");
1.9 + }
1.10 +
1.11 /** Returns the full class-name of an optional implementation class
1.12 * for repository object <code>type</code>. If a class of the returned
1.13 * name is available in the class-path it is used as super-class for the
2.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Mon Jul 29 09:07:49 2002 +0000
2.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/StorableClass.java Tue Jul 30 23:10:20 2002 +0000
2.3 @@ -519,66 +519,92 @@
2.4 * is returned as default value.</p>
2.5 */
2.6 private Class resolveClassSuperclass() throws StorageException, ClassNotFoundException {
2.7 + StorableClass cls[] = new StorableClass[1];
2.8 + findClassSuperclass(cls);
2.9 + if (cls[0] == null) {
2.10 + return ClassProxyHandler.class;
2.11 + } else {
2.12 + return resolveClass(cls[0], TagSupport.CLASS);
2.13 + }
2.14 + }
2.15 +
2.16 + private static Class resolveClass(StorableClass cls, int type) throws StorageException {
2.17 + try {
2.18 + return resolveClass(TagSupport.getImplFullName(cls.getMetaObject(), type));
2.19 + } catch (ClassNotFoundException e) {
2.20 + return (type == TagSupport.CLASS ? ClassProxyHandler.class : InstanceHandler.class);
2.21 + }
2.22 + }
2.23 +
2.24 + private static Class resolveClass(String className) throws ClassNotFoundException {
2.25 + return BaseObjectHandler.resolveImplementation(className);
2.26 + }
2.27 +
2.28 + private static Class resolveInterface(StorableClass cls, int type) throws ClassNotFoundException, StorageException {
2.29 + return BaseObjectHandler.resolveInterface(TagSupport.getTypeFullName(cls.getMetaObject(), type));
2.30 + }
2.31 +
2.32 + private Class findInstanceSuperclass(StorableClass cls[]) throws StorageException, ClassNotFoundException {
2.33 Class result = null;
2.34 - if (classDerived) {
2.35 - result = resolveClass(TagSupport.getImplFullName(getMetaObject(), TagSupport.CLASS));
2.36 + if (instanceDerived || TagSupport.getTagValue(getMetaObject(), INTERCEPTABLE_TAG_ID, "").equals("true")) {
2.37 + cls[0] = this;
2.38 + result = resolveInterface(this, TagSupport.INSTANCE);
2.39 } else {
2.40 Class current;
2.41 + StorableClass currentCls[] = new StorableClass[1];
2.42 for (Iterator it = superclasses.iterator(); it.hasNext();) {
2.43 - current = ((StorableClass) getMdrStorage().getObject((String) it.next())).getClassSuperclass();
2.44 - if (result == null) {
2.45 + current = ((StorableClass) getMdrStorage().getObject((String) it.next())).findInstanceSuperclass(currentCls);
2.46 + if (result == null || result.isAssignableFrom(current)) {
2.47 result = current;
2.48 - } else {
2.49 - if (result.isAssignableFrom(current)) {
2.50 - result = current;
2.51 - } else if (!current.isAssignableFrom(result)) {
2.52 - result = resolveClass(TagSupport.getImplFullName(getMetaObject(), TagSupport.CLASS));
2.53 - break;
2.54 - }
2.55 + cls[0] = currentCls[0];
2.56 + } else if (!current.isAssignableFrom(result)) {
2.57 + result = resolveInterface(this, TagSupport.INSTANCE);
2.58 + cls[0] = this;
2.59 + break;
2.60 }
2.61 }
2.62 if (result == null) {
2.63 - result = ClassProxyHandler.class;
2.64 + result = Object.class;
2.65 }
2.66 }
2.67 return result;
2.68 }
2.69 -
2.70 - private Class resolveClass(String className) throws ClassNotFoundException {
2.71 - return BaseObjectHandler.resolveImplementation(className);
2.72 - }
2.73 -
2.74 - private Class resolveInstanceSuperclass() throws StorageException, ClassNotFoundException {
2.75 +
2.76 + private Class findClassSuperclass(StorableClass cls[]) throws StorageException, ClassNotFoundException {
2.77 Class result = null;
2.78 - if (instanceDerived || TagSupport.getTagValue(getMetaObject(), INTERCEPTABLE_TAG_ID, "").equals("true")) try {
2.79 - result = resolveClass(TagSupport.getImplFullName(getMetaObject(), TagSupport.INSTANCE));
2.80 - } catch (ClassNotFoundException e) {
2.81 - result = null;
2.82 + if (classDerived) {
2.83 + cls[0] = this;
2.84 + result = resolveInterface(this, TagSupport.CLASS);
2.85 } else {
2.86 Class current;
2.87 + StorableClass currentCls[] = new StorableClass[1];
2.88 for (Iterator it = superclasses.iterator(); it.hasNext();) {
2.89 - current = ((StorableClass) getMdrStorage().getObject((String) it.next())).getInstanceSuperclass();
2.90 - if (result == null) {
2.91 + current = ((StorableClass) getMdrStorage().getObject((String) it.next())).findClassSuperclass(currentCls);
2.92 + if (result == null || result.isAssignableFrom(current)) {
2.93 result = current;
2.94 - } else {
2.95 - if (result.isAssignableFrom(current)) {
2.96 - result = current;
2.97 - } else if (!current.isAssignableFrom(result)) {
2.98 - try {
2.99 - result = resolveClass(TagSupport.getImplFullName(getMetaObject(), TagSupport.INSTANCE));
2.100 - } catch (ClassNotFoundException e) {
2.101 - result = null;
2.102 - }
2.103 - break;
2.104 - }
2.105 + cls[0] = currentCls[0];
2.106 + } else if (!current.isAssignableFrom(result)) {
2.107 + result = resolveInterface(this, TagSupport.CLASS);
2.108 + cls[0] = this;
2.109 + break;
2.110 }
2.111 }
2.112 if (result == null) {
2.113 - result = InstanceHandler.class;
2.114 + result = Object.class;
2.115 }
2.116 }
2.117 return result;
2.118 }
2.119 +
2.120 + private Class resolveInstanceSuperclass() throws StorageException, ClassNotFoundException {
2.121 + StorableClass cls[] = new StorableClass[1];
2.122 + findInstanceSuperclass(cls);
2.123 + if (cls[0] == null) {
2.124 + return InstanceHandler.class;
2.125 + } else {
2.126 + return resolveClass(cls[0], TagSupport.INSTANCE);
2.127 + }
2.128 + }
2.129
2.130 protected void deleteRecursive() throws StorageException {
2.131 Collection objects = new ArrayList(allObjects(false));
3.1 --- a/mdr/src/org/netbeans/mdr/util/IOUtils.java Mon Jul 29 09:07:49 2002 +0000
3.2 +++ b/mdr/src/org/netbeans/mdr/util/IOUtils.java Tue Jul 30 23:10:20 2002 +0000
3.3 @@ -297,19 +297,20 @@
3.4 return (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1;
3.5 }
3.6 case T_LONG | 0x80: {
3.7 - int ch1, ch2, ch3, ch4;
3.8 - long v;
3.9 -
3.10 + int ch1, ch2, ch3, ch4, v_low;
3.11 + long v_high;
3.12 + //add by kozusznikj
3.13 ch1 = inputStream.read();
3.14 ch2 = inputStream.read();
3.15 ch3 = inputStream.read();
3.16 ch4 = inputStream.read();
3.17 - v = (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1;
3.18 + v_low = (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1;
3.19 ch1 = inputStream.read();
3.20 ch2 = inputStream.read();
3.21 ch3 = inputStream.read();
3.22 ch4 = inputStream.read();
3.23 - return v << 32 + ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1);
3.24 + v_high = (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1;
3.25 + return (v_high << 32) + v_low;
3.26 }
3.27 default:
3.28 throw new IOException("Unknown int format: " + t);