Plugins using this extension point can define a new implementation of any desired communications protocol, and expose that protocol as an instance of an IContainer. When client requests are made to ECF ContainerFactory to create IContainer instances, those requests will be re-directed to the given IContainer implementer.
<!ELEMENT extension (containerFactory+)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT containerFactory EMPTY>
<!ATTLIST containerFactory
class CDATA #REQUIRED
name CDATA #IMPLIED
description CDATA #IMPLIED
server (true | false)
hidden (true | false) >
The container factory extension point. Can optionally contain a list of 'defaultargument' elements that describe the arguments (and provide default values) to be passed to provider implementation
<extension point="org.eclipse.ecf.containerFactory"> <containerFactory name="foo" class="org.eclipse.ecf.test.FooInstantiator" description="My container factory"/> </extension>Here is some example code to implement this class:
package org.eclipse.ecf.test;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.ContainerInstantiationException;
import org.eclipse.ecf.core.provider.IContainerInstantiator;
public class FooInstantiator implements IContainerInstantiator {
public FooInstantiator() {
super();
}
public IContainer createInstance(ContainerTypeDescription description, Class[] argTypes, Object[] args)
throws ContainerInstantiationException {
// Create/return instance of FooContainer
// Note that FooContainer class must
// implement IContainer
return new FooContainer();
}
}
In this example, the given class implements the IContainerInstantiator.createInstance method by creating and returning a new instance of FooInstantiator, a class also defined in the extension plugin. As noted in the code, this class must implement IContainer, so that it can successfully be returned from createInstance.
IContainer newContainer = ContainerFactory.getDefault().createContainer('foo');
// Further use of newContainer instance here
Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: Composent, Inc. - initial API and implementation.