Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 72903 Details for
Bug 195088
Provide IApplication startup point for ECF server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Provides a simple IApplication startup point
ecf.patch (text/plain), 4.17 KB, created by
Alex Blewitt
on 2007-07-02 18:41:52 EDT
(
hide
)
Description:
Provides a simple IApplication startup point
Filename:
MIME Type:
Creator:
Alex Blewitt
Created:
2007-07-02 18:41:52 EDT
Size:
4.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ecf.provider >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.ecf/plugins/org.eclipse.ecf.provider/plugin.xml,v >retrieving revision 1.26 >diff -u -r1.26 plugin.xml >--- plugin.xml 26 Mar 2007 22:32:07 -0000 1.26 >+++ plugin.xml 2 Jul 2007 22:32:24 -0000 >@@ -19,4 +19,14 @@ > name="ecf.generic.client"> > </containerFactory> > </extension> >+ <extension >+ id="ECFTCPServer" >+ point="org.eclipse.core.runtime.applications"> >+ <application >+ cardinality="*" >+ thread="any"> >+ <run >+ class="org.eclipse.ecf.provider.app.ECFTCPServer"/> >+ </application> >+ </extension> > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.ecf/plugins/org.eclipse.ecf.provider/META-INF/MANIFEST.MF,v >retrieving revision 1.103 >diff -u -r1.103 MANIFEST.MF >--- META-INF/MANIFEST.MF 21 Apr 2007 11:11:20 -0000 1.103 >+++ META-INF/MANIFEST.MF 2 Jul 2007 22:32:24 -0000 >@@ -18,7 +18,8 @@ > Bundle-ManifestVersion: 2 > Require-Bundle: org.eclipse.equinox.common, > org.eclipse.ecf, >- org.eclipse.ecf.sharedobject >+ org.eclipse.ecf.sharedobject, >+ org.eclipse.equinox.app > Import-Package: org.eclipse.osgi.util;version="1.0.0", > org.osgi.framework;version="1.3.0", > org.osgi.service.log;version="1.3.0", >Index: src/org/eclipse/ecf/provider/app/ECFTCPServer.java >=================================================================== >RCS file: src/org/eclipse/ecf/provider/app/ECFTCPServer.java >diff -N src/org/eclipse/ecf/provider/app/ECFTCPServer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ecf/provider/app/ECFTCPServer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,85 @@ >+package org.eclipse.ecf.provider.app; >+ >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ecf.core.identity.ID; >+import org.eclipse.ecf.core.identity.IDFactory; >+import org.eclipse.ecf.provider.generic.SOContainerConfig; >+import org.eclipse.ecf.provider.generic.TCPServerSOContainer; >+import org.eclipse.ecf.provider.generic.TCPServerSOContainerGroup; >+import org.eclipse.equinox.app.IApplication; >+import org.eclipse.equinox.app.IApplicationContext; >+ >+/** >+ * This class controls all aspects of the application's execution >+ */ >+public class ECFTCPServer implements IApplication { >+ private static Map groups = new HashMap(); >+ private String hostname = "localhost"; >+ private int port = 1234; >+ private String name = ""; >+ private int keepAlive = 30000; >+ private TCPServerSOContainerGroup group; >+ private TCPServerSOContainer container; >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) >+ */ >+ public Object start(IApplicationContext context) throws Exception { >+ try { >+ String args[] = (String[]) context.getArguments().get( >+ "application.args"); >+ switch (args.length) { >+ case 3: >+ name = args[2]; >+ case 2: >+ hostname = args[1]; >+ case 1: >+ port = Integer.parseInt(args[0]); >+ } >+ String url = "ecftcp://" + hostname + ":" + port + "/" + name; >+ System.out.print("Starting ECF server on " + url + " ... "); >+ synchronized (groups) { >+ group = (TCPServerSOContainerGroup) groups.get(url); >+ if (group == null) { >+ group = new TCPServerSOContainerGroup(hostname, port); >+ groups.put(url, group); >+ } >+ } >+ ID id = IDFactory.getDefault().createStringID(url); >+ // Create server config object with identity and default timeout >+ SOContainerConfig config = new SOContainerConfig(id); >+ >+ container = new TCPServerSOContainer(config, >+ group, keepAlive); >+ System.out.println("done."); >+ synchronized(this) { >+ this.wait(); >+ } >+ return IApplication.EXIT_OK; >+ } catch(Exception e) { >+ stop(); >+ throw e; >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.equinox.app.IApplication#stop() >+ */ >+ public void stop() { >+ if (group != null && group.isOnTheAir()) { >+ group.takeOffTheAir(); >+ } >+ if (container != null) >+ container.dispose(); >+ synchronized(this) { >+ this.notify(); >+ } >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 195088
: 72903 |
73492