use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class Activator method disposeServiceRegistration.
/**
* @param serviceRegistration disconnects the underlying IContainer and unregisters the service
*/
private void disposeServiceRegistration(ServiceRegistration serviceRegistration) {
final ServiceReference reference = serviceRegistration.getReference();
final IContainer aContainer = (DnsSdDiscoveryContainerAdapter) context.getService(reference);
serviceRegistration.unregister();
final IContainer container = (IContainer) aContainer.getAdapter(IContainer.class);
container.dispose();
container.disconnect();
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class RosterWriterHelper method getConnectedContainerAdapters.
private Object[] getConnectedContainerAdapters(Class adapterType) {
IContainer[] containers = getContainers();
List l = new ArrayList();
for (int i = 0; i < containers.length; i++) {
// Make sure connected
if (containers[i].getConnectedID() != null) {
Object o = containers[i].getAdapter(adapterType);
if (o != null)
l.add(o);
}
}
return (Object[]) l.toArray();
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class ShowAllRostersContribution method getContributionItems.
/* (non-Javadoc)
* @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
*/
protected IContributionItem[] getContributionItems() {
IAction action = new Action() {
public void run() {
// Get containers from container manager
IContainer[] containers = Activator.getDefault().getContainers();
List l = new ArrayList();
for (int i = 0; i < containers.length; i++) {
// Make sure the container is connected
if (containers[i].getConnectedID() != null) {
// Make sure container implements IPresenceContainerAdapter API
Object o = containers[i].getAdapter(IPresenceContainerAdapter.class);
if (o != null)
l.add(o);
}
}
IPresenceContainerAdapter[] adapters = (IPresenceContainerAdapter[]) l.toArray(new IPresenceContainerAdapter[] {});
for (int i = 0; i < adapters.length; i++) {
// Show all rosters on console...or do other things with it here.
new RosterWriterHelper().writeRosterToConsole(adapters[i].getRosterManager().getRoster());
}
}
};
action.setText("show all rosters on console");
return new IContributionItem[] { new ActionContributionItem(action) };
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class RpcContainerTest method testCreateContainer.
public void testCreateContainer() throws Exception {
IContainer container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
assertNotNull(container);
assertTrue(container instanceof RpcClientContainer);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class RpcContainerTest method testCreateContainer2.
public void testCreateContainer2() throws Exception {
ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
IContainer container = getContainerFactory().createContainer(description, new Object[] { new URL(RpcConstants.TEST_ECHO_TARGET) });
assertNotNull(container);
assertTrue(container instanceof RpcClientContainer);
}
Aggregations