use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class ServiceURLAdapter method setIServiceTypeID.
private void setIServiceTypeID(final ServiceURL aServiceURL, final String[] scopes) {
final Namespace namespace = IDFactory.getDefault().getNamespaceByName(JSLPNamespace.NAME);
serviceID = (IServiceTypeID) namespace.createInstance(new Object[] { aServiceURL, scopes });
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class AbstractPresenceTestCase method getServerConnectID.
protected ID getServerConnectID(int client) {
final IContainer container = getClient(client);
final Namespace connectNamespace = container.getConnectNamespace();
final String username = getUsername(client);
try {
return IDFactory.getDefault().createID(connectNamespace, username);
} catch (final IDCreateException e) {
fail("Could not create server connect ID");
return null;
}
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class IMBot method connect.
public synchronized void connect() throws ECFException {
fireInitBot();
try {
Namespace namespace = null;
if (container == null) {
container = ContainerFactory.getDefault().createContainer(bot.getContainerFactoryName());
namespace = container.getConnectNamespace();
} else
throw new ContainerConnectException("Already connected");
targetID = IDFactory.getDefault().createID(namespace, bot.getConnectID());
firePreConnect();
IPresenceContainerAdapter presenceAdapter = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
presenceAdapter.getChatManager().addMessageListener(this);
String password = bot.getPassword();
IConnectContext context = (password == null) ? null : ConnectContextFactory.createPasswordConnectContext(password);
container.connect(targetID, context);
} catch (ECFException e) {
if (container != null) {
if (container.getConnectedID() != null) {
container.disconnect();
}
container.dispose();
}
container = null;
throw e;
}
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class JSLPServiceIDTest method testjSLPDefaultsToECF.
public void testjSLPDefaultsToECF() {
Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
IServiceTypeID stid = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, DiscoveryTestHelper.SERVICES, new String[] { DiscoveryTestHelper.SCOPE }, DiscoveryTestHelper.PROTOCOLS, DiscoveryTestHelper.NAMINGAUTHORITY);
assertNotNull(stid);
assertEquals(DiscoveryTestHelper.NAMINGAUTHORITY, stid.getNamingAuthority());
assertEquals("_ecf._junit._tests._someProtocol." + DiscoveryTestHelper.SCOPE + "._" + DiscoveryTestHelper.NAMINGAUTHORITY, stid.getName());
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class JSLPServiceIDTest method testECFDefaultsTojSLP.
public void testECFDefaultsTojSLP() {
Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
IServiceTypeID stid = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, DiscoveryTestHelper.SERVICES, DiscoveryTestHelper.PROTOCOLS);
assertNotNull(stid);
assertTrue(Arrays.equals(DiscoveryTestHelper.SERVICES, stid.getServices()));
assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_SCOPE, stid.getScopes()));
assertTrue(Arrays.equals(DiscoveryTestHelper.PROTOCOLS, stid.getProtocols()));
String internal = stid.getInternal();
assertEquals("service:" + DiscoveryTestHelper.SERVICES[0] + ":" + DiscoveryTestHelper.SERVICES[1] + ":" + DiscoveryTestHelper.SERVICES[2], internal);
}
Aggregations