Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbridgha2011-11-07 09:55:34 +0000
committercbridgha2011-11-07 09:55:34 +0000
commit7b674725580ff92c71a32dd5726b1ff8df3be370 (patch)
treefae42797b3993fe1647815da559c5652b3ddc203 /plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common
parente3f00376058c43a13bd28b8c2c7075fb0839181c (diff)
downloadwebtools.javaee-201111071000.tar.gz
webtools.javaee-201111071000.tar.xz
webtools.javaee-201111071000.zip
This commit was manufactured by cvs2svn to create tag 'v201111071000'.v201111071000
Diffstat (limited to 'plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common')
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/AmbiguousMethodException.java33
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/CommandException.java50
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/GenericEventQueue.java146
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallback.java30
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackHandler.java101
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackRunnable.java28
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICommandException.java20
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMCallbackServer.java48
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMServer.java50
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MapTypes.java159
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/Messages.java41
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MethodHelper.java272
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/UnresolvedCompilationError.java47
-rw-r--r--plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/messages.properties11
14 files changed, 0 insertions, 1036 deletions
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/AmbiguousMethodException.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/AmbiguousMethodException.java
deleted file mode 100644
index 2856eba41..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/AmbiguousMethodException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
-
-
- */
-package org.eclipse.jem.internal.proxy.common;
-
-
-/**
- * Ambiguous Method Exception. I.E. There is more than one that could be used.
- */
-public class AmbiguousMethodException extends Exception {
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -7084137612344373381L;
- public AmbiguousMethodException() {
- }
- public AmbiguousMethodException(String msg) {
- super(msg);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/CommandException.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/CommandException.java
deleted file mode 100644
index cbb25f2d9..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/CommandException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-/*
-
-
- */
-/**
- * An error occurred during command processing.
- *
- */
-
-public class CommandException extends Exception {
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0
- */
- private static final long serialVersionUID = -2519238571145682514L;
- protected final Object fExceptionData;
-
- public CommandException() {
- fExceptionData = null;
- }
-
- public CommandException(Object data) {
- fExceptionData = data;
- }
-
- public CommandException(String msg, Object data) {
- super(msg);
- fExceptionData = data;
- }
-
- public Object getExceptionData() {
- return fExceptionData;
- }
-
- public boolean isRecoverable() {
- return false; // By default Command Exceptions are not recoverable.
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/GenericEventQueue.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/GenericEventQueue.java
deleted file mode 100644
index 72fd9fd07..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/GenericEventQueue.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile$
- * $Revision$ $Date$
- */
-package org.eclipse.jem.internal.proxy.common;
-
-import java.util.LinkedList;
-
-/**
- * A generic event queue. It runs on its own thread and will execute any queued up runnables.
- * <p>
- * When a runnable is added to the queue, the thread will be notified. If the thread is free it will
- * run the runnable. If it is not free, the runnable will be added to the queue. The thread will process
- * all intervening runnables and then execute the runnable in sequence with all of the rest.
- * <p>
- * This is used when you can't use the system widget (e.g. AWT event queue or SWT asyncExec) or when the
- * runnable must be executed on a non-ui thread.
- * <p>
- * <b>Note:</b> It is required that {@link #close()} be called so that resources are cleared up.
- *
- * @since 1.1.0.1
- */
-public class GenericEventQueue {
-
- private LinkedList queue = new LinkedList();
-
- private class EventThread extends Thread {
- private boolean run = true;
-
- public EventThread(String title) {
- super(title);
- }
-
- public void close() {
- synchronized (queue) {
- run = false;
- queue.clear();
- queue.notifyAll();
- }
- }
-
- public void postEvent(Runnable run) {
- if (!this.isAlive()) {
- throw new IllegalStateException("Event queue thread is not executing."); //$NON-NLS-1$
- }
- synchronized (queue) {
- if (run != null)
- queue.addLast(run);
- queue.notifyAll();
- }
- }
-
- public void run() {
- while (true) {
- Runnable runnable;
- synchronized (queue) {
- while (run && queue.isEmpty()) {
- try {
- queue.wait();
- } catch (InterruptedException e) {
- }
- }
- if (!run)
- return; // Done.
- else {
- runnable = (Runnable) queue.removeFirst();
- }
- }
-
- try {
- runnable.run();
- } catch (RuntimeException e) {
- e.printStackTrace();
- } finally {
- runnable = null; // Set this so that we don't hold onto resources in the runnable while waiting for next quy.
- }
- }
- }
- }
-
- private EventThread eventThread;
-
- /**
- * Construct with a title. (This title will be the title on the Thread for the queue).
- * The thread will have the same priority as the current thread.
- * @param queueTitle
- *
- * @since 1.1.0.1
- */
- public GenericEventQueue(String queueTitle) {
- this(queueTitle, Thread.currentThread().getPriority());
- }
-
- /**
- * Construct with a title. (This title will be the title on the Thread for the queue).
- * And a priority for the event queue's processing thread.
- * @param queueTitle
- * @param priority priority to use for event queue's thread.
- *
- * @since 1.1.0.1
- */
- public GenericEventQueue(String queueTitle, int priority) {
- eventThread = new EventThread(queueTitle);
- eventThread.setPriority(priority);
- synchronized(queue) {
- eventThread.start();
- try {
- queue.wait(100); // Wait for thread to start.
- } catch (InterruptedException e) {
- }
- }
- }
-
- /**
- * Close the event queue. This will clear out any pending events. They will not
- * be executed.
- *
- *
- * @since 1.1.0.1
- */
- public void close() {
- eventThread.close();
- }
-
- /**
- * Post the event.
- * @param runnable runnable to execute, or <code>null</code> to kick-start the thread if for some reason it may be waiting and it shouldn't be.
- *
- * @throws IllegalStateException thrown if the event queue thread has already been closed, or ended for some severe error.
- * @since 1.1.0.1
- */
- public void postEvent(Runnable runnable) {
- eventThread.postEvent(runnable);
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallback.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallback.java
deleted file mode 100644
index 4d718fe36..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallback.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-/*
-
-
- */
-
-/**
- * This interface is to be implemented by any callback.
- * The callback will use the IVMCallbackServer passed in to
- * get callback handlers, and the id passed in is
- * to be passed to these handlers.
- */
-public interface ICallback {
-
- /**
- * Initialize the callback
- */
- public void initializeCallback(IVMCallbackServer vmServer, int callbackID);
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackHandler.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackHandler.java
deleted file mode 100644
index 1d2f829a2..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackHandler.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-/*
-
-
- */
-
-/**
- * This is the interface for a callback handler.
- * Users will talk to this interface to perform
- * callbacks.
- */
-public interface ICallbackHandler {
-
- /**
- * Callback, but send the parm as an object, ie. it must
- * be nothing but constants, e.g. String, Integer, or an
- * array of constants. Constants should not be things like
- * regular objects. This is because only standard java.lang
- * type constants can be assured to be available on the other
- * client. Also you don't want to send big objects. It must
- * be constants that don't need to be sent back for any reason
- * since their identity will be lost in the transfer.
- * <p>
- * This should be used if there are no parms (i.e. it is null).
- * <p>
- * To send big objects, use the callback stream.
- *
- * @param callbackID
- * @param msgID
- * @param parm
- * @return
- * @throws CommandException
- *
- * @see IVMCallbackServer#requestStream(int, int)
- * @since 1.0.0
- */
- public Object callbackAsConstants(int callbackID, int msgID, Object parm) throws CommandException;
-
- /**
- * Callback to registered client.
- * <p>
- * The parms can be <code>null</code> if no parms, or it is an array of parms.
- * The parms
- * will be turned into proxies on the client vm. So the callback
- * will recieve an array of proxies to the values in the parms.
- * If any of the entries in the array is itself an array, a
- * proxy to the array will be created and sent. The array itself
- * will not be sent.
- * <p>
- * If an array entry should go across as an array of proxies and
- * not as one proxy to an array, then the entry needs to be an
- * instance of {@link ICallbackHandler.TransmitableArray transmitableArray}. This will flag
- * that it should transmit the entire entry as proxies. This should
- * be used sparingly, only if there isn't much data in the array and
- * all of the array would be used on the client. That way transmitting
- * the entire array will be faster than accessing individual components.
- * <p>
- * If the array contains only one entry or the parm itself is null, then {@link org.eclipse.jem.internal.proxy.core.ICallback#calledBack(int, IBeanProxy)}
- * will be called. Else {@link org.eclipse.jem.internal.proxy.core.ICallback#calledBack(int, Object[])} will be called with all of the parms
- * turned into proxies as mentioned in the previous paragraph.
- *
- * @param callbackID The id of the callback. This will be given
- * to the callback when it is created, and it must pass
- * on to the handler. That way it is know which callback
- * to call on the client.
- * @param msgID The id of the message for the callback. This is an
- * agreed upon id of the developers of the callback on both
- * sides.
- * @param parms Null if no parms, or an array of objects to send to the client vm. See the comments
- * above for a complete description of the parameter.
- *
- * @see ICallbackHandler.TransmitableArray
- */
- public Object callbackWithParms(int callbackID, int msgID, Object[] parms) throws CommandException;
-
- /**
- * Array wrapper that turns an array for parameters into a transmittable array.
- *
- * @see ICallbackHandler#callbackWithParms(int, int, Object[])
- * @since 1.1.0
- */
- public static class TransmitableArray {
- protected final Object[] fArray;
- public TransmitableArray(Object[] array) {
- fArray = array;
- }
- public Object[] getArray() {
- return fArray;
- }
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackRunnable.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackRunnable.java
deleted file mode 100644
index ceaae7cbc..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICallbackRunnable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
-
-
- */
-package org.eclipse.jem.internal.proxy.common;
-
-/**
- * Users would implement this as a runnable to
- * send a callback request.
- */
-public interface ICallbackRunnable {
-
- /**
- * The actual run code.
- */
- public Object run(ICallbackHandler handler) throws CommandException;
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICommandException.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICommandException.java
deleted file mode 100644
index 66b04dfa9..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/ICommandException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-/*
-
-
- */
-
-
-public class ICommandException {
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMCallbackServer.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMCallbackServer.java
deleted file mode 100644
index e79349a1b..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMCallbackServer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-/*
- * $RCSfile$
- * $Revision$ $Date$
- */
-
-import java.io.OutputStream;
-/**
- * This is the interface for accessing the
- * VM callback Server. It will be given to an
- * ICallback so that the callback can access
- * the server to request a callback.
- */
-public interface IVMCallbackServer {
-
- /**
- * Get the IVMServer for this callback server.
- * @return
- *
- * @since 1.1.0
- */
- public IVMServer getIVMServer();
-
-
- /**
- * Process a callback. The runnable contains the
- * actual code.
- */
- public Object doCallback(ICallbackRunnable runnable) throws CommandException;
-
- /**
- * Request a stream for writing a lot of data (suggested for larger
- * than several thousand bytes). The connection will be assigned
- * to this stream until the stream is closed.
- */
- public OutputStream requestStream(int callbackID, int msgID) throws CommandException;
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMServer.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMServer.java
deleted file mode 100644
index cdedb342d..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/IVMServer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
-
-
- */
-package org.eclipse.jem.internal.proxy.common;
-
-/**
- * This is the base server for the vm on the vm side (i.e. not the client side).
- * <p>
- * It can be passed to proxies if they need to access the vm server.
- * @since 1.1.0
- */
-public interface IVMServer {
-
- /**
- * Add a runnable that will be called if shutdown is requested. If already added,
- * it will not be added again.
- * <p>
- * The body of the runnable must not do any vm server calls. That is because
- * the server is shutdown at this point. The body must simply do clean up code.
- * The shutdown will not continue until the call to the runnable is returned.
- * <p>
- * Calls to this will be ignored if shutdown has already started.
- * @param runnable
- *
- * @since 1.1.0
- */
- public void addShutdownListener(Runnable runnable);
-
- /**
- * Remove the shutdown runnable from the list. If not added, then not an error to call this.
- * <p>
- * Calls to this will be ignored if shutdown has already started.
- * @param runnable
- *
- * @since 1.1.0
- */
- public void removeShutdownListener(Runnable runnable);
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MapTypes.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MapTypes.java
deleted file mode 100644
index c42afee48..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MapTypes.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
-
-
- */
-package org.eclipse.jem.internal.proxy.common;
-
-import java.util.HashMap;
-
-
-/**
- * This is used for mapping between JNI format and non-JNI format. It also has the
- * maps for primitives.
- * @since 1.0.0
- */
-public class MapTypes {
-
- public final static HashMap MAP_SHORTSIG_TO_TYPE = new HashMap(8);
- public final static HashMap MAP_TYPENAME_TO_SHORTSIG = new HashMap(8);
- static {
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("B", Byte.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("C", Character.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("D", Double.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("F", Float.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("I", Integer.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("J", Long.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("S", Short.TYPE); //$NON-NLS-1$
- MapTypes.MAP_SHORTSIG_TO_TYPE.put("Z", Boolean.TYPE); //$NON-NLS-1$
-
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("byte","B"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("char","C"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("double","D"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("float","F"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("int","I"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("long","J"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("short","S"); //$NON-NLS-1$ //$NON-NLS-2$
- MapTypes.MAP_TYPENAME_TO_SHORTSIG.put("boolean","Z"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
-
- /**
- * Convert formal type name for an array (i.e. java.lang.Object[]
- * to the jni format (i.e. [Ljava.lang.Object;)
- * This is used when a name is passed in from the IDE side.
- * The VM side uses the jni format, and all of proxy uses the jni format.
- *
- * @param classname
- * @return string jni form of name.
- *
- * @since 1.0.0
- */
- public static String getJNIFormatName(String classname) {
- if (classname.length() == 0 || !classname.endsWith("]")) //$NON-NLS-1$
- return classname; // Not an array,or invalid
-
- StringBuffer jni = new StringBuffer(classname.length());
- int firstOpenBracket = classname.indexOf('[');
- int ob = firstOpenBracket;
- while (ob > -1) {
- int cb = classname.indexOf(']', ob);
- if (cb == -1)
- break;
- jni.append('[');
- ob = classname.indexOf('[', cb);
- }
-
- String finalType = classname.substring(0, firstOpenBracket).trim();
- if (finalType != null) {
- String shortSig = (String) MapTypes.MAP_TYPENAME_TO_SHORTSIG.get(finalType);
- if (shortSig == null) {
- jni.append('L');
- jni.append(finalType);
- jni.append(';');
- } else {
- jni.append(shortSig);
- }
- }
-
- return jni.toString();
- }
-
- /**
- * This converts from the JNI format to the formal typename.
- *
- * @param jniName
- * @return formal typename
- *
- * @since 1.1.0
- */
- public static String getFormalTypeName(String jniName) {
- if (jniName.charAt(0) == '[') {
- // It is an array
- int dims = jniName.lastIndexOf('[')+1; // Number of dimensions
- int startType = dims;
- StringBuffer fName = new StringBuffer(jniName.length()+(2*dims));
- if (jniName.charAt(startType) == 'L')
- fName.append(jniName.substring(startType+1, jniName.length()-1)); // For "[Ljava.lang.String;" return "java.lang.String"
- else if (jniName.length() == startType+1) {
- // Possible primitive
- Class type = (Class) MAP_SHORTSIG_TO_TYPE.get(jniName.substring(startType, startType+1));
- if (type != null) {
- fName.append(type.getName());
- } else
- return ""; // Invalid if no 'L' and not a primitive. //$NON-NLS-1$
- } else
- return ""; // Invalid, must be either a primitive or 'L' type. //$NON-NLS-1$
- while(dims-- > 0) {
- fName.append("[]"); //$NON-NLS-1$
- }
- return fName.toString();
- } else if (jniName.length() == 1) {
- // Possible primitive.
- Class type = (Class) MAP_SHORTSIG_TO_TYPE.get(jniName);
- if (type != null) {
- return type.getName();
- }
- }
-
- // If got here then just a name as is.
- return jniName;
- }
-
- /**
- * Convert the formal type name, with the given number of dimensions,
- * to an array JNI type.
- * @param finalComponent final component name, should not be an array type.
- * @param dimensions number of dimensions for the array.
- * @return
- *
- * @since 1.1.0
- */
- public static String getJNITypeName(String finalComponent, int dimensions) {
- StringBuffer jni = new StringBuffer(finalComponent.length()+dimensions+2);
- while (dimensions-- > 0) {
- jni.append('[');
- }
-
- String shortSig = (String) MapTypes.MAP_TYPENAME_TO_SHORTSIG.get(finalComponent);
- if (shortSig == null) {
- jni.append('L');
- jni.append(finalComponent);
- jni.append(';');
- } else {
- jni.append(shortSig);
- }
-
- return jni.toString();
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/Messages.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/Messages.java
deleted file mode 100644
index e9d2984b3..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
-
-
- */
-package org.eclipse.jem.internal.proxy.common;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- *
- * @since 1.2.0
- */
-public class Messages {
-
- private static final String BUNDLE_NAME = "org.eclipse.jem.internal.proxy.common.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- // TODO Auto-generated method stub
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MethodHelper.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MethodHelper.java
deleted file mode 100644
index 3bceb66e4..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/MethodHelper.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jem.internal.proxy.common;
-import java.lang.reflect.*;
-import java.text.MessageFormat;
-import java.util.*;
-
-/**
- * This is a class to do message/constructor work.
- * Specifically to find the most appropriate method.
- */
-public class MethodHelper {
-
- /*
- * The class that is used to represent Null class type.
- *
- * @since 1.0.0
- */
- private static class NULL_CLASS {
- }
-
- public static final Class NULL_TYPE = NULL_CLASS.class;
-
- static final ArrayList sPrimitivesOrder;
- static final int sCharPos;
-
- static {
- sPrimitivesOrder = new ArrayList(6);
- sPrimitivesOrder.add(Byte.TYPE);
- sPrimitivesOrder.add(Short.TYPE);
- sPrimitivesOrder.add(Integer.TYPE);
- sPrimitivesOrder.add(Long.TYPE);
- sPrimitivesOrder.add(Float.TYPE);
- sPrimitivesOrder.add(Double.TYPE);
-
- // char can be treated like a short for purposes of ordering.
- sCharPos = sPrimitivesOrder.indexOf(Short.TYPE);
- }
-
- /**
- * Return whether the type2 can be assigned to type1 in
- * method argument conversion.
- */
- public static boolean isAssignableFrom(Class type1, Class type2) {
- if (type1 == type2)
- return true; // They're the same, so assignable.
- if (type1.isPrimitive()) {
- if (type2.isPrimitive()) {
- if (type1 == Boolean.TYPE || type2 == Boolean.TYPE)
- return false; // Since not equal and one is boolean and the other isn't, not assignable
- int type1Pos = (type1 != Character.TYPE) ? sPrimitivesOrder.indexOf(type1) : sCharPos;
- int type2Pos = (type2 != Character.TYPE) ? sPrimitivesOrder.indexOf(type2) : sCharPos;
- return type1Pos > type2Pos; // It can be widened if type1 is higher in the order
- }
- return false; // primitive to non-primitive, not assignable.
- } else
- if (type2 == NULL_TYPE)
- return true; // NULL_TYPE represents null for us, and null can be assigned to any object
- else
- return type1.isAssignableFrom(type2); // Can type2 be assigned to type1
- }
-
-
- /**
- * Every entry in Array2 can be assigned to the corresponding entry in Array1.
- */
- public static boolean isAssignableFrom(Class[] types1, Class[] types2) {
- if (types1.length != types2.length)
- return false; // Not the same size, so not compatible.
- for (int i=0; i<types1.length; i++) {
- if (!isAssignableFrom(types1[i], types2[i]))
- return false;
- }
- return true; // All are assignable
- }
-
- /**
- * Return the index of the most compatible method/constructor from the lists passed in.
- * MethodsList: List of methods (if null then this is for constructors)
- * ParmsList: List of parms for each method (each entry will be Class[]).
- */
- private static int findMostCompatible(List methods, List parms, String ambiguousName) throws AmbiguousMethodException {
- // The algorithm used is from the Java Language Specification 15.12.2.2
- // Find the maximally specific ones
- // This is defined as the one that is more specific then all of the rest.
- // If there are duplicates parms that are maximally specific, then it doesn't matter which choosen
- // because when invoked the JVM will make sure the right thing is done.
- //
- Class[][] parmsCopy = (Class[][]) parms.toArray(new Class[parms.size()][]);
- int size = parmsCopy.length;
- // For each entry see if it is maximally specific, i.e. it is more specific then all of the others.
-nextMethod: for (int i=0; i<size; i++) {
- // For ctors we don't need to test the declaring class because it will always be the same class.
- Class dclClassi = methods != null ? ((Method) methods.get(i)).getDeclaringClass() : null;
- Class[] parmsi = parmsCopy[i];
- for (int j=0; j<size; j++) {
- if (i == j)
- continue;
- // Methodi is more specific if
- // a) Methodi declaring class is assignable to Methodj declaring class
- // b) Methodi parms are assignable to Methodj parms
- //
- // First see if Methodi is more specific, if it is
- // then throw out Methodj and continue
- // If Methodi is not compatible to Methodj, go to the next method for i. Methodi is not the most specific
- // Something else is either more specific or none are ma
- if (dclClassi != null) {
- // Step a
- if (!isAssignableFrom(((Method) methods.get(j)).getDeclaringClass(), dclClassi))
- continue nextMethod; // Methodi is not more specific than Methodj, so try next i.
- }
-
- // Step b
- Class[] parmsj = parmsCopy[j];
- if (!isAssignableFrom(parmsj, parmsi)) {
- // Methodi is not more specific than Methodj, so go to next i.
- continue nextMethod;
- }
- }
- return i; // Methodi is more specific than all of the other ones.
- }
-
- throw new AmbiguousMethodException(ambiguousName); // There was not one more specific than all of the others.
- }
-
- /**
- * Find the most compatible method for the given arguments.
- */
- public static Method findCompatibleMethod(Class receiver, String methodName, Class[] arguments) throws NoSuchMethodException, AmbiguousMethodException {
- try {
- return receiver.getMethod(methodName, arguments); // Found exact match in public
- } catch (NoSuchMethodException exc) {
- if (arguments != null) {
- // Need to find most compatible one. We will take protected into consideration (i.e. inheritance).
- ArrayList parmsList = new ArrayList(); // The parm list from each compatible method.
- ArrayList mthdsList = new ArrayList(); // The list of compatible methods, same order as the parms above.
- Class cls = receiver;
- while (cls != null) {
- Method mthds[] = cls.getDeclaredMethods();
- for (int i = 0; i < mthds.length; i++) {
- Method mthd = mthds[i];
- if (!mthd.getName().equals(methodName))
- continue; // Not compatible, not same name
- int modifiers = mthd.getModifiers();
- if (!(Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)))
- continue; // Will not call private or package-protected because we don't know the context.
- Class[] parms = mthd.getParameterTypes();
- // If exact match we found a non-public exact match, which is good.
- if (Arrays.equals(arguments, parms))
- return makeMethodAccessable(mthd);
- if (!isAssignableFrom(parms, arguments))
- continue; // Not compatible, parms
- // It is compatible with the requested method - now see if we already have an exact match from a subclass. Don't want to add it twice.
- // We are assuming the actual number of compatible methods is small, so this O(n-squared) search is efficient enough.
- int size = parmsList.size();
- for (int j = 0; j < size; j++) {
- if (Arrays.equals(parms, (Object[]) parmsList.get(j)))
- continue;
- }
- parmsList.add(parms);
- mthdsList.add(mthd);
- }
- cls = cls.getSuperclass();
- }
- // Now have list of compatible methods.
- if (parmsList.size() == 0)
- throw throwFixedNoSuchMethod(exc, receiver, methodName, arguments); // None found, so rethrow the exception
- if (parmsList.size() == 1)
- return makeMethodAccessable((Method) mthdsList.get(0)); // Only one, so return it
-
- // Now find the most compatible method
- int mostCompatible = findMostCompatible(mthdsList, parmsList, methodName);
- return makeMethodAccessable((Method) mthdsList.get(mostCompatible));
- } else
- throw throwFixedNoSuchMethod(exc, receiver, methodName, arguments); // None found, so rethrow the exception
- }
- }
-
- private static Method makeMethodAccessable(Method m) {
- m.setAccessible(true); // We allow all access, let ide and compiler handle security.
- return m;
- }
-
- /*
- * NoSuchMEthodExeception doesn't include the signature. Since these are dynamic searches, the exception itself is useless without
- * the signature. So we add it.
- */
- private static NoSuchMethodException throwFixedNoSuchMethod(NoSuchMethodException e, Class declareClass, String methodName, Class[] argClasses) {
-
- // The default trace doesn't show what method was being searched for, so recreate with that.
- StringBuffer s = new StringBuffer();
- s.append(declareClass.getName());
- s.append('.');
- s.append(methodName);
- s.append('(');
- if (argClasses != null) {
- for (int i = 0; i < argClasses.length; i++) {
- if (i > 0)
- s.append(',');
- s.append(argClasses[i].getName());
- }
- }
- s.append(')');
- NoSuchMethodException ne = new NoSuchMethodException(s.toString());
- ne.setStackTrace(e.getStackTrace());
- return ne;
- }
-
-
- /**
- * Find the most compatible constructor for the class with the given arguments.
- * @param receiver class to get the constructor for
- * @param arguments array of argument types
- * @return the constructor
- * @throws NoSuchMethodException no compatible constructor can be found
- * @throws AmbiguousMethodException there is more than one compatible constructor
- * @throws IllegalAccessException it can't be accessed. Such as it is a non-static inner class.
- *
- * @since 1.2.0
- */
- public static Constructor findCompatibleConstructor(Class receiver, Class[] arguments) throws NoSuchMethodException, AmbiguousMethodException, IllegalAccessException {
- if (receiver.getDeclaringClass() != null && !Modifier.isStatic(receiver.getModifiers()))
- throw new IllegalAccessException(MessageFormat.format(Messages.getString("MethodHelper.NONSTATICINNERCLASS_WARNING"), new Object[] {receiver.getName()})); //$NON-NLS-1$
- try {
- java.lang.reflect.Constructor ctor = receiver.getDeclaredConstructor(arguments);
- ctor.setAccessible(true); // We allow all access, let ide and compiler handle security.
- return ctor; // Found exact match
- } catch (NoSuchMethodException exc) {
- if (arguments != null) {
- // Need to find most compatible one.
- java.lang.reflect.Constructor ctors[] = receiver.getDeclaredConstructors();
- ArrayList parmsList = new ArrayList(ctors.length); // The parm list from each compatible method.
- ArrayList ctorsList = new ArrayList(ctors.length); // The list of compatible methods, same order as the parms above.
- for (int i = 0; i < ctors.length; i++) {
- java.lang.reflect.Constructor ctor = ctors[i];
- Class[] parms = ctor.getParameterTypes();
- if (!isAssignableFrom(parms, arguments))
- continue; // Not compatible, parms
- // It is compatible with the requested method
- parmsList.add(parms);
- ctorsList.add(ctor);
- }
-
- // Now have list of compatible methods.
- if (parmsList.size() == 0)
- throw exc; // None found, so rethrow the exception
- if (parmsList.size() == 1) {
- java.lang.reflect.Constructor ctor = (java.lang.reflect.Constructor) ctorsList.get(0); // Only one, so return it
- ctor.setAccessible(true); // We allow all access, let ide and compilor handle security.
- return ctor;
- }
-
- // Now find the most compatible ctor
- int mostCompatible = findMostCompatible(null, parmsList, receiver.getName());
- java.lang.reflect.Constructor ctor = (java.lang.reflect.Constructor) ctorsList.get(mostCompatible);
- ctor.setAccessible(true); // We allow all access, let ide and compilor handle security.
- return ctor;
- } else
- throw exc; // None found, so rethrow the exception
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/UnresolvedCompilationError.java b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/UnresolvedCompilationError.java
deleted file mode 100644
index 687dd6f9c..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/UnresolvedCompilationError.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * $RCSfile$
- * $Revision$ $Date$
- */
-package org.eclipse.jem.internal.proxy.common;
-
-/**
- * Used by the the registries to indicate "UnresolvedCompilationError". This is because the
- * normal java throws just an Error with a message. To make it easier in processing, it will
- * be turned into this error instead so that it can be explicitly caught.
- * <p>
- * This will only be used in certain explicit parts of the code. It will be detailed where
- * it can be thrown.
- *
- * @since 1.1.0.1
- */
-public class UnresolvedCompilationError extends Error {
-
- /**
- * Comment for <code>serialVersionUID</code>
- *
- * @since 1.1.0.1
- */
- private static final long serialVersionUID = 7778842211073592790L;
-
- /**
- * Construct from an Error.
- * @param error The error that is the actual one. <b>This will not be the cause, the message and stacktrace will be copied into this new error.</b>
- *
- * @since 1.1.0.1
- */
- public UnresolvedCompilationError(Error error) {
- super(error.getMessage());
- setStackTrace(error.getStackTrace());
- }
-
-}
diff --git a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/messages.properties b/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/messages.properties
deleted file mode 100644
index 937eea7b7..000000000
--- a/plugins/org.eclipse.jem.proxy/proxyCommon/org/eclipse/jem/internal/proxy/common/messages.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-MethodHelper.NONSTATICINNERCLASS_WARNING=Class {0} is a non-static inner class. These cannot be instantiated at this time.

Back to the top