summaryrefslogtreecommitdiff
path: root/ridljar
diff options
context:
space:
mode:
Diffstat (limited to 'ridljar')
-rw-r--r--ridljar/com/makefile.mk64
-rw-r--r--ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java76
-rw-r--r--ridljar/com/sun/star/lib/uno/typedesc/MemberDescriptionHelper.java64
-rw-r--r--ridljar/com/sun/star/lib/uno/typedesc/MethodDescription.java111
-rw-r--r--ridljar/com/sun/star/lib/uno/typedesc/TypeDescription.java721
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/AttributeTypeInfo.java95
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/ConstantTypeInfo.java40
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/MemberTypeInfo.java105
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/MethodTypeInfo.java98
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/ParameterTypeInfo.java114
-rw-r--r--ridljar/com/sun/star/lib/uno/typeinfo/TypeInfo.java85
-rw-r--r--ridljar/com/sun/star/lib/util/DisposeListener.java43
-rw-r--r--ridljar/com/sun/star/lib/util/DisposeNotifier.java53
-rw-r--r--ridljar/com/sun/star/lib/util/WeakMap.java311
-rw-r--r--ridljar/com/sun/star/uno/Any.java140
-rw-r--r--ridljar/com/sun/star/uno/Enum.java61
-rw-r--r--ridljar/com/sun/star/uno/IBridge.java99
-rw-r--r--ridljar/com/sun/star/uno/IEnvironment.java152
-rw-r--r--ridljar/com/sun/star/uno/IFieldDescription.java55
-rw-r--r--ridljar/com/sun/star/uno/IMapping.java49
-rw-r--r--ridljar/com/sun/star/uno/IMemberDescription.java75
-rw-r--r--ridljar/com/sun/star/uno/IMethodDescription.java88
-rw-r--r--ridljar/com/sun/star/uno/IQueryInterface.java69
-rw-r--r--ridljar/com/sun/star/uno/ITypeDescription.java188
-rw-r--r--ridljar/com/sun/star/uno/Type.java652
-rw-r--r--ridljar/com/sun/star/uno/Union.java52
-rw-r--r--ridljar/com/sun/star/uno/UnoRuntime.java696
-rw-r--r--ridljar/javamaker/makefile.mk46
-rw-r--r--ridljar/prj/build.lst6
-rw-r--r--ridljar/prj/d.lst4
-rw-r--r--ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java214
-rw-r--r--ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java94
-rw-r--r--ridljar/source/unoloader/com/sun/star/lib/unoloader/makefile.mk60
-rw-r--r--ridljar/source/unoloader/com/sun/star/lib/unoloader/manifest1
-rw-r--r--ridljar/source/unoloader/delzip0
-rw-r--r--ridljar/source/unoloader/makefile.mk39
-rw-r--r--ridljar/test/com/sun/star/lib/uno/typedesc/TypeDescription_Test.java310
-rw-r--r--ridljar/test/com/sun/star/lib/uno/typedesc/makefile.mk35
-rw-r--r--ridljar/test/com/sun/star/lib/util/WeakMap_Test.java86
-rw-r--r--ridljar/test/com/sun/star/lib/util/makefile.mk36
-rw-r--r--ridljar/test/com/sun/star/uno/Any_Test.java58
-rw-r--r--ridljar/test/com/sun/star/uno/Type_Test.java111
-rw-r--r--ridljar/test/com/sun/star/uno/UnoRuntime_Test.java216
-rw-r--r--ridljar/test/com/sun/star/uno/makefile.mk38
-rw-r--r--ridljar/test/makefile.mk35
-rw-r--r--ridljar/util/delzip0
-rw-r--r--ridljar/util/makefile.mk52
47 files changed, 5797 insertions, 0 deletions
diff --git a/ridljar/com/makefile.mk b/ridljar/com/makefile.mk
new file mode 100644
index 000000000000..df816364060a
--- /dev/null
+++ b/ridljar/com/makefile.mk
@@ -0,0 +1,64 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..
+PRJNAME := ridljar
+TARGET := com
+
+PACKAGE := com
+
+.INCLUDE: settings.mk
+
+JAVAFILES = \
+ sun$/star$/lib$/uno$/typedesc$/FieldDescription.java \
+ sun$/star$/lib$/uno$/typedesc$/MemberDescriptionHelper.java \
+ sun$/star$/lib$/uno$/typedesc$/MethodDescription.java \
+ sun$/star$/lib$/uno$/typedesc$/TypeDescription.java \
+ sun$/star$/lib$/uno$/typeinfo$/AttributeTypeInfo.java \
+ sun$/star$/lib$/uno$/typeinfo$/ConstantTypeInfo.java \
+ sun$/star$/lib$/uno$/typeinfo$/MemberTypeInfo.java \
+ sun$/star$/lib$/uno$/typeinfo$/MethodTypeInfo.java \
+ sun$/star$/lib$/uno$/typeinfo$/ParameterTypeInfo.java \
+ sun$/star$/lib$/uno$/typeinfo$/TypeInfo.java \
+ sun$/star$/lib$/util$/DisposeListener.java \
+ sun$/star$/lib$/util$/DisposeNotifier.java \
+ sun$/star$/lib$/util$/WeakMap.java \
+ sun$/star$/uno$/Any.java \
+ sun$/star$/uno$/Enum.java \
+ sun$/star$/uno$/IBridge.java \
+ sun$/star$/uno$/IEnvironment.java \
+ sun$/star$/uno$/IFieldDescription.java \
+ sun$/star$/uno$/IMapping.java \
+ sun$/star$/uno$/IMemberDescription.java \
+ sun$/star$/uno$/IMethodDescription.java \
+ sun$/star$/uno$/IQueryInterface.java \
+ sun$/star$/uno$/ITypeDescription.java \
+ sun$/star$/uno$/Type.java \
+ sun$/star$/uno$/Union.java \
+ sun$/star$/uno$/UnoRuntime.java
+
+.INCLUDE: target.mk
diff --git a/ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java b/ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java
new file mode 100644
index 000000000000..ec291f1a8470
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typedesc/FieldDescription.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.typedesc;
+
+import com.sun.star.uno.IFieldDescription;
+import com.sun.star.uno.ITypeDescription;
+import java.lang.reflect.Field;
+
+final class FieldDescription implements IFieldDescription {
+ public FieldDescription(
+ String name, int index, ITypeDescription typeDescription, Field field)
+ {
+ this.name = name;
+ this.index = index;
+ this.typeDescription = typeDescription;
+ this.field = field;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean isUnsigned() {
+ return MemberDescriptionHelper.isUnsigned(typeDescription);
+ }
+
+ public boolean isAny() {
+ return MemberDescriptionHelper.isAny(typeDescription);
+ }
+
+ public boolean isInterface() {
+ return MemberDescriptionHelper.isInterface(typeDescription);
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public ITypeDescription getTypeDescription() {
+ return typeDescription;
+ }
+
+ public Field getField() {
+ return field;
+ }
+
+ private final String name;
+ private final int index;
+ private final ITypeDescription typeDescription;
+ private final Field field;
+}
diff --git a/ridljar/com/sun/star/lib/uno/typedesc/MemberDescriptionHelper.java b/ridljar/com/sun/star/lib/uno/typedesc/MemberDescriptionHelper.java
new file mode 100644
index 000000000000..0bc714374d64
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typedesc/MemberDescriptionHelper.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.typedesc;
+
+import com.sun.star.uno.ITypeDescription;
+import com.sun.star.uno.TypeClass;
+
+final class MemberDescriptionHelper {
+ public static boolean isUnsigned(ITypeDescription desc) {
+ switch (getElementTypeClass(desc).getValue()) {
+ case TypeClass.UNSIGNED_SHORT_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static boolean isAny(ITypeDescription desc) {
+ return getElementTypeClass(desc) == TypeClass.ANY;
+ }
+
+ public static boolean isInterface(ITypeDescription desc) {
+ return getElementTypeClass(desc) == TypeClass.INTERFACE;
+ }
+
+ private static TypeClass getElementTypeClass(ITypeDescription desc) {
+ for (;; desc = desc.getComponentType()) {
+ TypeClass tc = desc.getTypeClass();
+ if (tc != TypeClass.SEQUENCE) {
+ return tc;
+ }
+ }
+ }
+
+ private MemberDescriptionHelper() {} // do not instantiate
+}
diff --git a/ridljar/com/sun/star/lib/uno/typedesc/MethodDescription.java b/ridljar/com/sun/star/lib/uno/typedesc/MethodDescription.java
new file mode 100644
index 000000000000..56792fc913aa
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typedesc/MethodDescription.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.typedesc;
+
+import com.sun.star.uno.IMethodDescription;
+import com.sun.star.uno.ITypeDescription;
+import java.lang.reflect.Method;
+
+public final class MethodDescription implements IMethodDescription {
+ MethodDescription(
+ String name, int index, boolean oneway, ITypeDescription[] inSignature,
+ ITypeDescription[] outSignature, ITypeDescription returnSignature,
+ Method method)
+ {
+ this.name = name;
+ this.index = index;
+ this.oneway = oneway;
+ this.inSignature = inSignature;
+ this.outSignature = outSignature;
+ this.returnSignature = returnSignature;
+ this.method = method;
+ }
+
+ MethodDescription(IMethodDescription other, int index) {
+ this(
+ other.getName(), index, other.isOneway(), other.getInSignature(),
+ other.getOutSignature(), other.getReturnSignature(),
+ other.getMethod());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean isUnsigned() {
+ return MemberDescriptionHelper.isUnsigned(returnSignature);
+ }
+
+ public boolean isAny() {
+ return MemberDescriptionHelper.isAny(returnSignature);
+ }
+
+ public boolean isInterface() {
+ return MemberDescriptionHelper.isInterface(returnSignature);
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public boolean isOneway() {
+ return oneway;
+ }
+
+ public boolean isConst() {
+ return false;
+ }
+
+ public ITypeDescription[] getInSignature() {
+ return inSignature;
+ }
+
+ public ITypeDescription[] getOutSignature() {
+ return outSignature;
+ }
+
+ public ITypeDescription getReturnSignature() {
+ return returnSignature;
+ }
+
+ public Method getMethod() {
+ return method;
+ }
+
+ public static final int ID_QUERY_INTERFACE = 0;
+ public static final int ID_ACQUIRE = 1;
+ public static final int ID_RELEASE = 2;
+
+ private final String name;
+ private final int index;
+ private final boolean oneway;
+ private final ITypeDescription[] inSignature;
+ private final ITypeDescription[] outSignature;
+ private final ITypeDescription returnSignature;
+ private final Method method;
+}
diff --git a/ridljar/com/sun/star/lib/uno/typedesc/TypeDescription.java b/ridljar/com/sun/star/lib/uno/typedesc/TypeDescription.java
new file mode 100644
index 000000000000..35113bed0d47
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typedesc/TypeDescription.java
@@ -0,0 +1,721 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.typedesc;
+
+import com.sun.star.lib.uno.typeinfo.AttributeTypeInfo;
+import com.sun.star.lib.uno.typeinfo.MemberTypeInfo;
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.ParameterTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.IFieldDescription;
+import com.sun.star.uno.IMethodDescription;
+import com.sun.star.uno.ITypeDescription;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.TypeClass;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * Supplies information about UNO types.
+ *
+ * @since UDK2.0
+ */
+public final class TypeDescription implements ITypeDescription {
+ public static TypeDescription getTypeDescription(String typeName)
+ throws ClassNotFoundException
+ {
+ Type t = new Type(typeName);
+ if (t.getTypeClass() == TypeClass.UNKNOWN) {
+ if (typeName.startsWith("[]")) {
+ t = new Type(typeName, TypeClass.SEQUENCE);
+ } else {
+ t = new Type(Class.forName(typeName));
+ }
+ }
+ return get(t);
+ }
+
+ public static TypeDescription getTypeDescription(Class zClass) {
+ return getDefinitely(new Type(zClass));
+ }
+
+ public static TypeDescription getTypeDescription(Type type)
+ throws ClassNotFoundException
+ {
+ //TODO: synchronize on type?
+ TypeDescription desc = (TypeDescription) type.getTypeDescription();
+ if (desc == null) {
+ desc = getTypeDescription(type.getTypeName());
+ type.setTypeDescription(desc);
+ }
+ return desc;
+ }
+
+ public static TypeDescription getTypeDescription(TypeClass typeClass) {
+ switch (typeClass.getValue()) {
+ case TypeClass.VOID_value:
+ return getDefinitely(Type.VOID);
+
+ case TypeClass.BOOLEAN_value:
+ return getDefinitely(Type.BOOLEAN);
+
+ case TypeClass.BYTE_value:
+ return getDefinitely(Type.BYTE);
+
+ case TypeClass.SHORT_value:
+ return getDefinitely(Type.SHORT);
+
+ case TypeClass.UNSIGNED_SHORT_value:
+ return getDefinitely(Type.UNSIGNED_SHORT);
+
+ case TypeClass.LONG_value:
+ return getDefinitely(Type.LONG);
+
+ case TypeClass.UNSIGNED_LONG_value:
+ return getDefinitely(Type.UNSIGNED_LONG);
+
+ case TypeClass.HYPER_value:
+ return getDefinitely(Type.HYPER);
+
+ case TypeClass.UNSIGNED_HYPER_value:
+ return getDefinitely(Type.UNSIGNED_HYPER);
+
+ case TypeClass.FLOAT_value:
+ return getDefinitely(Type.FLOAT);
+
+ case TypeClass.DOUBLE_value:
+ return getDefinitely(Type.DOUBLE);
+
+ case TypeClass.CHAR_value:
+ return getDefinitely(Type.CHAR);
+
+ case TypeClass.STRING_value:
+ return getDefinitely(Type.STRING);
+
+ case TypeClass.TYPE_value:
+ return getDefinitely(Type.TYPE);
+
+ case TypeClass.ANY_value:
+ return getDefinitely(Type.ANY);
+
+ default:
+ return null;
+ }
+ }
+
+ public static boolean isTypeClassSimple(TypeClass typeClass) {
+ return getTypeDescription(typeClass) != null;
+ }
+
+ // @see ITypeDescription#getSuperType
+ public ITypeDescription getSuperType() {
+ // Arbitrarily take the first super type:
+ return superTypes == null || superTypes.length == 0
+ ? null : superTypes[0];
+ }
+
+ // @see ITypeDescription#getMethodDescriptions
+ public IMethodDescription[] getMethodDescriptions() {
+ initMethodDescriptions();
+ return methodDescriptions; //TODO: clone?
+ }
+
+ // @see ITypeDescription#getMethodDescription(int)
+ public IMethodDescription getMethodDescription(int methodId) {
+ initMethodDescriptions();
+ return methodId < 0
+ ? null
+ : methodId < superMethodDescriptions.length
+ ? superMethodDescriptions[methodId]
+ : (methodId - superMethodDescriptions.length
+ < methodDescriptions.length)
+ ? methodDescriptions[methodId - superMethodDescriptions.length]
+ : null;
+ }
+
+ // @see ITypeDescription#getMethodDescription(String)
+ public IMethodDescription getMethodDescription(String name) {
+ initMethodDescriptions();
+ for (int i = 0; i < superMethodDescriptions.length; ++i) {
+ if (superMethodDescriptions[i].getName().equals(name)) {
+ return superMethodDescriptions[i];
+ }
+ }
+ for (int i = 0; i < methodDescriptions.length; ++i) {
+ if (methodDescriptions[i].getName().equals(name)) {
+ return methodDescriptions[i];
+ }
+ }
+ return null;
+ }
+
+ // @see ITypeDescription#getFieldDescriptions
+ public IFieldDescription[] getFieldDescriptions() {
+ return fieldDescriptions; //TODO: clone?
+ }
+
+ // @see ITypeDescription#getFieldDescription
+ public IFieldDescription getFieldDescription(String name) {
+ for (int i = 0; i < fieldDescriptions.length; ++i) {
+ if (fieldDescriptions[i].getName().equals(name)) {
+ return fieldDescriptions[i];
+ }
+ }
+ return superTypes != null && superTypes.length == 1
+ ? superTypes[0].getFieldDescription(name) : null;
+ }
+
+ // @see ITypeDescription#getTypeClass
+ public TypeClass getTypeClass() {
+ return typeClass;
+ }
+
+ // @see ITypeDescription#getComponentType
+ public ITypeDescription getComponentType() {
+ return componentType;
+ }
+
+ // @see ITypeDescription#getTypeName
+ public String getTypeName() {
+ return typeName;
+ }
+
+ // @see ITypeDescription#getArrayTypeName
+ public String getArrayTypeName() {
+ return arrayTypeName;
+ }
+
+ // @see ITypeDescription#getZClass
+ public Class getZClass() {
+ return zClass;
+ }
+
+ public boolean hasTypeArguments() {
+ return hasTypeArguments;
+ }
+
+ // @see Object#toString
+ public String toString() {
+ return "[" + getClass().getName() + ": " + getTypeClass() + ", "
+ + getTypeName() + "]";
+ }
+
+ private static TypeDescription getDefinitely(Type type) {
+ try {
+ return get(type);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("this cannot happen: " + e);
+ }
+ }
+
+ private static TypeDescription get(Type type) throws ClassNotFoundException
+ {
+ String typeName = type.getTypeName();
+ TypeDescription desc = cache.get(typeName);
+ if (desc == null) {
+ desc = create(type);
+ cache.put(desc);
+ }
+ return desc;
+ }
+
+ private static TypeDescription create(Type type)
+ throws ClassNotFoundException
+ {
+ TypeClass typeClass = type.getTypeClass();
+ String typeName = type.getTypeName();
+ Class zClass = type.getZClass();
+ if (zClass == null) {
+ throw new ClassNotFoundException("UNO type " + type);
+ }
+ switch (typeClass.getValue()) {
+ case TypeClass.VOID_value:
+ return new TypeDescription(
+ typeClass, typeName, "[Ljava.lang.Void;", zClass, null, null);
+
+ case TypeClass.BOOLEAN_value:
+ return new TypeDescription(
+ typeClass, typeName, "[Z", zClass, null, null);
+
+ case TypeClass.BYTE_value:
+ return new TypeDescription(
+ typeClass, typeName, "[B", zClass, null, null);
+
+ case TypeClass.SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
+ return new TypeDescription(
+ typeClass, typeName, "[S", zClass, null, null);
+
+ case TypeClass.LONG_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ return new TypeDescription(
+ typeClass, typeName, "[I", zClass, null, null);
+
+ case TypeClass.HYPER_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ return new TypeDescription(
+ typeClass, typeName, "[J", zClass, null, null);
+
+ case TypeClass.FLOAT_value:
+ return new TypeDescription(
+ typeClass, typeName, "[F", zClass, null, null);
+
+ case TypeClass.DOUBLE_value:
+ return new TypeDescription(
+ typeClass, typeName, "[D", zClass, null, null);
+
+ case TypeClass.CHAR_value:
+ return new TypeDescription(
+ typeClass, typeName, "[C", zClass, null, null);
+
+ case TypeClass.STRING_value:
+ return new TypeDescription(
+ typeClass, typeName, "[Ljava.lang.String;", zClass, null, null);
+
+ case TypeClass.TYPE_value:
+ return new TypeDescription(
+ typeClass, typeName, "[Lcom.sun.star.uno.Type;", zClass, null,
+ null);
+
+ case TypeClass.ANY_value:
+ return new TypeDescription(
+ typeClass, typeName, "[Ljava.lang.Object;", zClass, null, null);
+
+ case TypeClass.SEQUENCE_value:
+ {
+ // assert typeName.startsWith("[]");
+ ITypeDescription componentType = getTypeDescription(
+ typeName.substring("[]".length()));
+ // assert zClass.getName().startsWith("[");
+ return new TypeDescription(
+ typeClass, typeName, "[" + zClass.getName(), zClass, null,
+ componentType);
+ }
+
+ case TypeClass.ENUM_value:
+ // assert !zClass.getName().startsWith("[");
+ return new TypeDescription(
+ typeClass, typeName, "[L" + zClass.getName() + ";", zClass,
+ null, null);
+
+ case TypeClass.STRUCT_value:
+ {
+ // This code exploits the fact that an instantiated polymorphic
+ // struct type may not be the direct base of a struct type:
+ Class superClass = zClass.getSuperclass();
+ TypeDescription[] superTypes = superClass != Object.class
+ ? new TypeDescription[] { get(new Type(superClass)) }
+ : null;
+ // assert !zClass.getName().startsWith("[");
+ return new TypeDescription(
+ typeClass, typeName, "[L" + zClass.getName() + ";", zClass,
+ superTypes, null);
+ }
+
+ case TypeClass.EXCEPTION_value:
+ {
+ TypeDescription[] superTypes
+ = typeName.equals("com.sun.star.uno.Exception")
+ || typeName.equals("com.sun.star.uno.RuntimeException")
+ ? null
+ : new TypeDescription[] {
+ get(new Type(zClass.getSuperclass())) };
+ // assert !zClass.getName().startsWith("[");
+ return new TypeDescription(
+ typeClass, typeName, "[L" + zClass.getName() + ";", zClass,
+ superTypes, null);
+ }
+
+ case TypeClass.INTERFACE_value:
+ {
+ List superTypes = new List();
+ Class[] interfaces = zClass.getInterfaces();
+ for (int i = 0; i < interfaces.length; ++i) {
+ Type t = new Type(interfaces[i]);
+ if (t.getTypeClass() == TypeClass.INTERFACE) {
+ TypeDescription desc = getDefinitely(t);
+ TypeDescription[] descs = desc.superTypes;
+ for (int j = 0; j < descs.length; ++j) {
+ superTypes.add(descs[j]);
+ }
+ superTypes.add(desc);
+ }
+ }
+ // assert !zClass.getName().startsWith("[");
+ return new TypeDescription(
+ typeClass, typeName, "[L" + zClass.getName() + ";", zClass,
+ superTypes.toArray(), null);
+ }
+
+ default:
+ throw new IllegalArgumentException("given type has bad type class");
+ }
+ }
+
+ private TypeDescription(
+ TypeClass typeClass, String typeName, String arrayTypeName,
+ Class zClass, TypeDescription[] superTypes,
+ ITypeDescription componentType)
+ {
+ this.typeClass = typeClass;
+ this.typeName = typeName;
+ this.arrayTypeName = arrayTypeName;
+ this.zClass = zClass;
+ this.superTypes = superTypes;
+ this.componentType = componentType;
+ TypeDescription[] args = calculateTypeArguments();
+ this.hasTypeArguments = args != null;
+ this.fieldDescriptions = calculateFieldDescriptions(args);
+ // methodDescriptions must be initialized lazily, to avoid problems with
+ // circular dependencies (a super-interface that has a sub-interface as
+ // method parameter type; an interface that has a struct as method
+ // parameter type, and the struct has the interface as member type)
+ }
+
+ private synchronized void initMethodDescriptions() {
+ if (methodDescriptions != null || typeClass != TypeClass.INTERFACE) {
+ return;
+ }
+ if (superTypes.length == 0) { // com.sun.star.uno.XInterface
+ superMethodDescriptions = new IMethodDescription[0];
+ methodDescriptions = new IMethodDescription[] {
+ new MethodDescription(
+ "queryInterface", MethodDescription.ID_QUERY_INTERFACE,
+ false, new ITypeDescription[] { getDefinitely(Type.TYPE) },
+ new ITypeDescription[] { null }, getDefinitely(Type.ANY),
+ null),
+ new MethodDescription(
+ "acquire", MethodDescription.ID_ACQUIRE, true,
+ new ITypeDescription[0], new ITypeDescription[0],
+ getDefinitely(Type.VOID), null),
+ new MethodDescription(
+ "release", MethodDescription.ID_RELEASE, true,
+ new ITypeDescription[0], new ITypeDescription[0],
+ getDefinitely(Type.VOID), null) };
+ } else {
+ int methodOffset = 0;
+ ArrayList superList = new ArrayList();
+ for (int i = 0; i < superTypes.length; ++i) {
+ IMethodDescription[] ds = superTypes[i].getMethodDescriptions();
+ for (int j = 0; j < ds.length; ++j) {
+ superList.add(new MethodDescription(ds[j], methodOffset++));
+ }
+ }
+ superMethodDescriptions = (IMethodDescription[]) superList.toArray(
+ new IMethodDescription[superList.size()]);
+ ArrayList directList = new ArrayList();
+ TypeInfo[] infos = getTypeInfo();
+ int infoCount = infos == null ? 0 : infos.length;
+ int index = 0;
+ Method[] methods = zClass.getDeclaredMethods();
+ for (int i = 0; i < infoCount;) {
+ if (infos[i] instanceof AttributeTypeInfo) {
+ AttributeTypeInfo info = (AttributeTypeInfo) infos[i++];
+ if (info.getIndex() != index) {
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass
+ + ": entries not ordererd");
+ }
+ String getterName = "get" + info.getName();
+ Method getter = findMethod(methods, getterName);
+ Type t = info.getUnoType();
+ ITypeDescription type = t == null
+ ? getTypeDescription(getter.getReturnType(), info)
+ : getDefinitely(t);
+ directList.add(
+ new MethodDescription(
+ getterName, index++ + methodOffset, false,
+ new ITypeDescription[0], new ITypeDescription[0],
+ type, getter));
+ if (!info.isReadOnly()) {
+ String setterName = "set" + info.getName();
+ Method setter = findMethod(methods, setterName);
+ directList.add(
+ new MethodDescription(
+ setterName, index++ + methodOffset, false,
+ new ITypeDescription[] { type },
+ new ITypeDescription[] { null },
+ getDefinitely(Type.VOID), setter));
+ }
+ } else {
+ MethodTypeInfo info = (MethodTypeInfo) infos[i++];
+ if (info.getIndex() != index) {
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass
+ + ": entries not ordererd");
+ }
+ Method method = findMethod(methods, info.getName());
+ Class[] params = method.getParameterTypes();
+ ITypeDescription[] in = new ITypeDescription[params.length];
+ ITypeDescription[] out
+ = new ITypeDescription[params.length];
+ for (int j = 0; j < params.length; ++j) {
+ ParameterTypeInfo p = null;
+ if (i < infoCount
+ && infos[i] instanceof ParameterTypeInfo
+ && ((ParameterTypeInfo) infos[i]).getIndex() == j)
+ {
+ p = (ParameterTypeInfo) infos[i++];
+ }
+ Type pt = p == null ? null : p.getUnoType();
+ ITypeDescription d = pt == null
+ ? getTypeDescription(params[j], p)
+ : getDefinitely(pt);
+ if (p == null || p.isIN()) {
+ in[j] = d;
+ }
+ if (p != null && p.isOUT()) {
+ out[j] = d;
+ }
+ }
+ Type t = info.getUnoType();
+ directList.add(
+ new MethodDescription(
+ info.getName(), index++ + methodOffset,
+ info.isOneway(), in, out,
+ (t == null
+ ? getTypeDescription(method.getReturnType(), info)
+ : getDefinitely(t)),
+ method));
+ }
+ }
+ methodDescriptions = (IMethodDescription[]) directList.toArray(
+ new IMethodDescription[directList.size()]);
+ }
+ }
+
+ private TypeDescription[] calculateTypeArguments() {
+ if (typeClass != TypeClass.STRUCT) {
+ return null;
+ }
+ int i = typeName.indexOf('<');
+ if (i < 0) {
+ return null;
+ }
+ java.util.List args = new java.util.ArrayList();
+ do {
+ ++i; // skip '<' or ','
+ int j = i;
+ loop:
+ for (int level = 0; j != typeName.length(); ++j) {
+ switch (typeName.charAt(j)) {
+ case ',':
+ if (level == 0) {
+ break loop;
+ }
+ break;
+
+ case '<':
+ ++level;
+ break;
+
+ case '>':
+ if (level == 0) {
+ break loop;
+ }
+ --level;
+ break;
+ }
+ }
+ if (j != typeName.length()) {
+ Type t = new Type(typeName.substring(i, j));
+ if (t.getZClass() == null) {
+ throw new IllegalArgumentException(
+ "UNO type name \"" + typeName
+ + "\" contains bad type argument \""
+ + typeName.substring(i, j) + "\"");
+ }
+ args.add(getDefinitely(t));
+ }
+ i = j;
+ } while (i != typeName.length() && typeName.charAt(i) != '>');
+ if (i != typeName.length() - 1 || typeName.charAt(i) != '>'
+ || args.isEmpty())
+ {
+ throw new IllegalArgumentException(
+ "UNO type name \"" + typeName + "\" is syntactically invalid");
+ }
+ return (TypeDescription[]) args.toArray(
+ new TypeDescription[args.size()]);
+ }
+
+ private IFieldDescription[] calculateFieldDescriptions(
+ TypeDescription[] typeArguments)
+ {
+ if (typeClass != TypeClass.STRUCT && typeClass != TypeClass.EXCEPTION) {
+ return null;
+ }
+ TypeInfo[] infos = getTypeInfo();
+ int infoCount = infos == null ? 0 : infos.length;
+ ITypeDescription superType = getSuperType();
+ IFieldDescription[] superDescs = superType == null
+ ? null : superType.getFieldDescriptions();
+ int superCount = superDescs == null ? 0 : superDescs.length;
+ IFieldDescription[] descs = new IFieldDescription[
+ superCount + infoCount];
+ if (superCount != 0) {
+ System.arraycopy(superDescs, 0, descs, 0, superCount);
+ }
+ for (int i = 0; i < infoCount; ++i) {
+ MemberTypeInfo info = (MemberTypeInfo) infos[i];
+ if (info.getIndex() != i) {
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass + ": entries not ordererd");
+ }
+ Field field;
+ try {
+ field = zClass.getDeclaredField(info.getName());
+ } catch (NoSuchFieldException e) {
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass + ": " + e);
+ }
+ Type t = info.getUnoType();
+ int index = info.getTypeParameterIndex();
+ descs[i + superCount] = new FieldDescription(
+ info.getName(), i + superCount,
+ (index >= 0
+ ? typeArguments[index]
+ : t == null
+ ? getTypeDescription(field.getType(), info)
+ : getDefinitely(t)),
+ field);
+ }
+ return descs;
+ }
+
+ private TypeInfo[] getTypeInfo() {
+ try {
+ return (TypeInfo[])
+ zClass.getDeclaredField("UNOTYPEINFO").get(null);
+ } catch (NoSuchFieldException e) {
+ return null;
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass + ": " + e);
+ }
+ }
+
+ private Method findMethod(Method[] methods, String name) {
+ for (int i = 0; i < methods.length; ++i) {
+ if (methods[i].getName().equals(name)) {
+ return methods[i];
+ }
+ }
+ throw new IllegalArgumentException(
+ "Bad UNOTYPEINFO for " + zClass + ": no method " + name);
+ }
+
+ private static ITypeDescription getTypeDescription(
+ Class zClass, TypeInfo typeInfo)
+ {
+ return getDefinitely(
+ new Type(
+ zClass,
+ typeInfo != null
+ && (typeInfo.isUnsigned() || typeInfo.isInterface())));
+ }
+
+ private static final class List {
+ public List() {}
+
+ public void add(TypeDescription desc) {
+ if (!list.contains(desc)) {
+ list.add(desc);
+ }
+ }
+
+ public boolean isEmpty() {
+ return list.isEmpty();
+ }
+
+ public TypeDescription[] toArray() {
+ return (TypeDescription[]) list.toArray(
+ new TypeDescription[list.size()]);
+ }
+
+ private final ArrayList list = new ArrayList();
+ }
+
+ private static final class Cache {
+ public Cache() {}
+
+ public TypeDescription get(String typeName) {
+ synchronized (map) {
+ cleanUp();
+ Entry e = (Entry) map.get(typeName);
+ return e == null ? null : (TypeDescription) e.get();
+ }
+ }
+
+ public void put(TypeDescription desc) {
+ synchronized (map) {
+ cleanUp();
+ map.put(desc.getTypeName(), new Entry(desc, queue));
+ }
+ }
+
+ private void cleanUp() {
+ for (;;) {
+ Entry e = (Entry) queue.poll();
+ if (e == null) {
+ break;
+ }
+ map.remove(e.typeName);
+ }
+ }
+
+ private static final class Entry extends SoftReference {
+ public Entry(TypeDescription desc, ReferenceQueue queue) {
+ super(desc, queue);
+ typeName = desc.getTypeName();
+ }
+
+ public final String typeName;
+ }
+
+ private final HashMap map = new HashMap();
+ private final ReferenceQueue queue = new ReferenceQueue();
+ }
+
+ private static final Cache cache = new Cache();
+
+ private final TypeClass typeClass;
+ private final String typeName;
+ private final String arrayTypeName;
+ private final Class zClass;
+ private final TypeDescription[] superTypes;
+ private final ITypeDescription componentType;
+ private final boolean hasTypeArguments;
+ private final IFieldDescription[] fieldDescriptions;
+ private IMethodDescription[] methodDescriptions = null;
+ private IMethodDescription[] superMethodDescriptions;
+}
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/AttributeTypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/AttributeTypeInfo.java
new file mode 100644
index 000000000000..e0d7bd3cc1e2
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/AttributeTypeInfo.java
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+import com.sun.star.uno.Type;
+
+public class AttributeTypeInfo extends TypeInfo
+{
+ protected int m_index;
+ private final Type m_unoType; // @since UDK 3.2
+
+ /**
+ Create an attribute type info with a UNO type that cannot unambiguously
+ be represented as a Java&nbsp;1.2 type.
+
+ @param name the name of this attribute; must not be <code>null</code>
+
+ @param index the index among the direct members
+
+ @param flags any flags (<code>READONLY</code>, <code>BOUND</code>,
+ <code>UNSIGNED</code>, <code>ANY</code>, <code>INTERFACE</code>)
+
+ @param unoType the exact UNO type; or <code>null</code> if the UNO type
+ is already unambiguously represented by the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public AttributeTypeInfo(String name, int index, int flags, Type unoType) {
+ super(name, flags);
+ m_index = index;
+ m_unoType = unoType;
+ }
+
+ public AttributeTypeInfo(String name, int index, int flags)
+ {
+ this(name, index, flags, null);
+ }
+
+ public int getIndex()
+ {
+ return m_index;
+ }
+
+ public boolean isReadOnly()
+ {
+ return (m_flags & TypeInfo.READONLY) != 0;
+ }
+
+ /**
+ Returns the status of the 'bound' flag.
+
+ @since UDK 3.2
+ */
+ public final boolean isBound() {
+ return (m_flags & TypeInfo.BOUND) != 0;
+ }
+
+ /**
+ Get the exact UNO type of this attribute type info, in case it cannot
+ unambiguously be represented as a Java&nbsp;1.2 type.
+
+ @return the exact UNO type of this attribute type info, or
+ <code>null</code> if the UNO type is already unambiguously represented by
+ the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public final Type getUnoType() {
+ return m_unoType;
+ }
+}
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/ConstantTypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/ConstantTypeInfo.java
new file mode 100644
index 000000000000..44f9f9bc371d
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/ConstantTypeInfo.java
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+/**
+ @deprecated <code>UNOTYPEINFO</code> for constants is not needed
+ */
+public class ConstantTypeInfo extends TypeInfo
+{
+ public ConstantTypeInfo(String name, int flags)
+ {
+ super(name, flags);
+ }
+}
+
+
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/MemberTypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/MemberTypeInfo.java
new file mode 100644
index 000000000000..384295bb9cad
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/MemberTypeInfo.java
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+import com.sun.star.uno.Type;
+
+public class MemberTypeInfo extends TypeInfo
+{
+ int m_index;
+ private final Type m_unoType; // @since UDK 3.2
+ private final int m_typeParameterIndex; // @since UDK 3.2
+
+ /**
+ Create a member type info with a UNO type that cannot unambiguously be
+ represented as a Java&nbsp;1.2 type.
+
+ @param name the name of this member; must not be <code>null</code>
+
+ @param index the index among the direct members
+
+ @param flags any flags (<code>UNSIGNED</code>, <code>ANY</code>,
+ <code>INTERFACE</code>, <code>TYPE_PARAMETER</code>)
+
+ @param unoType the exact UNO type; or <code>null</code> if the UNO type
+ is already unambiguously represented by the Java&nbsp;1.2 type
+
+ @param typeParameterIndex the index of the type parameter that determines
+ the type of this parameterized member; or <code>-1</code> if this member
+ is of an explicit type, or is the member of a plain struct type
+
+ @since UDK 3.2
+ */
+ public MemberTypeInfo(
+ String name, int index, int flags, Type unoType, int typeParameterIndex)
+ {
+ super(name, flags);
+ m_index = index;
+ m_unoType = unoType;
+ m_typeParameterIndex = typeParameterIndex;
+ }
+
+ public MemberTypeInfo(String name, int index, int flags )
+ {
+ this(name, index, flags, null, -1);
+ }
+
+ public int getIndex()
+ {
+ return m_index;
+ }
+
+ /**
+ Get the exact UNO type of this member type info, in case it cannot
+ unambiguously be represented as a Java&nbsp;1.2 type.
+
+ @return the exact UNO type of this member type info, or <code>null</code>
+ if the UNO type is already unambiguously represented by the Java&nbsp;1.2
+ type
+
+ @since UDK 3.2
+ */
+ public final Type getUnoType() {
+ return m_unoType;
+ }
+
+ /**
+ Returns the index of the type parameter that determines the parameterized
+ type of this member.
+
+ @return the index of the type parameter that determines the type of this
+ parameterized member; if this member is of an explicit type, or is the
+ member of a plain struct type, <code>-1</code> is returned
+
+ @since UDK 3.2
+ */
+ public final int getTypeParameterIndex() {
+ return m_typeParameterIndex;
+ }
+}
+
+
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/MethodTypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/MethodTypeInfo.java
new file mode 100644
index 000000000000..4b8ebe65a260
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/MethodTypeInfo.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+import com.sun.star.uno.Type;
+
+public class MethodTypeInfo extends TypeInfo
+{
+ protected int m_index;
+ private final Type m_unoType; // @since UDK 3.2
+
+ /**
+ Create a method type info with a UNO return type that cannot
+ unambiguously be represented as a Java&nbsp;1.2 type.
+
+ @param name the name of this method; must not be <code>null</code>
+
+ @param index the index among the direct members
+
+ @param flags any flags (<code>ONEWAY</code>, <code>UNSIGNED</code>,
+ <code>ANY</code>, <code>INTERFACE</code>)
+
+ @param unoType the exact UNO return type; or <code>null</code> if the UNO
+ type is already unambiguously represented by the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public MethodTypeInfo(String name, int index, int flags, Type unoType) {
+ super(name, flags);
+ m_index = index;
+ m_unoType = unoType;
+ }
+
+ public MethodTypeInfo(String name, int index, int flags)
+ {
+ this(name, index, flags, null);
+ }
+
+ public int getIndex()
+ {
+ return m_index;
+ }
+
+ public boolean isReturnUnsigned()
+ {
+ return isUnsigned();
+ }
+
+ public boolean isOneway()
+ {
+ return (m_flags & TypeInfo.ONEWAY) != 0;
+ }
+
+ public boolean isConst()
+ {
+ return (m_flags & TypeInfo.CONST) != 0;
+ }
+
+ /**
+ Get the exact UNO return type of this method type info, in case it cannot
+ unambiguously be represented as a Java&nbsp;1.2 type.
+
+ @return the exact UNO return type of this method type info, or
+ <code>null</code> if the UNO type is already unambiguously represented by
+ the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public final Type getUnoType() {
+ return m_unoType;
+ }
+}
+
+
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/ParameterTypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/ParameterTypeInfo.java
new file mode 100644
index 000000000000..3aecce7a6891
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/ParameterTypeInfo.java
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+import com.sun.star.uno.Type;
+
+public class ParameterTypeInfo extends TypeInfo
+{
+ protected int m_index;
+ protected String m_methodName;
+ private final Type m_unoType; // @since UDK 3.2
+
+ /**
+ Create a parameter type info with a UNO type that cannot unambiguously be
+ represented as a Java&nbsp;1.2 type.
+
+ @param name the name of this parameter; must not be <code>null</code>
+
+ @param methodName the name of the method; must not be <code>null</code>
+
+ @param index the index among the parameters
+
+ @param flags any flags (<code>IN</code>, <code>OUT</code>,
+ <code>UNSIGNED</code>, <code>ANY</code>, <code>INTERFACE</code>)
+
+ @param unoType the exact UNO type; or <code>null</code> if the UNO type
+ is already unambiguously represented by the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public ParameterTypeInfo(
+ String name, String methodName, int index, int flags, Type unoType)
+ {
+ super(name, flags);
+ m_index = index;
+ m_methodName = methodName;
+ m_unoType = unoType;
+ }
+
+ public ParameterTypeInfo(String name, String methodName, int index, int flags)
+ {
+ this(name, methodName, index, flags, null);
+ }
+
+ public String getMethodName()
+ {
+ return m_methodName;
+ }
+
+ public int getIndex()
+ {
+ return m_index;
+ }
+
+ public boolean isIN()
+ {
+ return ((m_flags & TypeInfo.IN) != 0 ||
+ (m_flags & (TypeInfo.IN | TypeInfo.OUT)) == 0); // nothing set => IN
+ }
+
+ public boolean isOUT()
+ {
+ return (m_flags & TypeInfo.OUT) != 0;
+ }
+
+ public boolean isINOUT()
+ {
+ return (m_flags & (TypeInfo.IN | TypeInfo.OUT)) == (TypeInfo.IN | TypeInfo.OUT);
+ }
+
+ /**
+ Get the exact UNO type of this parameter type info, in case it cannot
+ unambiguously be represented as a Java&nbsp;1.2 type.
+
+ <p>If this is an out or in&ndash;out parameter, the UNO type must be a
+ sequence type, taking into account that such a parameter is represented
+ in Java as a parameter of array type.</p>
+
+ @return the exact UNO type of this parameter type info, or
+ <code>null</code> if the UNO type is already unambiguously represented by
+ the Java&nbsp;1.2 type
+
+ @since UDK 3.2
+ */
+ public final Type getUnoType() {
+ return m_unoType;
+ }
+}
+
+
diff --git a/ridljar/com/sun/star/lib/uno/typeinfo/TypeInfo.java b/ridljar/com/sun/star/lib/uno/typeinfo/TypeInfo.java
new file mode 100644
index 000000000000..40745df56b44
--- /dev/null
+++ b/ridljar/com/sun/star/lib/uno/typeinfo/TypeInfo.java
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.lib.uno.typeinfo;
+
+
+/** Defines a class to describe additional type information.
+ */
+public class TypeInfo
+{
+ public static final int IN = 0x00000001;
+ public static final int OUT = 0x00000002;
+ public static final int UNSIGNED = 0x00000004;
+ public static final int READONLY = 0x00000008;
+ public static final int ONEWAY = 0x00000010;
+ public static final int CONST = 0x00000020;
+ public static final int ANY = 0x00000040;
+ public static final int INTERFACE = 0x00000080;
+
+ /**
+ Marks an extended attribute of an interface type as bound.
+
+ <p>Only used in the <code>flags</code> argument of the
+ <code>AttributeTypeInfo</code> constructors.</p>
+
+ @since UDK 3.2
+ */
+ public static final int BOUND = 0x00000100;
+
+ protected int m_flags;
+ protected String m_name;
+
+ public TypeInfo(String name, int flags)
+ {
+ m_name = name;
+ m_flags = flags;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+
+ public int getFlags() {
+ return m_flags;
+ }
+
+ public boolean isUnsigned()
+ {
+ return (m_flags & TypeInfo.UNSIGNED) != 0;
+ }
+
+ public boolean isAny()
+ {
+ return (m_flags & TypeInfo.ANY) != 0;
+ }
+
+ public boolean isInterface()
+ {
+ return (m_flags & TypeInfo.INTERFACE) != 0;
+ }
+}
diff --git a/ridljar/com/sun/star/lib/util/DisposeListener.java b/ridljar/com/sun/star/lib/util/DisposeListener.java
new file mode 100644
index 000000000000..a53834148708
--- /dev/null
+++ b/ridljar/com/sun/star/lib/util/DisposeListener.java
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.util;
+
+/**
+ * Counterpart to <code>DisposeNotifier</code>.
+ *
+ * @see DisposeNotifier
+ */
+public interface DisposeListener {
+ /**
+ * Callback fired by a <code>DisposeNotifier</code> once it is disposed.
+ *
+ * @param source the <code>DisposeNotifer</code> that fires the callback;
+ * will never be <code>null</code>
+ */
+ void notifyDispose(DisposeNotifier source);
+}
diff --git a/ridljar/com/sun/star/lib/util/DisposeNotifier.java b/ridljar/com/sun/star/lib/util/DisposeNotifier.java
new file mode 100644
index 000000000000..7ef8bf740d01
--- /dev/null
+++ b/ridljar/com/sun/star/lib/util/DisposeNotifier.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.util;
+
+/**
+ * Optional interface to be implemented by objects stored in a
+ * <code>WeakMap</code>.
+ *
+ * @see WeakMap
+ */
+public interface DisposeNotifier {
+ /**
+ * Adds a dispose listener, to be notified when this object is disposed.
+ *
+ * <p>It is unspecified what happens when the same listener is added
+ * multiple times.</p>
+ *
+ * <p>It is unspecified exactly when the <code>notifyDispose</code> callback
+ * is fired: immediately before the notifier is disposed, while it is in the
+ * process of disposing, or some time after it got disposed. But even if
+ * adding a listener to an already disposed notifer, the listener must
+ * eventually receive a <code>notifyDispose</code> callback.</p>
+ *
+ * @param listener a dispose listener, to be notified when this object is
+ * disposed; must not be <code>null</code>
+ */
+ void addDisposeListener(DisposeListener listener);
+}
diff --git a/ridljar/com/sun/star/lib/util/WeakMap.java b/ridljar/com/sun/star/lib/util/WeakMap.java
new file mode 100644
index 000000000000..7c2ccde1ded1
--- /dev/null
+++ b/ridljar/com/sun/star/lib/util/WeakMap.java
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.util;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A hash map that holds values of type <code>WeakReference</code>.
+ *
+ * <p>Like <code>HashMap</code>, this implementation provides all of the
+ * optional map operations, and permits the <code>null</code> key.</p>
+ *
+ * <p>Also like <code>HashMap</code>, this implementation is not synchronized.
+ * If multiple threads share an instance, and at least one of them executes any
+ * modifying operations on the <code>WeakMap</code>, they have to use external
+ * synchronization.</p>
+ *
+ * <p>Unlike other map implementations, <code>WeakMap</code> is asymmetric in
+ * that <code>put</code> expects the given value to be a plain object that is
+ * then wrapped in a <code>WeakReference</code>, while the occurences of values
+ * in all other methods (<code>containsValue</code>, <code>entrySet</code>,
+ * <code>equals</code>, <code>get</code>, <code>hashCode</code>,
+ * <code>remove</code>, <code>values</code>, and also the return value of
+ * <code>put</code>) expect already wrapped instances of
+ * <code>WeakReference</code>. That is, after <code>weakMap.put("key",
+ * o)</code>, <code>weakMap.get("key").equals(o)</code> does not work as
+ * na&iuml;vely expected; neither does
+ * <code>weakMap1.putAll(weakMap2)</code>.</p>
+ *
+ * <p>At an arbitrary time after the <code>WeakReference</code> value of an
+ * entry has been cleared by the garbage collector, the entry is automatically
+ * removed from the map.</p>
+ *
+ * <p>Values placed into a <code>WeakMap</code> may optionally support the
+ * <code>DisposeNotifier</code> interface. For those that do, the associated
+ * <code>WeakReference</code> wrappers are automatically cleared as soon as the
+ * values are disposed.</p>
+ */
+public final class WeakMap implements Map {
+ /**
+ * Constructs an empty <code>WeakMap</code>.
+ */
+ public WeakMap() {}
+
+ /**
+ * Constructs a new <code>WeakMap</code> with the same mappings as the
+ * specified <code>Map</code>.
+ *
+ * @param m the map whose mappings are to be placed in this map
+ */
+ public WeakMap(Map m) {
+ putAll(m);
+ }
+
+ /**
+ * Returns the number of key&ndash;value mappings in this map.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @return the number of key&ndash;value mappings in this map
+ */
+ public int size() {
+ return map.size();
+ }
+
+ /**
+ * Returns <code>true</code> if this map contains no key&ndash;value
+ * mappings.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @return <code>true</code> if this map contains no key&ndash;value
+ * mappings
+ */
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ /**
+ * Returns <code>true</code> if this map contains a mapping for the
+ * specified key.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @param key the key whose presence in this map is to be tested
+ * @return <code>true</code> if this map contains a mapping for the
+ * specified key
+ */
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ /**
+ * Returns <code>true</code> if this map maps one or more keys to the
+ * specified value.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @param value the value whose presence in this map is to be tested
+ * @return <code>true</code> if this map maps one or more keys to the
+ * specified value
+ */
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ /**
+ * Returns the value to which the specified key is mapped in this map, or
+ * <code>null</code> if the map contains no mapping for this key.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @param key the key whose associated value is to be returned
+ *
+ * @return the value to which this map maps the specified key, or
+ * <code>null</code> if the map contains no mapping for this key
+ */
+ public Object get(Object key) {
+ return map.get(key);
+ }
+
+ /**
+ * Associates the specified value with the specified key in this map.
+ *
+ * <p>This is a modifying operation.</p>
+ *
+ * @param key the key with witch the specified value is to be associated
+ * @param value the value to be associated with the specified key. This
+ * must be a plain object, which is then wrapped in a
+ * <code>WeakReference</code>.
+ * @return previous value associated with the specified key, or
+ * <code>null</code> if there was no mapping for the key
+ */
+ public Object put(Object key, Object value) {
+ cleanUp();
+ return map.put(key, new Entry(key, value, queue));
+ }
+
+ /**
+ * Removes the mapping for this key from this map if present.
+ *
+ * <p>This is a modifying operation.</p>
+ *
+ * @param key the key whose mapping is to be removed from the map
+ * @return previous value associated with the specified key, or
+ * <code>null</code> if there was no mapping for the key
+ */
+ public Object remove(Object key) {
+ cleanUp();
+ return map.remove(key);
+ }
+
+ /**
+ * Copies all of the mappings from the specified map to this map.
+ *
+ * <p>This is a modifying operation.</p>
+ *
+ * @param m mappings to be stored in this map. The values of those mappings
+ * must be plain objects, which are then wrapped in instances of
+ * <code>WeakReference</code>.
+ */
+ public void putAll(Map t) {
+ cleanUp();
+ for (Iterator i = t.entrySet().iterator(); i.hasNext();) {
+ Map.Entry e = (Map.Entry) i.next();
+ Object k = e.getKey();
+ map.put(k, new Entry(k, e.getValue(), queue));
+ }
+ }
+
+ /**
+ * Removes all mappings from this map.
+ *
+ * <p>This is a modifying operation.</p>
+ */
+ public void clear() {
+ cleanUp();
+ map.clear();
+ }
+
+ /**
+ * Returns a view of the keys contained in this map.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @return a set view of the keys contained in this map
+ */
+ public Set keySet() {
+ return map.keySet();
+ }
+
+ /**
+ * Returns a collection view of the values contained in this map.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @return a collection view of the values contained in this map
+ */
+ public Collection values() {
+ return map.values();
+ }
+
+ /**
+ * Returns a collection view of the mappings contained in this map.
+ *
+ * <p>This is a non-modifying operation.</p>
+ *
+ * @return a collection view of the mappings contained in this map
+ */
+ public Set entrySet() {
+ return map.entrySet();
+ }
+
+ public boolean equals(Object o) {
+ return map.equals(o);
+ }
+
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ /**
+ * Returns the referent of a <code>WeakReference</code>, silently handling a
+ * <code>null</code> argument.
+ *
+ * <p>This static method is useful to wrap around the return values of
+ * methods like <code>get</code>.</p>
+ *
+ * @param ref must be either an instance of <code>WeakReference</code> or
+ * <code>null</code>
+ * @return the referent of the specified <code>WeakReference</code>, or
+ * <code>null</code> if <code>ref</code> is <code>null</code>
+ */
+ public static Object getValue(Object ref) {
+ return ref == null ? null : ((WeakReference) ref).get();
+ }
+
+ // cleanUp must only be called from within modifying methods. Otherwise,
+ // the implementations of entrySet, keySet and values would break
+ // (specificially, iterating over the collections returned by those
+ // methods), as non-modifying methods might modify the underlying map.
+ private void cleanUp() {
+ for (;;) {
+ Entry e = (Entry) queue.poll();
+ if (e == null) {
+ break;
+ }
+ // It is possible that an Entry e1 becomes weakly reachable, then
+ // another Entry e2 is added to the map for the same key, and only
+ // then e1 is enqueued. To not erroneously remove the new e2 in
+ // that case, check whether the map still contains e1:
+ Object k = e.key;
+ if (e == map.get(k)) {
+ map.remove(k);
+ }
+ }
+ }
+
+ private static final class Entry extends WeakReference
+ implements DisposeListener
+ {
+ public void notifyDispose(DisposeNotifier source) {
+ Entry.this.clear(); // qualification needed for Java 1.3
+ enqueue();
+ }
+
+ private Entry(Object key, Object value, ReferenceQueue queue) {
+ super(value, queue);
+ this.key = key;
+ if (value instanceof DisposeNotifier) {
+ ((DisposeNotifier) value).addDisposeListener(this);
+ }
+ }
+
+ private final Object key;
+ }
+
+ private final HashMap map = new HashMap();
+ private final ReferenceQueue queue = new ReferenceQueue();
+}
diff --git a/ridljar/com/sun/star/uno/Any.java b/ridljar/com/sun/star/uno/Any.java
new file mode 100644
index 000000000000..d83d6a5951ea
--- /dev/null
+++ b/ridljar/com/sun/star/uno/Any.java
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+package com.sun.star.uno;
+
+
+/**
+ * The UNO IDL type any is mapped to java type <code>java.lang.Object</code>.
+ * <p>
+ * In special cases it is necessary to have an explicit any to additionally transport
+ * an exact type. For instance if you want to pass an object reference via
+ * an interprocess connection using an any, you should use this class to add
+ * an explicit interface type, so the remote counterpart doesn't need to invoke
+ * a queryInterface).
+ * <p>
+ * @version $Revision: 1.11 $ $ $Date: 2008-04-11 11:11:43 $
+ */
+public class Any {
+ /**
+ * The type of the any.
+ * <p>
+ * @see #getType
+ */
+ protected Type _type;
+
+ /**
+ * The data of the any.
+ * <p>
+ * @see #getObject
+ */
+ protected Object _object;
+
+ public static final Any VOID = new Any(new Type("void", TypeClass.VOID),
+ null);
+ // do not use Type.VOID here to avoid circular dependencies between
+ // static members of Any and Type
+
+ /**
+ * Constructs a new any.
+ * <p>
+ * @param zInterface the type of the any.
+ * @param object the data of the any.
+ * @deprecated as of UDK 2.0
+ */
+ public Any(Class zInterface, Object object) {
+ this(new Type(zInterface), object);
+ }
+
+ /** Constructs a new any with a given type and value
+ @param type the UNO type of the any.
+ @param object the value of the any.
+ */
+ public Any(Type type, Object object) {
+ if (type.equals(Type.ANY)) {
+ throw new IllegalArgumentException("Any cannot contain Any");
+ }
+ _type = type;
+ _object = object;
+ }
+
+ /**
+ Complete a UNO <code>ANY</code> (make sure it is wrapped up as an
+ <code>Any</code> instance).
+
+ @param any a Java value representing a UNO <code>ANY</code> value.
+
+ @return a complete Java value (that is, an <code>Any</code> instance)
+ representing the same UNO <code>ANY</code> value as the given argument.
+
+ @since UDK 3.2.3
+ */
+ public static final Any complete(Object any) {
+ return any instanceof Any
+ ? (Any) any
+ : new Any(
+ new Type(any == null ? XInterface.class : any.getClass()), any);
+ }
+
+ /**
+ * Gets the type of the value within the any.
+ * <p>
+ * @return the type of the value within the any.
+ */
+ public Type getType() {
+ return _type;
+ }
+
+ /**
+ * Gets the value within the any.
+ * <p>
+ * @return gets the value within the any.
+ */
+ public Object getObject() {
+ return _object;
+ }
+
+ // @see java.lang.Object#equals
+ public boolean equals(Object obj) {
+ return obj instanceof Any && _type.equals(((Any) obj)._type)
+ && (_object == null
+ ? ((Any) obj)._object == null
+ : _object.equals(((Any) obj)._object));
+ }
+
+ // @see java.lang.Object#hashCode
+ public int hashCode() {
+ return _type.hashCode() * 13
+ + (_object == null ? 0 : _object.hashCode());
+ }
+
+ // @see java.lang.Object#toString
+ public String toString() {
+ return "Any[" + _type + ", " + _object + "]";
+ }
+}
diff --git a/ridljar/com/sun/star/uno/Enum.java b/ridljar/com/sun/star/uno/Enum.java
new file mode 100644
index 000000000000..eb509096c503
--- /dev/null
+++ b/ridljar/com/sun/star/uno/Enum.java
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * The Enum class is the base class for all classes generated
+ * as java binding for the IDL type enum.
+ * Each java mapped enum class provides static member of this class
+ * which represents the enum values.
+ * You cannot create a object of this class or subclass direct, to
+ * avoid enum values with integer values outside the defined range.
+ * <p>
+ * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:11:59 $
+ */
+public abstract class Enum {
+ private int m_value;
+
+ /**
+ * Constructs a enum value.
+ * <p>
+ * @param value the integer value of this enum value.
+ */
+ protected Enum(int value) {
+ m_value = value;
+ }
+
+ /**
+ * Get the integer value of an enum value.
+ * <p>
+ * @return the integer value.
+ */
+ public final int getValue() {
+ return m_value;
+ }
+}
+
diff --git a/ridljar/com/sun/star/uno/IBridge.java b/ridljar/com/sun/star/uno/IBridge.java
new file mode 100644
index 000000000000..f1150b661e1d
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IBridge.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import java.io.IOException;
+
+/**
+ * This is abstract interface for bridges.
+ *
+ * <p>Bridges are able to map one object from one UNO environment to another and
+ * vice versa.<p>
+ *
+ * @see com.sun.star.uno.IBridge
+ * @see com.sun.star.uno.IQueryInterface
+ * @see com.sun.star.uno.UnoRuntime
+ *
+ * @deprecated As of UDK 3.2, this interface is deprecated, without offering a
+ * replacement.
+ */
+public interface IBridge {
+ /**
+ * Maps an object from the source environment to the destination
+ * environment.
+ *
+ * @param object the object to map
+ * @param type the type of the interface that shall be mapped
+ * @return the object in the destination environment
+ */
+ Object mapInterfaceTo(Object object, Type type);
+
+ /**
+ * Maps an object from the destination environment to the source
+ * environment.
+ *
+ * @param object the object to map
+ * @param type the type of the interface that shall be mapped
+ * @return the object in the source environment
+ */
+ Object mapInterfaceFrom(Object object, Type type);
+
+ /**
+ * Returns the source environment.
+ *
+ * @return the source environment of this bridge
+ */
+ IEnvironment getSourceEnvironment();
+
+ /**
+ * Returns the destination environment.
+ *
+ * @return the destination environment of this bridge
+ */
+ IEnvironment getTargetEnvironment();
+
+ /**
+ * Increases the life count.
+ */
+ void acquire();
+
+ /**
+ * Decreases the life count.
+ *
+ * <p>If the life count drops to zero, the bridge disposes itself.</p>
+ */
+ void release();
+
+ /**
+ * Disposes the bridge.
+ *
+ * <p>Sends involved threads an <code>InterruptedException</code>. Releases
+ * mapped objects.</p>
+ */
+ void dispose() throws InterruptedException, IOException;
+}
diff --git a/ridljar/com/sun/star/uno/IEnvironment.java b/ridljar/com/sun/star/uno/IEnvironment.java
new file mode 100644
index 000000000000..028aff0916d8
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IEnvironment.java
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * The interface implemented by UNO environments.
+ *
+ * <p>With this interface, objects can be registered at and revoked from an
+ * environment.</p>
+ *
+ * @see com.sun.star.uno.IBridge
+ * @see com.sun.star.uno.IQueryInterface
+ * @see com.sun.star.uno.UnoRuntime
+ *
+ * @deprecated As of UDK 3.2, this interface is deprecated, without offering a
+ * replacement.
+ */
+public interface IEnvironment {
+ /**
+ * Gets the context of this environment.
+ *
+ * @return the context of this environment
+ */
+ Object getContext();
+
+ /**
+ * Gets the name of this environment.
+ *
+ * @return the name of this environment
+ */
+ String getName();
+
+ /**
+ * Registers one UNO interface facet of an object.
+ *
+ * <p>Such an object will typically be one of three things:
+ * <ul>
+ * <li>A local Java object, to be mapped out of this environment via a given
+ * bridge.</li>
+ * <li>A proxy object, mapped into this environment via some bridge
+ * <var>B1</var>, and now to be mapped out of this environment via a
+ * given bridge <var>B2</var>.</li>
+ * <li>A proxy object, created as a remote object is mapped into this
+ * environment via a given bridge.</li>
+ * </ul></p>
+ *
+ * <p>The object actually registered may differ from the specified
+ * <code>object</code> that is passed as an argument. This enables an
+ * environment to work in a multi-threaded scenario, where two threads can
+ * call <code>registerInterface</code> for the same combination of
+ * <code>oid</code> and <code>type</code> at the same time; the race
+ * condition is solved by letting one of the calls register its argument
+ * <code>object</code>, ignoring the argument <code>object</code> of the
+ * other call, and letting both calls return the same
+ * <code>object</code>.</p>
+ *
+ * <p>The registered object is held only weakly by the environment. After a
+ * call to <code>registerInterface</code>, a call to
+ * <code>getRegisteredInterface</code> only succeeds as long as the
+ * registered object is still strongly reachable, and the registered object
+ * has not been explicitly revoked by calling
+ * <code>revokeInterface</code>.</p>
+ *
+ * @param object the object to register; must be non-null
+ * @param oid in-out parameter containing the OID of <code>object</code>.
+ * This must be a non-null reference to an array of length at least one;
+ * the zeroth element is used to pass the argument in and out. If the
+ * zeroth element is null on input, the OID will be computed and passed
+ * out (that is, the zeroth element will never be null upon normal
+ * return).
+ * @param type the UNO interface type to register. This argument must be
+ * non-null, and must denote a UNO interface type. The given
+ * <code>object</code> should implement this <code>type</code>.
+ * @return the registered object (may differ from the <code>object</code>
+ * passed in); will never be null
+ */
+ Object registerInterface(Object object, String[] oid, Type type);
+
+ /**
+ * Explicitly revokes a UNO interface facet.
+ *
+ * <p>Calls to <code>registerInterface</code> and
+ * <code>revokeInterface</code> must be paired. A facet is only removed
+ * from the environment when it has been revoked as often as it has been
+ * registered. This may change in the future, so that a facet would be
+ * removed upon the first call to <code>revokeInterface</code> (and calls to
+ * <code>revokeInterface</code> would no longer be necessary if the calling
+ * code does not want to control the temporal extent of the
+ * registration).</p>
+ *
+ * <p>It is not an error if the specified facet is not registered at this
+ * environment (either because no corresponding object has ever been
+ * registered, or it has been explicitly revoked, or it is no longer
+ * strongly reachable). In such a case, this method simply does
+ * nothing.</p>
+ *
+ * @param oid the OID of the object to revoke; must be non-null
+ * @param type the UNO interface type of the object to revoke. This
+ * argument must be non-null, and must denote a UNO interface type.
+ */
+ void revokeInterface(String oid, Type type);
+
+ /**
+ * Retrieves a registered object, specified by OID and UNO interface type.
+ *
+ * @param oid the OID of the object to retrieve; must be non-null
+ * @param type the UNO interface type of the object to retrieve. This
+ * argument must be non-null, and must denote a UNO interface type.
+ * @return the registered object, or null if none is found
+ */
+ Object getRegisteredInterface(String oid, Type type);
+
+ /**
+ * Retrieves the OID for a registered object.
+ *
+ * @param object a registered object; must be non-null
+ * @return the OID of the <code>object</code>; will never be null
+ */
+ String getRegisteredObjectIdentifier(Object object);
+
+ /**
+ * Lists the registered objects to <code>System.out</code>.
+ *
+ * <p>This is for debug purposes.</p>
+ */
+ void list();
+}
diff --git a/ridljar/com/sun/star/uno/IFieldDescription.java b/ridljar/com/sun/star/uno/IFieldDescription.java
new file mode 100644
index 000000000000..f68baca7f817
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IFieldDescription.java
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+
+import java.lang.reflect.Field;
+
+/**
+ * The <code>IFieldDescription</code> describes non
+ * method members.
+ *
+ * @deprecated This interface does not cover all the features supported by the
+ * corresponding (unpublished) implementation. But no client code should need
+ * to access this functionality, anyway.
+ */
+public interface IFieldDescription extends IMemberDescription {
+ /**
+ * Gives the name of this member.
+ * <p>
+ * @return the name
+ */
+ ITypeDescription getTypeDescription();
+
+ /**
+ * Gives native java field of this member.
+ * <p>
+ * @return the java field
+ */
+ Field getField();
+}
diff --git a/ridljar/com/sun/star/uno/IMapping.java b/ridljar/com/sun/star/uno/IMapping.java
new file mode 100644
index 000000000000..5bb39ac890f3
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IMapping.java
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * With a mapping objets can be mapped from one environment to another.
+ *
+ * <p>This interface exists for compatibility with the binary UNO API.</p>
+ *
+ * @see com.sun.star.uno.IBridge
+ *
+ * @deprecated As of UDK 3.2, this interface is deprecated, without offering a
+ * replacement.
+ */
+public interface IMapping {
+ /**
+ * Maps an interface from one environment to another.
+ *
+ * @param object source object that is to be mapped
+ * @param type description of the interface that is to be mapped
+ * @return the object mapped to the destination environment
+ */
+ Object mapInterface(Object object, Type type);
+}
diff --git a/ridljar/com/sun/star/uno/IMemberDescription.java b/ridljar/com/sun/star/uno/IMemberDescription.java
new file mode 100644
index 000000000000..c65441f9cb96
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IMemberDescription.java
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * The <code>IMemberDescription</code> is the base interface
+ * for for the special subset of typedescriptions, which describe
+ * members of IDL structs or interfeces.
+ *
+ * @deprecated This interface does not cover all the features supported by the
+ * corresponding (unpublished) implementation. But no client code should need
+ * to access this functionality, anyway.
+ */
+public interface IMemberDescription {
+ /**
+ * Gives the name of this member.
+ * <p>
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Indicates if this member is unsigned. (Not useful for IMethodDescription).
+ * <p>
+ * @return the unsigned state
+ */
+ boolean isUnsigned();
+
+ /**
+ * Indicates if this member is an any.
+ * <p>
+ * @return the any state
+ */
+ boolean isAny();
+
+ /**
+ * Indicates if this member is an interface.
+ * <p>
+ * @return the interface state
+ */
+ boolean isInterface();
+
+ /**
+ * Gives the relative index of this member in the declaring
+ * interface or struct (including superclasses).
+ * <p>
+ * @return the relative index of this member
+ */
+ int getIndex();
+}
diff --git a/ridljar/com/sun/star/uno/IMethodDescription.java b/ridljar/com/sun/star/uno/IMethodDescription.java
new file mode 100644
index 000000000000..3e1664042bb9
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IMethodDescription.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+
+import java.lang.reflect.Method;
+
+
+/**
+ * The <code>IMethodDescription</code> allows to examine a method
+ * in detail. It gives a view to java methods from a UNO point.
+ *
+ * @deprecated This interface does not cover all the features supported by the
+ * corresponding (unpublished) implementation. But no client code should need
+ * to access this functionality, anyway.
+ */
+public interface IMethodDescription extends IMemberDescription {
+ /**
+ * Indicates if this method is <code>oneWay</code>,
+ * respectivly if this method may become executed asynchronously.
+ * <p>
+ * @return true means may execute asynchronously .
+ */
+ boolean isOneway();
+
+ /**
+ * Indicates if this method is const.
+ * <p>
+ * @return true means it is const.
+ */
+ boolean isConst();
+
+ /**
+ * Gives any array of <code>ITypeDescription> of
+ * the [in] parameters.
+ * <p>
+ * @return the in parameters
+ */
+ ITypeDescription[] getInSignature();
+
+ /**
+ * Gives any array of <code>ITypeDescription> of
+ * the [out] parameters.
+ * <p>
+ * @return the out parameters
+ */
+ ITypeDescription[] getOutSignature();
+
+ /**
+ * Gives the <code>ITypeDescription</code> of
+ * the return type.
+ * <p>
+ * @return the return type <code>ITypeDescription</code>
+ */
+ ITypeDescription getReturnSignature();
+
+ /**
+ * Gives native java method of this method.
+ * <p>
+ * @return the java methodd
+ */
+ Method getMethod();
+}
diff --git a/ridljar/com/sun/star/uno/IQueryInterface.java b/ridljar/com/sun/star/uno/IQueryInterface.java
new file mode 100644
index 000000000000..cb9a79c8b9d4
--- /dev/null
+++ b/ridljar/com/sun/star/uno/IQueryInterface.java
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * This is the delegator interface for Java objects implementing interfaces of
+ * an underlying UNO object.
+ *
+ * <p>Calls are delegated through the <code>UnoRuntime</code> to this
+ * interface. Implement this interface in case you want to customize the
+ * behaviour of <code>UnoRuntime.queryInterface</code>.</p>
+ *
+ * @see com.sun.star.uno.UnoRuntime
+ */
+public interface IQueryInterface {
+ /**
+ * Returns the unique object identifier (OID) of the underlying UNO object.
+ *
+ * @return the OID of the underlying object
+ */
+ String getOid();
+
+ /**
+ * Returns an object implementing the requested interface type.
+ *
+ * @param type the requested UNO interface type; must be a <code>Type</code>
+ * object representing a UNO interface type
+ * @return a reference to the requested UNO interface type if available,
+ * otherwise <code>null</code>
+ * @see com.sun.star.uno.UnoRuntime
+ */
+ Object queryInterface(Type type);
+
+ /**
+ * Tests if the given reference represents a facet of the underlying UNO
+ * object.
+ *
+ * @param object a reference to any Java object representing (a facet of) a
+ * UNO object; may be <code>null</code>
+ * @return <code>true</code> if and only if <code>object</code> is not
+ * <code>null</code> and represents the same UNO object as this object
+ */
+ boolean isSame(Object object);
+}
diff --git a/ridljar/com/sun/star/uno/ITypeDescription.java b/ridljar/com/sun/star/uno/ITypeDescription.java
new file mode 100644
index 000000000000..51a32c6f5484
--- /dev/null
+++ b/ridljar/com/sun/star/uno/ITypeDescription.java
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * The <code>ITypeDescription</code> allows to examine a type
+ * in detail (e.g. it is used for marshaling/unmarshaling).
+ *
+ * @deprecated This interface does not cover all the features supported by the
+ * corresponding (unpublished) implementation. But no client code should need
+ * to access this functionality, anyway.
+ */
+public interface ITypeDescription {
+ /**
+ * Gets the <code>ITypeDescription</code> of the
+ * super, if it exists.
+ * <p>
+ * @return the <code>ITypeDescription</code>.
+ */
+ ITypeDescription getSuperType();
+
+ /**
+ * Gets the <code>IMethodDescription</code> for every
+ * method, if this type is an interface. Otherwise
+ * returns <code>null</code>.
+ * <p>
+ * @return the <code>IMethodDescription[]</code>.
+ */
+ IMethodDescription []getMethodDescriptions();
+
+ /**
+ * Gets the <code>IMethodDescription</code> for the
+ * method with index methodId, if it exists, otherwise
+ * returns <code>null</code>.
+ * <p>
+ * @return the <code>IMethodDescription</code>.
+ */
+ IMethodDescription getMethodDescription(int methodId);
+
+ /**
+ * Gets the <code>IMethodDescription</code> for the
+ * method with the name <code>name</code>, if it exists,
+ * otherwise returns <code>null</code>.
+ * <p>
+ * @return the <code>IMethodDescription</code>.
+ */
+ IMethodDescription getMethodDescription(String name);
+
+ /**
+ * Gets the <code>IFieldDescription</code> for every
+ * field, if this type is an interface. Otherwise
+ * returns <code>null</code>.
+ * <p>
+ * @return the <code>IFieldDescription[]</code>.
+ */
+ IFieldDescription []getFieldDescriptions();
+
+ /**
+ * Gets the <code>IFieldDescription</code> for the
+ * field with the name <code>name</code>, if it exists,
+ * otherwise returns <code>null</code>.
+ * <p>
+ * @return the <code>IFieldDescription</code>.
+ */
+ IFieldDescription getFieldDescription(String name);
+
+ /**
+ * Gets the IDL <code>TypeClass</code> of the type.
+ * <p>
+ * @return the <code>TypeClass</code>.
+ */
+ TypeClass getTypeClass();
+
+ /**
+ * Gets the component <code>ITypeDescription</code> if
+ * this is an array type, otherwise returns <code>null</code>.
+ * <p>
+ * @return the <code>ITypeDescription</code>
+ */
+ ITypeDescription getComponentType();
+
+ /**
+ * Gets the (UNO) type name.
+ *
+ * <p>The following table lists how UNO types map to type names:</p>
+ * <table>
+ * <thead>
+ * <tr><th>UNO type</th><th>type name</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><td>VOID</td><td><code>"void"</code></td></tr>
+ * <tr><td>BOOLEAN</td><td><code>"boolean"</code></td></tr>
+ * <tr><td>CHAR</td><td><code>"char"</code></td></tr>
+ * <tr><td>BYTE</td><td><code>"byte"</code></td></tr>
+ * <tr><td>SHORT</td><td><code>"short"</code></td></tr>
+ * <tr>
+ * <td>UNSIGNED SHORT</td><td><code>"unsigned short"</code></td>
+ * </tr>
+ * <tr><td>LONG</td><td><code>"long"</code></td></tr>
+ * <tr><td>UNSIGNED LONG</td><td><code>"unsigned long"</code></td></tr>
+ * <tr><td>HYPER</td><td></td><code>"hyper"</code></tr>
+ * <tr>
+ * <td>UNSIGNED HYPER</td><td></td><code>"unsigned hyper"</code>
+ * </tr>
+ * <tr><td>FLOAT</td><td></td><code>"float"</code></tr>
+ * <tr><td>DOUBLE</td><td></td><code>"double"</code></tr>
+ * <tr><td>STRING</td><td></td><code>"string"</code></tr>
+ * <tr><td>TYPE</td><td></td><code>"type"</code></tr>
+ * <tr><td>ANY</td><td></td><code>"any"</code></tr>
+ * <tr>
+ * <td>sequence type of base type <var>T</var></td>
+ * <td><code>"[]"</code> followed by type name for <var>T</var></td>
+ * </tr>
+ * <tr>
+ * <td>enum type named <var>N</var></td>
+ * <td><var>N</var> (see below)</td>
+ * </tr>
+ * <tr>
+ * <td>struct type named <var>N</var></td>
+ * <td><var>N</var> (see below)</td>
+ * </tr>
+ * <tr>
+ * <td>exception type named <var>N</var>
+ * </td><td><var>N</var> (see below)</td>
+ * </tr>
+ * <tr>
+ * <td>interface type named <var>N</var></td>
+ * <td><var>N</var> (see below)</td>
+ * </tr>
+ * <tbody>
+ * </table>
+ * <p>For a UNO type named <var>N</var>, consisting of a sequence of module
+ * names <var>M<sub>1</sub></var>, ..., <var>M<sub>n</sub></var> followed by
+ * a simple name <var>S</var>, the corresponding type name consists of the
+ * same sequence of module names and simple name, with <code>"."</code>
+ * seperating the individual elements.</p>
+ *
+ * @return the type name.
+ */
+ String getTypeName();
+
+ /**
+ * Gets the (Java) array type name.
+ *
+ * <p>The array type name is defined to be the Java class name (as returned
+ * by <code>Class.forName</code>) of the Java array class that corresponds
+ * to the UNO sequence type with this type (the UNO type represented by this
+ * <code>ITypeDescription</code> instance) as base type. For an
+ * <code>ITypeDescription</code> instance representing the UNO type VOID,
+ * the array type name is defined to be
+ * <code>"[Ljava.lang.Void;"</code>.</p>
+ *
+ * @return the array type name.
+ */
+ String getArrayTypeName();
+
+ /**
+ * Gets the corresponding java class for the type.
+ * <p>
+ * @return the corresponding java class.
+ */
+ Class getZClass();
+}
diff --git a/ridljar/com/sun/star/uno/Type.java b/ridljar/com/sun/star/uno/Type.java
new file mode 100644
index 000000000000..b87674ccdf63
--- /dev/null
+++ b/ridljar/com/sun/star/uno/Type.java
@@ -0,0 +1,652 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import java.util.HashMap;
+
+/**
+ * Represents the UNO built-in type <code>TYPE</code>.
+ *
+ * <p>The UNO type is not directly mapped to <code>java.lang.Class</code> for at
+ * least two reasons. For one, some UNO types (like <code>UNSIGNED
+ * SHORT</code>) do not have a matching Java class. For another, it can be
+ * necessary to describe a type which is unknown to the Java runtime system
+ * (for example, for delaying the need of a class, so that it is possible to
+ * generate it on the fly.)</p>
+ *
+ * <p>A <code>Type</code> is uniquely determined by its type class (a
+ * <code>TypeClass</code>) and its type name (a <code>String</code>); these two
+ * will never be <code>null</code>. A <code>Type</code> may have an additional
+ * "z class" (a <code>java.lang.Class</code>), giving a Java class type that
+ * corresponds to the UNO type. Also, a <code>Type</code> can cache a type
+ * description (a <code>com.sun.star.uno.ITypeDescription</code>), which can be
+ * computed and set by <code>TypeDescription.getTypeDescription</code>.
+ */
+public class Type {
+ // The following private static members and static initializer must come
+ // first in the class definition, so that the class can be initialized
+ // sucessfully:
+
+ private static final String TYPE_NAME_VOID = "void";
+ private static final String TYPE_NAME_BOOLEAN = "boolean";
+ private static final String TYPE_NAME_BYTE = "byte";
+ private static final String TYPE_NAME_SHORT = "short";
+ private static final String TYPE_NAME_UNSIGNED_SHORT = "unsigned short";
+ private static final String TYPE_NAME_LONG = "long";
+ private static final String TYPE_NAME_UNSIGNED_LONG = "unsigned long";
+ private static final String TYPE_NAME_HYPER = "hyper";
+ private static final String TYPE_NAME_UNSIGNED_HYPER = "unsigned hyper";
+ private static final String TYPE_NAME_FLOAT = "float";
+ private static final String TYPE_NAME_DOUBLE = "double";
+ private static final String TYPE_NAME_CHAR = "char";
+ private static final String TYPE_NAME_STRING = "string";
+ private static final String TYPE_NAME_TYPE = "type";
+ private static final String TYPE_NAME_ANY = "any";
+
+ // must be sorted same as TypeClass:
+ private static final String[] __typeClassToTypeName = new String[] {
+ TYPE_NAME_VOID,
+ TYPE_NAME_CHAR,
+ TYPE_NAME_BOOLEAN,
+ TYPE_NAME_BYTE,
+ TYPE_NAME_SHORT,
+ TYPE_NAME_UNSIGNED_SHORT,
+ TYPE_NAME_LONG,
+ TYPE_NAME_UNSIGNED_LONG,
+ TYPE_NAME_HYPER,
+ TYPE_NAME_UNSIGNED_HYPER,
+ TYPE_NAME_FLOAT,
+ TYPE_NAME_DOUBLE,
+ TYPE_NAME_STRING,
+ TYPE_NAME_TYPE,
+ TYPE_NAME_ANY
+ };
+
+ private static final HashMap __javaClassToTypeClass = new HashMap();
+ static {
+ __javaClassToTypeClass.put(
+ void.class, new TypeClass[] { TypeClass.VOID, TypeClass.VOID });
+ __javaClassToTypeClass.put(
+ Void.class, new TypeClass[] { TypeClass.VOID, TypeClass.VOID });
+ __javaClassToTypeClass.put(
+ boolean.class,
+ new TypeClass[] { TypeClass.BOOLEAN, TypeClass.BOOLEAN });
+ __javaClassToTypeClass.put(
+ Boolean.class,
+ new TypeClass[] { TypeClass.BOOLEAN, TypeClass.BOOLEAN });
+ __javaClassToTypeClass.put(
+ byte.class, new TypeClass[] { TypeClass.BYTE, TypeClass.BYTE });
+ __javaClassToTypeClass.put(
+ Byte.class, new TypeClass[] { TypeClass.BYTE, TypeClass.BYTE });
+ __javaClassToTypeClass.put(
+ short.class,
+ new TypeClass[] { TypeClass.SHORT, TypeClass.UNSIGNED_SHORT });
+ __javaClassToTypeClass.put(
+ Short.class,
+ new TypeClass[] { TypeClass.SHORT, TypeClass.UNSIGNED_SHORT });
+ __javaClassToTypeClass.put(
+ int.class,
+ new TypeClass[] { TypeClass.LONG, TypeClass.UNSIGNED_LONG });
+ __javaClassToTypeClass.put(
+ Integer.class,
+ new TypeClass[] { TypeClass.LONG, TypeClass.UNSIGNED_LONG });
+ __javaClassToTypeClass.put(
+ long.class,
+ new TypeClass[] { TypeClass.HYPER, TypeClass.UNSIGNED_HYPER });
+ __javaClassToTypeClass.put(
+ Long.class,
+ new TypeClass[] { TypeClass.HYPER, TypeClass.UNSIGNED_HYPER });
+ __javaClassToTypeClass.put(
+ float.class, new TypeClass[] { TypeClass.FLOAT, TypeClass.FLOAT });
+ __javaClassToTypeClass.put(
+ Float.class, new TypeClass[] { TypeClass.FLOAT, TypeClass.FLOAT });
+ __javaClassToTypeClass.put(
+ double.class,
+ new TypeClass[] { TypeClass.DOUBLE, TypeClass.DOUBLE });
+ __javaClassToTypeClass.put(
+ Double.class,
+ new TypeClass[] { TypeClass.DOUBLE, TypeClass.DOUBLE });
+ __javaClassToTypeClass.put(
+ char.class, new TypeClass[] { TypeClass.CHAR, TypeClass.CHAR });
+ __javaClassToTypeClass.put(
+ Character.class,
+ new TypeClass[] { TypeClass.CHAR, TypeClass.CHAR });
+ __javaClassToTypeClass.put(
+ String.class,
+ new TypeClass[] { TypeClass.STRING, TypeClass.STRING });
+ __javaClassToTypeClass.put(
+ Type.class, new TypeClass[] { TypeClass.TYPE, TypeClass.TYPE });
+ __javaClassToTypeClass.put(
+ Any.class, new TypeClass[] { TypeClass.ANY, TypeClass.ANY });
+ __javaClassToTypeClass.put(
+ Object.class,
+ new TypeClass[] { TypeClass.ANY, TypeClass.INTERFACE });
+ }
+
+ public static final Type VOID = new Type(void.class);
+ public static final Type CHAR = new Type(char.class);
+ public static final Type BOOLEAN = new Type(boolean.class);
+ public static final Type BYTE = new Type(byte.class);
+ public static final Type SHORT = new Type(short.class);
+ public static final Type UNSIGNED_SHORT = new Type(
+ TYPE_NAME_UNSIGNED_SHORT, TypeClass.UNSIGNED_SHORT);
+ public static final Type LONG = new Type(int.class);
+ public static final Type UNSIGNED_LONG = new Type(
+ TYPE_NAME_UNSIGNED_LONG, TypeClass.UNSIGNED_LONG);
+ public static final Type HYPER = new Type(long.class);
+ public static final Type UNSIGNED_HYPER = new Type(
+ TYPE_NAME_UNSIGNED_HYPER, TypeClass.UNSIGNED_HYPER);
+ public static final Type FLOAT = new Type(float.class);
+ public static final Type DOUBLE = new Type(double.class);
+ public static final Type STRING = new Type(String.class);
+ public static final Type TYPE = new Type(Type.class);
+ public static final Type ANY = new Type(Any.class);
+
+ /**
+ * Constructs a new <code>Type</code> which defaults to <code>VOID</code>.
+ */
+ public Type() {
+ init(null, void.class, false, false);
+ }
+
+ /**
+ * Constructs a new <code>Type</code> with the given type class and type
+ * name.
+ *
+ * @param typeName the type name. Must not be <code>null</code>.
+ * @param typeClass the type class. Must not be <code>null</code>, and must
+ * match the <code>typeName</code> (for example, it is illegal to
+ * combine a <code>typeName</code> of <code>"void"</code> with a
+ * <code>typeClass</code> of <code>BOOLEAN</code>).
+ */
+ public Type(String typeName, TypeClass typeClass) {
+ _typeClass = typeClass;
+ _typeName = typeName;
+ }
+
+ /**
+ * Constructs a new <code>Type</code> from the given
+ * <code>java.lang.Class</code>.
+ *
+ * <p>This is equivalent to <code>Type(zClass, false)</code>.</p>
+ *
+ * @param zClass the Java class of this type. Must not be
+ * <code>null</code>.
+ */
+ public Type(Class zClass) {
+ init(null, zClass, false, false);
+ }
+
+ /**
+ * Constructs a new <code>Type</code> from the given
+ * <code>java.lang.Class</code>, handling ambiguous cases.
+ *
+ * <p>In certain cases, one Java class corresponds to two UNO types (e.g.,
+ * the Java class <code>short[].class</code> corresponds to both a sequence
+ * of <codde>SHORT</code> and a sequence of <code>UNSIGNED SHORT</code> in
+ * UNO). In such ambiguous cases, the parameter <code>alternative</code>
+ * controls which UNO type is chosen:</p>
+ * <ul>
+ * <li>If the Java type is (an array type with element type)
+ * <code>short</code> or <code>java.lang.Short</code>: If
+ * <code>alternative</code> is <code>false</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>SHORT</code>. If
+ * <code>alternative</code> is <code>true</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>UNSIGNED SHORT</code>.</li>
+ *
+ * <li>If the Java type is (an array type with element type)
+ * <code>int</code> or <code>java.lang.Integer</code>: If
+ * <code>alternative</code> is <code>false</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>LONG</code>. If
+ * <code>alternative</code> is <code>true</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>UNSIGNED LONG</code>.</li>
+ *
+ * <li>If the Java type is (an array type with element type)
+ * <code>long</code> or <code>java.lang.Long</code>: If
+ * <code>alternative</code> is <code>false</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>HYPER</code>. If
+ * <code>alternative</code> is <code>true</code>, the chosen UNO type is
+ * (a sequence type with element type) <code>UNSIGNED HYPER</code>.</li>
+ *
+ * <li>If the Java type is (an array type with element type)
+ * <code>java.lang.Object</code>: If <code>alternative</code> is
+ * <code>false</code>, the chosen UNO type is (a sequence type with
+ * element type) <code>ANY</code>. If <code>alternative</code> is
+ * <code>true</code>, the chosen UNO type is (a sequence type with element
+ * type) <code>com.sun.star.uno.XInterface</code>.</li>
+ * </ul>
+ * <p>In all other cases, the value of <code>alternative</code> is
+ * ignored.</p>
+ *
+ * <p>This constructor cannot be used to create <code>Type</code> instances
+ * that represent (sequences of) instantiated polymorphic struct types.</p>
+ *
+ * @param zClass the Java class of this type; must not be <code>null</code>
+ * @param alternative controls which UNO type to choose in case of
+ * ambiguities
+ *
+ * @since UDK 3.2.0
+ */
+ public Type(Class zClass, boolean alternative) {
+ init(null, zClass, alternative, false);
+ }
+
+ /**
+ * Constructs a new <code>Type</code> from the given type description.
+ *
+ * @param typeDescription a type description. Must not be
+ * <code>null</code>.
+ */
+ public Type(ITypeDescription typeDescription) {
+ _typeName = typeDescription.getTypeName();
+ _typeClass = typeDescription.getTypeClass();
+ _iTypeDescription = typeDescription;
+ }
+
+ /**
+ * Constructs a new <code>Type</code> with the given type name.
+ *
+ * @param typeName the name of this type; must not be <code>null</code>.
+ */
+ public Type(String typeName) {
+ if (typeName.startsWith("[]")) {
+ _typeName = typeName;
+ _typeClass = TypeClass.SEQUENCE;
+ return;
+ }
+ for (int i = 0; i < __typeClassToTypeName.length; ++i) {
+ if (__typeClassToTypeName[i].equals(typeName)) {
+ _typeName = typeName;
+ _typeClass = TypeClass.fromInt(i);
+ return;
+ }
+ }
+ int i = typeName.indexOf('<');
+ try {
+ init(
+ typeName,
+ Class.forName(i < 0 ? typeName : typeName.substring(0, i)),
+ false, i >= 0);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e.toString());
+ }
+ }
+
+ /**
+ * Constructs a new <code>Type</code> with the given type class.
+ *
+ * @param typeClass the type class of this type; must not be
+ * <code>null</code>. Only type classes for simple types are allowed
+ * here.
+ *
+ * @throws IllegalArgumentException if the given <code>typeClass</code> is
+ * not simple (for example, a struct or an interface type). This
+ * constructor could not find out the type name in such a case.
+ */
+ public Type(TypeClass typeClass) {
+ if(__isTypeClassPrimitive(typeClass)) {
+ _typeClass = typeClass;
+ _typeName = __typeClassToTypeName[typeClass.getValue()];
+ }
+ else
+ throw new IllegalArgumentException(typeClass + " is not primitive");
+ }
+
+ /**
+ * Gets the type class.
+ *
+ * @return the type class. Will never be <code>null</code>, but might be
+ * <code>UNKNOWN</code>.
+ */
+ public TypeClass getTypeClass() {
+ return _typeClass;
+ }
+
+ /**
+ * Gets the type name.
+ *
+ * @return the type name; will never be <code>null</code>
+ */
+ public String getTypeName() {
+ return _typeName;
+ }
+
+ /**
+ * Gets the Java class.
+ *
+ * @return the type name; may be <code>null</code> in extreme situations
+ * (inconsistent <code>TypeClass</code>, error loading a class)
+ */
+ public Class getZClass() {
+ synchronized (this) {
+ if (_class == null) {
+ _class = determineClass();
+ }
+ }
+ return _class;
+ }
+
+ /**
+ * Gives the type description of this type.
+ *
+ * @return the type description; may be <code>null</code>
+ */
+ public ITypeDescription getTypeDescription() {
+ return _iTypeDescription;
+ }
+
+ /**
+ * Sets the type description for this type.
+ *
+ * @param typeDescription the type description
+ */
+ public void setTypeDescription(ITypeDescription typeDescription) {
+ _iTypeDescription = typeDescription;
+ }
+
+ /**
+ * Determines whether this UNO type is a supertype of another UNO type.
+ *
+ * UNO only defines the following supertype relations:
+ * (1) A struct type t1 is a supertype of a struct type t2, if either t1
+ * and t2 are the same, or t1 is a direct or indirect parent of t2.
+ * (2) An exception type t1 is a supertype of an exception type t2, if
+ * either t1 and t2 are the same, or t1 is a direct or indirect parent
+ * of t2.
+ * (3) An interface type t1 is a supertype of an interface type t2, if
+ * either t1 and t2 are the same, or t1 is a direct or indirect parent
+ * of t2.
+ *
+ * Following the conventions of the Java UNO language binding,
+ * com.sun.star.uno.Exception is not considered a supertype of
+ * com.sun.star.uno.RuntimeException or any exception type derived from
+ * com.sun.star.uno.RuntimeException.
+ *
+ * @param type some Type
+ * @return true if this type is a supertype of the given type
+ *
+ * @since UDK 3.2.0
+ */
+ public boolean isSupertypeOf(Type type) {
+ if (_typeClass != type._typeClass) {
+ return false;
+ }
+ switch (_typeClass.getValue()) {
+ case TypeClass.SEQUENCE_value:
+ case TypeClass.ENUM_value:
+ return _typeName.equals(type._typeName);
+
+ case TypeClass.STRUCT_value:
+ // This check exploits the fact that an instantiated polymorphic
+ // struct type may not be the direct base of a struct type:
+ if (_typeName.indexOf('<') >= 0 || type._typeName.indexOf('<') >= 0)
+ {
+ return _typeName.equals(type._typeName);
+ }
+ case TypeClass.EXCEPTION_value:
+ case TypeClass.INTERFACE_value:
+ Class c1 = getZClass();
+ Class c2 = type.getZClass();
+ return c1 != null && c2 != null && c1.isAssignableFrom(c2);
+
+ default:
+ return true;
+ }
+ }
+
+ // @see java.lang.Object#equals
+ public boolean equals(Object obj) {
+ return obj instanceof Type
+ && _typeClass == ((Type) obj)._typeClass
+ && _typeName.equals(((Type) obj)._typeName);
+ }
+
+ // @see java.lang.Object#hashCode
+ public int hashCode() {
+ return _typeName.hashCode();
+ }
+
+ // @see java.lang.Object#toString
+ public String toString() {
+ return "Type[" + _typeName + "]";
+ }
+
+ private void init(
+ String name, Class zClass, boolean alternative, boolean arguments)
+ {
+ TypeClass[] tc = (TypeClass[]) __javaClassToTypeClass.get(zClass);
+ if (tc != null) {
+ // tc only contains primitive type classes, except for
+ // TypeClass.INTERFACE, which stands for XInterface (the alternative
+ // interpretation of java.lang.Object):
+ _typeClass = tc[alternative ? 1 : 0];
+ _typeName = _typeClass == TypeClass.INTERFACE
+ ? XInterface.class.getName()
+ : __typeClassToTypeName[_typeClass.getValue()];
+ // do not assign _class from zClass, as _class should always be
+ // normalized (e.g., boolean.class instead of
+ // java.lang.Boolean.class); getZClass will later calculate the
+ // correct class when needed
+ } else if (zClass.isArray()) {
+ Type t = new Type(zClass.getComponentType(), alternative);
+ _typeClass = t.getTypeClass() != TypeClass.UNKNOWN
+ ? TypeClass.SEQUENCE : TypeClass.UNKNOWN;
+ _typeName = "[]" + t.getTypeName();
+ // do not assign _class from zClass, as _class should always be
+ // normalized (e.g., boolean[].class instead of
+ // java.lang.Boolean[].class); getZClass will later calculate the
+ // correct class when needed
+ } else if (Enum.class.isAssignableFrom(zClass)) {
+ _typeClass = zClass != Enum.class
+ ? TypeClass.ENUM : TypeClass.UNKNOWN;
+ _typeName = zClass.getName();
+ _class = zClass;
+ } else if (Throwable.class.isAssignableFrom(zClass)) {
+ _typeClass
+ = com.sun.star.uno.Exception.class.isAssignableFrom(zClass)
+ || com.sun.star.uno.RuntimeException.class.isAssignableFrom(
+ zClass)
+ ? TypeClass.EXCEPTION : TypeClass.UNKNOWN;
+ _typeName = zClass.getName();
+ _class = zClass;
+ } else if (zClass.isInterface()) {
+ _typeClass = XInterface.class.isAssignableFrom(zClass)
+ ? TypeClass.INTERFACE : TypeClass.UNKNOWN;
+ _typeName = zClass.getName();
+ _class = zClass;
+ } else if (XInterface.class.isAssignableFrom(zClass)) {
+ // This case is needed by code that uses this constructor to
+ // calculate the UNO type corresponding to a Java object:
+ _typeClass = TypeClass.INTERFACE;
+ _typeName = XInterface.class.getName();
+ _class = XInterface.class;
+ } else {
+ // assert zClass != Object.class && !zClass.isPrimitive();
+ _typeClass = TypeClass.STRUCT;
+ _typeName = name == null ? zClass.getName() : name;
+ _class = zClass;
+ }
+ if (arguments && _typeClass != TypeClass.STRUCT) {
+ throw new IllegalArgumentException(
+ zClass + " cannot have type arguments");
+ }
+ }
+
+ private Class determineClass() {
+ switch (_typeClass.getValue()) {
+ case TypeClass.VOID_value:
+ return _typeName.equals(TYPE_NAME_VOID) ? void.class : null;
+
+ case TypeClass.BOOLEAN_value:
+ return _typeName.equals(TYPE_NAME_BOOLEAN) ? boolean.class : null;
+
+ case TypeClass.BYTE_value:
+ return _typeName.equals(TYPE_NAME_BYTE) ? byte.class : null;
+
+ case TypeClass.SHORT_value:
+ return _typeName.equals(TYPE_NAME_SHORT) ? short.class : null;
+
+ case TypeClass.UNSIGNED_SHORT_value:
+ return _typeName.equals(TYPE_NAME_UNSIGNED_SHORT)
+ ? short.class : null;
+
+ case TypeClass.LONG_value:
+ return _typeName.equals(TYPE_NAME_LONG) ? int.class : null;
+
+ case TypeClass.UNSIGNED_LONG_value:
+ return _typeName.equals(TYPE_NAME_UNSIGNED_LONG) ? int.class : null;
+
+ case TypeClass.HYPER_value:
+ return _typeName.equals(TYPE_NAME_HYPER) ? long.class : null;
+
+ case TypeClass.UNSIGNED_HYPER_value:
+ return _typeName.equals(TYPE_NAME_UNSIGNED_HYPER)
+ ? long.class : null;
+
+ case TypeClass.FLOAT_value:
+ return _typeName.equals(TYPE_NAME_FLOAT) ? float.class : null;
+
+ case TypeClass.DOUBLE_value:
+ return _typeName.equals(TYPE_NAME_DOUBLE) ? double.class : null;
+
+ case TypeClass.CHAR_value:
+ return _typeName.equals(TYPE_NAME_CHAR) ? char.class : null;
+
+ case TypeClass.STRING_value:
+ return _typeName.equals(TYPE_NAME_STRING) ? String.class : null;
+
+ case TypeClass.TYPE_value:
+ return _typeName.equals(TYPE_NAME_TYPE) ? Type.class : null;
+
+ case TypeClass.ANY_value:
+ return _typeName.equals(TYPE_NAME_ANY) ? Object.class : null;
+
+ case TypeClass.SEQUENCE_value:
+ StringBuffer buf = new StringBuffer();
+ int offset = 0;
+ for (; _typeName.startsWith("[]", offset); offset += "[]".length())
+ {
+ buf.append('[');
+ }
+ if (buf.length() == 0) {
+ return null;
+ }
+ String base = _typeName.substring(offset);
+ if (base.equals(TYPE_NAME_VOID)) {
+ buf.append('V');
+ } else if (base.equals(TYPE_NAME_BOOLEAN)) {
+ buf.append('Z');
+ } else if (base.equals(TYPE_NAME_BYTE)) {
+ buf.append('B');
+ } else if (base.equals(TYPE_NAME_SHORT)
+ || base.equals(TYPE_NAME_UNSIGNED_SHORT)) {
+ buf.append('S');
+ } else if (base.equals(TYPE_NAME_LONG)
+ || base.equals(TYPE_NAME_UNSIGNED_LONG)) {
+ buf.append('I');
+ } else if (base.equals(TYPE_NAME_HYPER)
+ || base.equals(TYPE_NAME_UNSIGNED_HYPER)) {
+ buf.append('J');
+ } else if (base.equals(TYPE_NAME_FLOAT)) {
+ buf.append('F');
+ } else if (base.equals(TYPE_NAME_DOUBLE)) {
+ buf.append('D');
+ } else if (base.equals(TYPE_NAME_CHAR)) {
+ buf.append('C');
+ } else if (base.equals(TYPE_NAME_STRING)) {
+ buf.append("Ljava.lang.String;");
+ } else if (base.equals(TYPE_NAME_TYPE)) {
+ buf.append("Lcom.sun.star.uno.Type;");
+ } else if (base.equals(TYPE_NAME_ANY)) {
+ buf.append("Ljava.lang.Object;");
+ } else {
+ int args = base.indexOf('<');
+ if (args >= 0) {
+ base = base.substring(0, args);
+ }
+ Class c;
+ try {
+ c = Class.forName(base);
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+ if (args < 0 && new Type(c).getTypeClass() == TypeClass.UNKNOWN)
+ {
+ return null;
+ }
+ buf.append('L');
+ buf.append(base);
+ buf.append(';');
+ }
+ try {
+ return Class.forName(buf.toString());
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+
+ case TypeClass.ENUM_value:
+ case TypeClass.EXCEPTION_value:
+ case TypeClass.INTERFACE_value:
+ {
+ Class c;
+ try {
+ c = Class.forName(_typeName);
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+ return new Type(c).equals(this) ? c : null;
+ }
+
+ case TypeClass.STRUCT_value:
+ {
+ int args = _typeName.indexOf('<');
+ Class c;
+ try {
+ c = Class.forName(
+ args < 0 ? _typeName : _typeName.substring(0, args));
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+ return args >= 0 || new Type(c).equals(this) ? c : null;
+ }
+
+ default:
+ return null;
+ }
+ }
+
+ private static boolean __isTypeClassPrimitive(TypeClass typeClass) {
+ return typeClass.getValue() < __typeClassToTypeName.length;
+ }
+
+ protected TypeClass _typeClass; // TODO should be final
+ protected String _typeName; // TODO should be final
+
+ protected Class _class;
+ protected ITypeDescription _iTypeDescription;
+}
diff --git a/ridljar/com/sun/star/uno/Union.java b/ridljar/com/sun/star/uno/Union.java
new file mode 100644
index 000000000000..5edb1988c820
--- /dev/null
+++ b/ridljar/com/sun/star/uno/Union.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+/**
+ * The Union class is the base class for all classes generated
+ * as java binding for the IDL type union.
+ * <p>
+ * Note: The idl type <code>union<code> is currently not fully
+ * integrated into the UNO framework, so don't use it.
+ *
+ * @version $Revision: 1.5 $ $ $Date: 2008-04-11 11:15:07 $
+ */
+public class Union {
+ /**
+ * Get the value in the union.
+ * The representation of the value is an any.
+ * <p>
+ * @return the any value.
+ */
+ public final Object getValue() {
+ return m_value;
+ }
+
+ protected Object m_value;
+}
+
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java
new file mode 100644
index 000000000000..188ea54a74a6
--- /dev/null
+++ b/ridljar/com/sun/star/uno/UnoRuntime.java
@@ -0,0 +1,696 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Iterator;
+import com.sun.star.lib.uno.typedesc.TypeDescription;
+import com.sun.star.lib.util.WeakMap;
+
+/**
+ * The central class needed for implementing or using UNO components in Java.
+ *
+ * <p>The methods <code>queryInterface</code> and <code>areSame</code> delegate
+ * calls to the implementing objects and are used instead of casts,
+ * <code>instanceof</code>, <code>==</code>, and <code>equals</code>.<p>
+ *
+ * <p>For historic reasons, this class is not <code>final</code>, and has a
+ * <code>public</code> constructor. These artifacts are considered mistakes,
+ * which might be corrected in a future version of this class, so client code
+ * should not rely on them.</p>
+ *
+ * @see com.sun.star.uno.IBridge
+ * @see com.sun.star.uno.IEnvironment
+ * @see com.sun.star.uno.IQueryInterface
+ */
+public class UnoRuntime {
+ /**
+ * @deprecated As of UDK&nbsp;3.2.0, do not create instances of this class.
+ * It is considered a historic mistake to have a <code>public</code>
+ * constructor for this class, which only has <code>static</code> members.
+ * Also, this class might be changed to become <code>final</code> in a
+ * future version.
+ */
+ public UnoRuntime() {}
+
+ /**
+ * Generates a world wide unique identifier string.
+ *
+ * <p>It is guaranteed that every invocation of this method generates a new
+ * ID, which is unique within the VM. The quality of &ldquo;world wide
+ * unique&rdquo; will depend on the actual implementation, you should look
+ * at the source to determine if it meets your requirements.</p>
+ *
+ * @return a unique <code>String</code>
+ */
+ public static String getUniqueKey() {
+ synchronized (uniqueKeyLock) {
+ if (uniqueKeyCount == Long.MAX_VALUE) {
+ long time;
+ for (time = System.currentTimeMillis(); time == uniqueKeyTime;)
+ {
+ // Conservatively sleep for 100 millisecond to wait for
+ // System.currentTimeMillis() to change:
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ uniqueKeyTime = time;
+ uniqueKeyCount = Long.MIN_VALUE;
+ }
+ return uniqueKeyHostPrefix + Long.toString(uniqueKeyTime, 16) + ":"
+ + Long.toString(uniqueKeyCount++, 16);
+ }
+ }
+
+ /**
+ * Generates a world wide unique object identifier (OID) for the given
+ * Java object.
+ *
+ * <p>It is guaranteed that subsequent calls to this method with the same
+ * Java object will give the same ID.</p>
+ *
+ * <p>This method is generally of little use for client code. It should be
+ * considered a mistake that this method is published at all.</p>
+ *
+ * @param object any object for which a OID shall be generated; must not be
+ * <code>null</code>
+ * @return the generated OID
+ * @see com.sun.star.uno.IQueryInterface#getOid
+ */
+ public static String generateOid(Object object) {
+ String oid = null;
+ if (object instanceof IQueryInterface) {
+ oid = ((IQueryInterface) object).getOid();
+ }
+ return oid == null ? object.hashCode() + oidSuffix : oid;
+ }
+
+ /**
+ * Queries the given UNO object for the given UNO interface type.
+ *
+ * <p>This method returns <code>null</code> in case the given UNO object
+ * does not support the given UNO interface type (or is itself
+ * <code>null</code>). Otherwise, a reference to a Java object implementing
+ * the Java interface type corresponding to the given UNO interface is
+ * returned. In the latter case, it is unspecified whether the returned
+ * Java object is the same as the given object, or is another facet of that
+ * UNO object.</p>
+ *
+ * @param type the requested UNO interface type; must be a <code>Type</code>
+ * object representing a UNO interface type
+ * @param object a reference to any Java object representing (a facet of) a
+ * UNO object; may be <code>null</code>
+ * @return a reference to the requested UNO interface type if available,
+ * otherwise <code>null</code>
+ * @see com.sun.star.uno.IQueryInterface#queryInterface
+ */
+ public static Object queryInterface(Type type, Object object) {
+ // Gracefully handle those situations where the passed in UNO object is
+ // wrapped in an Any. Strictly speaking, such a situation constitutes a
+ // bug, but it is anticipated that such situations will arise quite
+ // often in practice (especially since UNO Anys containing an XInterface
+ // reference are not wrapped in a Java Any, but UNO Anys containing any
+ // other interface reference are wrapped in a Java Any, which can lead
+ // to confusion).
+ if (object instanceof Any) {
+ Any a = (Any) object;
+ if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
+ object = a.getObject();
+ }
+ }
+ if (object instanceof IQueryInterface) {
+ object = ((IQueryInterface) object).queryInterface(type);
+ if (object instanceof Any) {
+ Any a = (Any) object;
+ object = a.getType().getTypeClass() == TypeClass.INTERFACE
+ ? a.getObject() : null;
+ }
+ }
+ // Ensure that the object implements the requested interface type:
+ Class c = type.getZClass();
+ if (c == null || !c.isInstance(object)) {
+ object = null;
+ }
+ return object;
+ }
+
+ /**
+ * Queries the given UNO object for the given Java class (which must
+ * represent a UNO interface type).
+ *
+ * @param ifc a Java class representing a UNO interface type
+ * @param object a reference to any Java object representing (a facet of) a
+ * UNO object; may be <code>null</code>
+ * @return a reference to the requested UNO interface type if available,
+ * otherwise <code>null</code>
+ * @see #queryInterface(Type, Object)
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T queryInterface(Class<T> zInterface, Object object) {
+ return (T) queryInterface(new Type(zInterface), object);
+ }
+
+ /**
+ Tests two UNO <code>ANY</code> values for equality.
+
+ <p>Two UNO values are <dfn>equal</dfn> if and only if they are of the
+ same UNO type&nbsp;<var>t</var>, and they meet the following condition,
+ depending on&nbsp;<var>t</var>:</p>
+ <ul>
+ <li>If <var>t</var> is a primitive type, then both values must denote
+ the same element of the set of values of&nbsp;<var>t</var>.</li>
+
+ <li>If <var>t</var> is a structured type, then both values must
+ recursively contain corresponding values that are equal.</li>
+
+ <li>If <var>t</var> is an interface type, then the two values must be
+ either both null references, or both references to the same UNO
+ object.</li>
+ </ul>
+
+ @param any1 a Java value representing a UNO <code>ANY</code> value.
+
+ @param any2 a Java value representing a UNO <code>ANY</code> value.
+
+ @return <code>true</code> if and only if the two arguments represent
+ equal UNO values.
+ */
+ public static boolean areSame(Object any1, Object any2) {
+ Any a1 = Any.complete(any1);
+ Any a2 = Any.complete(any2);
+ Type t = a1.getType();
+ if (!a2.getType().equals(t)) {
+ return false;
+ }
+ Object v1 = a1.getObject();
+ Object v2 = a2.getObject();
+ switch (t.getTypeClass().getValue()) {
+ case TypeClass.VOID_value:
+ return true;
+ case TypeClass.BOOLEAN_value:
+ case TypeClass.BYTE_value:
+ case TypeClass.SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
+ case TypeClass.LONG_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ case TypeClass.HYPER_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ case TypeClass.FLOAT_value:
+ case TypeClass.DOUBLE_value:
+ case TypeClass.CHAR_value:
+ case TypeClass.STRING_value:
+ case TypeClass.TYPE_value:
+ return v1.equals(v2);
+ case TypeClass.SEQUENCE_value:
+ int n = Array.getLength(v1);
+ if (n != Array.getLength(v2)) {
+ return false;
+ }
+ for (int i = 0; i < n; ++i) {
+ // Recursively using areSame on Java values that are (boxed)
+ // elements of Java arrays representing UNO sequence values,
+ // instead of on Java values that are representations of UNO ANY
+ // values, works by chance:
+ if (!areSame(Array.get(v1, i), Array.get(v2, i))) {
+ return false;
+ }
+ }
+ return true;
+ case TypeClass.ENUM_value:
+ return v1 == v2;
+ case TypeClass.STRUCT_value:
+ case TypeClass.EXCEPTION_value:
+ IFieldDescription[] fs;
+ try {
+ fs = TypeDescription.getTypeDescription(t).
+ getFieldDescriptions();
+ } catch (ClassNotFoundException e) {
+ throw new java.lang.RuntimeException(e.toString());
+ }
+ for (int i = 0; i< fs.length; ++i) {
+ Type ft = new Type(fs[i].getTypeDescription());
+ try {
+ // Recursively using areSame on Java values that are (boxed)
+ // fields of Java classes representing UNO struct or
+ // exception values, instead of on Java values that are
+ // representations of UNO ANY values, works by chance:
+ if (!areSame(
+ completeValue(ft, fs[i].getField().get(v1)),
+ completeValue(ft, fs[i].getField().get(v2))))
+ {
+ return false;
+ }
+ } catch (IllegalAccessException e) {
+ throw new java.lang.RuntimeException(e.toString());
+ }
+ }
+ return true;
+ case TypeClass.INTERFACE_value:
+ return v1 == v2
+ || (v1 instanceof IQueryInterface
+ && ((IQueryInterface) v1).isSame(v2))
+ || (v2 instanceof IQueryInterface
+ && ((IQueryInterface) v2).isSame(v1));
+ default:
+ throw new java.lang.RuntimeException(
+ "com.sun.star.uno.Any has bad com.sun.star.uno.TypeClass");
+ }
+ }
+
+ /**
+ Complete a UNO value (make sure it is no invalid <code>null</code>
+ value).
+
+ <p>This is useful for members of parameterized type of instantiated
+ polymorphic struct types, as <code>null</code> is a valid value there
+ (and only there, for all types except <code>ANY</code> and interface
+ types).</p>
+
+ @param type a non-void, non-exception UNO type.
+
+ @param value a Java value representing a UNO value of the given UNO type,
+ or <code>null</code>.
+
+ @return the given value, or the neutral value of the given type, if the
+ given value was an invalid <code>null</code> value.
+
+ @since UDK 3.2.3
+ */
+ public static final Object completeValue(Type type, Object value) {
+ if (value != null) {
+ return value;
+ }
+ switch (type.getTypeClass().getValue()) {
+ case TypeClass.BOOLEAN_value:
+ return Boolean.FALSE;
+ case TypeClass.BYTE_value:
+ return new Byte((byte) 0);
+ case TypeClass.SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
+ return new Short((short) 0);
+ case TypeClass.LONG_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ return new Integer(0);
+ case TypeClass.HYPER_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ return new Long(0L);
+ case TypeClass.FLOAT_value:
+ return new Float(0.0f);
+ case TypeClass.DOUBLE_value:
+ return new Double(0.0);
+ case TypeClass.CHAR_value:
+ return new Character('\u0000');
+ case TypeClass.STRING_value:
+ return "";
+ case TypeClass.TYPE_value:
+ return Type.VOID;
+ case TypeClass.ANY_value:
+ case TypeClass.INTERFACE_value:
+ return null;
+ case TypeClass.SEQUENCE_value:
+ return Array.newInstance(type.getZClass().getComponentType(), 0);
+ case TypeClass.STRUCT_value:
+ try {
+ return type.getZClass().getConstructor(null).newInstance(null);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.lang.RuntimeException(e.toString());
+ }
+ case TypeClass.ENUM_value:
+ try {
+ return type.getZClass().getMethod("getDefault", null).invoke(
+ null, null);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.lang.RuntimeException(e.toString());
+ }
+ default:
+ throw new IllegalArgumentException(
+ "com.sun.star.uno.UnoRuntime.completeValue called with bad"
+ + " com.sun.star.uno.Type");
+ }
+ }
+
+ /**
+ * Gets the current context of the current thread, or <code>null</code> if
+ * no context has been set for the current thread.
+ *
+ * <p>The current context is thread local, which means that this method
+ * returns the context that was last set for this thread.</p>
+ *
+ * @return the current context of the current thread, or <code>null</code>
+ * if no context has been set for the current thread
+ */
+ public static XCurrentContext getCurrentContext() {
+ return (XCurrentContext) currentContext.get();
+ }
+
+ /**
+ * Sets the current context for the current thread.
+ *
+ * <p>The current context is thread local. To support a stacking behaviour,
+ * every function that sets the current context should reset it to the
+ * original value when exiting (for example, within a <code>finally</code>
+ * block).</p>
+ *
+ * @param context the context to be set; if <code>null</code>, any
+ * previously set context will be removed
+ */
+ public static void setCurrentContext(XCurrentContext context) {
+ // optimize this by using Java 1.5 ThreadLocal.remove if context == null
+ currentContext.set(context);
+ }
+
+ /**
+ * Retrieves an environment of type <code>name</code> with context
+ * <code>context</code>.
+ *
+ * <p>Environments are held weakly by this class. If the requested
+ * environment already exists, this methods simply returns it. Otherwise,
+ * this method looks for it under
+ * <code>com.sun.star.lib.uno.environments.<var>name</var>.<!--
+ * --><var>name</var>_environment</code>.</p>
+ *
+ * @param name the name of the environment
+ * @param context the context of the environment
+ * @see com.sun.star.uno.IEnvironment
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IEnvironment getEnvironment(String name, Object context)
+ throws java.lang.Exception
+ {
+ synchronized (environments) {
+ IEnvironment env = (IEnvironment) WeakMap.getValue(
+ environments.get(name + context));
+ if (env == null) {
+ Class c = Class.forName(
+ "com.sun.star.lib.uno.environments." + name + "." + name
+ + "_environment");
+ Constructor ctor = c.getConstructor(
+ new Class[] { Object.class });
+ env = (IEnvironment) ctor.newInstance(new Object[] { context });
+ environments.put(name + context, env);
+ }
+ return env;
+ }
+ }
+
+ /**
+ * Gets a bridge from environment <code>from</code> to environment
+ * <code>to</code>.
+ *
+ * <p>Creates a new bridge, if the requested bridge does not yet exist, and
+ * hands the arguments to the bridge.</p>
+ *
+ * <p>If the requested bridge does not exist, it is searched for in package
+ * <code>com.sun.star.lib.uno.bridges.<var>from</var>_<var>to</var>;</code>
+ * and the root classpath as
+ * <code><var>from</var>_<var>to</var>_bridge</code>.</p>
+ *
+ * @param from the source environment
+ * @param to the target environment
+ * @param args the initial arguments for the bridge
+ * @return the requested bridge
+ * @see #getBridgeByName
+ * @see com.sun.star.uno.IBridge
+ * @see com.sun.star.uno.IEnvironment
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IBridge getBridge(
+ IEnvironment from, IEnvironment to, Object[] args)
+ throws java.lang.Exception
+ {
+ synchronized (bridges) {
+ String name = from.getName() + "_" + to.getName();
+ String hashName = from.getName() + from.getContext() + "_"
+ + to.getName() + to.getContext();
+ IBridge bridge = (IBridge) WeakMap.getValue(bridges.get(hashName));
+ if(bridge == null) {
+ Class zClass = null;
+ String className = name + "_bridge";
+ try {
+ zClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ className = "com.sun.star.lib.uno.bridges." + name + "."
+ + className;
+ zClass = Class.forName(className);
+ }
+ Class[] signature = {
+ IEnvironment.class, IEnvironment.class, args.getClass() };
+ Constructor constructor = zClass.getConstructor(signature);
+ Object[] iargs = { from, to, args };
+ bridge = (IBridge) constructor.newInstance(iargs);
+ bridges.put(hashName, bridge);
+ }
+ return bridge;
+ }
+ }
+
+ /**
+ * Gets a bridge from environment <code>from</code> to environment
+ * <code>to</code>.
+ *
+ * <p>Creates a new bridge, if the requested bridge does not yet exist, and
+ * hands the arguments to the bridge.</p>
+ *
+ * <p>If the requested bridge does not exist, it is searched for in package
+ * <code>com.sun.star.lib.uno.bridges.<var>from</var>_<var>to</var>;</code>
+ * and the root classpath as
+ * <code><var>from</var>_<var>to</var>_bridge</code>. The used environments
+ * are retrieved through <code>getEnvironment</code>.</p>
+ *
+ * @param from the name of the source environment
+ * @param fromContext the context for the source environment
+ * @param to the name of the target environment
+ * @param toContext the context for the target environment
+ * @param args the initial arguments for the bridge
+ * @return the requested bridge
+ * @see #getBridge
+ * @see #getEnvironment
+ * @see com.sun.star.uno.IBridge
+ * @see com.sun.star.uno.IEnvironment
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IBridge getBridgeByName(
+ String from, Object fromContext, String to, Object toContext,
+ Object[] args) throws java.lang.Exception
+ {
+ return getBridge(
+ getEnvironment(from, fromContext), getEnvironment(to, toContext),
+ args);
+ }
+
+ /**
+ * Returns an array of all active bridges.
+ *
+ * @return an array of <code>IBridge</code> objects
+ * @see com.sun.star.uno.IBridge
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IBridge[] getBridges() {
+ ArrayList l = new ArrayList();
+ synchronized (bridges) {
+ for (Iterator i = bridges.values().iterator(); i.hasNext();) {
+ Object o = WeakMap.getValue(i.next());
+ if (o != null) {
+ l.add(o);
+ }
+ }
+ }
+ return (IBridge[]) l.toArray(new IBridge[l.size()]);
+ }
+
+ /**
+ * Gets a mapping from environment <code>from</code> to environment
+ * <code>to</code>.
+ *
+ * <p>Mappings are like bridges, except that with mappings one can only map
+ * in one direction. Mappings are here for compatibility with the binary
+ * UNO API. Mappings are implemented as wrappers around bridges.</p>
+ *
+ * @param from the source environment
+ * @param to the target environment
+ * @return the requested mapping
+ * @see com.sun.star.uno.IEnvironment
+ * @see com.sun.star.uno.IMapping
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IMapping getMapping(IEnvironment from, IEnvironment to)
+ throws java.lang.Exception
+ {
+ IBridge bridge;
+ try {
+ bridge = getBridge(from, to, null);
+ }
+ catch (ClassNotFoundException e) {
+ bridge = new BridgeTurner(getBridge(to, from, null));
+ }
+ return new MappingWrapper(bridge);
+ }
+
+ /**
+ * Gets a mapping from environment <code>from</code> to environment
+ * <code>to</code>.
+ *
+ * <p>The used environments are retrieved through
+ * <code>getEnvironment</code>.</p>
+ *
+ * @param from the name of the source environment
+ * @param to the name of the target environment
+ * @return the requested mapping
+ * @see #getEnvironment
+ * @see #getMapping
+ * @see com.sun.star.uno.IMapping
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ public static IMapping getMappingByName(String from, String to)
+ throws java.lang.Exception
+ {
+ return getMapping(getEnvironment(from, null), getEnvironment(to, null));
+ }
+
+ /**
+ * Resets this <code>UnoRuntime</code> to its initial state.
+ *
+ * <p>Releases all references to bridges and environments.</p>
+ *
+ * @deprecated As of UDK&nbsp;3.2.0, this method is deprecated, without
+ * offering a replacement.
+ */
+ static public boolean reset() {
+ synchronized (bridges) {
+ for (Iterator i = bridges.values().iterator(); i.hasNext();) {
+ IBridge b = (IBridge) WeakMap.getValue(i.next());
+ if (b != null) {
+ // The following call to dispose was originally made to
+ // com.sun.star.lib.sandbox.Disposable.dispose, which cannot
+ // throw an InterruptedException or IOException:
+ try {
+ b.dispose();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupted();
+ throw new RuntimeException(
+ "Unexpected exception in UnoRuntime.reset: " + e);
+ } catch (IOException e) {
+ throw new RuntimeException(
+ "Unexpected exception in UnoRuntime.reset: " + e);
+ }
+ }
+ }
+ bridges.clear();
+ }
+ environments.clear();
+ return bridges.isEmpty() && environments.isEmpty();
+ }
+
+ /**
+ * @deprecated As of UDK&nbsp;3.2.0, do not use this internal field.
+ */
+ static public final boolean DEBUG = false;
+
+ private static final class BridgeTurner implements IBridge {
+ public BridgeTurner(IBridge bridge) {
+ this.bridge = bridge;
+ }
+
+ public Object mapInterfaceTo(Object object, Type type) {
+ return bridge.mapInterfaceFrom(object, type);
+ }
+
+ public Object mapInterfaceFrom(Object object, Type type) {
+ return bridge.mapInterfaceTo(object, type);
+ }
+
+ public IEnvironment getSourceEnvironment() {
+ return bridge.getTargetEnvironment();
+ }
+
+ public IEnvironment getTargetEnvironment() {
+ return bridge.getSourceEnvironment();
+ }
+
+ public void acquire() {
+ bridge.acquire();
+ }
+
+ public void release() {
+ bridge.release();
+ }
+
+ public void dispose() throws InterruptedException, IOException {
+ bridge.dispose();
+ }
+
+ private final IBridge bridge;
+ }
+
+ private static final class MappingWrapper implements IMapping {
+ public MappingWrapper(IBridge bridge) {
+ this.bridge = bridge;
+ }
+
+ public Object mapInterface(Object object, Type type) {
+ return bridge.mapInterfaceTo(object, type);
+ }
+
+ private final IBridge bridge;
+ }
+
+ private static final String uniqueKeyHostPrefix
+ = Integer.toString(new Object().hashCode(), 16) + ":";
+ private static final Object uniqueKeyLock = new Object();
+ private static long uniqueKeyTime = System.currentTimeMillis();
+ private static long uniqueKeyCount = Long.MIN_VALUE;
+
+ private static final String oidSuffix = ";java[];" + getUniqueKey();
+
+ private static final ThreadLocal currentContext = new ThreadLocal();
+
+ private static final WeakMap environments = new WeakMap();
+ private static final WeakMap bridges = new WeakMap();
+}
diff --git a/ridljar/javamaker/makefile.mk b/ridljar/javamaker/makefile.mk
new file mode 100644
index 000000000000..cf4e70d38c87
--- /dev/null
+++ b/ridljar/javamaker/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..
+PRJNAME := ridljar
+TARGET := javamaker
+
+.INCLUDE: settings.mk
+
+RDB = $(SOLARBINDIR)$/udkapi.rdb
+
+.INCLUDE: target.mk
+
+.IF "$(SOLAR_JAVA)" != ""
+
+ALLTAR: $(MISC)$/javamaker.done
+
+$(MISC)$/javamaker.done .ERRREMOVE: $(RDB)
+ $(JAVAMAKER) -BUCR -O$(CLASSDIR) $<
+ $(TOUCH) $@
+
+.ENDIF
diff --git a/ridljar/prj/build.lst b/ridljar/prj/build.lst
new file mode 100644
index 000000000000..ac91c68bd9c1
--- /dev/null
+++ b/ridljar/prj/build.lst
@@ -0,0 +1,6 @@
+ri ridljar : codemaker solenv udkapi NULL
+ri ridljar\javamaker nmake - all javamaker NULL
+ri ridljar\com nmake - all com javamaker NULL
+ri ridljar\util nmake - all util javamaker com NULL
+ri ridljar\source\unoloader nmake - all unoloader NULL
+ri ridljar\source\unoloader\com\sun\star\lib\unoloader nmake - all unoloader_cssl_unoloader NULL
diff --git a/ridljar/prj/d.lst b/ridljar/prj/d.lst
new file mode 100644
index 000000000000..12cde6f2815e
--- /dev/null
+++ b/ridljar/prj/d.lst
@@ -0,0 +1,4 @@
+..\%__SRC%\bin\ridl_src.zip %COMMON_DEST%\bin%_EXT%\ridl_src.zip
+..\%__SRC%\class\ridl.jar %_DEST%\bin%_EXT%\ridl.jar
+..\%__SRC%\class\unoloader\unoloader.jar %_DEST%\bin%_EXT%\unoloader.jar
+..\%__SRC%\bin\unoloader_src.zip %COMMON_DEST%\bin%_EXT%\unoloader_src.zip
diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java
new file mode 100644
index 000000000000..d43acfe4727d
--- /dev/null
+++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.unoloader;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.jar.JarInputStream;
+
+/**
+ * The root UNO class loader.
+ *
+ * <p>This class loader is able to load all published URE classes, including the
+ * classes representing the published URE UNO types. For consistency, it is
+ * important that within each Java UNO environment there is one instance of this
+ * class loader that is the defining class loader of all published URE classes
+ * (and hence of all unpublished URE classes, too) and of all classes
+ * representing UNO types (the published URE UNO types, any unpublished URE UNO
+ * types, and any additional UNO types introduced by components; for the latter,
+ * {@link #addURL} may be necessary).</p>
+ *
+ * <p><em>This is an internal, unstable class of the Uno Runtime Environment; it
+ * should not be used by client code.</em></p>
+ *
+ * @since UDK 3.2.0
+ */
+public final class UnoClassLoader extends URLClassLoader {
+ /**
+ * Instantiates the root UNO class loader.
+ *
+ * @param base a base URL relative to which the URE JARs
+ * (<code>java_uno.jar</code>, <code>juh.jar</code>, <code>jurt.jar</code>,
+ * <code>ridl.jar</code>) can be found; must not be <code>null</code>.
+ *
+ * @param classPath an array of URLs that form the class path of this class
+ * loader; may be <code>null</code>, which is the same as an empty array.
+ * The URLs are interpreted in the same way as the arguments of a {@link
+ * URLClassLoader}.
+ *
+ * @param parent the parent class loader for delegation.
+ *
+ * @throws MalformedURLException if the given <code>base</code> URL is
+ * malformed.
+ */
+ public UnoClassLoader(URL base, URL[] classPath, ClassLoader parent)
+ throws MalformedURLException
+ {
+ super(createUrls(base, classPath), parent);
+ }
+
+ /**
+ * Obtains a class loader for a UNO JAR.
+ *
+ * @param jar the URL of a UNO JAR; must not be <code>null</code>.
+ *
+ * @param mainAttributes represents the main section of the manifest of the
+ * given JAR <code>jar</code>; <code>null</code> if the given JAR does not
+ * have a manifest. (This redundant parameter is there for performance
+ * reasons, as typically the caller of this method already has this
+ * information available.)
+ *
+ * @return an appropriate class loader; will never be <code>null</code>.
+ *
+ * @throws MalformedURLException if the given <code>jar</code> URL or any of
+ * the UNO-Type-Path URLs specified in the given JAR are malformed.
+ */
+ public ClassLoader getClassLoader(URL jar, Attributes mainAttributes)
+ throws MalformedURLException
+ {
+ String path = mainAttributes == null ?
+ null : mainAttributes.getValue("UNO-Type-Path");
+ if (path == null) {
+ path = "<>";
+ }
+ for (int i = 0; i < path.length();) {
+ while (i < path.length() && path.charAt(i) == ' ') {
+ ++i;
+ }
+ if (i < path.length()) {
+ String url;
+ if (path.charAt(i) == '<') {
+ int j = path.indexOf('>', i + 1);
+ if (j < 0) {
+ url = path.substring(i + 1);
+ i = path.length();
+ } else {
+ url = path.substring(i + 1, j);
+ i = j + 1;
+ }
+ } else {
+ int j = path.indexOf(' ', i + 1);
+ if (j < 0) {
+ j = path.length();
+ }
+ url = path.substring(i, j);
+ i = j;
+ }
+ addURL(new URL(jar, url));
+ }
+ }
+ return URLClassLoader.newInstance(new URL[] { jar }, this);
+ }
+
+ /**
+ * Executes a UNO JAR.
+ *
+ * @param jar the URL of a UNO JAR that specifies a Main-Class; must not be
+ * <code>null</code>.
+ *
+ * @param arguments any arguments passed to the <code>main</code> method of
+ * the specified Main-Class of the given JAR <code>jar</code>; must not be
+ * <code>null</code>.
+ *
+ * @throws IOException if there are any problems processing the given JAR
+ * <code>jar</code>.
+ *
+ * @throws ClassNotFoundException if the given JAR <code>jar</code> does not
+ * specify a Main-Class, or if the specified Main-Class cannot be found.
+ *
+ * @throws NoSuchMethodException if the specified Main-Class of the given
+ * JAR <code>jar</code> does not have an appropriate <code>main</code>
+ * method.
+ *
+ * @throws InvocationTargetException if an exception occurs while executing
+ * the <code>main</code> method of the specified Main-Class of the given JAR
+ * <code>jar</code>.
+ */
+ public void execute(URL jar, String[] arguments)
+ throws IOException, ClassNotFoundException, NoSuchMethodException,
+ InvocationTargetException
+ {
+ Attributes attr = getJarMainAttributes(jar);
+ String name = attr == null
+ ? null : attr.getValue(Attributes.Name.MAIN_CLASS);
+ if (name == null) {
+ throw new ClassNotFoundException(
+ jar + " does not specify a main class");
+ }
+ try {
+ getClassLoader(jar, attr).loadClass(name.replace('/', '.')).
+ getMethod("main", new Class[] { String[].class }).
+ invoke(null, new Object[] { arguments });
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("impossible " + e);
+ }
+ }
+
+ /**
+ * Obtains the main section of the manifest of a JAR.
+ *
+ * @param jar the URL of a JAR; must not be <code>null</code>.
+ *
+ * @return the representation of the main section of the manifest of the
+ * given JAR <code>jar</code>, or <code>null</code> if the given JAR does
+ * not have a manifest.
+ *
+ * @throws IOException if there are any problems processing the given JAR
+ * <code>jar</code>.
+ */
+ public static Attributes getJarMainAttributes(URL jar) throws IOException {
+ JarInputStream s = new JarInputStream(jar.openStream());
+ Manifest mf;
+ try {
+ mf = s.getManifest();
+ } finally {
+ s.close();
+ }
+ return mf == null ? null : mf.getMainAttributes();
+ }
+
+ private static URL[] createUrls(URL base, URL[] classPath)
+ throws MalformedURLException
+ {
+ final int JARS = 4;
+ URL[] urls = new URL[JARS + (classPath == null ? 0 : classPath.length)];
+ urls[0] = new URL(base, "java_uno.jar"); //TODO get rid of it here
+ urls[1] = new URL(base, "juh.jar");
+ urls[2] = new URL(base, "jurt.jar");
+ urls[3] = new URL(base, "ridl.jar");
+ if (classPath != null) {
+ System.arraycopy(classPath, 0, urls, JARS, classPath.length);
+ }
+ return urls;
+ }
+}
diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java
new file mode 100644
index 000000000000..b0829d11a1fb
--- /dev/null
+++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.unoloader;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * A helper class for executing UNO JARs.
+ *
+ * <p><em>This class is not yet stable.</em></p>
+ *
+ * @since UDK 3.2.0
+ */
+public final class UnoLoader {
+ /**
+ * Executes a UNO JAR.
+ *
+ * @param base a base URL relative to which the URE JARs
+ * (<code>jurt.jar</code>, <code>ridl.jar</code>, etc.) can be found; must
+ * not be <code>null</code>.
+ *
+ * @param jar the URL of a UNO JAR that specifies a Main-Class; must not be
+ * <code>null</code>.
+ *
+ * @param arguments any arguments passed to the <code>main</code> method of
+ * the specified Main-Class of the given JAR <code>jar</code>; must not be
+ * <code>null</code>.
+ *
+ * @throws IOException if the given <code>base</code> URL is malformed, or
+ * if there are any problems processing the given JAR <code>jar</code>.
+ *
+ * @throws ClassNotFoundException if the given JAR <code>jar</code> does not
+ * specify a Main-Class, or if the specified Main-Class cannot be found.
+ *
+ * @throws NoSuchMethodException if the specified Main-Class of the given
+ * JAR <code>jar</code> does not have an appropriate <code>main</code>
+ * method.
+ *
+ * @throws InvocationTargetException if an exception occurs while executing
+ * the <code>main</code> method of the specified Main-Class of the given JAR
+ * <code>jar</code>.
+ */
+ public static void execute(final URL base, URL jar, String[] arguments)
+ throws IOException, ClassNotFoundException, NoSuchMethodException,
+ InvocationTargetException
+ {
+ UnoClassLoader cl;
+ try {
+ cl = (UnoClassLoader) AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() throws MalformedURLException {
+ return new UnoClassLoader(
+ base, null, UnoLoader.class.getClassLoader());
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (MalformedURLException) e.getException();
+ }
+ cl.execute(jar, arguments);
+ }
+
+ private UnoLoader() {}
+}
diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/makefile.mk b/ridljar/source/unoloader/com/sun/star/lib/unoloader/makefile.mk
new file mode 100644
index 000000000000..a9f8b1d0b9e0
--- /dev/null
+++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..$/..$/..
+PRJNAME := ridljar
+
+TARGET := unoloader_cssl_unoloader
+PACKAGE := com$/sun$/star$/lib$/unoloader
+
+.INCLUDE: settings.mk
+
+# Use a non-default CLASSDIR, so that the util/makefile.mk can use
+# JARCLASSDIRS=com and nevertheless not include this package in ridl.jar:
+CLASSDIR != $(OUT)$/class$/unoloader
+
+JAVAFILES = \
+ UnoClassLoader.java \
+ UnoLoader.java
+
+JARTARGET = unoloader.jar
+JARCLASSDIRS = $(PACKAGE)
+CUSTOMMANIFESTFILE = manifest
+
+.INCLUDE: target.mk
+
+.IF "$(SOLAR_JAVA)" != ""
+
+.IF "$(depend)" == ""
+$(JAVACLASSFILES): $(MISC)$/$(TARGET).mkdir.done
+.ENDIF
+
+$(MISC)$/$(TARGET).mkdir.done .ERRREMOVE:
+ $(MKDIRHIER) $(CLASSDIR)
+ $(TOUCH) $@
+
+.ENDIF
diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/manifest b/ridljar/source/unoloader/com/sun/star/lib/unoloader/manifest
new file mode 100644
index 000000000000..7ad02e156d9a
--- /dev/null
+++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/manifest
@@ -0,0 +1 @@
+Sealed: true
diff --git a/ridljar/source/unoloader/delzip b/ridljar/source/unoloader/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/ridljar/source/unoloader/delzip
diff --git a/ridljar/source/unoloader/makefile.mk b/ridljar/source/unoloader/makefile.mk
new file mode 100644
index 000000000000..9cb7b0efa139
--- /dev/null
+++ b/ridljar/source/unoloader/makefile.mk
@@ -0,0 +1,39 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..
+PRJNAME := ridljar
+
+TARGET := unoloader
+
+.INCLUDE: settings.mk
+
+ZIP1TARGET = $(TARGET)_src
+ZIP1FLAGS = -r
+ZIP1LIST = com -x '*makefile.mk' -x '*manifest'
+
+.INCLUDE: target.mk
diff --git a/ridljar/test/com/sun/star/lib/uno/typedesc/TypeDescription_Test.java b/ridljar/test/com/sun/star/lib/uno/typedesc/TypeDescription_Test.java
new file mode 100644
index 000000000000..2032d53ab98a
--- /dev/null
+++ b/ridljar/test/com/sun/star/lib/uno/typedesc/TypeDescription_Test.java
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.uno.typedesc;
+
+import com.sun.star.lib.uno.typeinfo.MethodTypeInfo;
+import com.sun.star.lib.uno.typeinfo.TypeInfo;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.IFieldDescription;
+import com.sun.star.uno.IMethodDescription;
+import com.sun.star.uno.ITypeDescription;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.TypeClass;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.XNamingService;
+import complexlib.ComplexTestCase;
+
+public final class TypeDescription_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] { "test", "testUnsigned",
+ "testGetMethodDescription", "testSequence" };
+ }
+
+ public void test() throws Exception {
+ ITypeDescription voidTD = TypeDescription.getTypeDescription(
+ void.class);
+ ITypeDescription stringTD = TypeDescription.getTypeDescription(
+ String.class);
+ ITypeDescription typeTD = TypeDescription.getTypeDescription(
+ Type.class);
+ ITypeDescription anyTD = TypeDescription.getTypeDescription(Any.class);
+ ITypeDescription interfaceTD = TypeDescription.getTypeDescription(
+ XInterface.class);
+
+ MethodSignature sigBuildinSyncTypeToAny = new MethodSignature(
+ true, false, new ITypeDescription[] { typeTD },
+ new ITypeDescription[1], anyTD);
+ MethodSignature sigBuildinAsyncToVoid = new MethodSignature(
+ true, true, new ITypeDescription[0], new ITypeDescription[0],
+ voidTD);
+ MethodSignature sigAddonSyncStringToVoid = new MethodSignature(
+ false, false, new ITypeDescription[] { stringTD },
+ new ITypeDescription[1], voidTD);
+ MethodSignature sigAddonSyncStringInterfaceToVoid = new MethodSignature(
+ false, false, new ITypeDescription[] { stringTD, interfaceTD },
+ new ITypeDescription[2], voidTD);
+ MethodSignature sigAddonSyncStringToInterface = new MethodSignature(
+ false, false, new ITypeDescription[] { stringTD },
+ new ITypeDescription[1], interfaceTD);
+
+ TypeSignature emptyTypeSig = new TypeSignature(
+ null, new String[0], null, new String[0], null);
+ TypeSignature interfaceTypeSig = new TypeSignature(
+ null, new String[] { "queryInterface", "acquire", "release" },
+ new MethodSignature[] { sigBuildinSyncTypeToAny,
+ sigBuildinAsyncToVoid,
+ sigBuildinAsyncToVoid },
+ new String[0], null);
+ TypeSignature exceptionTypeSig = new TypeSignature(
+ null, new String[0], null,
+ new String[]{"Context"}, new TypeSignature[] { interfaceTypeSig });
+ // com.sun.star.uno.Exception.idl says that Exception (a) has no
+ // base exception, and (b) has two fields, Message and Context; the
+ // generated com.sun.star.uno.Exception.java, however, (a) is
+ // inherited from java.lang.Exception, and (b) has only one field,
+ // Context, as Message is inherited from java.lang.Exception
+ TypeSignature namingServiceTypeSig = new TypeSignature(
+ interfaceTypeSig,
+ new String[] { "getRegisteredObject", "registerObject",
+ "revokeObject" },
+ new MethodSignature[] { sigAddonSyncStringToInterface,
+ sigAddonSyncStringInterfaceToVoid,
+ sigAddonSyncStringToVoid },
+ new String[0], null);
+
+ Object[] byteData = new Object[] {
+ "byte", "[B", byte.class, TypeClass.BYTE };
+ Object[] stringData = new Object[] {
+ "string", "[Ljava.lang.String;", java.lang.String.class,
+ TypeClass.STRING };
+ Object[] typeClassData = new Object[] {
+ "com.sun.star.uno.TypeClass", "[Lcom.sun.star.uno.TypeClass;",
+ TypeClass.class, TypeClass.ENUM };
+ Object[] interfaceData = new Object[] {
+ "com.sun.star.uno.XInterface", "[Lcom.sun.star.uno.XInterface;",
+ XInterface.class, TypeClass.INTERFACE };
+ Object[] exceptionData = new Object [] {
+ "com.sun.star.uno.Exception", "[Lcom.sun.star.uno.Exception;",
+ com.sun.star.uno.Exception.class, TypeClass.EXCEPTION,
+ new Object[] { interfaceData } };
+ Object[] namingServiceData = new Object[] {
+ "com.sun.star.uno.XNamingService",
+ "[Lcom.sun.star.uno.XNamingService;", XNamingService.class,
+ TypeClass.INTERFACE, null, interfaceData };
+
+ emptyTypeSig.test("TypeSignature.test(byte)", byteData,
+ TypeDescription.getTypeDescription("byte"));
+ emptyTypeSig.test("TypeSignature.test(string)", stringData,
+ TypeDescription.getTypeDescription("string"));
+ emptyTypeSig.test("TypeSignature.test(TypeClass)", typeClassData,
+ TypeDescription.getTypeDescription(
+ "com.sun.star.uno.TypeClass"));
+ exceptionTypeSig.test("TypeSignature.test(com.sun.star.uno.Exception)",
+ exceptionData,
+ TypeDescription.getTypeDescription(
+ "com.sun.star.uno.Exception"));
+ interfaceTypeSig.test("TypeSignature.test(XInterface)", interfaceData,
+ TypeDescription.getTypeDescription(
+ "com.sun.star.uno.XInterface"));
+ namingServiceTypeSig.test("TypeSignature.test(XNamingService)",
+ namingServiceData,
+ TypeDescription.getTypeDescription(
+ "com.sun.star.uno.XNamingService"));
+ }
+
+ public void testUnsigned() throws ClassNotFoundException {
+ assure("TypeDescription for UNSIGNED LONG",
+ TypeDescription.getTypeDescription(Type.UNSIGNED_LONG).
+ getTypeName().equals("unsigned long"));
+ }
+
+ public void testGetMethodDescription() {
+ TypeDescription td = TypeDescription.getTypeDescription(XDerived.class);
+ td.getMethodDescription("fn");
+ }
+
+ public void testSequence() throws ClassNotFoundException {
+ assure(
+ TypeDescription.getTypeDescription("[]unsigned short").
+ getComponentType().getTypeName().equals("unsigned short"));
+ }
+
+ public interface XBase extends XInterface {
+ void fn();
+
+ TypeInfo[] UNOTYPEINFO = { new MethodTypeInfo("fn", 0, 0) };
+ }
+
+ public interface XDerived extends XBase {
+ TypeInfo[] UNOTYPEINFO = null;
+ }
+
+ private final class MethodSignature {
+ public MethodSignature(
+ boolean buildIn, boolean oneWay, ITypeDescription[] inParameters,
+ ITypeDescription[] outParameters, ITypeDescription returnValue)
+ {
+ this.buildIn = buildIn;
+ this.oneWay = oneWay;
+ this.inParameters = inParameters;
+ this.outParameters = outParameters;
+ this.returnValue = returnValue;
+ }
+
+ public void test(String prefix, int index,
+ IMethodDescription description) {
+ assure(prefix + "; getIndex", description.getIndex() == index);
+ assure(prefix + "; getMethod",
+ (description.getMethod() == null) == buildIn);
+ assure(prefix + "; isOneway", description.isOneway() == oneWay);
+ ITypeDescription[] in = description.getInSignature();
+ assure(prefix + "; getInSignature",
+ in.length == inParameters.length);
+ for (int i = 0; i < in.length; ++i) {
+ assure(prefix + "; getInSignature " + i,
+ in[i].equals(inParameters[i]));
+ }
+ ITypeDescription[] out = description.getOutSignature();
+ assure(prefix + "; getOutSignature",
+ out.length == outParameters.length);
+ for (int i = 0; i < out.length; ++i) {
+ assure(prefix + "; getOutSignature " + i,
+ out[i] == null ? outParameters[i] == null
+ : out[i].equals(outParameters[i]));
+ }
+ assure(prefix + "; getReturnSignature",
+ description.getReturnSignature().equals(returnValue));
+ }
+
+ private final boolean buildIn;
+ private final boolean oneWay;
+ private final ITypeDescription[] inParameters;
+ private final ITypeDescription[] outParameters;
+ private final ITypeDescription returnValue;
+ }
+
+ private final class TypeSignature {
+ public TypeSignature(TypeSignature superType, String[] methodNames,
+ MethodSignature[] methodSignatures,
+ String[] fieldNames,
+ TypeSignature[] fieldSignatures) {
+ this._superType = superType;
+ this.methodNames = methodNames;
+ this.methodSignatures = methodSignatures;
+ methodOffset = superType == null ? 0
+ : superType.methodOffset + superType.methodNames.length;
+ this.fieldSignatures = fieldSignatures;
+ this.fieldNames = fieldNames;
+ fieldOffset = superType == null ? 0
+ : superType.fieldOffset + superType.fieldNames.length;
+ }
+
+ public void test(String prefix, Object[] data,
+ ITypeDescription description) throws Exception {
+ assure(prefix + "; getTypeName",
+ description.getTypeName().equals(data[0]));
+ assure(prefix + "; equals",
+ description.equals(TypeDescription.getTypeDescription(
+ (String)data[0])));
+ assure(prefix + "; getArrayTypeName",
+ description.getArrayTypeName().equals(data[1]));
+ assure(prefix + "; getZClass", description.getZClass() == data[2]);
+ assure(prefix + "; getTypeClass",
+ description.getTypeClass() == data[3]);
+ assure(prefix + "; getComponentType",
+ description.getComponentType() == null);
+
+ IMethodDescription[] mds = description.getMethodDescriptions();
+ assure(
+ prefix + "; getMethodDescriptions",
+ mds == null
+ ? methodSignatures == null
+ : mds.length == methodSignatures.length);
+ if (methodSignatures != null) {
+ for (int i = 0; i < methodSignatures.length; ++i) {
+ methodSignatures[i].test(
+ prefix + "; getMethodDescriptions " + i,
+ i + methodOffset, mds[i]);
+ }
+ }
+ for (int i = 0; i < methodNames.length; ++i) {
+ IMethodDescription md = description.getMethodDescription(
+ i + methodOffset);
+ assure(prefix + "; getMethodDescription " + (i + methodOffset),
+ md != null);
+ methodSignatures[i].test(
+ prefix + "; getMethodDescription " + (i + methodOffset),
+ i + methodOffset, md);
+ }
+ for (int i = 0; i < methodNames.length; ++i) {
+ IMethodDescription md = description.getMethodDescription(
+ methodNames[i]);
+ assure(prefix + "; getMethodDescription " + methodNames[i],
+ md != null);
+ methodSignatures[i].test(
+ prefix + "; getMethodDescription " + methodNames[i],
+ i + methodOffset, md);
+ }
+
+ IFieldDescription[] fds = description.getFieldDescriptions();
+ assure(
+ prefix + "; getFieldDescriptions",
+ fds == null
+ ? fieldSignatures == null
+ : fds.length == fieldSignatures.length);
+ if (fieldSignatures != null) {
+ for (int i = 0; i < fieldSignatures.length; ++i) {
+ fieldSignatures[i].test(
+ prefix + "; getFieldDescriptions " + i,
+ (Object[]) ((Object[]) data[4])[i],
+ fds[i].getTypeDescription());
+ }
+ }
+
+ ITypeDescription supert = description.getSuperType();
+ assure(prefix + "; getSuperType",
+ (supert == null) == (data.length < 6));
+ if (supert != null && data[5] != null) {
+ _superType.test(prefix + "; getSuperType", (Object[]) data[5],
+ supert);
+ }
+ }
+
+ private final TypeSignature _superType;
+ private final MethodSignature[] methodSignatures;
+ private final String[] methodNames;
+ private final int methodOffset;
+ private final TypeSignature[] fieldSignatures;
+ private final String[] fieldNames;
+ private final int fieldOffset;
+ }
+}
diff --git a/ridljar/test/com/sun/star/lib/uno/typedesc/makefile.mk b/ridljar/test/com/sun/star/lib/uno/typedesc/makefile.mk
new file mode 100644
index 000000000000..e329026542cd
--- /dev/null
+++ b/ridljar/test/com/sun/star/lib/uno/typedesc/makefile.mk
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..$/..$/..
+PRJNAME := ridljar
+TARGET := test_com_sun_star_lib_uno_typedesc
+
+PACKAGE := com$/sun$/star$/lib$/uno$/typedesc
+JAVATESTFILES := TypeDescription_Test.java
+
+.INCLUDE: javaunittest.mk
diff --git a/ridljar/test/com/sun/star/lib/util/WeakMap_Test.java b/ridljar/test/com/sun/star/lib/util/WeakMap_Test.java
new file mode 100644
index 000000000000..de605502b172
--- /dev/null
+++ b/ridljar/test/com/sun/star/lib/util/WeakMap_Test.java
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.util;
+
+import complexlib.ComplexTestCase;
+import util.WaitUnreachable;
+
+public final class WeakMap_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "test" };
+ }
+
+ public void test() {
+ WeakMap m = new WeakMap();
+ assure("", m.size() == 0);
+ assure("", m.isEmpty());
+ assure("", !m.containsKey("key1"));
+ assure("", !m.containsValue(null));
+ WaitUnreachable u1 = new WaitUnreachable(new Object());
+ m.put("key1", u1.get());
+ WaitUnreachable u2 = new WaitUnreachable(new Disposable());
+ m.put("key2", u2.get());
+ assure("", m.size() == 2);
+ assure("", !m.isEmpty());
+ assure("", m.containsKey("key1"));
+ assure("", m.containsKey("key2"));
+ assure("", !m.containsKey("key3"));
+ assure("", m.containsValue(m.get("key1")));
+ assure("", m.containsValue(m.get("key2")));
+ assure("", WeakMap.getValue(m.get("key1")).equals(u1.get()));
+ assure("", WeakMap.getValue(m.get("key2")).equals(u2.get()));
+ assure("", m.values().size() == 2);
+ assure("", m.values().contains(m.get("key1")));
+ assure("", m.values().contains(m.get("key2")));
+ u1.waitUnreachable();
+ assure("", WeakMap.getValue(m.get("key1")) == null);
+ ((Disposable) u2.get()).dispose();
+ assure("", WeakMap.getValue(m.get("key2")) == null);
+ m.clear();
+ u2.waitUnreachable();
+ assure("", m.size() == 0);
+ m.put("key2", new Object());
+ assure("", m.size() == 1);
+ }
+
+ // This simple class (single listener, no synchronization) exploits
+ // knowledge about the implementation of WeakMap:
+ private static final class Disposable implements DisposeNotifier {
+ public void addDisposeListener(DisposeListener listener) {
+ this.listener = listener;
+ }
+
+ public void dispose() {
+ if (listener != null) {
+ listener.notifyDispose(this);
+ }
+ }
+
+ private DisposeListener listener = null;
+ }
+}
diff --git a/ridljar/test/com/sun/star/lib/util/makefile.mk b/ridljar/test/com/sun/star/lib/util/makefile.mk
new file mode 100644
index 000000000000..7da28b6e1b47
--- /dev/null
+++ b/ridljar/test/com/sun/star/lib/util/makefile.mk
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..$/..
+PRJNAME := ridljar
+TARGET := test_com_sun_star_lib_util
+
+PACKAGE := com$/sun$/star$/lib$/util
+JAVATESTFILES := \
+ WeakMap_Test.java
+
+.INCLUDE: javaunittest.mk
diff --git a/ridljar/test/com/sun/star/uno/Any_Test.java b/ridljar/test/com/sun/star/uno/Any_Test.java
new file mode 100644
index 000000000000..71ecac87cc0b
--- /dev/null
+++ b/ridljar/test/com/sun/star/uno/Any_Test.java
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import complexlib.ComplexTestCase;
+
+public final class Any_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "testAnyAny", "testComplete" };
+ }
+
+ public void testAnyAny() {
+ boolean caught = false;
+ try {
+ new Any(Type.ANY, null);
+ } catch (IllegalArgumentException e) {
+ caught = true;
+ }
+ assure(caught);
+ }
+
+ public void testComplete() {
+ assure(Any.complete(Any.VOID) == Any.VOID);
+ assure(
+ Any.complete(new Integer(10)).equals(
+ new Any(Type.LONG, new Integer(10))));
+ assure(
+ Any.complete(null).equals(
+ new Any(new Type(XInterface.class), null)));
+ XInterface x = new XInterface() {};
+ assure(Any.complete(x).equals(new Any(new Type(XInterface.class), x)));
+ }
+}
diff --git a/ridljar/test/com/sun/star/uno/Type_Test.java b/ridljar/test/com/sun/star/uno/Type_Test.java
new file mode 100644
index 000000000000..6e1cb9b9edb6
--- /dev/null
+++ b/ridljar/test/com/sun/star/uno/Type_Test.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import complexlib.ComplexTestCase;
+
+public final class Type_Test extends ComplexTestCase {
+ public String[] getTestMethodNames() {
+ return new String[] { "testZClass", "testIsSupertypeOf" };
+ }
+
+ public void testZClass() {
+ assure("VOID", new Type("void").getZClass() == void.class);
+ assure("BOOLEAN", new Type("boolean").getZClass() == boolean.class);
+ assure("BYTE", new Type("byte").getZClass() == byte.class);
+ assure("SHORT", new Type("short").getZClass() == short.class);
+ assure("UNSIGNED SHORT",
+ new Type("unsigned short").getZClass() == short.class);
+ assure("LONG", new Type("long").getZClass() == int.class);
+ assure("UNSIGNED LONG",
+ new Type("unsigned long").getZClass() == int.class);
+ assure("HYPER", new Type("hyper").getZClass() == long.class);
+ assure("UNSIGNED HYPER",
+ new Type("unsigned hyper").getZClass() == long.class);
+ assure("FLOAT", new Type("float").getZClass() == float.class);
+ assure("DOUBLE", new Type("double").getZClass() == double.class);
+ assure("CHAR", new Type("char").getZClass() == char.class);
+ assure("STRING", new Type("string").getZClass() == String.class);
+ assure("TYPE", new Type("type").getZClass() == Type.class);
+ assure("ANY", new Type("any").getZClass() == Object.class);
+ assure("sequence of BOOLEAN",
+ new Type("[]boolean", TypeClass.SEQUENCE).getZClass()
+ == boolean[].class);
+ assure("sequence of sequence of XComponentContext",
+ new Type("[][]com.sun.star.uno.XComponentContext",
+ TypeClass.SEQUENCE).getZClass()
+ == XComponentContext[][].class);
+ assure("enum TypeClass",
+ new Type("com.sun.star.uno.TypeClass",
+ TypeClass.ENUM).getZClass() == TypeClass.class);
+ assure("struct Uik",
+ new Type("com.sun.star.uno.Uik", TypeClass.STRUCT).getZClass()
+ == Uik.class);
+ assure("exception Exception",
+ new Type("com.sun.star.uno.Exception",
+ TypeClass.EXCEPTION).getZClass()
+ == com.sun.star.uno.Exception.class);
+ assure("exception RuntimeException",
+ new Type("com.sun.star.uno.RuntimeException",
+ TypeClass.EXCEPTION).getZClass()
+ == com.sun.star.uno.RuntimeException.class);
+ assure("exception DeploymentException",
+ new Type("com.sun.star.uno.DeploymentException",
+ TypeClass.EXCEPTION).getZClass()
+ == DeploymentException.class);
+ assure("interface XInterface",
+ new Type("com.sun.star.uno.XInterface",
+ TypeClass.INTERFACE).getZClass() == XInterface.class);
+ assure("interface XComponentContext",
+ new Type("com.sun.star.uno.XComponentContext",
+ TypeClass.INTERFACE).getZClass()
+ == XComponentContext.class);
+
+ assure(new Type(boolean.class).getZClass() == boolean.class);
+ assure(new Type(Boolean.class).getZClass() == boolean.class);
+ assure(new Type(boolean[].class).getZClass() == boolean[].class);
+ assure(new Type(Boolean[].class).getZClass() == boolean[].class);
+ }
+
+ public void testIsSupertypeOf() {
+ Type ifc = new Type(com.sun.star.uno.XInterface.class);
+ Type ctx = new Type(com.sun.star.uno.XComponentContext.class);
+ Type exc = new Type(com.sun.star.uno.RuntimeException.class);
+ assure("LONG :> LONG", Type.LONG.isSupertypeOf(Type.LONG));
+ assure("not ANY :> XInterface", !Type.ANY.isSupertypeOf(ifc));
+ assure("ANY :> ANY", Type.ANY.isSupertypeOf(Type.ANY));
+ assure("not ANY :> LONG", !Type.ANY.isSupertypeOf(Type.LONG));
+ assure("not XInterface :> ANY", !ifc.isSupertypeOf(Type.ANY));
+ assure("XInterface :> XInterface", ifc.isSupertypeOf(ifc));
+ assure("XInterface :> XComponentContext", ifc.isSupertypeOf(ctx));
+ assure("not XComponentContext :> XInterface", !ctx.isSupertypeOf(ifc));
+ assure("XComponentContext :> XComponentContext",
+ ctx.isSupertypeOf(ctx));
+ assure("not XInterface :> RuntimeException", !ifc.isSupertypeOf(exc));
+ }
+}
diff --git a/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
new file mode 100644
index 000000000000..87b6d498b971
--- /dev/null
+++ b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.uno;
+
+import com.sun.star.beans.Optional;
+import complexlib.ComplexTestCase;
+
+public final class UnoRuntime_Test extends ComplexTestCase {
+ public String getTestObjectName() {
+ return getClass().getName();
+ }
+
+ public String[] getTestMethodNames() {
+ return new String[] {
+ "test_generateOid", "test_queryInterface", "test_areSame",
+ "test_completeValue", "test_currentContext" };
+ }
+
+ public void test_generateOid() {
+ // Test if UnoRuntime generates an OID for a simple class:
+ assure("Test1", UnoRuntime.generateOid(new Test1()) != null);
+
+ // Test if UnoRuntime generates an OID for a class implementing
+ // IQueryInterface and returning null from getOid:
+ assure("Test2", UnoRuntime.generateOid(new Test2()) != null);
+
+ // Test if a delegator object has the same OID as its creator:
+ Test4 test4 = new Test4();
+ Ifc ifc = UnoRuntime.queryInterface(Ifc.class, test4);
+ assure(
+ "Test4",
+ UnoRuntime.generateOid(test4).equals(UnoRuntime.generateOid(ifc)));
+ }
+
+ public void test_queryInterface() {
+ // Test if a query for an interface which is not supported returns null:
+ assure(
+ "Test1",
+ UnoRuntime.queryInterface(Ifc.class, new Test1()) == null);
+
+ // Test if a query for an interface which is supported through
+ // IQueryInterface succeeds:
+ assure(
+ "Test2",
+ UnoRuntime.queryInterface(Ifc.class, new Test2()) != null);
+
+ // Test if a query for an interface which is directly supported (through
+ // inheritance) succeeds:
+ assure(
+ "Test3",
+ UnoRuntime.queryInterface(Ifc.class, new Test3()) != null);
+ }
+
+ public void test_areSame() {
+ assure(
+ UnoRuntime.areSame(
+ new Any(Type.UNSIGNED_LONG, new Integer(3)),
+ new Any(Type.UNSIGNED_LONG, new Integer(3))));
+ assure(
+ !UnoRuntime.areSame(
+ new Any(Type.UNSIGNED_LONG, new Integer(3)), new Integer(3)));
+ assure(!UnoRuntime.areSame(new int[] { 1 }, new int[] { 1, 2 }));
+ assure(
+ UnoRuntime.areSame(
+ TypeClass.UNSIGNED_LONG,
+ new Any(new Type(TypeClass.class), TypeClass.UNSIGNED_LONG)));
+ assure(
+ UnoRuntime.areSame(
+ new Any(
+ new Type("com.sun.star.beans.Optional<unsigned long>"),
+ new Optional()),
+ new Any(
+ new Type("com.sun.star.beans.Optional<unsigned long>"),
+ new Optional(false, new Integer(0)))));
+ assure(!UnoRuntime.areSame(new Test1(), new Test2()));
+ Test2 test2 = new Test2();
+ assure(
+ "Test2",
+ UnoRuntime.areSame(
+ UnoRuntime.queryInterface(Ifc.class, test2), test2));
+ }
+
+ public void test_completeValue() {
+ assure(
+ UnoRuntime.completeValue(Type.UNSIGNED_LONG, null).equals(
+ new Integer(0)));
+ Object v = UnoRuntime.completeValue(
+ new Type("[][]unsigned long"), null);
+ assure(v instanceof int[][]);
+ assure(((int[][]) v).length == 0);
+ assure(
+ UnoRuntime.completeValue(new Type(TypeClass.class), null) ==
+ TypeClass.VOID);
+ v = UnoRuntime.completeValue(
+ new Type("com.sun.star.beans.Optional<unsigned long>"), null);
+ assure(v instanceof Optional);
+ assure(!((Optional) v).IsPresent);
+ assure(((Optional) v).Value == null);
+ }
+
+ public void test_currentContext() throws InterruptedException {
+ TestThread t1 = new TestThread();
+ TestThread t2 = new TestThread();
+ t1.start();
+ t2.start();
+ t1.join();
+ t2.join();
+ Object v1 = t1.context.getValueByName("");
+ Object v2 = t2.context.getValueByName("");
+ assure("", t1.context != t2.context);
+ assure("", v1 == t1);
+ assure("", v2 == t2);
+ assure("", v1 != v2);
+ }
+
+ private interface Ifc extends XInterface {}
+
+ private static class Test1 {}
+
+ private static class Test2 implements XInterface, IQueryInterface {
+ public String getOid() {
+ return null;
+ }
+
+ public Object queryInterface(Type type) {
+ return type.equals(new Type(Ifc.class)) ? t2 : null;
+ }
+
+ public boolean isSame(Object object) {
+ return object == t2;
+ }
+
+ private static final class T2 implements Ifc {}
+
+ private final T2 t2 = new T2();
+ }
+
+ private static class Test3 implements Ifc {}
+
+ private static class Test4 implements XInterface, IQueryInterface {
+ public String getOid() {
+ return null;
+ }
+
+ public Object queryInterface(Type type) {
+ return type.equals(new Type(Ifc.class)) ? t4 : null;
+ }
+
+ public boolean isSame(Object object) {
+ return object == t4;
+ }
+
+ private final class T4 implements Ifc, IQueryInterface {
+ public String getOid() {
+ return UnoRuntime.generateOid(Test4.this);
+ }
+
+ public Object queryInterface(Type type) {
+ return Test4.this.queryInterface(type);
+ }
+
+ public boolean isSame(Object object) {
+ return UnoRuntime.areSame(Test4.this, object);
+ }
+ }
+
+ private final T4 t4 = new T4();
+ }
+
+ private final class TestThread extends Thread {
+ public void run() {
+ assure("", UnoRuntime.getCurrentContext() == null);
+ context = new TestCurrentContext();
+ UnoRuntime.setCurrentContext(context);
+ assure("", UnoRuntime.getCurrentContext() == context);
+ assure("", context.getValueByName("") == this);
+ UnoRuntime.setCurrentContext(null);
+ assure("", UnoRuntime.getCurrentContext() == null);
+ }
+
+ public XCurrentContext context = null;
+ }
+
+ private static final class TestCurrentContext implements XCurrentContext {
+ public Object getValueByName(String name) {
+ return value;
+ }
+
+ private final Object value = Thread.currentThread();
+ }
+}
diff --git a/ridljar/test/com/sun/star/uno/makefile.mk b/ridljar/test/com/sun/star/uno/makefile.mk
new file mode 100644
index 000000000000..6f2fd8332378
--- /dev/null
+++ b/ridljar/test/com/sun/star/uno/makefile.mk
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ := ..$/..$/..$/..$/..
+PRJNAME := ridljar
+TARGET := test_com_sun_star_uno
+
+PACKAGE := com$/sun$/star$/uno
+JAVATESTFILES := \
+ Any_Test.java \
+ Type_Test.java \
+ UnoRuntime_Test.java
+
+.INCLUDE: javaunittest.mk
diff --git a/ridljar/test/makefile.mk b/ridljar/test/makefile.mk
new file mode 100644
index 000000000000..86b432dc3bb4
--- /dev/null
+++ b/ridljar/test/makefile.mk
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# Quick and dirty way to run all tests in sub-directories; probably only works
+# on Unix.
+# Can be removed once tests are included in regular builds.
+
+all .PHONY:
+ cd com/sun/star/lib/uno/typedesc && dmake
+ cd com/sun/star/lib/util && dmake
+ cd com/sun/star/uno && dmake
diff --git a/ridljar/util/delzip b/ridljar/util/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/ridljar/util/delzip
diff --git a/ridljar/util/makefile.mk b/ridljar/util/makefile.mk
new file mode 100644
index 000000000000..b97690422b2d
--- /dev/null
+++ b/ridljar/util/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = ridljar
+TARGET = ridl
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = com
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# Special work necessary for building java reference with javadoc.
+# The source of puplic APIs must be delivered and used later in the
+# odk module.
+ZIP1TARGET=$(TARGET)_src
+ZIP1FLAGS=-u -r
+ZIP1DIR=$(PRJ)
+ZIP1LIST=com -x "*makefile.mk"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk