Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 180796 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ecf/internal/provider/vbulletin/Thread.java (-6 / +6 lines)
Lines 67-77 Link Here
67
		return forum;
67
		return forum;
68
	}
68
	}
69
69
70
	public List<IThreadMessage> getMessages() throws BBException {
70
	public IThreadMessage[] getMessages() throws BBException {
71
		return getNewMessages();
71
		return getNewMessages();
72
	}
72
	}
73
73
74
	public List<IThreadMessage> getNewMessages() throws BBException {
74
	public IThreadMessage[] getNewMessages() throws BBException {
75
		ThreadBrowser2 browser = new ThreadBrowser2((VBulletin) bb, this);
75
		ThreadBrowser2 browser = new ThreadBrowser2((VBulletin) bb, this);
76
		List<IThreadMessage> msgs = browser.fetchNewMessages();
76
		List<IThreadMessage> msgs = browser.fetchNewMessages();
77
		if (msgs.size() > 0) {
77
		if (msgs.size() > 0) {
Lines 85-94 Link Here
85
				((Member) author).setBulletinBoard(bb);
85
				((Member) author).setBulletinBoard(bb);
86
			}
86
			}
87
		}
87
		}
88
		return msgs;
88
		return msgs.toArray(new IThreadMessage[msgs.size()]);
89
	}
89
	}
90
90
91
	public List<IThreadMessage> getNewMessages(ID lastReadId)
91
	public IThreadMessage[] getNewMessages(ID lastReadId)
92
			throws BBException {
92
			throws BBException {
93
		if (lastReadId != null) {
93
		if (lastReadId != null) {
94
			lastReadMessageId = (ThreadMessageID) lastReadId;
94
			lastReadMessageId = (ThreadMessageID) lastReadId;
Lines 144-150 Link Here
144
		request.addParameters(params);
144
		request.addParameters(params);
145
		params = new NameValuePair[] {
145
		params = new NameValuePair[] {
146
				new NameValuePair("title", message.getName()),
146
				new NameValuePair("title", message.getName()),
147
				new NameValuePair("message", msg.getMessage()),
147
				new NameValuePair("message", msg.getBody()),
148
				new NameValuePair("iconid", "0"), new NameValuePair("s", ""),
148
				new NameValuePair("iconid", "0"), new NameValuePair("s", ""),
149
				new NameValuePair("do", "postreply"),
149
				new NameValuePair("do", "postreply"),
150
				new NameValuePair("t", String.valueOf(id.getLongValue())) };
150
				new NameValuePair("t", String.valueOf(id.getLongValue())) };
Lines 226-232 Link Here
226
		return id.hashCode();
226
		return id.hashCode();
227
	}
227
	}
228
228
229
	public IMember getAuthor() {
229
	public IMember getPoster() {
230
		return author;
230
		return author;
231
	}
231
	}
232
232
(-)src/org/eclipse/ecf/internal/provider/vbulletin/MemberGroup.java (-43 / +28 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.vbulletin;
11
package org.eclipse.ecf.internal.provider.vbulletin;
12
12
13
import java.util.Collection;
13
import java.util.Arrays;
14
import java.util.Collections;
15
14
16
import org.eclipse.ecf.bulletinboard.IMember;
15
import org.eclipse.ecf.bulletinboard.IMember;
17
import org.eclipse.ecf.bulletinboard.IMemberGroup;
16
import org.eclipse.ecf.bulletinboard.IMemberGroup;
Lines 30-54 Link Here
30
	}
29
	}
31
30
32
	private void attainDetailsFetched() {
31
	private void attainDetailsFetched() {
33
		/*if (!detailsFetched) {
32
		/*
34
			GetRequest request = new GetRequest(bb.getHttpClient(),
33
		 * if (!detailsFetched) { GetRequest request = new
35
					bb.getURL(), "groupcp.php");
34
		 * GetRequest(bb.getHttpClient(), bb.getURL(), "groupcp.php");
36
			request.addParameter(new NameValuePair("g", String.valueOf(id
35
		 * request.addParameter(new NameValuePair("g", String.valueOf(id
37
					.getLongValue())));
36
		 * .getLongValue()))); request.execute(); String resp = null; try { resp =
38
			request.execute();
37
		 * request.getResponseBodyAsString(); } catch (IOException e) {
39
			String resp = null;
38
		 * e.printStackTrace(); } request.releaseConnection(); if (resp != null) {
40
			try {
39
		 * MemberGroup group = bb.getParser().parseMemberGroup(resp);
41
				resp = request.getResponseBodyAsString();
40
		 * group.detailsFetched = true; this.description =
42
			} catch (IOException e) {
41
		 * group.getDescription(); } }
43
				e.printStackTrace();
42
		 */
44
			}
45
			request.releaseConnection();
46
			if (resp != null) {
47
				MemberGroup group = bb.getParser().parseMemberGroup(resp);
48
				group.detailsFetched = true;
49
				this.description = group.getDescription();
50
			}
51
		}*/
52
	}
43
	}
53
44
54
	public String getDescription() {
45
	public String getDescription() {
Lines 56-83 Link Here
56
		return description;
47
		return description;
57
	}
48
	}
58
49
59
	public Collection<IMember> getMembers() {
50
	public IMember[] getMembers() {
60
		/*Map<ID, Member> map = null;
51
		/*
61
		GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(),
52
		 * Map<ID, Member> map = null; GetRequest request = new
62
				"groupcp.php");
53
		 * GetRequest(bb.getHttpClient(), bb.getURL(), "groupcp.php");
63
		request.addParameter(new NameValuePair("g", String.valueOf(id
54
		 * request.addParameter(new NameValuePair("g", String.valueOf(id
64
				.getLongValue())));
55
		 * .getLongValue()))); request.execute(); String resp = null; try { resp =
65
		request.execute();
56
		 * request.getResponseBodyAsString(); } catch (IOException e) {
66
		String resp = null;
57
		 * e.printStackTrace(); } request.releaseConnection(); if (resp != null) {
67
		try {
58
		 * map = bb.getParser().parseMemberLinks(resp); for (Member member :
68
			resp = request.getResponseBodyAsString();
59
		 * map.values()) { member.bb = bb; } } return new HashSet<IMember>(map.values());
69
		} catch (IOException e) {
60
		 */
70
			e.printStackTrace();
61
		return new IMember[0];
71
		}
72
		request.releaseConnection();
73
		if (resp != null) {
74
			map = bb.getParser().parseMemberLinks(resp);
75
			for (Member member : map.values()) {
76
				member.bb = bb;
77
			}
78
		}
79
		return new HashSet<IMember>(map.values());*/
80
		return Collections.emptyList();
81
	}
62
	}
82
63
83
	public ID getID() {
64
	public ID getID() {
Lines 101-104 Link Here
101
	public int hashCode() {
82
	public int hashCode() {
102
		return id.hashCode();
83
		return id.hashCode();
103
	}
84
	}
85
86
	public boolean isMember(IMember member) {
87
		return Arrays.asList(getMembers()).contains(member);
88
	}
104
}
89
}
(-)src/org/eclipse/ecf/internal/provider/vbulletin/ThreadMessage.java (-7 / +7 lines)
Lines 15-21 Link Here
15
import java.util.Date;
15
import java.util.Date;
16
16
17
import org.eclipse.ecf.bulletinboard.IMember;
17
import org.eclipse.ecf.bulletinboard.IMember;
18
import org.eclipse.ecf.bulletinboard.IMessageBase;
18
import org.eclipse.ecf.bulletinboard.IBBMessage;
19
import org.eclipse.ecf.bulletinboard.IThread;
19
import org.eclipse.ecf.bulletinboard.IThread;
20
import org.eclipse.ecf.bulletinboard.IThreadMessage;
20
import org.eclipse.ecf.bulletinboard.IThreadMessage;
21
import org.eclipse.ecf.bulletinboard.IllegalWriteException;
21
import org.eclipse.ecf.bulletinboard.IllegalWriteException;
Lines 53-72 Link Here
53
		return number;
53
		return number;
54
	}
54
	}
55
55
56
	public String getMessage() {
56
	public String getBody() {
57
		return message;
57
		return message;
58
	}
58
	}
59
59
60
	public IMember getFrom() {
60
	public IMember getPoster() {
61
		return author;
61
		return author;
62
	}
62
	}
63
63
64
	public IMessageBase getReplyTo() {
64
	public IBBMessage getReplyTo() {
65
		// TODO Implement reply relationships
65
		// TODO Implement reply relationships
66
		return null;
66
		return null;
67
	}
67
	}
68
68
69
	public void setReplyTo(IMessageBase message) throws IllegalWriteException {
69
	public void setReplyTo(IBBMessage message) throws IllegalWriteException {
70
		// TODO Auto-generated method stub
70
		// TODO Auto-generated method stub
71
	}
71
	}
72
72
Lines 95-108 Link Here
95
		this.thread = thread;
95
		this.thread = thread;
96
	}
96
	}
97
97
98
	public void setName(String name) throws IllegalWriteException {
98
	public void setTitle(String name) throws IllegalWriteException {
99
		if ((mode & READ_ONLY) == READ_ONLY) {
99
		if ((mode & READ_ONLY) == READ_ONLY) {
100
			throw new IllegalWriteException(E_READ_ONLY);
100
			throw new IllegalWriteException(E_READ_ONLY);
101
		}
101
		}
102
		this.name = name;
102
		this.name = name;
103
	}
103
	}
104
104
105
	public void setMessage(String message) throws IllegalWriteException {
105
	public void setBody(String message) throws IllegalWriteException {
106
		if ((mode & READ_ONLY) == READ_ONLY) {
106
		if ((mode & READ_ONLY) == READ_ONLY) {
107
			throw new IllegalWriteException(E_READ_ONLY);
107
			throw new IllegalWriteException(E_READ_ONLY);
108
		}
108
		}
(-)src/org/eclipse/ecf/internal/provider/vbulletin/VBulletin.java (-6 / +5 lines)
Lines 22-28 Link Here
22
import org.eclipse.ecf.bulletinboard.IForum;
22
import org.eclipse.ecf.bulletinboard.IForum;
23
import org.eclipse.ecf.bulletinboard.IThread;
23
import org.eclipse.ecf.bulletinboard.IThread;
24
import org.eclipse.ecf.bulletinboard.IThreadMessage;
24
import org.eclipse.ecf.bulletinboard.IThreadMessage;
25
import org.eclipse.ecf.core.ContainerConnectException;
26
import org.eclipse.ecf.core.identity.ID;
25
import org.eclipse.ecf.core.identity.ID;
27
import org.eclipse.ecf.internal.bulletinboard.commons.AbstractBulletinBoard;
26
import org.eclipse.ecf.internal.bulletinboard.commons.AbstractBulletinBoard;
28
import org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest;
27
import org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest;
Lines 86-92 Link Here
86
		return this.title;
85
		return this.title;
87
	}
86
	}
88
87
89
	public List<IForum> getForums() throws BBException {
88
	public IForum[] getForums() throws BBException {
90
		if (cachedForums.isEmpty()) {
89
		if (cachedForums.isEmpty()) {
91
			GetRequest request = new GetRequest(httpClient, url, "");
90
			GetRequest request = new GetRequest(httpClient, url, "");
92
			try {
91
			try {
Lines 101-117 Link Here
101
				// log.error(e);
100
				// log.error(e);
102
			}
101
			}
103
		}
102
		}
104
		return new ArrayList<IForum>(cachedForums.values());
103
		return cachedForums.values().toArray(new IForum[cachedForums.size()]);
105
	}
104
	}
106
105
107
	public List<IForum> getTopLevelForums() throws BBException {
106
	public IForum[] getTopLevelForums() throws BBException {
108
		List<IForum> topForums = new ArrayList<IForum>();
107
		List<IForum> topForums = new ArrayList<IForum>();
109
		for (IForum forum : getForums()) {
108
		for (IForum forum : getForums()) {
110
			if (forum.getParentForum() == null) {
109
			if (forum.getParent() == null) {
111
				topForums.add(forum);
110
				topForums.add(forum);
112
			}
111
			}
113
		}
112
		}
114
		return topForums;
113
		return topForums.toArray(new IForum[topForums.size()]);
115
	}
114
	}
116
115
117
	public IForum getForum(ID id) throws BBException {
116
	public IForum getForum(ID id) throws BBException {
(-)src/org/eclipse/ecf/internal/provider/vbulletin/Member.java (-4 / +2 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.vbulletin;
11
package org.eclipse.ecf.internal.provider.vbulletin;
12
12
13
import java.util.Collection;
14
import java.util.Collections;
13
import java.util.Collections;
15
import java.util.Map;
14
import java.util.Map;
16
15
Lines 18-24 Link Here
18
import org.eclipse.ecf.bulletinboard.IMemberGroup;
17
import org.eclipse.ecf.bulletinboard.IMemberGroup;
19
import org.eclipse.ecf.core.identity.ID;
18
import org.eclipse.ecf.core.identity.ID;
20
import org.eclipse.ecf.internal.bulletinboard.commons.AbstractBulletinBoard;
19
import org.eclipse.ecf.internal.bulletinboard.commons.AbstractBulletinBoard;
21
import org.eclipse.ecf.internal.provider.vbulletin.identity.MemberID;
22
20
23
public class Member extends VBObject implements IMember {
21
public class Member extends VBObject implements IMember {
24
	private static final long serialVersionUID = -1931142128734519538L;
22
	private static final long serialVersionUID = -1931142128734519538L;
Lines 41-50 Link Here
41
39
42
	public boolean isMemberOf(IMemberGroup group) {
40
	public boolean isMemberOf(IMemberGroup group) {
43
		// TODO maybe a better way?
41
		// TODO maybe a better way?
44
		return group.getMembers().contains(this);
42
		return group.isMember(this);
45
	}
43
	}
46
44
47
	public Collection<IMemberGroup> getGroups() {
45
	public IMemberGroup[] getGroups() {
48
		// TODO Auto-generated method stub
46
		// TODO Auto-generated method stub
49
		return null;
47
		return null;
50
	}
48
	}
(-)src/org/eclipse/ecf/internal/provider/vbulletin/Forum.java (-7 / +5 lines)
Lines 14-22 Link Here
14
import java.net.MalformedURLException;
14
import java.net.MalformedURLException;
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.ArrayList;
16
import java.util.ArrayList;
17
import java.util.Collection;
18
import java.util.HashSet;
17
import java.util.HashSet;
19
import java.util.List;
20
import java.util.Map;
18
import java.util.Map;
21
19
22
import org.apache.commons.httpclient.NameValuePair;
20
import org.apache.commons.httpclient.NameValuePair;
Lines 64-78 Link Here
64
		return IForum.HOLDS_THREADS | IForum.HOLDS_FORUMS;
62
		return IForum.HOLDS_THREADS | IForum.HOLDS_FORUMS;
65
	}
63
	}
66
64
67
	public IForum getParentForum() {
65
	public IForum getParent() {
68
		return parent;
66
		return parent;
69
	}
67
	}
70
68
71
	public List<IForum> getSubForums() {
69
	public IForum[] getSubForums() {
72
		return subforums;
70
		return subforums.toArray(new IForum[subforums.size()]);
73
	}
71
	}
74
72
75
	public Collection<IThread> getThreads() {
73
	public IThread[] getThreads() {
76
		VBParser parser = (VBParser) bb.getParser();
74
		VBParser parser = (VBParser) bb.getParser();
77
		Map<ID, IThread> threadMap = null;
75
		Map<ID, IThread> threadMap = null;
78
		WebRequest request = new GetRequest(bb.getHttpClient(), getURL(), "");
76
		WebRequest request = new GetRequest(bb.getHttpClient(), getURL(), "");
Lines 90-96 Link Here
90
		} catch (IOException e) {
88
		} catch (IOException e) {
91
			e.printStackTrace();
89
			e.printStackTrace();
92
		}
90
		}
93
		return new HashSet<IThread>(threadMap.values());
91
		return threadMap.values().toArray(new IThread[threadMap.size()]);
94
	}
92
	}
95
93
96
	public URL getURL() {
94
	public URL getURL() {
(-)src/org/eclipse/ecf/internal/provider/phpbb/MemberGroup.java (-4 / +7 lines)
Lines 11-19 Link Here
11
package org.eclipse.ecf.internal.provider.phpbb;
11
package org.eclipse.ecf.internal.provider.phpbb;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.util.Collection;
14
import java.util.Arrays;
15
import java.util.Collections;
15
import java.util.Collections;
16
import java.util.HashSet;
17
import java.util.Map;
16
import java.util.Map;
18
17
19
import org.apache.commons.httpclient.NameValuePair;
18
import org.apache.commons.httpclient.NameValuePair;
Lines 66-72 Link Here
66
		return description;
65
		return description;
67
	}
66
	}
68
67
69
	public Collection<IMember> getMembers() {
68
	public IMember[] getMembers() {
70
		Map<ID, IMember> map = Collections.emptyMap();
69
		Map<ID, IMember> map = Collections.emptyMap();
71
		GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(),
70
		GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(),
72
				"groupcp.php");
71
				"groupcp.php");
Lines 85-91 Link Here
85
		} catch (IOException e) {
84
		} catch (IOException e) {
86
			e.printStackTrace();
85
			e.printStackTrace();
87
		}
86
		}
88
		return new HashSet<IMember>(map.values());
87
		return map.values().toArray(new IMember[map.size()]);
89
	}
88
	}
90
89
91
	public ID getID() {
90
	public ID getID() {
Lines 109-112 Link Here
109
	public int hashCode() {
108
	public int hashCode() {
110
		return id.hashCode();
109
		return id.hashCode();
111
	}
110
	}
111
112
	public boolean isMember(IMember member) {
113
		return Arrays.asList(getMembers()).contains(member);
114
	}
112
}
115
}
(-)src/org/eclipse/ecf/internal/provider/phpbb/PHPBBParser.java (-3 / +3 lines)
Lines 64-71 Link Here
64
64
65
	public static final Pattern PAT_FORUM_OR_CATEGORY = Pattern
65
	public static final Pattern PAT_FORUM_OR_CATEGORY = Pattern
66
			.compile("(?:"
66
			.compile("(?:"
67
					+ "<span class=\"forumlink\"> <a href=\"viewforum.php\\?f=([0-9]+)(?:.*)\" class=\"forumlink\">(.*)</a><br />"
67
					+ "<span class=\"forumlink\">(?:\\s*)<a href=\"viewforum.php\\?f=([0-9]+)(?:.*)\" class=\"forumlink\">(.*)</a><br />"
68
					+ "(?:\\s*)</span> <span class=\"genmed\">(?s)(.*?)</span>"
68
					+ "(?:\\s*)</span>(?:\\s*)<span class=\"gen(?:med|small)\">(?s)(.*?)</span>"
69
					+ ")|(?:"
69
					+ ")|(?:"
70
					+ "<a href=\"index.php\\?c=([0-9]+)(?:.*)\" class=\"cattitle\">(.*)</a>"
70
					+ "<a href=\"index.php\\?c=([0-9]+)(?:.*)\" class=\"cattitle\">(.*)</a>"
71
					+ ")");
71
					+ ")");
Lines 136-142 Link Here
136
				.defaultCustom(
136
				.defaultCustom(
137
						Pattern
137
						Pattern
138
								.compile(
138
								.compile(
139
										"<a href=\"viewtopic.php\\?t=([0-9]+)(?:.*?)\" class=\"topictitle\">(.*)</a>(?:.*?)<span class=\"name\">(.+?)</span>",
139
										"<a href=\"viewtopic.php\\?t=([0-9]+?)(?:.*?)\" class=\"topictitle\">(.+?)</a>(?:.*?)<span class=\"name\">(.+?)</span>",
140
										Pattern.DOTALL), new String[] { "id",
140
										Pattern.DOTALL), new String[] { "id",
141
								"name", "authorInfo" });
141
								"name", "authorInfo" });
142
	}
142
	}
(-)src/org/eclipse/ecf/internal/provider/phpbb/ThreadMessage.java (-7 / +7 lines)
Lines 13-19 Link Here
13
import java.util.Date;
13
import java.util.Date;
14
14
15
import org.eclipse.ecf.bulletinboard.IMember;
15
import org.eclipse.ecf.bulletinboard.IMember;
16
import org.eclipse.ecf.bulletinboard.IMessageBase;
16
import org.eclipse.ecf.bulletinboard.IBBMessage;
17
import org.eclipse.ecf.bulletinboard.IThread;
17
import org.eclipse.ecf.bulletinboard.IThread;
18
import org.eclipse.ecf.bulletinboard.IThreadMessage;
18
import org.eclipse.ecf.bulletinboard.IThreadMessage;
19
import org.eclipse.ecf.bulletinboard.IllegalWriteException;
19
import org.eclipse.ecf.bulletinboard.IllegalWriteException;
Lines 49-68 Link Here
49
		return -1;
49
		return -1;
50
	}
50
	}
51
51
52
	public String getMessage() {
52
	public String getBody() {
53
		return message;
53
		return message;
54
	}
54
	}
55
55
56
	public IMember getFrom() {
56
	public IMember getPoster() {
57
		return author;
57
		return author;
58
	}
58
	}
59
59
60
	public IMessageBase getReplyTo() {
60
	public IBBMessage getReplyTo() {
61
		// TODO Implement reply relationships
61
		// TODO Implement reply relationships
62
		return null;
62
		return null;
63
	}
63
	}
64
64
65
	public void setReplyTo(IMessageBase message) throws IllegalWriteException {
65
	public void setReplyTo(IBBMessage message) throws IllegalWriteException {
66
		// TODO Auto-generated method stub
66
		// TODO Auto-generated method stub
67
	}
67
	}
68
68
Lines 82-95 Link Here
82
		this.thread = thread;
82
		this.thread = thread;
83
	}
83
	}
84
84
85
	public void setName(String name) throws IllegalWriteException {
85
	public void setTitle(String name) throws IllegalWriteException {
86
		if ((mode & READ_ONLY) == READ_ONLY) {
86
		if ((mode & READ_ONLY) == READ_ONLY) {
87
			throw new IllegalWriteException(E_READ_ONLY);
87
			throw new IllegalWriteException(E_READ_ONLY);
88
		}
88
		}
89
		this.name = name;
89
		this.name = name;
90
	}
90
	}
91
91
92
	public void setMessage(String message) throws IllegalWriteException {
92
	public void setBody(String message) throws IllegalWriteException {
93
		if ((mode & READ_ONLY) == READ_ONLY) {
93
		if ((mode & READ_ONLY) == READ_ONLY) {
94
			throw new IllegalWriteException(E_READ_ONLY);
94
			throw new IllegalWriteException(E_READ_ONLY);
95
		}
95
		}
(-)src/org/eclipse/ecf/internal/provider/phpbb/PHPBB.java (-5 / +5 lines)
Lines 70-76 Link Here
70
		return sessionId;
70
		return sessionId;
71
	}
71
	}
72
72
73
	public List<IForum> getForums() {
73
	public IForum[] getForums() {
74
		if (cachedForums.isEmpty()) {
74
		if (cachedForums.isEmpty()) {
75
			GetRequest request = new GetRequest(httpClient, url, "");
75
			GetRequest request = new GetRequest(httpClient, url, "");
76
			try {
76
			try {
Lines 85-101 Link Here
85
				// log.error(e);
85
				// log.error(e);
86
			}
86
			}
87
		}
87
		}
88
		return new ArrayList<IForum>(cachedForums.values());
88
		return cachedForums.values().toArray(new IForum[cachedForums.size()]);
89
	}
89
	}
90
90
91
	public List<IForum> getTopLevelForums() {
91
	public IForum[] getTopLevelForums() {
92
		List<IForum> topForums = new ArrayList<IForum>();
92
		List<IForum> topForums = new ArrayList<IForum>();
93
		for (IForum forum : getForums()) {
93
		for (IForum forum : getForums()) {
94
			if (forum.getParentForum() == null) {
94
			if (forum.getParent() == null) {
95
				topForums.add(forum);
95
				topForums.add(forum);
96
			}
96
			}
97
		}
97
		}
98
		return topForums;
98
		return topForums.toArray(new IForum[topForums.size()]);
99
	}
99
	}
100
100
101
	public IForum getForum(ID id) {
101
	public IForum getForum(ID id) {
(-)src/org/eclipse/ecf/internal/provider/phpbb/Member.java (-4 / +2 lines)
Lines 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.phpbb;
11
package org.eclipse.ecf.internal.provider.phpbb;
12
12
13
import java.util.Collection;
14
import java.util.Collections;
13
import java.util.Collections;
15
import java.util.Map;
14
import java.util.Map;
16
15
17
import org.eclipse.ecf.bulletinboard.IMember;
16
import org.eclipse.ecf.bulletinboard.IMember;
18
import org.eclipse.ecf.bulletinboard.IMemberGroup;
17
import org.eclipse.ecf.bulletinboard.IMemberGroup;
19
import org.eclipse.ecf.core.identity.ID;
18
import org.eclipse.ecf.core.identity.ID;
20
import org.eclipse.ecf.internal.bulletinboard.commons.AbstractBulletinBoard;
21
19
22
public class Member extends PHPBBObject implements IMember {
20
public class Member extends PHPBBObject implements IMember {
23
	// private static final Logger log = Logger.getLogger(Member.class);
21
	// private static final Logger log = Logger.getLogger(Member.class);
Lines 37-46 Link Here
37
35
38
	public boolean isMemberOf(IMemberGroup group) {
36
	public boolean isMemberOf(IMemberGroup group) {
39
		// TODO maybe a better way?
37
		// TODO maybe a better way?
40
		return group.getMembers().contains(this);
38
		return group.isMember(this);
41
	}
39
	}
42
40
43
	public Collection<IMemberGroup> getGroups() {
41
	public IMemberGroup[] getGroups() {
44
		// TODO Auto-generated method stub
42
		// TODO Auto-generated method stub
45
		return null;
43
		return null;
46
	}
44
	}
(-)src/org/eclipse/ecf/internal/provider/phpbb/Thread.java (-6 / +6 lines)
Lines 65-76 Link Here
65
		return forum;
65
		return forum;
66
	}
66
	}
67
67
68
	public List<IThreadMessage> getMessages() throws BBException {
68
	public IThreadMessage[] getMessages() throws BBException {
69
		// TODO Auto-generated method stub
69
		// TODO Auto-generated method stub
70
		return getNewMessages();
70
		return getNewMessages();
71
	}
71
	}
72
72
73
	public List<IThreadMessage> getNewMessages() throws BBException {
73
	public IThreadMessage[] getNewMessages() throws BBException {
74
		ThreadBrowser2 browser = new ThreadBrowser2((AbstractBulletinBoard) bb,
74
		ThreadBrowser2 browser = new ThreadBrowser2((AbstractBulletinBoard) bb,
75
				this);
75
				this);
76
		List<IThreadMessage> msgs = browser.fetchNewMessages();
76
		List<IThreadMessage> msgs = browser.fetchNewMessages();
Lines 85-94 Link Here
85
				((Member) author).setBulletinBoard(bb);
85
				((Member) author).setBulletinBoard(bb);
86
			}
86
			}
87
		}
87
		}
88
		return msgs;
88
		return msgs.toArray(new IThreadMessage[msgs.size()]);
89
	}
89
	}
90
90
91
	public List<IThreadMessage> getNewMessages(ID lastReadId)
91
	public IThreadMessage[] getNewMessages(ID lastReadId)
92
			throws BBException {
92
			throws BBException {
93
		if (lastReadId != null) {
93
		if (lastReadId != null) {
94
			lastReadMessageId = (ThreadMessageID) lastReadId;
94
			lastReadMessageId = (ThreadMessageID) lastReadId;
Lines 133-139 Link Here
133
				"posting.php");
133
				"posting.php");
134
		NameValuePair[] params = new NameValuePair[] {
134
		NameValuePair[] params = new NameValuePair[] {
135
				new NameValuePair("subject", msg.getName()),
135
				new NameValuePair("subject", msg.getName()),
136
				new NameValuePair("message", msg.getMessage()),
136
				new NameValuePair("message", msg.getBody()),
137
				new NameValuePair("t", String.valueOf(id.getLongValue())),
137
				new NameValuePair("t", String.valueOf(id.getLongValue())),
138
				new NameValuePair("mode", "reply"),
138
				new NameValuePair("mode", "reply"),
139
				// checkbox : disabled new NameValuePair("disable_smilies",
139
				// checkbox : disabled new NameValuePair("disable_smilies",
Lines 204-210 Link Here
204
		return id.hashCode();
204
		return id.hashCode();
205
	}
205
	}
206
206
207
	public IMember getAuthor() {
207
	public IMember getPoster() {
208
		return author;
208
		return author;
209
	}
209
	}
210
210
(-)src/org/eclipse/ecf/internal/provider/phpbb/Forum.java (-10 / +6 lines)
Lines 11-22 Link Here
11
package org.eclipse.ecf.internal.provider.phpbb;
11
package org.eclipse.ecf.internal.provider.phpbb;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.net.URISyntaxException;
15
import java.net.URL;
14
import java.net.URL;
16
import java.util.ArrayList;
15
import java.util.ArrayList;
17
import java.util.Collection;
18
import java.util.HashSet;
19
import java.util.List;
20
import java.util.Map;
16
import java.util.Map;
21
17
22
import org.apache.commons.httpclient.NameValuePair;
18
import org.apache.commons.httpclient.NameValuePair;
Lines 69-83 Link Here
69
		return IForum.HOLDS_THREADS;
65
		return IForum.HOLDS_THREADS;
70
	}
66
	}
71
67
72
	public IForum getParentForum() {
68
	public IForum getParent() {
73
		return parent;
69
		return parent;
74
	}
70
	}
75
71
76
	public List<IForum> getSubForums() {
72
	public IForum[] getSubForums() {
77
		return subforums;
73
		return subforums.toArray(new IForum[subforums.size()]);
78
	}
74
	}
79
75
80
	public Collection<IThread> getThreads() {
76
	public IThread[] getThreads() {
81
		PHPBBParser parser = (PHPBBParser) bb.getParser();
77
		PHPBBParser parser = (PHPBBParser) bb.getParser();
82
		Map<ID, IThread> threadMap = null;
78
		Map<ID, IThread> threadMap = null;
83
		try {
79
		try {
Lines 97-103 Link Here
97
			// TODO Auto-generated catch block
93
			// TODO Auto-generated catch block
98
			e.printStackTrace();
94
			e.printStackTrace();
99
		}
95
		}
100
		return new HashSet<IThread>(threadMap.values());
96
		return threadMap.values().toArray(new IThread[threadMap.size()]);
101
	}
97
	}
102
98
103
	public IThread createThread() throws IllegalWriteException, BBException {
99
	public IThread createThread() throws IllegalWriteException, BBException {
Lines 123-129 Link Here
123
				new NameValuePair("subject", thread.getPrePostMessage()
119
				new NameValuePair("subject", thread.getPrePostMessage()
124
						.getName()),
120
						.getName()),
125
				new NameValuePair("message", thread.getPrePostMessage()
121
				new NameValuePair("message", thread.getPrePostMessage()
126
						.getMessage()),
122
						.getBody()),
127
				new NameValuePair("f", String.valueOf(id.getLongValue())),
123
				new NameValuePair("f", String.valueOf(id.getLongValue())),
128
				new NameValuePair("mode", "newtopic"),
124
				new NameValuePair("mode", "newtopic"),
129
				// checkbox : disabled new NameValuePair("disable_smilies",
125
				// checkbox : disabled new NameValuePair("disable_smilies",
(-)src/org/eclipse/ecf/internal/provider/phpbb/Category.java (-5 / +2 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.phpbb;
11
package org.eclipse.ecf.internal.provider.phpbb;
12
12
13
import java.util.Collections;
14
import java.util.List;
15
16
import org.eclipse.ecf.bulletinboard.BBException;
13
import org.eclipse.ecf.bulletinboard.BBException;
17
import org.eclipse.ecf.bulletinboard.IForum;
14
import org.eclipse.ecf.bulletinboard.IForum;
18
import org.eclipse.ecf.bulletinboard.IThread;
15
import org.eclipse.ecf.bulletinboard.IThread;
Lines 38-45 Link Here
38
		return IForum.HOLDS_FORUMS;
35
		return IForum.HOLDS_FORUMS;
39
	}
36
	}
40
37
41
	public List<IThread> getThreads() {
38
	public IThread[] getThreads() {
42
		return Collections.emptyList();
39
		return new Thread[0];
43
	}
40
	}
44
41
45
	/*
42
	/*
(-)src/org/eclipse/ecf/internal/provider/phpbb/GuestFactory.java (+3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.phpbb;
11
package org.eclipse.ecf.internal.provider.phpbb;
12
12
13
import java.io.UnsupportedEncodingException;
13
import java.net.URI;
14
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.net.URISyntaxException;
15
import java.net.URL;
16
import java.net.URL;
Lines 39-44 Link Here
39
			return new GuestID((PHPBBNamespace) namespace, baseURL, longValue);
40
			return new GuestID((PHPBBNamespace) namespace, baseURL, longValue);
40
		} catch (URISyntaxException e) {
41
		} catch (URISyntaxException e) {
41
			throw new IDCreateException(e);
42
			throw new IDCreateException(e);
43
		} catch (UnsupportedEncodingException e) {
44
			throw new IDCreateException(e);
42
		}
45
		}
43
	}
46
	}
44
47
(-)src/org/eclipse/ecf/internal/provider/phpbb/identity/GuestID.java (-2 / +5 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.internal.provider.phpbb.identity;
11
package org.eclipse.ecf.internal.provider.phpbb.identity;
12
12
13
import java.io.UnsupportedEncodingException;
13
import java.net.URI;
14
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.net.URISyntaxException;
15
import java.net.URL;
16
import java.net.URL;
17
import java.net.URLEncoder;
16
18
17
import org.eclipse.ecf.internal.bulletinboard.commons.util.IDUtil;
19
import org.eclipse.ecf.internal.bulletinboard.commons.util.IDUtil;
18
20
Lines 25-33 Link Here
25
	}
27
	}
26
28
27
	public GuestID(PHPBBNamespace namespace, URL baseURL, String name)
29
	public GuestID(PHPBBNamespace namespace, URL baseURL, String name)
28
			throws URISyntaxException {
30
			throws URISyntaxException, UnsupportedEncodingException {
29
		super(namespace, IDUtil.composeURI(baseURL,
31
		super(namespace, IDUtil.composeURI(baseURL,
30
				"profile.php?mode=viewprofile&u=0#" + name));
32
				"profile.php?mode=viewprofile&u=0#"
33
						+ URLEncoder.encode(name, "UTF-8")));
31
	}
34
	}
32
35
33
	public long getLongValue() {
36
	public long getLongValue() {
(-)plugin.xml (-1 / +1 lines)
Lines 129-135 Link Here
129
      <objectContribution
129
      <objectContribution
130
            adaptable="false"
130
            adaptable="false"
131
            id="org.eclipse.ecf.examples.bbreader.objectContribution2"
131
            id="org.eclipse.ecf.examples.bbreader.objectContribution2"
132
            objectClass="org.eclipse.ecf.examples.bbreader.model.IURLProvider">
132
            objectClass="org.eclipse.ecf.examples.bbreader.model.IURIProvider">
133
         <action
133
         <action
134
               class="org.eclipse.ecf.examples.bbreader.actions.OpenInBrowserAction"
134
               class="org.eclipse.ecf.examples.bbreader.actions.OpenInBrowserAction"
135
               id="org.eclipse.ecf.examples.bbreader.action1"
135
               id="org.eclipse.ecf.examples.bbreader.action1"
(-)BB Explorer.launch (-5 / +5 lines)
Lines 6-27 Link Here
6
<booleanAttribute key="useProduct" value="false"/>
6
<booleanAttribute key="useProduct" value="false"/>
7
<stringAttribute key="deselected_workspace_plugins" value="org.tigris.bbapi.core,org.tigris.bbapi.example.reader,org.tigris.bbapi.googlegroups,org.tigris.bbapi.phpbb,org.tigris.bbapi.commons,org.tigris.bbapi.vbulletin,org.tigris.bbapi.phpbb.test,org.tigris.bbapi.vbulletin.test"/>
7
<stringAttribute key="deselected_workspace_plugins" value="org.tigris.bbapi.core,org.tigris.bbapi.example.reader,org.tigris.bbapi.googlegroups,org.tigris.bbapi.phpbb,org.tigris.bbapi.commons,org.tigris.bbapi.vbulletin,org.tigris.bbapi.phpbb.test,org.tigris.bbapi.vbulletin.test"/>
8
<booleanAttribute key="tracing" value="false"/>
8
<booleanAttribute key="tracing" value="false"/>
9
<stringAttribute key="selected_target_plugins" value="com.ibm.icu,org.apache.commons_logging,org.apache.jakarta_log4j,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.osgi,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.forms,org.eclipse.ui.navigator,org.eclipse.ui.workbench"/>
9
<stringAttribute key="selected_target_plugins" value="com.ibm.icu,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.forms,org.eclipse.ui.navigator,org.eclipse.ui.workbench"/>
10
<booleanAttribute key="automaticValidate" value="false"/>
10
<booleanAttribute key="automaticValidate" value="false"/>
11
<booleanAttribute key="automaticAdd" value="false"/>
11
<booleanAttribute key="automaticAdd" value="false"/>
12
<stringAttribute key="checked" value="[NONE]"/>
12
<stringAttribute key="checked" value="[NONE]"/>
13
<stringAttribute key="location" value="${workspace_loc}/../runtime-New_configuration"/>
13
<stringAttribute key="location" value="${workspace_loc}/../runtime-New_configuration"/>
14
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.ecf.provider.nntp,org.eclipse.ecf.bulletinboard.commons,org.eclipse.ecf.bulletinboard,org.eclipse.ecf.provider.phpbb,org.apache.oro,org.eclipse.ecf.provider.vbulletin,org.eclipse.ecf.identity,org.eclipse.ecf.examples.bbreader,org.eclipse.mylar.context.core,org.apache.commons.httpclient,org.apache.commons.net,org.eclipse.ecf"/>
14
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.ecf.provider.nntp,org.eclipse.ecf.provider.vbulletin,org.eclipse.ecf.identity,org.eclipse.ecf.examples.bbreader,org.eclipse.ecf.bulletinboard.commons,org.eclipse.mylar,org.eclipse.ecf.bulletinboard,org.apache.oro,org.apache.commons.net,org.eclipse.ecf.provider.phpbb,org.eclipse.ecf"/>
15
<stringAttribute key="configLocation" value=""/>
16
<stringAttribute key="application" value="org.eclipse.ecf.examples.bbreader.bbReader"/>
15
<stringAttribute key="application" value="org.eclipse.ecf.examples.bbreader.bbReader"/>
16
<stringAttribute key="configLocation" value=""/>
17
<booleanAttribute key="clearws" value="false"/>
17
<booleanAttribute key="clearws" value="false"/>
18
<stringAttribute key="pde.version" value="3.2a"/>
18
<stringAttribute key="pde.version" value="3.3"/>
19
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
19
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
20
<booleanAttribute key="default" value="false"/>
20
<booleanAttribute key="default" value="false"/>
21
<booleanAttribute key="clearConfig" value="false"/>
21
<booleanAttribute key="clearConfig" value="false"/>
22
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
22
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
23
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
24
<booleanAttribute key="useDefaultConfigArea" value="true"/>
23
<booleanAttribute key="useDefaultConfigArea" value="true"/>
24
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
25
<booleanAttribute key="useDefaultConfig" value="true"/>
25
<booleanAttribute key="useDefaultConfig" value="true"/>
26
<booleanAttribute key="askclear" value="true"/>
26
<booleanAttribute key="askclear" value="true"/>
27
<booleanAttribute key="includeOptional" value="true"/>
27
<booleanAttribute key="includeOptional" value="true"/>
(-)src/org/eclipse/ecf/examples/bbreader/navigator/Group.java (-8 / +8 lines)
Lines 3-10 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.ArrayList;
8
import java.util.ArrayList;
9
import java.util.List;
9
import java.util.List;
10
10
Lines 12-21 Link Here
12
import org.eclipse.ecf.bulletinboard.IMemberGroup;
12
import org.eclipse.ecf.bulletinboard.IMemberGroup;
13
import org.eclipse.ecf.examples.bbreader.Activator;
13
import org.eclipse.ecf.examples.bbreader.Activator;
14
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
14
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
15
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
15
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
16
import org.eclipse.swt.graphics.Image;
16
import org.eclipse.swt.graphics.Image;
17
17
18
public final class Group implements ITreeNode, IURLProvider {
18
public final class Group implements ITreeNode, IURIProvider {
19
	private final ITreeNode parent;
19
	private final ITreeNode parent;
20
20
21
	private final IMemberGroup group;
21
	private final IMemberGroup group;
Lines 35-41 Link Here
35
35
36
	public List<ITreeNode> getChildren() {
36
	public List<ITreeNode> getChildren() {
37
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
37
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
38
		if (group.getMembers() != null && group.getMembers().size() > 0) {
38
		if (group.getMembers() != null && group.getMembers().length > 0) {
39
			for (Object o : group.getMembers()) {
39
			for (Object o : group.getMembers()) {
40
				IMember m = (IMember) o;
40
				IMember m = (IMember) o;
41
				list.add(new Member(this, m));
41
				list.add(new Member(this, m));
Lines 55-64 Link Here
55
		return parent;
55
		return parent;
56
	}
56
	}
57
57
58
	public URL getURL() {
58
	public URI getURI() {
59
		try {
59
		try {
60
			return new URL(group.getID().toExternalForm());
60
			return new URI(group.getID().toExternalForm());
61
		} catch (MalformedURLException e) {
61
		} catch (URISyntaxException e) {
62
			// TODO Auto-generated catch block
62
			// TODO Auto-generated catch block
63
			e.printStackTrace();
63
			e.printStackTrace();
64
		}
64
		}
(-)src/org/eclipse/ecf/examples/bbreader/navigator/ThreadMessage.java (-8 / +8 lines)
Lines 3-20 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.List;
8
import java.util.List;
9
9
10
import org.eclipse.ecf.bulletinboard.IThreadMessage;
10
import org.eclipse.ecf.bulletinboard.IThreadMessage;
11
import org.eclipse.ecf.examples.bbreader.Activator;
11
import org.eclipse.ecf.examples.bbreader.Activator;
12
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
12
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
13
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
13
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
14
import org.eclipse.ecf.internal.bulletinboard.commons.util.StringUtil;
14
import org.eclipse.ecf.internal.bulletinboard.commons.util.StringUtil;
15
import org.eclipse.swt.graphics.Image;
15
import org.eclipse.swt.graphics.Image;
16
16
17
public final class ThreadMessage implements ITreeNode, IURLProvider {
17
public final class ThreadMessage implements ITreeNode, IURIProvider {
18
	private final ITreeNode parent;
18
	private final ITreeNode parent;
19
19
20
	private final IThreadMessage msg;
20
	private final IThreadMessage msg;
Lines 37-43 Link Here
37
		} else {
37
		} else {
38
			name.append(msg.getName());
38
			name.append(msg.getName());
39
		}
39
		}
40
		name.append(" (by ").append(msg.getFrom().getName()).append(")");
40
		name.append(" (by ").append(msg.getPoster().getName()).append(")");
41
		return name.toString();
41
		return name.toString();
42
	}
42
	}
43
43
Lines 57-66 Link Here
57
		return parent;
57
		return parent;
58
	}
58
	}
59
59
60
	public URL getURL() {
60
	public URI getURI() {
61
		try {
61
		try {
62
			return new URL(msg.getID().toExternalForm());
62
			return new URI(msg.getID().toExternalForm());
63
		} catch (MalformedURLException e) {
63
		} catch (URISyntaxException e) {
64
			// TODO Auto-generated catch block
64
			// TODO Auto-generated catch block
65
			e.printStackTrace();
65
			e.printStackTrace();
66
		}
66
		}
(-)src/org/eclipse/ecf/examples/bbreader/navigator/BBRoot.java (-1 / +1 lines)
Lines 148-154 Link Here
148
			BulletinBoard bb = (BulletinBoard) elem;
148
			BulletinBoard bb = (BulletinBoard) elem;
149
			IMemento child = memento.createChild(BB_ELEM);
149
			IMemento child = memento.createChild(BB_ELEM);
150
			child.putString(TYPE_ELEM, bb.getContainerName());
150
			child.putString(TYPE_ELEM, bb.getContainerName());
151
			child.putString(URL_ELEM, bb.getURL().toString());
151
			child.putString(URL_ELEM, bb.getURI().toString());
152
			if (bb.getCredentials() != null) {
152
			if (bb.getCredentials() != null) {
153
				child.putString(USERNAME_ELEM, bb.getCredentials()
153
				child.putString(USERNAME_ELEM, bb.getCredentials()
154
						.getUsername());
154
						.getUsername());
(-)src/org/eclipse/ecf/examples/bbreader/navigator/Forum.java (-10 / +10 lines)
Lines 3-10 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.ArrayList;
8
import java.util.ArrayList;
9
import java.util.List;
9
import java.util.List;
10
10
Lines 12-21 Link Here
12
import org.eclipse.ecf.bulletinboard.IThread;
12
import org.eclipse.ecf.bulletinboard.IThread;
13
import org.eclipse.ecf.examples.bbreader.Activator;
13
import org.eclipse.ecf.examples.bbreader.Activator;
14
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
14
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
15
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
15
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
16
import org.eclipse.swt.graphics.Image;
16
import org.eclipse.swt.graphics.Image;
17
17
18
public final class Forum implements ITreeNode, IURLProvider {
18
public final class Forum implements ITreeNode, IURIProvider {
19
	private final ITreeNode parent;
19
	private final ITreeNode parent;
20
20
21
	private final IForum forum;
21
	private final IForum forum;
Lines 35-41 Link Here
35
35
36
	public List<ITreeNode> getChildren() {
36
	public List<ITreeNode> getChildren() {
37
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
37
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
38
		if (forum.getSubForums() != null && forum.getSubForums().size() > 0) {
38
		if (forum.getSubForums() != null && forum.getSubForums().length > 0) {
39
			for (Object o : forum.getSubForums()) {
39
			for (Object o : forum.getSubForums()) {
40
				IForum f = (IForum) o;
40
				IForum f = (IForum) o;
41
				list.add(new Forum(this, f));
41
				list.add(new Forum(this, f));
Lines 46-52 Link Here
46
46
47
	public List<ForumThread> getThreads() {
47
	public List<ForumThread> getThreads() {
48
		ArrayList<ForumThread> list = new ArrayList<ForumThread>();
48
		ArrayList<ForumThread> list = new ArrayList<ForumThread>();
49
		if (forum.getThreads() != null && forum.getThreads().size() > 0) {
49
		if (forum.getThreads() != null && forum.getThreads().length > 0) {
50
			for (Object o : forum.getThreads()) {
50
			for (Object o : forum.getThreads()) {
51
				IThread t = (IThread) o;
51
				IThread t = (IThread) o;
52
				list.add(new ForumThread(this, t));
52
				list.add(new ForumThread(this, t));
Lines 56-62 Link Here
56
	}
56
	}
57
57
58
	public boolean hasChildren() {
58
	public boolean hasChildren() {
59
		return !forum.getSubForums().isEmpty();
59
		return forum.getSubForums().length > 0;
60
	}
60
	}
61
61
62
	public ITreeNode getParent() {
62
	public ITreeNode getParent() {
Lines 68-77 Link Here
68
	 * 
68
	 * 
69
	 * @see org.eclipse.ecf.examples.bbreader.navigator.IURLProvider#getURL()
69
	 * @see org.eclipse.ecf.examples.bbreader.navigator.IURLProvider#getURL()
70
	 */
70
	 */
71
	public URL getURL() {
71
	public URI getURI() {
72
		try {
72
		try {
73
			return new URL(forum.getID().toExternalForm());
73
			return new URI(forum.getID().toExternalForm());
74
		} catch (MalformedURLException e) {
74
		} catch (URISyntaxException e) {
75
			// TODO Auto-generated catch block
75
			// TODO Auto-generated catch block
76
			e.printStackTrace();
76
			e.printStackTrace();
77
		}
77
		}
(-)src/org/eclipse/ecf/examples/bbreader/navigator/BulletinBoard.java (-7 / +7 lines)
Lines 3-10 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.Arrays;
8
import java.util.Arrays;
9
import java.util.Collections;
9
import java.util.Collections;
10
import java.util.List;
10
import java.util.List;
Lines 21-30 Link Here
21
import org.eclipse.ecf.examples.bbreader.Activator;
21
import org.eclipse.ecf.examples.bbreader.Activator;
22
import org.eclipse.ecf.examples.bbreader.jobs.ContainerConnectJob;
22
import org.eclipse.ecf.examples.bbreader.jobs.ContainerConnectJob;
23
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
23
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
24
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
24
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
25
import org.eclipse.swt.graphics.Image;
25
import org.eclipse.swt.graphics.Image;
26
26
27
public final class BulletinBoard implements ITreeNode, IURLProvider, IAdaptable {
27
public final class BulletinBoard implements ITreeNode, IURIProvider, IAdaptable {
28
	private final ITreeNode parent;
28
	private final ITreeNode parent;
29
29
30
	private IContainer container;
30
	private IContainer container;
Lines 91-100 Link Here
91
		return containerName;
91
		return containerName;
92
	}
92
	}
93
93
94
	public URL getURL() {
94
	public URI getURI() {
95
		try {
95
		try {
96
			return new URL(id.toExternalForm());
96
			return new URI(id.toExternalForm());
97
		} catch (MalformedURLException e) {
97
		} catch (URISyntaxException e) {
98
			// TODO Auto-generated catch block
98
			// TODO Auto-generated catch block
99
			e.printStackTrace();
99
			e.printStackTrace();
100
		}
100
		}
(-)src/org/eclipse/ecf/examples/bbreader/navigator/ForumThread.java (-12 / +10 lines)
Lines 3-10 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.ArrayList;
8
import java.util.ArrayList;
9
import java.util.List;
9
import java.util.List;
10
10
Lines 13-22 Link Here
13
import org.eclipse.ecf.bulletinboard.IThreadMessage;
13
import org.eclipse.ecf.bulletinboard.IThreadMessage;
14
import org.eclipse.ecf.examples.bbreader.Activator;
14
import org.eclipse.ecf.examples.bbreader.Activator;
15
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
15
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
16
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
16
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
17
import org.eclipse.swt.graphics.Image;
17
import org.eclipse.swt.graphics.Image;
18
18
19
public final class ForumThread implements ITreeNode, IURLProvider {
19
public final class ForumThread implements ITreeNode, IURIProvider {
20
	private final ITreeNode parent;
20
	private final ITreeNode parent;
21
21
22
	private final IThread thread;
22
	private final IThread thread;
Lines 37-49 Link Here
37
	@SuppressWarnings("unchecked")
37
	@SuppressWarnings("unchecked")
38
	public List<ITreeNode> getChildren() {
38
	public List<ITreeNode> getChildren() {
39
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
39
		ArrayList<ITreeNode> list = new ArrayList<ITreeNode>();
40
		List<IThreadMessage> msgs = null;
40
		IThreadMessage[] msgs = null;
41
		try {
41
		try {
42
			msgs = thread.getMessages();
42
			msgs = thread.getMessages();
43
			if (msgs != null && msgs.size() > 0) {
43
			for (IThreadMessage msg : msgs) {
44
				for (IThreadMessage msg : msgs) {
44
				list.add(new ThreadMessage(this, msg));
45
					list.add(new ThreadMessage(this, msg));
46
				}
47
			}
45
			}
48
		} catch (BBException e) {
46
		} catch (BBException e) {
49
			// TODO Auto-generated catch block
47
			// TODO Auto-generated catch block
Lines 67-76 Link Here
67
		return thread;
65
		return thread;
68
	}
66
	}
69
67
70
	public URL getURL() {
68
	public URI getURI() {
71
		try {
69
		try {
72
			return new URL(thread.getID().toExternalForm());
70
			return new URI(thread.getID().toExternalForm());
73
		} catch (MalformedURLException e) {
71
		} catch (URISyntaxException e) {
74
			// TODO Auto-generated catch block
72
			// TODO Auto-generated catch block
75
			e.printStackTrace();
73
			e.printStackTrace();
76
		}
74
		}
(-)src/org/eclipse/ecf/examples/bbreader/navigator/Member.java (-7 / +7 lines)
Lines 3-19 Link Here
3
 */
3
 */
4
package org.eclipse.ecf.examples.bbreader.navigator;
4
package org.eclipse.ecf.examples.bbreader.navigator;
5
5
6
import java.net.MalformedURLException;
6
import java.net.URI;
7
import java.net.URL;
7
import java.net.URISyntaxException;
8
import java.util.List;
8
import java.util.List;
9
9
10
import org.eclipse.ecf.bulletinboard.IMember;
10
import org.eclipse.ecf.bulletinboard.IMember;
11
import org.eclipse.ecf.examples.bbreader.Activator;
11
import org.eclipse.ecf.examples.bbreader.Activator;
12
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
12
import org.eclipse.ecf.examples.bbreader.model.ITreeNode;
13
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
13
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
14
import org.eclipse.swt.graphics.Image;
14
import org.eclipse.swt.graphics.Image;
15
15
16
public final class Member implements ITreeNode, IURLProvider {
16
public final class Member implements ITreeNode, IURIProvider {
17
	private final ITreeNode parent;
17
	private final ITreeNode parent;
18
18
19
	private final IMember member;
19
	private final IMember member;
Lines 43-52 Link Here
43
		return parent;
43
		return parent;
44
	}
44
	}
45
45
46
	public URL getURL() {
46
	public URI getURI() {
47
		try {
47
		try {
48
			return new URL(member.getID().toExternalForm());
48
			return new URI(member.getID().toExternalForm());
49
		} catch (MalformedURLException e) {
49
		} catch (URISyntaxException e) {
50
			// TODO Auto-generated catch block
50
			// TODO Auto-generated catch block
51
			e.printStackTrace();
51
			e.printStackTrace();
52
		}
52
		}
(-)src/org/eclipse/ecf/examples/bbreader/views/ThreadLabelProvider.java (-2 / +2 lines)
Lines 24-30 Link Here
24
			case 0:
24
			case 0:
25
				return t.getThread().getName();
25
				return t.getThread().getName();
26
			case 1:
26
			case 1:
27
				return t.getThread().getAuthor().getName();
27
				return t.getThread().getPoster().getName();
28
				/*
28
				/*
29
				 * case 2: return t.getThread().getTimePosted().toGMTString();
29
				 * case 2: return t.getThread().getTimePosted().toGMTString();
30
				 * case 3: return t.getThread().getTimeUpdated().toGMTString();
30
				 * case 3: return t.getThread().getTimeUpdated().toGMTString();
Lines 40-46 Link Here
40
			case 0:
40
			case 0:
41
				return m.getMessage().getName();
41
				return m.getMessage().getName();
42
			case 1:
42
			case 1:
43
				return m.getMessage().getFrom().getName();
43
				return m.getMessage().getPoster().getName();
44
			case 2:
44
			case 2:
45
				Date d = m.getMessage().getTimePosted();
45
				Date d = m.getMessage().getTimePosted();
46
				if (d == null) {
46
				if (d == null) {
(-)src/org/eclipse/ecf/examples/bbreader/views/MessageView.java (-2 / +2 lines)
Lines 107-113 Link Here
107
107
108
	private void fillData() {
108
	private void fillData() {
109
		IThreadMessage msg = getMessage();
109
		IThreadMessage msg = getMessage();
110
		author.setText(msg.getFrom().getName());
110
		author.setText(msg.getPoster().getName());
111
		subject.setText(msg.getName());
111
		subject.setText(msg.getName());
112
		Date d = msg.getTimePosted();
112
		Date d = msg.getTimePosted();
113
		if (d != null) {
113
		if (d != null) {
Lines 115-121 Link Here
115
					DateFormat.SHORT);
115
					DateFormat.SHORT);
116
			postDate.setText(fmt.format(d));
116
			postDate.setText(fmt.format(d));
117
		}
117
		}
118
		styledText.setText(msg.getMessage());
118
		styledText.setText(msg.getBody());
119
	}
119
	}
120
120
121
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
121
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
(-)src/org/eclipse/ecf/examples/bbreader/editors/MessageEditor.java (-2 / +2 lines)
Lines 128-134 Link Here
128
128
129
	private void fillData() {
129
	private void fillData() {
130
		IThreadMessage msg = getMessage();
130
		IThreadMessage msg = getMessage();
131
		author.setText(msg.getFrom().getName());
131
		author.setText(msg.getPoster().getName());
132
		subject.setText(msg.getName());
132
		subject.setText(msg.getName());
133
		Date d = msg.getTimePosted();
133
		Date d = msg.getTimePosted();
134
		if (d != null) {
134
		if (d != null) {
Lines 136-142 Link Here
136
					DateFormat.SHORT);
136
					DateFormat.SHORT);
137
			postDate.setText(fmt.format(d));
137
			postDate.setText(fmt.format(d));
138
		}
138
		}
139
		styledText.setText(msg.getMessage());
139
		styledText.setText(msg.getBody());
140
	}
140
	}
141
141
142
	@Override
142
	@Override
(-)src/org/eclipse/ecf/examples/bbreader/editors/MessageEditorInput.java (-1 / +1 lines)
Lines 36-42 Link Here
36
	}
36
	}
37
37
38
	public String getToolTipText() {
38
	public String getToolTipText() {
39
		return msg.getMessage();
39
		return msg.getBody();
40
	}
40
	}
41
41
42
	public Object getAdapter(Class adapter) {
42
	public Object getAdapter(Class adapter) {
(-)src/org/eclipse/ecf/examples/bbreader/model/IURLProvider.java (-9 lines)
Removed Link Here
1
package org.eclipse.ecf.examples.bbreader.model;
2
3
import java.net.URL;
4
5
public interface IURLProvider {
6
7
	public URL getURL();
8
9
}
(-)src/org/eclipse/ecf/examples/bbreader/actions/OpenInBrowserAction.java (-7 / +13 lines)
Lines 1-9 Link Here
1
package org.eclipse.ecf.examples.bbreader.actions;
1
package org.eclipse.ecf.examples.bbreader.actions;
2
2
3
import java.net.MalformedURLException;
3
import java.util.ArrayList;
4
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.Iterator;
5
6
6
import org.eclipse.ecf.examples.bbreader.model.IURLProvider;
7
import org.eclipse.ecf.examples.bbreader.model.IURIProvider;
7
import org.eclipse.jface.action.IAction;
8
import org.eclipse.jface.action.IAction;
8
import org.eclipse.jface.viewers.ISelection;
9
import org.eclipse.jface.viewers.ISelection;
9
import org.eclipse.jface.viewers.StructuredSelection;
10
import org.eclipse.jface.viewers.StructuredSelection;
Lines 14-20 Link Here
14
15
15
public class OpenInBrowserAction implements IObjectActionDelegate {
16
public class OpenInBrowserAction implements IObjectActionDelegate {
16
17
17
	private ArrayList<IURLProvider> urlProviders;
18
	private ArrayList<IURIProvider> urlProviders;
18
19
19
	private IWorkbenchPart targetPart;
20
	private IWorkbenchPart targetPart;
20
21
Lines 28-37 Link Here
28
29
29
	public void run(IAction action) {
30
	public void run(IAction action) {
30
		try {
31
		try {
31
			for (IURLProvider urlProv : urlProviders) {
32
			for (IURIProvider urlProv : urlProviders) {
32
				IWebBrowser browser = targetPart.getSite().getWorkbenchWindow()
33
				IWebBrowser browser = targetPart.getSite().getWorkbenchWindow()
33
						.getWorkbench().getBrowserSupport().createBrowser(null);
34
						.getWorkbench().getBrowserSupport().createBrowser(null);
34
				browser.openURL(urlProv.getURL());
35
				try {
36
					browser.openURL(urlProv.getURI().toURL());
37
				} catch (MalformedURLException e) {
38
					// TODO Auto-generated catch block
39
					e.printStackTrace();
40
				}
35
			}
41
			}
36
		} catch (PartInitException e) {
42
		} catch (PartInitException e) {
37
			// TODO Auto-generated catch block
43
			// TODO Auto-generated catch block
Lines 41-53 Link Here
41
47
42
	@SuppressWarnings("unchecked")
48
	@SuppressWarnings("unchecked")
43
	public void selectionChanged(IAction action, ISelection selection) {
49
	public void selectionChanged(IAction action, ISelection selection) {
44
		urlProviders = new ArrayList<IURLProvider>();
50
		urlProviders = new ArrayList<IURIProvider>();
45
		if (selection instanceof StructuredSelection) {
51
		if (selection instanceof StructuredSelection) {
46
			StructuredSelection sel = (StructuredSelection) selection;
52
			StructuredSelection sel = (StructuredSelection) selection;
47
			for (Iterator<Object> iter = sel.iterator(); iter.hasNext();) {
53
			for (Iterator<Object> iter = sel.iterator(); iter.hasNext();) {
48
				Object obj = iter.next();
54
				Object obj = iter.next();
49
				if (obj instanceof IURLProvider) {
55
				if (obj instanceof IURIProvider) {
50
					urlProviders.add((IURLProvider) obj);
56
					urlProviders.add((IURIProvider) obj);
51
				}
57
				}
52
			}
58
			}
53
		}
59
		}
(-)src/org/eclipse/ecf/examples/bbreader/model/IURIProvider.java (+9 lines)
Added Link Here
1
package org.eclipse.ecf.examples.bbreader.model;
2
3
import java.net.URI;
4
5
public interface IURIProvider {
6
7
	public URI getURI();
8
9
}
(-)src/org/eclipse/ecf/internal/bulletinboard/commons/AbstractBulletinBoard.java (-11 / +11 lines)
Lines 3-13 Link Here
3
import java.io.IOException;
3
import java.io.IOException;
4
import java.net.MalformedURLException;
4
import java.net.MalformedURLException;
5
import java.net.URL;
5
import java.net.URL;
6
import java.util.ArrayList;
7
import java.util.Collection;
8
import java.util.HashMap;
6
import java.util.HashMap;
9
import java.util.HashSet;
10
import java.util.List;
11
import java.util.Map;
7
import java.util.Map;
12
8
13
import org.apache.commons.httpclient.HttpClient;
9
import org.apache.commons.httpclient.HttpClient;
Lines 94-101 Link Here
94
	}
90
	}
95
91
96
	public Object getAdapter(Class adapter) {
92
	public Object getAdapter(Class adapter) {
97
		IAdapterManager adapterManager = Activator.getDefault().getAdapterManager();
93
		IAdapterManager adapterManager = Activator.getDefault()
98
		if (adapterManager == null) return null;
94
				.getAdapterManager();
95
		if (adapterManager == null)
96
			return null;
99
		return adapterManager.getAdapter(this, adapter);
97
		return adapterManager.getAdapter(this, adapter);
100
	}
98
	}
101
99
Lines 149-155 Link Here
149
147
150
	protected abstract WebRequest createMemberListRequest();
148
	protected abstract WebRequest createMemberListRequest();
151
149
152
	public List<IMember> getMembers() throws BBException {
150
	public IMember[] getMembers() throws BBException {
153
		// TODO: this only returns first page
151
		// TODO: this only returns first page
154
		if (cachedMembers.isEmpty()) {
152
		if (cachedMembers.isEmpty()) {
155
			WebRequest request = createMemberListRequest();
153
			WebRequest request = createMemberListRequest();
Lines 165-176 Link Here
165
				e.printStackTrace();
163
				e.printStackTrace();
166
			}
164
			}
167
		}
165
		}
168
		return new ArrayList<IMember>(cachedMembers.values());
166
		return cachedMembers.values()
167
				.toArray(new IMember[cachedMembers.size()]);
169
	}
168
	}
170
169
171
	protected abstract WebRequest createMemberGroupListRequest();
170
	protected abstract WebRequest createMemberGroupListRequest();
172
171
173
	public Collection<IMemberGroup> getMemberGroups() throws BBException {
172
	public IMemberGroup[] getMemberGroups() throws BBException {
174
		if (cachedMemberGroups.isEmpty()) {
173
		if (cachedMemberGroups.isEmpty()) {
175
			WebRequest request = createMemberGroupListRequest();
174
			WebRequest request = createMemberGroupListRequest();
176
			try {
175
			try {
Lines 182-191 Link Here
182
					((AbstractBBObject) grp).setBulletinBoard(this);
181
					((AbstractBBObject) grp).setBulletinBoard(this);
183
				}
182
				}
184
			} catch (IOException e) {
183
			} catch (IOException e) {
185
				// log.error(e);
184
				throw new BBException(e);
186
			}
185
			}
187
		}
186
		}
188
		return new HashSet<IMemberGroup>(cachedMemberGroups.values());
187
		return cachedMemberGroups.values().toArray(
188
				new IMemberGroup[cachedMemberGroups.size()]);
189
	}
189
	}
190
190
191
	public IMemberGroup getMemberGroup(ID id) throws BBException {
191
	public IMemberGroup getMemberGroup(ID id) throws BBException {
(-)src/org/eclipse/ecf/bulletinboard/IThread.java (-8 / +7 lines)
Lines 11-22 Link Here
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Date;
13
import java.util.Date;
14
import java.util.List;
15
14
16
import org.eclipse.ecf.core.identity.ID;
15
import org.eclipse.ecf.core.identity.ID;
17
16
18
/**
17
/**
19
 * Models a thread in a forum.
18
 * Represents a thread in a forum.
20
 * 
19
 * 
21
 * @author Erkki
20
 * @author Erkki
22
 */
21
 */
Lines 44-54 Link Here
44
	public int getType();
43
	public int getType();
45
44
46
	/**
45
	/**
47
	 * Returns the author of the thread.
46
	 * Returns the poster of the thread.
48
	 * 
47
	 * 
49
	 * @return the author of the thread.
48
	 * @return the poster of the thread.
50
	 */
49
	 */
51
	public IMember getAuthor();
50
	public IMember getPoster();
52
51
53
	public Date getTimePosted();
52
	public Date getTimePosted();
54
53
Lines 79-85 Link Here
79
	 * @throws BBException
78
	 * @throws BBException
80
	 *             if fetching the messages failed
79
	 *             if fetching the messages failed
81
	 */
80
	 */
82
	public List getMessages() throws BBException;
81
	public IThreadMessage[] getMessages() throws BBException;
83
82
84
	/**
83
	/**
85
	 * Returns all new messages in this thread. The exact meaning of when a
84
	 * Returns all new messages in this thread. The exact meaning of when a
Lines 91-97 Link Here
91
	 * @throws BBException
90
	 * @throws BBException
92
	 *             if fetching the messages failed
91
	 *             if fetching the messages failed
93
	 */
92
	 */
94
	public List getNewMessages() throws BBException;
93
	public IThreadMessage[] getNewMessages() throws BBException;
95
94
96
	/**
95
	/**
97
	 * Returns all new messages since the last read message ID given in the
96
	 * Returns all new messages since the last read message ID given in the
Lines 106-112 Link Here
106
	 * @throws BBException
105
	 * @throws BBException
107
	 *             if fetching the messages failed
106
	 *             if fetching the messages failed
108
	 */
107
	 */
109
	public List getNewMessages(ID lastPostId) throws BBException;
108
	public IThreadMessage[] getNewMessages(ID lastPostId) throws BBException;
110
109
111
	/**
110
	/**
112
	 * Returns your subscription status of this thread. SUBSCRIBED or -1 if the
111
	 * Returns your subscription status of this thread. SUBSCRIBED or -1 if the
(-)src/org/eclipse/ecf/bulletinboard/IPoll.java (-4 / +3 lines)
Lines 11-17 Link Here
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Collection;
13
import java.util.Collection;
14
import java.util.List;
15
14
16
/**
15
/**
17
 * Models a poll. Some Bulletin Board implementations only allow a single poll
16
 * Models a poll. Some Bulletin Board implementations only allow a single poll
Lines 68-74 Link Here
68
	 * 
67
	 * 
69
	 * @return the options
68
	 * @return the options
70
	 */
69
	 */
71
	public List getOptions();
70
	public IPollOption[] getOptions();
72
71
73
	/**
72
	/**
74
	 * Returns a particular option for this poll, identified by the option
73
	 * Returns a particular option for this poll, identified by the option
Lines 89-95 Link Here
89
	 * @throws BBException
88
	 * @throws BBException
90
	 *             if fetching the votes failed.
89
	 *             if fetching the votes failed.
91
	 */
90
	 */
92
	public List getSummaryVotes() throws BBException;
91
	public IPollVote[] getSummaryVotes() throws BBException;
93
92
94
	/**
93
	/**
95
	 * Returns all the votes for this poll. One vote will be returned for all
94
	 * Returns all the votes for this poll. One vote will be returned for all
Lines 99-105 Link Here
99
	 * @throws BBException
98
	 * @throws BBException
100
	 *             if fetching the votes failed.
99
	 *             if fetching the votes failed.
101
	 */
100
	 */
102
	public List getDetailVotes() throws BBException;
101
	public IPollVote[] getDetailVotes() throws BBException;
103
102
104
	/**
103
	/**
105
	 * Creates a IPollVote implementation that can be used to vote on this poll.
104
	 * Creates a IPollVote implementation that can be used to vote on this poll.
(-)src/org/eclipse/ecf/bulletinboard/IMessageBase.java (-82 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 Erkki Lindpere and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Erkki Lindpere - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
12
13
import java.util.Date;
14
15
/**
16
 * This interface contains accessors for properties common to Private and Thread
17
 * Messages.
18
 * 
19
 * @author Erkki
20
 */
21
public interface IMessageBase extends IBBObject {
22
	/**
23
	 * Returns the moment in time when this message was posted.
24
	 * 
25
	 * TODO Design timezone handling.
26
	 * 
27
	 * @return
28
	 */
29
	public Date getTimePosted();
30
31
	/**
32
	 * Sets the name (title) of the message.
33
	 * 
34
	 * @param name
35
	 *            the name to set
36
	 * @throws IllegalWriteException
37
	 *             if the message is read-only
38
	 */
39
	public void setName(String name) throws IllegalWriteException;
40
41
	/**
42
	 * Returns the contents of the message.
43
	 * 
44
	 * @return contents
45
	 */
46
	public String getMessage();
47
48
	/**
49
	 * Sets the contents of the message.
50
	 * 
51
	 * @param message
52
	 *            the contents to set
53
	 * @throws IllegalWriteException
54
	 *             if the message is read-only
55
	 */
56
	public void setMessage(String message) throws IllegalWriteException;
57
58
	/**
59
	 * Returns the author (sender) of the message.
60
	 * 
61
	 * @return author
62
	 */
63
	public IMember getFrom();
64
65
	/**
66
	 * Returns the message that this one is a reply to or null if it's not a
67
	 * reply.
68
	 * 
69
	 * @return the message that this is a reply to
70
	 */
71
	public IMessageBase getReplyTo();
72
73
	/**
74
	 * Sets this message as a reply to another message.
75
	 * 
76
	 * @param message
77
	 *            the message that this will be set as a reply to.
78
	 * @throws IllegalWriteException
79
	 *             if the message is read-only
80
	 */
81
	public void setReplyTo(IMessageBase message) throws IllegalWriteException;
82
}
(-)src/org/eclipse/ecf/bulletinboard/IBulletinBoardContainerAdapter.java (-8 / +6 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Collection;
14
import java.util.List;
15
16
import org.eclipse.core.runtime.IAdaptable;
13
import org.eclipse.core.runtime.IAdaptable;
17
import org.eclipse.ecf.core.identity.ID;
14
import org.eclipse.ecf.core.identity.ID;
18
import org.eclipse.ecf.core.identity.IIdentifiable;
15
import org.eclipse.ecf.core.identity.IIdentifiable;
Lines 24-30 Link Here
24
 * 
21
 * 
25
 * @author Erkki
22
 * @author Erkki
26
 */
23
 */
27
public interface IBulletinBoardContainerAdapter extends IAdaptable, IIdentifiable {
24
public interface IBulletinBoardContainerAdapter extends IAdaptable,
25
		IIdentifiable {
28
26
29
	/**
27
	/**
30
	 * Returns the title for this Bulletin Board.
28
	 * Returns the title for this Bulletin Board.
Lines 42-48 Link Here
42
	 * @throws BBException
40
	 * @throws BBException
43
	 *             if fetching the forums failed.
41
	 *             if fetching the forums failed.
44
	 */
42
	 */
45
	public List getForums() throws BBException;
43
	public IForum[] getForums() throws BBException;
46
44
47
	/**
45
	/**
48
	 * Returns all the top-level forums (or forum categories) that are visible
46
	 * Returns all the top-level forums (or forum categories) that are visible
Lines 52-58 Link Here
52
	 * @throws BBException
50
	 * @throws BBException
53
	 *             if fetching the forums failed
51
	 *             if fetching the forums failed
54
	 */
52
	 */
55
	public List getTopLevelForums() throws BBException;
53
	public IForum[] getTopLevelForums() throws BBException;
56
54
57
	/**
55
	/**
58
	 * Returns a particular forum identified by the id parameter.
56
	 * Returns a particular forum identified by the id parameter.
Lines 102-108 Link Here
102
	 * @throws BBException
100
	 * @throws BBException
103
	 *             if fetching the groups failed
101
	 *             if fetching the groups failed
104
	 */
102
	 */
105
	public Collection getMemberGroups() throws BBException;
103
	public IMemberGroup[] getMemberGroups() throws BBException;
106
104
107
	/**
105
	/**
108
	 * Returns a particular member group identified by the id parameter
106
	 * Returns a particular member group identified by the id parameter
Lines 124-130 Link Here
124
	 * @throws BBException
122
	 * @throws BBException
125
	 *             if fetching the members failed.
123
	 *             if fetching the members failed.
126
	 */
124
	 */
127
	public List getMembers() throws BBException;
125
	public IMember[] getMembers() throws BBException;
128
126
129
	/**
127
	/**
130
	 * Returns a particular member of the Bulletin Board identified by the id
128
	 * Returns a particular member of the Bulletin Board identified by the id
(-)src/org/eclipse/ecf/bulletinboard/BBException.java (+5 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import org.eclipse.core.runtime.IStatus;
13
import org.eclipse.ecf.core.util.ECFException;
14
import org.eclipse.ecf.core.util.ECFException;
14
15
15
/**
16
/**
Lines 35-38 Link Here
35
	public BBException(Throwable cause) {
36
	public BBException(Throwable cause) {
36
		super(cause);
37
		super(cause);
37
	}
38
	}
39
40
	public BBException(IStatus status) {
41
		super(status);
42
	}
38
}
43
}
(-)src/org/eclipse/ecf/bulletinboard/IMemberGroup.java (-3 / +9 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Collection;
14
15
/**
13
/**
16
 * Models a member group of a Bulletin Board.
14
 * Models a member group of a Bulletin Board.
17
 * 
15
 * 
Lines 30-34 Link Here
30
	 * 
28
	 * 
31
	 * @return all group members
29
	 * @return all group members
32
	 */
30
	 */
33
	public Collection getMembers();
31
	public IMember[] getMembers();
32
33
	/**
34
	 * Whether the member given in the parameter is a member of this group.
35
	 * 
36
	 * @param member
37
	 * @return
38
	 */
39
	public boolean isMember(IMember member);
34
}
40
}
(-)src/org/eclipse/ecf/bulletinboard/IForum.java (-9 / +21 lines)
Lines 10-27 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Collection;
14
import java.util.List;
15
13
16
/**
14
/**
17
 * This interface models a forum or a forum category.
15
 * This is an interface for forums and forum categories.
18
 * 
16
 * 
19
 * Some bulletin boards support flexible forum structures, including forums
17
 * Some bulletin boards support flexible forum structures, including forums
20
 * inside other forums; some support forum categories that can contain forums,
18
 * inside other forums; some support forum categories that can contain forums,
21
 * but no forums inside other forums. Implementations should model categories as
19
 * but no forums inside other forums. Implementations should model categories as
22
 * forums that do not have the HOLDS_FORUMS type.
20
 * forums that have the HOLDS_FORUMS type, but not the HOLDS_THREADS type.
23
 * 
21
 * 
24
 * Two different forum instances representing the same forum must be equal.
22
 * <pre>
23
 * Flexible structure: 
24
 * Top Level Forum 1 - HOLDS_FORUMS | HOLDS_THREADS
25
 * 		Sub Forum 2 - HOLDS_FORUMS | HOLDS_THREADS
26
 * 			Sub Sub Forum 3 - HOLDS_FORUMS | HOLDS_THREADS
27
 * 		Sub Forum 4 - HOLDS_FORUMS | HOLDS_THREADS
28
 * 
29
 * Fixed structure:
30
 * Category 1 - HOLDS_FORUMS
31
 * 		Forum 1 - HOLDS_THREADS
32
 * Category 2 - HOLDS_FORUMS
33
 * 		Forum 2 - HOLDS_THREADS
34
 * </pre>
35
 * 
36
 * Two different IForum instances representing the same forum must be equal.
25
 * 
37
 * 
26
 * @author Erkki
38
 * @author Erkki
27
 */
39
 */
Lines 32-38 Link Here
32
	public static final int HOLDS_FORUMS = 1;
44
	public static final int HOLDS_FORUMS = 1;
33
45
34
	/**
46
	/**
35
	 * This forum can contain messages.
47
	 * This forum can contain threads.
36
	 */
48
	 */
37
	public static final int HOLDS_THREADS = 2;
49
	public static final int HOLDS_THREADS = 2;
38
50
Lines 56-62 Link Here
56
	 * 
68
	 * 
57
	 * @return the parent of this forum or null
69
	 * @return the parent of this forum or null
58
	 */
70
	 */
59
	public IForum getParentForum();
71
	public IForum getParent();
60
72
61
	/**
73
	/**
62
	 * Returns the subforums of this forum or an empty list if there are none.
74
	 * Returns the subforums of this forum or an empty list if there are none.
Lines 65-71 Link Here
65
	 * 
77
	 * 
66
	 * @return subforums
78
	 * @return subforums
67
	 */
79
	 */
68
	public List getSubForums();
80
	public IForum[] getSubForums();
69
81
70
	/**
82
	/**
71
	 * Returns the threads in this forum or an empty list if there are none.
83
	 * Returns the threads in this forum or an empty list if there are none.
Lines 74-80 Link Here
74
	 * 
86
	 * 
75
	 * @return threads
87
	 * @return threads
76
	 */
88
	 */
77
	public Collection getThreads();
89
	public IThread[] getThreads();
78
90
79
	/**
91
	/**
80
	 * Returns a newly created thread that can be filled and posted in this
92
	 * Returns a newly created thread that can be filled and posted in this
(-)src/org/eclipse/ecf/bulletinboard/IMember.java (-2 / +1 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.Collection;
14
13
15
/**
14
/**
16
 * This interface models a forum Member.
15
 * This interface models a forum Member.
Lines 35-39 Link Here
35
	 * 
34
	 * 
36
	 * @return
35
	 * @return
37
	 */
36
	 */
38
	public Collection getGroups();
37
	public IMemberGroup[] getGroups();
39
}
38
}
(-)src/org/eclipse/ecf/bulletinboard/IPrivateMessage.java (-7 / +5 lines)
Lines 10-33 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
import java.util.List;
14
15
/**
13
/**
16
 * Models a message sent using Private Messaging of a Bulletin Board.
14
 * Represents a message sent using Private Messaging of a Bulletin Board.
17
 * 
15
 * 
18
 * Extends the IMessageBase interface with additional properties that are
16
 * Extends the {@link IBBMessage} interface with additional properties that are
19
 * specific to private messages.
17
 * specific to private messages.
20
 * 
18
 * 
21
 * @author Erkki
19
 * @author Erkki
22
 */
20
 */
23
public interface IPrivateMessage extends IMessageBase {
21
public interface IPrivateMessage extends IBBMessage {
24
22
25
	/**
23
	/**
26
	 * Returns the recipients of this message.
24
	 * Returns the recipients of this message.
27
	 * 
25
	 * 
28
	 * @return the recipients
26
	 * @return the recipients
29
	 */
27
	 */
30
	public List getRecipients();
28
	public IMember[] getRecipients();
31
29
32
	/**
30
	/**
33
	 * Sets the recipient of this message.
31
	 * Sets the recipient of this message.
Lines 47-52 Link Here
47
	 * @throws IllegalWriteException
45
	 * @throws IllegalWriteException
48
	 *             if the message is read-only
46
	 *             if the message is read-only
49
	 */
47
	 */
50
	public void setRecipients(List recipients)
48
	public void setRecipients(IMember[] recipients)
51
			throws IllegalWriteException;
49
			throws IllegalWriteException;
52
}
50
}
(-)src/org/eclipse/ecf/bulletinboard/IThreadMessage.java (-3 / +3 lines)
Lines 11-24 Link Here
11
package org.eclipse.ecf.bulletinboard;
11
package org.eclipse.ecf.bulletinboard;
12
12
13
/**
13
/**
14
 * Models a thread message in a Bulletin Board forum.
14
 * Represents a thread message in a Bulletin Board forum.
15
 * 
15
 * 
16
 * Extends the IMessageBase interface with additional properties that are
16
 * Extends the {@link IBBMessage} interface with additional properties that are
17
 * specific to thread messages.
17
 * specific to thread messages.
18
 * 
18
 * 
19
 * @author Erkki
19
 * @author Erkki
20
 */
20
 */
21
public interface IThreadMessage extends IMessageBase {
21
public interface IThreadMessage extends IBBMessage {
22
	/**
22
	/**
23
	 * Returns the thread that this message belongs to or null if it's unknown.
23
	 * Returns the thread that this message belongs to or null if it's unknown.
24
	 * 
24
	 * 
(-)src/org/eclipse/ecf/bulletinboard/IBBMessage.java (+84 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 Erkki Lindpere and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Erkki Lindpere - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ecf.bulletinboard;
12
13
import java.util.Date;
14
15
/**
16
 * This is a super interface for all bulletin board messages and contains
17
 * accessors for properties common to both private and thread messages.
18
 * 
19
 * @see IThreadMessage, IPrivateMessage
20
 * 
21
 * @author Erkki
22
 */
23
public interface IBBMessage extends IBBObject {
24
	/**
25
	 * Returns the poster of the message.
26
	 * 
27
	 * @return author
28
	 */
29
	public IMember getPoster();
30
31
	/**
32
	 * Returns the moment in time when this message was posted.
33
	 * 
34
	 * TODO Design timezone handling.
35
	 * 
36
	 * @return
37
	 */
38
	public Date getTimePosted();
39
40
	/**
41
	 * Sets the name (title) of the message.
42
	 * 
43
	 * @param name
44
	 *            the name to set
45
	 * @throws IllegalWriteException
46
	 *             if the message is read-only
47
	 */
48
	public void setTitle(String name) throws IllegalWriteException;
49
50
	/**
51
	 * Returns the contents of the message.
52
	 * 
53
	 * @return contents
54
	 */
55
	public String getBody();
56
57
	/**
58
	 * Sets the contents of the message.
59
	 * 
60
	 * @param body
61
	 *            the contents to set
62
	 * @throws IllegalWriteException
63
	 *             if the message is read-only
64
	 */
65
	public void setBody(String body) throws IllegalWriteException;
66
67
	/**
68
	 * Returns the message that this one is a reply to or null if it's not a
69
	 * reply.
70
	 * 
71
	 * @return the message that this is a reply to
72
	 */
73
	public IBBMessage getReplyTo();
74
75
	/**
76
	 * Sets this message as a reply to another message.
77
	 * 
78
	 * @param message
79
	 *            the message that this will be set as a reply to.
80
	 * @throws IllegalWriteException
81
	 *             if the message is read-only
82
	 */
83
	public void setReplyTo(IBBMessage message) throws IllegalWriteException;
84
}

Return to bug 180796