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 Connection Creation and Management"

(IContainer instance creation)
Line 5: Line 5:
 
In ECF, connections are represented as implementations of the [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/core/IContainer.html IContainer] interface.
 
In ECF, connections are represented as implementations of the [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/core/IContainer.html IContainer] interface.
  
===IContainer instance creation===
+
===Connection creation===
  
 
IContainer instances are created via instances of [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/core/IContainerFactory.html IConnectionFactory].
 
IContainer instances are created via instances of [http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/core/IContainerFactory.html IConnectionFactory].
Line 26: Line 26:
  
 
There are a number of createContainer methods on the IContainerFactory, to support a variety of cases for creating/configuring IContainer instances.
 
There are a number of createContainer methods on the IContainerFactory, to support a variety of cases for creating/configuring IContainer instances.
 +
 +
==Connection==
  
 
Once an IContainer instance has be created, it may be used to first create a target ID (address), and then connect to it:
 
Once an IContainer instance has be created, it may be used to first create a target ID (address), and then connect to it:
Line 38: Line 40:
 
If the connect call completes successfully, the container is then connected.
 
If the connect call completes successfully, the container is then connected.
  
 +
==Container Adapters==
 
Either before or after the connection, the client may wish to get an adapter from the IContainer in order to communicate in specific ways supported by the implementation.
 
Either before or after the connection, the client may wish to get an adapter from the IContainer in order to communicate in specific ways supported by the implementation.
  
Line 49: Line 52:
 
</pre>
 
</pre>
  
By way of introduction, here's a snippet that creat
+
==Providers==
 +
 
 +
ECF provider implementations are defined by implementing two extension points:
 +
 
  
==API Reference==
+
==Reference==
  
 
[[ECF_API_Docs#ECF_Core | Core API - bundle docs]]
 
[[ECF_API_Docs#ECF_Core | Core API - bundle docs]]
 
[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/org.eclipse.ecf.tests/?root=Technology_Project Core API - test code]]
 
[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/tests/org.eclipse.ecf.tests/?root=Technology_Project Core API - test code]]
 +
[http://help.eclipse.org/ganymede/index.jsp ECF docs in Eclipse help]

Revision as of 14:42, 23 September 2008

Introduction

ECF's core API provides support for connection management...i.e. connection creation, connect, disconnect, entry point access to protocol-specific capabilities, platform-wide connection management, etc.

In ECF, connections are represented as implementations of the IContainer interface.

Connection creation

IContainer instances are created via instances of IConnectionFactory.

IConnectionFactory instances can be accessed as an OSGi service, or statically:

IContainerFactory factory = ContainerFactory.getDefault();

or

IContainerFactory factory = (IContainerFactory) factoryServiceTracker.getService();

where factoryServiceTracker is a ServiceTracker that has been setup to get the org.eclipse.ecf.core.IContainerFactory service. Once a factory is available, IContainer instances can then be created:

IContainer container = factory.createContainer("ecf.xmpp.smack");

There are a number of createContainer methods on the IContainerFactory, to support a variety of cases for creating/configuring IContainer instances.

Connection

Once an IContainer instance has be created, it may be used to first create a target ID (address), and then connect to it:

// Create targetID
ID targetID = IDFactory.getDefault().createID(container.getConnectNamespace(),"fliwatuet@ecf.eclipse.org");
// Connect
container.connect(targetID,null);

If the connect call completes successfully, the container is then connected.

Container Adapters

Either before or after the connection, the client may wish to get an adapter from the IContainer in order to communicate in specific ways supported by the implementation.

IDatashareContainerAdapter datashare = (IDatashareContainerAdapter) container.getAdapter(IDatashareContainerAdapter.class);
if (datashare != null) { 
...use 
} else {
...this provider does not implement this adapter
}

Providers

ECF provider implementations are defined by implementing two extension points:


Reference

Core API - bundle docs Core API - test code] ECF docs in Eclipse help

Copyright © Eclipse Foundation, Inc. All Rights Reserved.