use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class Forum method getThreads.
public Collection<IThread> getThreads() {
PHPBBParser parser = (PHPBBParser) bb.getParser();
Map<ID, IThread> threadMap = null;
try {
WebRequest request = new GetRequest(bb.getHttpClient(), new URL(id.toExternalForm()), "");
request.addParameter(new NameValuePair("f", String.valueOf(id.getLongValue())));
request.execute();
String resp = request.getResponseBodyAsString();
request.releaseConnection();
threadMap = parser.parseThreads(resp);
for (IThread thread : threadMap.values()) {
((AbstractBBObject) thread).setBulletinBoard(bb);
((Thread) thread).forum = this;
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new HashSet<IThread>(threadMap.values());
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class Forum method getThreads.
public Collection<IThread> getThreads() {
VBParser parser = (VBParser) bb.getParser();
Map<ID, IThread> threadMap = null;
WebRequest request = new GetRequest(bb.getHttpClient(), getURL(), "");
request.addParameter(new NameValuePair("f", String.valueOf(id.getLongValue())));
try {
request.execute();
String resp = request.getResponseBodyAsString();
request.releaseConnection();
threadMap = parser.parseThreads(resp);
for (IThread thread : threadMap.values()) {
((AbstractBBObject) thread).setBulletinBoard(bb);
((Thread) thread).forum = this;
}
} catch (IOException e) {
e.printStackTrace();
}
return new HashSet<IThread>(threadMap.values());
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class XMPPHyperlink method getContainers.
protected IContainer[] getContainers() {
final IContainerManager manager = Activator.getDefault().getContainerManager();
if (manager == null)
return EMPTY;
final List results = new ArrayList();
final IContainer[] containers = manager.getAllContainers();
for (int i = 0; i < containers.length; i++) {
final ID connectedID = containers[i].getConnectedID();
// Must be connected and ID of correct type
if (connectedID != null && ((isXMPPS && containers[i] instanceof XMPPSContainer) || (!isXMPPS && containers[i] instanceof XMPPContainer)))
results.add(containers[i]);
}
return (IContainer[]) results.toArray(EMPTY);
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class XMPPChatRoomContainer method disconnect.
public void disconnect() {
final ID groupID = getConnectedID();
fireContainerEvent(new ContainerDisconnectingEvent(this.getID(), groupID));
synchronized (getConnectLock()) {
// If we are currently connected
if (isConnected()) {
try {
multiuserchat.leave();
} catch (final Exception e) {
// $NON-NLS-1$
traceStack("Exception in multi user chat.leave", e);
}
}
connectionState = DISCONNECTED;
remoteServerID = null;
if (containerHelper != null)
containerHelper.disconnect();
this.connection = null;
}
// notify listeners
fireContainerEvent(new ContainerDisconnectedEvent(this.getID(), groupID));
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class XMPPChatRoomContainer method sendMessage.
protected void sendMessage(ContainerMessage data) throws IOException {
synchronized (getConnectLock()) {
final ID toID = data.getToContainerID();
if (toID == null) {
data.setToContainerID(remoteServerID);
}
super.sendMessage(data);
}
}
Aggregations