use of org.eclipse.ecf.core.identity.IDCreateException 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.IDCreateException in project ecf by eclipse.
the class ChatRoomMessageHandler method preChatRoomConnect.
public void preChatRoomConnect(IChatRoomContainer roomContainer, ID roomID) {
// retrieve our name
ID connectedID = container.getConnectedID();
botName = connectedID.getName();
IChatID chatID = (IChatID) connectedID.getAdapter(IChatID.class);
if (chatID != null) {
botName = chatID.getUsername();
}
messageSenders.put(roomID, roomContainer.getChatRoomMessageSender());
if (password != null) {
try {
sendMessage(IDFactory.getDefault().createStringID("nickserv"), "identify " + password);
} catch (IDCreateException e) {
}
}
}
use of org.eclipse.ecf.core.identity.IDCreateException in project ecf by eclipse.
the class PHPBBParser method parseMessages.
public Map<ID, ThreadMessage> parseMessages(final CharSequence seq, final boolean newOnly) throws BBException {
Matcher matcher;
String title;
ThreadMessage msg;
final Map<ID, ThreadMessage> messages = new HashMap<ID, ThreadMessage>();
matcher = PAT_MSG.matcher(seq);
boolean anyFound = false;
while (matcher.find()) {
anyFound = true;
title = StringUtil.stripHTMLTrim(matcher.group(3));
if (StringUtil.notEmptyStr(title)) {
final ThreadMessageFactory tmf = new ThreadMessageFactory();
final String idStr = matcher.group(1);
ID id = null;
try {
id = tmf.createBBObjectId(namespace, baseURL, idStr);
} catch (final NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final IDCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
msg = (ThreadMessage) tmf.createBBObject(id, title, null);
messages.put(id, msg);
}
}
if (!anyFound) {
throw createPHPBBException("No messages found!", seq);
}
return messages;
}
use of org.eclipse.ecf.core.identity.IDCreateException in project ecf by eclipse.
the class PHPBBParser method parseForums.
/**
* Parses forum HTML output into a list of forums.
* @param seq
* @return map of ID -> Forum associations.
*/
public Map<ID, Forum> parseForums(final CharSequence seq) {
final Map<ID, Forum> forums = new LinkedHashMap<ID, Forum>();
final Matcher matcher = PAT_FORUM_OR_CATEGORY.matcher(seq);
Category lastCat = null;
while (matcher.find()) {
// Matched forum
if (matcher.group(2) != null) {
final String name = StringUtil.stripHTMLTrim(matcher.group(2));
final String desc = StringUtil.stripHTMLTrim(matcher.group(3));
if (StringUtil.notEmptyStr(name)) {
final ForumFactory ff = new ForumFactory();
final String idStr = matcher.group(1);
ID id = null;
try {
id = ff.createBBObjectId(namespace, baseURL, idStr);
} catch (final IDCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final Forum forum = (Forum) ff.createBBObject(id, name, null);
forum.setDescription(desc);
if (lastCat != null) {
lastCat.addSubForum(forum);
forum.setParent(lastCat);
}
forums.put(id, forum);
}
}
// Matched category
if (matcher.group(5) != null) {
final String name = StringUtil.stripHTMLTrim(matcher.group(5));
if (StringUtil.notEmptyStr(name)) {
final CategoryFactory cf = new CategoryFactory();
final String idStr = matcher.group(4);
ID id = null;
try {
id = cf.createBBObjectId(namespace, baseURL, idStr);
} catch (final NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final IDCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
lastCat = (Category) cf.createBBObject(id, name, null);
forums.put(id, lastCat);
}
}
}
return forums;
}
use of org.eclipse.ecf.core.identity.IDCreateException in project ecf by eclipse.
the class VBParser method parseForums.
public Map<ID, Forum> parseForums(final CharSequence seq) {
Map<ID, Forum> forums = new LinkedHashMap<ID, Forum>();
Matcher matcher = PAT_FORUM.matcher(seq);
while (matcher.find()) {
String name = StringUtil.stripHTMLTrim(matcher.group(2));
// String desc = StringUtil.stripHTMLTrim(matcher.group(3));
if (StringUtil.notEmptyStr(name)) {
ForumFactory ff = new ForumFactory();
String idStr = matcher.group(1);
ID id = null;
try {
id = ff.createBBObjectId(namespace, baseURL, idStr);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IDCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Forum forum = (Forum) ff.createBBObject(id, name, null);
// forum.setDescription(desc);
forums.put(id, forum);
}
}
return forums;
}
Aggregations