use of org.eclipse.ecf.core.security.IConnectContext in project ecf by eclipse.
the class GenericClientApplication method createContainer.
protected ISharedObjectContainer createContainer() throws ContainerCreateException {
IContainerFactory f = Activator.getDefault().getContainerManager().getContainerFactory();
ClientSOContainer client = (ClientSOContainer) ((clientId == null) ? f.createContainer(GENERIC_CLIENT_CONTAINER_TYPE) : f.createContainer(GENERIC_CLIENT_CONTAINER_TYPE, clientId));
if (password != null) {
client.setConnectInitiatorPolicy(new IConnectInitiatorPolicy() {
public void refresh() {
// nothing
}
public Object createConnectData(IContainer container, ID targetID, IConnectContext context) {
return password;
}
public int getConnectTimeout() {
return 30000;
}
});
}
return client;
}
use of org.eclipse.ecf.core.security.IConnectContext in project ecf by eclipse.
the class SSLGenericClientApplication method createContainer.
protected ISharedObjectContainer createContainer() throws ContainerCreateException {
IContainerFactory f = Activator.getDefault().getContainerManager().getContainerFactory();
ClientSOContainer client = (ClientSOContainer) ((clientId == null) ? f.createContainer(GENERIC_SSL_CLIENT) : f.createContainer(GENERIC_SSL_CLIENT, clientId));
if (password != null) {
client.setConnectInitiatorPolicy(new IConnectInitiatorPolicy() {
public void refresh() {
// nothing
}
public Object createConnectData(IContainer container, ID targetID, IConnectContext context) {
return password;
}
public int getConnectTimeout() {
return 30000;
}
});
}
return client;
}
use of org.eclipse.ecf.core.security.IConnectContext 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;
}
}
use of org.eclipse.ecf.core.security.IConnectContext in project ecf by eclipse.
the class XMPPSContainer method createConnection.
protected ISynchAsynchConnection createConnection(ID remoteSpace, Object data) throws ConnectionCreateException {
boolean google = isGoogle(remoteSpace);
CallbackHandler ch = data instanceof IConnectContext ? ((IConnectContext) data).getCallbackHandler() : null;
return new ECFConnection(google, getConnectNamespace(), receiver, ch);
}
Aggregations