Search in sources :

Example 6 with Namespace

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 });
}
Also used : JSLPNamespace(org.eclipse.ecf.provider.jslp.identity.JSLPNamespace) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 7 with Namespace

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;
    }
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) IContainer(org.eclipse.ecf.core.IContainer) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 8 with Namespace

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;
    }
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IConnectContext(org.eclipse.ecf.core.security.IConnectContext) ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) ECFException(org.eclipse.ecf.core.util.ECFException) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 9 with Namespace

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());
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) JSLPNamespace(org.eclipse.ecf.provider.jslp.identity.JSLPNamespace) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 10 with Namespace

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);
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) JSLPNamespace(org.eclipse.ecf.provider.jslp.identity.JSLPNamespace) Namespace(org.eclipse.ecf.core.identity.Namespace)

Aggregations

Namespace (org.eclipse.ecf.core.identity.Namespace)51 ID (org.eclipse.ecf.core.identity.ID)10 IServiceTypeID (org.eclipse.ecf.discovery.identity.IServiceTypeID)10 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)9 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)5 JSLPNamespace (org.eclipse.ecf.provider.jslp.identity.JSLPNamespace)4 GUID (org.eclipse.ecf.core.identity.GUID)3 UnknownHostException (java.net.UnknownHostException)2 UUID (java.util.UUID)2 IContainer (org.eclipse.ecf.core.IContainer)2 ContainerConnectedEvent (org.eclipse.ecf.core.events.ContainerConnectedEvent)2 ContainerConnectingEvent (org.eclipse.ecf.core.events.ContainerConnectingEvent)2 StringID (org.eclipse.ecf.core.identity.StringID)2 IConnectContext (org.eclipse.ecf.core.security.IConnectContext)2 ECFException (org.eclipse.ecf.core.util.ECFException)2 ServiceTypeID (org.eclipse.ecf.discovery.identity.ServiceTypeID)2 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)2 SimpleResolver (org.xbill.DNS.SimpleResolver)2 URI (java.net.URI)1 Map (java.util.Map)1