** Not tbuild part **
Ported BlackConnect to Linux. It is working wuth IBM jdk1.3 git-svn-id: svn://10.0.0.236/trunk@74286 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -26,52 +26,58 @@ import java.util.*;
|
||||
|
||||
public class ProxyClass { //nb it should not be public
|
||||
public ProxyClass(IID _iid, Method[] _methods) { //nb it should not be public
|
||||
iid = _iid;
|
||||
methods = _methods;
|
||||
if (classes == null) {
|
||||
classes = new Hashtable();
|
||||
}
|
||||
classes.put(iid, this);
|
||||
iid = _iid;
|
||||
methods = _methods;
|
||||
if (classes == null) {
|
||||
classes = new Hashtable();
|
||||
}
|
||||
classes.put(iid, this);
|
||||
}
|
||||
Method getMethodByIndex(int mid) { //first method has index equal to 'offset'
|
||||
System.out.println("--[java]ProxyClass.GetMehodByIndex "+mid);
|
||||
Method result = null;
|
||||
try {
|
||||
result = methods[mid-offset];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
System.out.println("--[java]ProxyClass.GetMehodByIndex "+mid);
|
||||
Method result = null;
|
||||
try {
|
||||
result = methods[mid-offset];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int getIndexByMethod(Method method) {
|
||||
int result = 0;
|
||||
if (method == null
|
||||
||methods == null) {
|
||||
return result;
|
||||
}
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].equals(method)) {
|
||||
result = i + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
int result = 0;
|
||||
if (method == null
|
||||
||methods == null) {
|
||||
return result;
|
||||
}
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].equals(method)) {
|
||||
result = i + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static ProxyClass getProxyClass(IID iid) {
|
||||
ProxyClass result = null;
|
||||
Object obj = null;
|
||||
if (classes != null) {
|
||||
obj = classes.get(iid);
|
||||
if (obj != null
|
||||
&& (obj instanceof ProxyClass)) {
|
||||
result = (ProxyClass)obj;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
ProxyClass result = null;
|
||||
Object obj = null;
|
||||
if (classes != null) {
|
||||
obj = classes.get(iid);
|
||||
if (obj != null
|
||||
&& (obj instanceof ProxyClass)) {
|
||||
result = (ProxyClass)obj;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private IID iid;
|
||||
private Method[] methods;
|
||||
private final int offset = 3; //from xpcom
|
||||
static Hashtable classes = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,15 +25,15 @@ import java.lang.reflect.*;
|
||||
|
||||
public class Utilities {
|
||||
static Object callMethodByIndex(Object obj, IID iid, int mid, Object[] args) {
|
||||
System.out.println("--org.mozilla.xpcom.Utilities.callMethodByIndex "+args.length+" "+mid);
|
||||
System.out.println("--[java]org.mozilla.xpcom.Utilities.callMethodByIndex "+args.length+" "+mid);
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("--callMethodByIndex args["+i+"] = "+args[i]);
|
||||
System.out.println("--[java]callMethodByIndex args["+i+"] = "+args[i]);
|
||||
}
|
||||
Method method = getMethodByIndex(mid,iid);
|
||||
System.out.println("--callMethodByIndex method "+method);
|
||||
try {
|
||||
if (method != null) {
|
||||
method.invoke(obj,args);
|
||||
method.invoke(obj,args);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -41,34 +41,34 @@ public class Utilities {
|
||||
return null; //nb for testing
|
||||
}
|
||||
static Object callMethod(long oid, Method method, IID iid, long orb , Object[] args) {
|
||||
System.out.println("--[java]Utilities.callMethod "+method);
|
||||
int mid = getIndexByMethod(method, iid);
|
||||
if (mid <= 0) {
|
||||
return null;
|
||||
}
|
||||
System.out.println("--[java]Utilities.callMethod "+mid);
|
||||
return callMethodByIndex(oid,mid,iid.getString(), orb, args);
|
||||
System.out.println("--[java]Utilities.callMethod "+method);
|
||||
int mid = getIndexByMethod(method, iid);
|
||||
if (mid <= 0) {
|
||||
return null;
|
||||
}
|
||||
System.out.println("--[java]Utilities.callMethod "+mid);
|
||||
return callMethodByIndex(oid,mid,iid.getString(), orb, args);
|
||||
}
|
||||
|
||||
|
||||
private static Method getMethodByIndex(int index, IID iid) {
|
||||
Method result = null;
|
||||
ProxyClass proxyClass = ProxyClass.getProxyClass(iid);
|
||||
if (proxyClass != null) {
|
||||
result = proxyClass.getMethodByIndex(index);
|
||||
}
|
||||
return result;
|
||||
Method result = null;
|
||||
ProxyClass proxyClass = ProxyClass.getProxyClass(iid);
|
||||
if (proxyClass != null) {
|
||||
result = proxyClass.getMethodByIndex(index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private static int getIndexByMethod(Method method, IID iid) {
|
||||
int result = 0;
|
||||
ProxyClass proxyClass = ProxyClass.getProxyClass(iid);
|
||||
if (proxyClass != null) {
|
||||
result = proxyClass.getIndexByMethod(method);
|
||||
}
|
||||
return result;
|
||||
int result = 0;
|
||||
ProxyClass proxyClass = ProxyClass.getProxyClass(iid);
|
||||
if (proxyClass != null) {
|
||||
result = proxyClass.getIndexByMethod(method);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private static native Object callMethodByIndex(long oid, int index, String iid, long orb, Object[] args);
|
||||
static {
|
||||
System.loadLibrary("bcjavastubs");
|
||||
System.loadLibrary("bcjavastubs");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,3 +76,7 @@ public class Utilities {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user