Search in sources :

Example 71 with ID

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());
}
Also used : NameValuePair(org.apache.commons.httpclient.NameValuePair) AbstractBBObject(org.eclipse.ecf.internal.bulletinboard.commons.AbstractBBObject) WebRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) ID(org.eclipse.ecf.core.identity.ID) ForumID(org.eclipse.ecf.internal.provider.phpbb.identity.ForumID) IOException(java.io.IOException) URL(java.net.URL) IThread(org.eclipse.ecf.bulletinboard.IThread) HashSet(java.util.HashSet)

Example 72 with ID

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());
}
Also used : NameValuePair(org.apache.commons.httpclient.NameValuePair) AbstractBBObject(org.eclipse.ecf.internal.bulletinboard.commons.AbstractBBObject) WebRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) ID(org.eclipse.ecf.core.identity.ID) ForumID(org.eclipse.ecf.internal.provider.vbulletin.identity.ForumID) IOException(java.io.IOException) IThread(org.eclipse.ecf.bulletinboard.IThread) HashSet(java.util.HashSet)

Example 73 with ID

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);
}
Also used : XMPPSContainer(org.eclipse.ecf.provider.xmpp.XMPPSContainer) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) XMPPID(org.eclipse.ecf.provider.xmpp.identity.XMPPID) ID(org.eclipse.ecf.core.identity.ID) XMPPSID(org.eclipse.ecf.provider.xmpp.identity.XMPPSID) XMPPContainer(org.eclipse.ecf.provider.xmpp.XMPPContainer)

Example 74 with ID

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));
}
Also used : XMPPRoomID(org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID) ID(org.eclipse.ecf.core.identity.ID) ContainerDisconnectingEvent(org.eclipse.ecf.core.events.ContainerDisconnectingEvent) ECFException(org.eclipse.ecf.core.util.ECFException) ConnectionCreateException(org.eclipse.ecf.provider.comm.ConnectionCreateException) XMPPException(org.jivesoftware.smack.XMPPException) IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) IOException(java.io.IOException) ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) SharedObjectAddException(org.eclipse.ecf.core.sharedobject.SharedObjectAddException) ContainerDisconnectedEvent(org.eclipse.ecf.core.events.ContainerDisconnectedEvent)

Example 75 with ID

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);
    }
}
Also used : XMPPRoomID(org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID) ID(org.eclipse.ecf.core.identity.ID)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)256 IContainer (org.eclipse.ecf.core.IContainer)29 IOException (java.io.IOException)19 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)18 UUID (java.util.UUID)17 HashMap (java.util.HashMap)12 ArrayList (java.util.ArrayList)11 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)11 GUID (org.eclipse.ecf.core.identity.GUID)11 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)11 XMPPRoomID (org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID)11 Namespace (org.eclipse.ecf.core.identity.Namespace)10 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)10 Map (java.util.Map)9 Matcher (java.util.regex.Matcher)9 ECFException (org.eclipse.ecf.core.util.ECFException)9 List (java.util.List)8 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)8 IChannel (org.eclipse.ecf.datashare.IChannel)8 Iterator (java.util.Iterator)7