use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class NoRegistryNamespaceTest method testGetNamespace.
public void testGetNamespace() throws Exception {
Namespace n = IDFactory.getDefault().getNamespaceByName(this.getClass().getName());
assertNotNull(n);
assertTrue(n.getName().equals(getClass().getName()));
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class UuIDTest method testGetNamespace.
public void testGetNamespace() throws Exception {
final ID id = createID();
final Namespace ns = id.getNamespace();
assertNotNull(ns);
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class UuIDTest method testEqualNamespaces.
public void testEqualNamespaces() throws Exception {
final ID id1 = createID();
final ID id2 = createID();
final Namespace ns1 = id1.getNamespace();
final Namespace ns2 = id2.getNamespace();
assertTrue(ns1.equals(ns2));
assertTrue(ns2.equals(ns2));
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class ServiceInfoFactory method createServiceTypeID.
/**
* @param endpointDescription endpoint description
* @param advertiser advertiser
* @return IServiceTypeID created service type ID
* @since 3.0
*/
protected IServiceTypeID createServiceTypeID(org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser) {
Namespace servicesNamespace = IDFactory.getDefault().getNamespaceByName(// $NON-NLS-1$
"ecf.namespace.discovery");
if (advertiser != null) {
servicesNamespace = advertiser.getServicesNamespace();
}
Map props = endpointDescription.getProperties();
String[] scopes = PropertiesUtil.getStringArrayWithDefault(props, RemoteConstants.DISCOVERY_SCOPE, IServiceTypeID.DEFAULT_SCOPE);
String[] protocols = PropertiesUtil.getStringArrayWithDefault(props, RemoteConstants.DISCOVERY_PROTOCOLS, IServiceTypeID.DEFAULT_SCOPE);
String namingAuthority = PropertiesUtil.getStringWithDefault(props, RemoteConstants.DISCOVERY_NAMING_AUTHORITY, IServiceTypeID.DEFAULT_NA);
return ServiceIDFactory.getDefault().createServiceTypeID(servicesNamespace, new String[] { RemoteConstants.DISCOVERY_SERVICE_TYPE }, scopes, protocols, namingAuthority);
}
use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.
the class ChatRoomBot 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
// $NON-NLS-1$
throw new ContainerConnectException("Already connected");
targetID = IDFactory.getDefault().createID(namespace, bot.getConnectID());
IChatRoomManager manager = (IChatRoomManager) container.getAdapter(IChatRoomManager.class);
if (manager == null)
// $NON-NLS-1$
throw new ECFException("No chat room manager available");
firePreConnect();
String password = bot.getPassword();
IConnectContext context = (password == null) ? null : ConnectContextFactory.createPasswordConnectContext(password);
container.connect(targetID, context);
String[] roomNames = bot.getChatRooms();
String[] roomPasswords = bot.getChatRoomPasswords();
for (int i = 0; i < roomNames.length; i++) {
IChatRoomInfo room = manager.getChatRoomInfo(roomNames[i]);
roomContainer = room.createChatRoomContainer();
roomID = room.getRoomID();
firePreRoomConnect();
roomContainer.addMessageListener(this);
IConnectContext roomContext = (roomPasswords[i] == null) ? null : ConnectContextFactory.createPasswordConnectContext(roomPasswords[i]);
roomContainer.connect(roomID, roomContext);
}
} catch (ECFException e) {
if (container != null) {
if (container.getConnectedID() != null) {
container.disconnect();
}
container.dispose();
}
container = null;
throw e;
}
}
Aggregations