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.
Difference between revisions of "ECF Connection Creation and Management"
(→IContainer instance creation) |
(→IContainer instance creation) |
||
Line 19: | Line 19: | ||
</pre> | </pre> | ||
+ | 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 be created: | ||
+ | |||
+ | <pre> | ||
+ | IContainer container = factory.createContainer("ecf.xmpp.smack"); | ||
+ | </pre> | ||
Revision as of 14:28, 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.
IContainer instance 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 be created:
IContainer container = factory.createContainer("ecf.xmpp.smack");
By way of introduction, here's a snippet that creat