Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-04-21 04:17:09 +0000
committerslewis2007-04-21 04:17:09 +0000
commitd68b70bbee2ae2abbece99c4f185feb9758d1456 (patch)
treefb36ca4800ea4e9d5ed8b36d7fc4d3c0653bf9b1
parentfa1db74018ccde14e09db7016f1ff26a5dbf93ce (diff)
downloadorg.eclipse.ecf-d68b70bbee2ae2abbece99c4f185feb9758d1456.tar.gz
org.eclipse.ecf-d68b70bbee2ae2abbece99c4f185feb9758d1456.tar.xz
org.eclipse.ecf-d68b70bbee2ae2abbece99c4f185feb9758d1456.zip
Removed deprecated references
-rw-r--r--examples/bundles/org.eclipse.ecf.example.clients/META-INF/MANIFEST.MF1
-rw-r--r--examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRobotApplication.java59
-rw-r--r--examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRoomRobotApplication.java49
-rw-r--r--examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatSORobotApplication.java50
4 files changed, 100 insertions, 59 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.clients/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.example.clients/META-INF/MANIFEST.MF
index b7ee3d523..11629b2a9 100644
--- a/examples/bundles/org.eclipse.ecf.example.clients/META-INF/MANIFEST.MF
+++ b/examples/bundles/org.eclipse.ecf.example.clients/META-INF/MANIFEST.MF
@@ -16,5 +16,6 @@ Require-Bundle: org.eclipse.ecf,
org.eclipse.ecf.ui
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Import-Package: org.eclipse.core.runtime,
+ org.eclipse.equinox.app;version="1.0.0",
org.osgi.framework;version="1.3.0"
Bundle-Activator: org.eclipse.ecf.example.clients.Activator
diff --git a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRobotApplication.java b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRobotApplication.java
index 569b901e4..ca3131ffe 100644
--- a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRobotApplication.java
+++ b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRobotApplication.java
@@ -13,44 +13,57 @@ package org.eclipse.ecf.example.clients.applications;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.example.clients.IMessageReceiver;
import org.eclipse.ecf.example.clients.XMPPChatClient;
import org.eclipse.ecf.presence.im.IChatMessage;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
-public class ChatRobotApplication implements IPlatformRunnable,
- IMessageReceiver {
+public class ChatRobotApplication implements IApplication, IMessageReceiver {
public static final int WAIT_TIME = 10000;
public static final int WAIT_COUNT = 10;
-
+
private boolean running = false;
private String userName;
private XMPPChatClient client;
- public synchronized Object run(Object args) throws Exception {
- if (args instanceof Object[]) {
- Object[] arguments = (Object[]) args;
- int l = arguments.length;
- if (arguments[l - 1] instanceof String
- && arguments[l - 2] instanceof String
- && arguments[l - 3] instanceof String
- && arguments[l - 4] instanceof String) {
- userName = (String) arguments[l - 4];
- String hostName = (String) arguments[l - 3];
- String password = (String) arguments[l - 2];
- String targetName = (String) arguments[l - 1];
- runRobot(hostName, password, targetName);
- return new Integer(0);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ Object[] args = context.getArguments().values().toArray();
+ while (args[0] instanceof Object[])
+ args = (Object[]) args[0];
+ Object[] arguments = (Object[]) args;
+ int l = arguments.length;
+ if (arguments[l - 1] instanceof String
+ && arguments[l - 2] instanceof String
+ && arguments[l - 3] instanceof String
+ && arguments[l - 4] instanceof String) {
+ userName = (String) arguments[l - 4];
+ String hostName = (String) arguments[l - 3];
+ String password = (String) arguments[l - 2];
+ String targetName = (String) arguments[l - 1];
+ runRobot(hostName, password, targetName);
+ return new Integer(0);
}
-
System.out
.println("Usage: pass in four arguments (username, hostname, password, targetIMUser)");
return new Integer(-1);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ }
+
private void runRobot(String hostName, String password, String targetIMUser)
throws ECFException, Exception, InterruptedException {
// Create client
@@ -63,11 +76,9 @@ public class ChatRobotApplication implements IPlatformRunnable,
client.doConnect(connectTarget, password);
- System.out.println("ECF chat robot ("+connectTarget+")");
+ System.out.println("ECF chat robot (" + connectTarget + ")");
// Send initial message to target user
- client
- .sendChat(targetIMUser,
- "Hi, I'm an ECF chat robot.");
+ client.sendChat(targetIMUser, "Hi, I'm an ECF chat robot.");
running = true;
int count = 0;
diff --git a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRoomRobotApplication.java b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRoomRobotApplication.java
index b458fda96..6ee0e345a 100644
--- a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRoomRobotApplication.java
+++ b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatRoomRobotApplication.java
@@ -8,7 +8,6 @@
******************************************************************************/
package org.eclipse.ecf.example.clients.applications;
-import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.example.clients.IMessageReceiver;
@@ -20,6 +19,8 @@ import org.eclipse.ecf.presence.chatroom.IChatRoomMessage;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessageEvent;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessageSender;
import org.eclipse.ecf.presence.im.IChatMessage;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
/**
* To be started as an application. Go to Run->Run..., create a new Eclipse
@@ -27,7 +28,7 @@ import org.eclipse.ecf.presence.im.IChatMessage;
* and make sure you have all required plug-ins.
*
*/
-public class ChatRoomRobotApplication implements IPlatformRunnable,
+public class ChatRoomRobotApplication implements IApplication,
IMessageReceiver, IIMMessageListener {
private IChatRoomMessageSender sender;
@@ -36,27 +37,41 @@ public class ChatRoomRobotApplication implements IPlatformRunnable,
private String userName;
- public synchronized Object run(Object args) throws Exception {
- if (args instanceof Object[]) {
- Object[] arguments = (Object[]) args;
- int l = arguments.length;
- if (arguments[l - 1] instanceof String
- && arguments[l - 2] instanceof String
- && arguments[l - 3] instanceof String
- && arguments[l - 4] instanceof String) {
- userName = (String) arguments[l - 4];
- String hostName = (String) arguments[l - 3];
- String password = (String) arguments[l - 2];
- String roomName = (String) arguments[l - 1];
- runRobot(hostName, password, roomName);
- return new Integer(0);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ Object[] args = context.getArguments().values().toArray();
+ while (args[0] instanceof Object[])
+ args = (Object[]) args[0];
+ Object[] arguments = (Object[]) args;
+ int l = arguments.length;
+ if (arguments[l - 1] instanceof String
+ && arguments[l - 2] instanceof String
+ && arguments[l - 3] instanceof String
+ && arguments[l - 4] instanceof String) {
+ userName = (String) arguments[l - 4];
+ String hostName = (String) arguments[l - 3];
+ String password = (String) arguments[l - 2];
+ String roomName = (String) arguments[l - 1];
+ runRobot(hostName, password, roomName);
+ return new Integer(0);
}
System.out
.println("Usage: pass in four arguments (username, hostname, password, roomname)");
return new Integer(-1);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ }
+
private void runRobot(String hostName, String password, String roomName)
throws ECFException, Exception, InterruptedException {
XMPPChatRoomClient client = new XMPPChatRoomClient(this);
diff --git a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatSORobotApplication.java b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatSORobotApplication.java
index 484214ff7..0c1d099ef 100644
--- a/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatSORobotApplication.java
+++ b/examples/bundles/org.eclipse.ecf.example.clients/src/org/eclipse/ecf/example/clients/applications/ChatSORobotApplication.java
@@ -10,16 +10,16 @@
******************************************************************************/
package org.eclipse.ecf.example.clients.applications;
-import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.example.clients.IMessageReceiver;
import org.eclipse.ecf.example.clients.XMPPChatClient;
import org.eclipse.ecf.presence.im.IChatMessage;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
-public class ChatSORobotApplication implements IPlatformRunnable,
- IMessageReceiver {
+public class ChatSORobotApplication implements IApplication, IMessageReceiver {
public static final int WAIT_TIME = 10000;
public static final int WAIT_COUNT = 10;
@@ -29,21 +29,27 @@ public class ChatSORobotApplication implements IPlatformRunnable,
private XMPPChatClient client;
private TrivialSharedObject sharedObject = null;
- public synchronized Object run(Object args) throws Exception {
- if (args instanceof Object[]) {
- Object[] arguments = (Object[]) args;
- int l = arguments.length;
- if (arguments[l - 1] instanceof String
- && arguments[l - 2] instanceof String
- && arguments[l - 3] instanceof String
- && arguments[l - 4] instanceof String) {
- userName = (String) arguments[l - 4];
- String hostName = (String) arguments[l - 3];
- String password = (String) arguments[l - 2];
- String targetName = (String) arguments[l - 1];
- runRobot(hostName, password, targetName);
- return new Integer(0);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ Object[] args = context.getArguments().values().toArray();
+ while (args[0] instanceof Object[])
+ args = (Object[]) args[0];
+ Object[] arguments = (Object[]) args;
+ int l = arguments.length;
+ if (arguments[l - 1] instanceof String
+ && arguments[l - 2] instanceof String
+ && arguments[l - 3] instanceof String
+ && arguments[l - 4] instanceof String) {
+ userName = (String) arguments[l - 4];
+ String hostName = (String) arguments[l - 3];
+ String password = (String) arguments[l - 2];
+ String targetName = (String) arguments[l - 1];
+ runRobot(hostName, password, targetName);
+ return new Integer(0);
}
System.out
@@ -51,6 +57,14 @@ public class ChatSORobotApplication implements IPlatformRunnable,
return new Integer(-1);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ }
+
private void runRobot(String hostName, String password, String targetIMUser)
throws ECFException, Exception, InterruptedException {
// Create client and connect to host

Back to the top