Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "ECF/Servers"

< ECF
Line 1: Line 1:
 
==ECF Generic Server==
 
==ECF Generic Server==
[[Eclipse Communication Framework Project|ECF]] is currently using the [http://www.eclipse.org/equinox/server/http_in_container.php Equinox Servlet Incubator] to run and support the example collab application running on the 'ECF generic' provider.
 
  
===Connecting to the ECF Generic Server===
+
ECF Generic Servers can now be created, started, and managed dynamically using the [https://build.ecf-project.org/jenkins/job/C-HEAD-sdk.feature/javadoc/org/eclipse/ecf/server/generic/IGenericServerContainerGroupFactory.html IGenericServerContainerGroupFactory] service started in the bundle activator of the org.eclipse.ecf.server.generic bundle.
#[http://www.eclipse.org/ecf/downloads.php Download] and install the ECF SDK.
+
#Right-click on a project within your workspace.
+
#Choose 'Communications' -> 'Connect Project to Collaboration Group...' from the popup menu.
+
#Select the 'ECF generic' provider from the list.
+
#Use '''ecftcp://ecf.eclipse.org:3282/server''' as the connect URI.
+
#Choose a nickname and then select the 'OK' button.
+
  
===Starting an ECF Generic Server as Eclipse Application===
+
Here some example code for creating/starting a simple ECF generic server
 
+
To start and configure an ECF Generic Server as an Eclipse Application
+
  
 
<pre>
 
<pre>
eclipse.exe -console -application org.eclipse.ecf.provider.AppGenericServer
+
// Get generic server container group factory service...e.g. via declarative service injection
 +
// or via ServiceTracker
 +
IGenericServerContainerGroupFactory genericServerFactory = <get IGenericServerContainerGroupFactory service>;
 +
// Create generic server container group for localhost, listen port=3282
 +
IGenericServerContainerGroup containerGroup = genericServerFactory.createContainerGroup("localhost",3282);
 +
// Create an ECF container within the container group, and give it path="/server"
 +
containerGroup.createContainer("/server",30000,null);
 +
// The resulting container's ID will be:  ecftcp://localhost:3282/server
 +
// Now start listening for client connections
 +
containerGroup.startListening();
 
</pre>
 
</pre>
 
For ECF 2.1 and up use the following command:
 
<pre>
 
eclipse.exe -console -application org.eclipse.ecf.server.generic.Server
 
</pre>
 
 
This will start a server with hostname=localhost, port=3282,
 
groupname=server...i.e. id=ecftcp://localhost:3282/server.  The output upon
 
startup looks like this:
 
 
<pre>
 
Putting server localhost:3282 on the air...
 
  Creating container with id=ecftcp://localhost:3282/server keepAlive=30000
 
GenericServer localhost:3282 on the air.
 
</pre>
 
 
It's also possible to provide the port groupname hostname and keepAlive (ms)
 
For example:
 
 
<pre>
 
eclipse.exe -console -application org.eclipse.ecf.provider.AppGenericServer 3285 mygroup ecf.eclipse.org 20000
 
 
Putting server ecf.eclipse.org:3285 on the air...
 
  Creating container with id=ecftcp://ecf.eclipse.org:3285/mygroup
 
keepAlive=20000
 
GenericServer ecf.eclipse.org:3285 on the air.
 
</pre>
 
 
or
 
 
<pre>
 
eclipse.exe -console -application org.eclipse.ecf.provider.AppGenericServer 3333
 
 
Putting server localhost:3333 on the air...
 
  Creating container with id=ecftcp://localhost:3333/server keepAlive=30000
 
GenericServer localhost:3333 on the air.
 
</pre>
 
 
====Starting from Equinox Console====
 
 
It's possible to start multiple additional instances of the GenericServer application from within the Equinox Console.  For example:
 
 
<pre>
 
java -Declipse.application.registerDescriptors=true -Declipse.ignoreApp=false -jar org.eclipse.osgi -console -noExit
 
osgi> startApp org.eclipse.ecf.provider.GenericServer 3333
 
osgi> startApp org.eclipse.ecf.provider.GenericServer 3285 mygroup ecf.eclipse.org 20000
 
</pre>
 
 
This can be used in addition to, or instead of, the -application argument. Note that with the -application argument, if that main server/application closes, then all other running apps are closed. If you want the VM to remain running, supply -noExit and run individual instances as above.
 
 
''NB the reason for 'AppGenericServer' and 'GenericServer' is due to a workaround for a [https://bugs.eclipse.org/bugs/show_bug.cgi?id=193596 bug in Equinox 3.3.0]. If this is fixed and released in Equinox 3.3.1, then you'll be able to use the same name for both -application and startApp equivalents.''
 
 
A typical eclipseless Equinox directory structure will look like this.
 
 
somedir/
 
  org.eclipse.core.runtime.jar
 
  org.eclipse.equinox.common.jar
 
  org.eclipse.osgi.jar
 
  org.eclipse.update.configurator.jar
 
  configuration/
 
    config.ini
 
  plugins/ (jobs plugin + equinox plugins + ecf plugins)
 
 
Note the four jars in the "root" directory.
 
 
====Server Configuration File====
 
 
Another way to start a number of servers and groups is to create a file with
 
the server configuration...for example:
 
 
<source lang="xml">
 
<server>
 
        <connector protocol="ecftcp"  hostname="localhost" port="3282" timeout="30000">
 
            <group name="server"/>
 
            <group name="foobar"/>
 
        </connector>
 
        <connector protocol="ecftcp"  hostname="localhost" port="3283" timeout="30000">
 
            <group name="server"/>
 
            <group name="foobar"/>
 
        </connector>
 
</server>
 
</source>
 
 
If this content is in file ./server.xml
 
Then the command line would be:
 
 
<pre>
 
eclipse.exe -application org.eclipse.ecf.provider.AppGenericServer -config server.xml
 
</pre>
 
And the output would be:
 
<pre>
 
Putting server localhost:3282 on the air...
 
  Creating container with id=ecftcp://localhost:3282/server keepAlive=30000
 
  Creating container with id=ecftcp://localhost:3282/foobar keepAlive=30000
 
GenericServer localhost:3282 on the air.
 
Putting server localhost:3283 on the air...
 
  Creating container with id=ecftcp://localhost:3283/server keepAlive=30000
 
  Creating container with id=ecftcp://localhost:3283/foobar keepAlive=30000
 
GenericServer localhost:3283 on the air.
 
</pre>
 
 
===Starting an ECF Generic Server with java only===
 
 
It is possible to start ECF server and not execute eclipse binary... Eclipse package and ECF plugin are still required, though. Keep in mind that provided example very likely contains paths and package versions not existing in your system, so you will have to tweak it a little bit. In short - I included all org.eclipse.ecf*.jar packages (I am sure not all of them are necessary), and following ones: org.eclipse.equinox.common_*.jar, org.eclipse.core.runtime.compatibility.registry_*.jar, org.eclipse.equinox.registry_*.jar, org.eclipse.osgi.services_*.jar, org.eclipse.osgi_*.jar, org.eclipse.core.jobs_*.jar and org.eclipse.equinox.app_*.jar. Run following command (in single line):
 
 
<pre>
 
java -Dfile.encoding=ISO-8859-1
 
-classpath /home/ecf/eclipse/plugins/org.eclipse.equinox.common_3.4.0.v20080421-2006.jar:/home/ecf/eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.200.v20080610.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.equinox.registry_3.4.0.v20080516-0950.jar:/home/ecf/eclipse/plugins/org.eclipse.osgi.services_3.1.200.v20071203.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar:/home/ecf/eclipse/plugins/org.eclipse.core.jobs_3.4.0.v20080512.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.equinox.app_1.1.0.v20080421-2006.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf.discovery_2.1.0.v20081224-1728.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf.identity_2.0.0.v20080611-1715.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf.server.generic_1.2.1.v20081224-1728.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf.provider_1.3.0.v20081224-1728.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf.sharedobject_1.3.100.v20081224-1728.jar
 
:/home/ecf/eclipse/plugins/org.eclipse.ecf_2.0.0.v20080611-1715.jar
 
org.eclipse.ecf.server.generic.app.ServerApplication
 
-c /home/ecf/server.xml
 
</pre>
 
 
This will start server(s) and group(s) configured in server.xml file. To run it with defaults, just omit <pre>-c /home/ecf/server.xml</pre> from end of this command.
 
 
===Setting up an ECF Generic Server with Equinox===
 
 
With the following enhancement: {{bug|112890}}, it's possible to configure an ECF generic server by providing a plugin with an extension for the '''org.eclipse.ecf.server.generic.configure''' extension point.
 
 
*Download the [http://download.eclipse.org/eclipse/equinox/ Equinox SDK 3.3M6 (or newer)] Note the location of the '''<equinoxhome>/plugins''' directory.
 
*Install the ECF SDK bundles to the '''<equinoxhome>/plugins''' directory.  Get the ECF SDK [http://www.eclipse.org/ecf/downloads.php here].
 
*ECF server requires the Eclipse bundle: '''org.eclipse.core.jobs''', which is not yet part of the Equinox distribution. The jobs bundle can be found in the '''<eclipsehome>/plugins''' directory of an Eclipse installation, and has a name similar to:  org.eclipse.core.jobs_3.3.0.v20070423.jar (the 3.3.0.v20070423 may be different).  You should '''copy''' this jar into the '''<equinoxhome>/plugins''' directory.  Make sure you do not remove or rename the original copy of this bundle as it will disable that copy of Eclipse.
 
*Start/Run the generic server app as described above in '''Starting an ECF Generic Server as Eclipse Application'''.
 
 
OR
 
 
*Create a new plugin, and add the following extension to this new plugin:
 
<source lang="xml">
 
  <extension
 
        point="org.eclipse.ecf.server.generic.configuration">
 
      <connector
 
            hostname="localhost"
 
            keepAlive="30000"
 
            port="3283">
 
        <group
 
              name="server">
 
        </group>
 
      </connector>
 
  </extension>
 
</source>
 
 
With the above, the server id would be 'ecftcp://localhost:3283/server'.
 
 
Change the values of 'hostname', 'keepAlive', 'port' for the connector, and add groups as desired/appropriate.  For example:
 
 
<source lang="xml">
 
  <extension
 
        point="org.eclipse.ecf.server.generic.configuration">
 
      <connector
 
            hostname="ecf.eclipse.org"
 
            keepAlive="20000"
 
            port="9999">
 
        <group
 
              name="groupone">
 
        </group>
 
        <group
 
              name="grouptwo">
 
        </group>
 
      </connector>
 
  </extension>
 
</source>
 
 
*With the above, the ids for the two groups would be 'ecftcp://ecf.eclipse.org:9999/groupone' and 'ecftcp://ecf.eclipse.org:9999/grouptwo'.
 
*Build and deploy this new plugin to server plugins directory, along with all the other ECF bundles.
 
*Start the '''org.eclipse.ecf.server.generic''' bundle.  This can be done via the server console (with ''''start org.eclipse.ecf.server.generic'''') or can be setup to start automatically via the '''<appserverhome>webapps/bridge/WEB-INF/platform/configuration/config.ini''' file. Which is chosen is dependent upon how one has setup the [http://www.eclipse.org/equinox/server/ Equinox server].
 
 
===Plugins for ECF 3.0 with Eclipse 3.5===
 
You need these plugins to start the server:
 
 
*org.eclipse.core.runtime_3.5.0.v20090525.jar
 
*org.eclipse.core.jobs_3.4.100.v20090429-1800.jar
 
*org.eclipse.core.contenttype_3.4.0.v20090429-1800.jar
 
*org.eclipse.equinox.app_1.2.0.v20090520-1800.jar
 
*org.eclipse.equinox.common_3.5.0.v20090520-1800.jar
 
*org.eclipse.equinox.concurrent_1.0.0.v20090520-1800.jar
 
*org.eclipse.equinox.preferences_3.2.300.v20090520-1800.jar
 
*org.eclipse.equinox.registry_3.4.100.v20090520-1800.jar
 
*org.eclipse.ecf_3.0.0.v20090604-1131.jar
 
*org.eclipse.ecf.discovery_3.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.identity_3.0.0.v20090604-1131.jar
 
*org.eclipse.ecf.provider_2.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.provider.remoteservice_3.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.remoteservice_3.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.server.generic_2.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.sharedobject_2.0.0.v20090616-0832.jar
 
*org.eclipse.ecf.server_2.0.0.v20090616-0832.jar
 
 
Sources for plugins: Eclipse Installation + ECF 3.0 from [http://www.eclipse.org/downloads/download.php?file=/rt/ecf/3.0/3.5/org.eclipse.ecf.sdk-3.0.0.v20090616-0832.zip Zip file] or [http://download.eclipse.org/rt/ecf/3.0/3.5/repo Update site]
 
 
===ECF 3.1===
 
#Download and install ECF 3.1 as it is outlined [http://www.eclipse.org/ecf/downloads.php here].
 
#When you are prompted to restart, do so.
 
#After Eclipse restarts, shutdown Eclipse.
 
#Now you can start the ECF server from the command line. When you wish to shutdown the server, enter the <code>exit</code> command to the OSGi console.
 
 
<pre>
 
eclipse.exe -console -nosplash -application org.eclipse.ecf.server.generic.Server
 
</pre>
 
 
If you have problems with the application starting up, you can add <tt>-consolelog</tt> to the command line and you may see the exceptions displayed there.
 
 
You might also try invoking the jar directly, using a command similar to this, run from the eclipse home directory - the exact command will depend on which version of ECF you have.
 
 
<pre>
 
java -jar plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar -console -nosplash -application org.eclipse.ecf.server.generic.Server
 
</pre>
 
 
You may see some exceptions in the log about SWTError and similar - you can ignore these, since they just mean that Eclipse is trying to initialise the user interface, but can't find a suitable window. There may be extra parameters you can add to the run command to allow it to run headless without complaining. Perhaps somebody can figure out what they are and add them here?
 
  
 
{{ECF}}
 
{{ECF}}

Revision as of 19:26, 3 March 2011

ECF Generic Server

ECF Generic Servers can now be created, started, and managed dynamically using the IGenericServerContainerGroupFactory service started in the bundle activator of the org.eclipse.ecf.server.generic bundle.

Here some example code for creating/starting a simple ECF generic server

// Get generic server container group factory service...e.g. via declarative service injection
// or via ServiceTracker
IGenericServerContainerGroupFactory genericServerFactory = <get IGenericServerContainerGroupFactory service>;
// Create generic server container group for localhost, listen port=3282
IGenericServerContainerGroup containerGroup = genericServerFactory.createContainerGroup("localhost",3282);
// Create an ECF container within the container group, and give it path="/server"
containerGroup.createContainer("/server",30000,null);
// The resulting container's ID will be:  ecftcp://localhost:3282/server
// Now start listening for client connections
containerGroup.startListening();
Eclipse Communication Framework
API
API DocumentationJavadocProviders
Development
Development GuidelinesIntegrators Guide

Back to the top