-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNewAndNoteworthy_0.6.2.html
185 lines (171 loc) · 6.43 KB
/
NewAndNoteworthy_0.6.2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ECF New and Noteworthy</title>
<link rel="stylesheet" href="http://www.eclipse.org/default_style.css" type="text/css">
</head>
<body bgcolor="#FFFFFF">
<table border=0 cellspacing=5 cellpadding=2 width="100%">
<tbody>
<tr>
<td width="69%" class="bannertext">
<font class="indextop style">eclipse communication framework</font>
<br><br>
<font class="indexsub">an eclipse technology subproject</font>
<br><br>
<font class="indextop style2">New and Noteworthy</font><br>0.6.2 Stable Release</font>
<br><br><br>
Return to <a href="downloads.php">ECF download page</a></br>
Return to <a href="comm_resources.php">ECF communication resources page</a>
<br><br>
<a href="NewAndNoteworthy_0.4.0.html">New and Noteworthy for 0.4.0</a><br>
<a href="NewAndNoteworthy_0.5.2.html">New and Noteworthy for 0.5.2</a><br>
<a href="NewAndNoteworthy_0.5.4.html">New and Noteworthy for 0.5.4</a><br>
<a href="NewAndNoteworthy_0.6.0.html">New and Noteworthy for 0.6.0</a>
</td>
<td width="31%">
<div align="center">
<img src="../images/Idea.jpg" width="120" height="86" hspace="50" align="middle">
</div>
</td>
</tr>
</tbody>
</table>
<table>
<TR> <!----------------------------------------------------->
<TD colSpan=2> <HR> </TD>
</TR>
<TR><TD colSpan=2><H2>ECF API Additions and Changes</H2></TD>
<TR>
<TD vAlign=top align=left width="30%">
<p><br></p>
<P align=left>
<B>Revised Datashare API</B>
</P>
</TD>
<TD vAlign=top width="70%">
<p><br></p>
<P>The revised datashare API <b>org.eclipse.ecf.datashare</b> allows clients
to create channels for distributing arbitrary data. Here's some example code showing the
creation of a channel and use to distribute some test data:
<pre>
// Create container
IContainer container = ContainerFactory.getDefault().createContainer(
CHANNEL_CONTAINER);
// Connect container
container.connect(serverID, null);
// Get IChannelContainer adapter
IChannelContainer channelContainer = (IChannelContainer) container
.getAdapter(IChannelContainer.class);
// Create channel listener
IChannelListener listener = new IChannelListener() {
public void handleChannelEvent(IChannelEvent event) {
System.out.println("handleChannelEvent(evt=" + event + ")");
}
};
// Create channel named "mychannel"
IChannel channel = channelContainer.createChannel(IDFactory.getDefault().createStringID("channel1"), listener,
new HashMap());
// Send data on channel
for (int i = 0; i < 10; i++) {
channel.sendMessage("hello".getBytes());
Thread.sleep(200);
}
</pre>
See the javadocs for the
<a href="http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/datashare/package-summary.html">org.eclipse.ecf.datashare package</a>
, and the
<a href="http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/datashare/events/package-summary.html">org.eclipse.ecf.datashare.events</a>
package.
</p>
</TD>
</TR>
<TR>
<TD vAlign=top align=left width="30%">
<p><br></p>
<P align=left>
<B>New Fileshare API</B>
</P>
</TD>
<TD vAlign=top width="70%">
<p><br></p>
<P>The new Fileshare API provides clients with a mechanism for asynchronously sending and retrieving files. Here's
some example code that sends a file to all of the other connected participants within the given <b>IContainer</b>
instance:
<pre>
// Create container
IContainer container = ContainerFactory.getDefault().createContainer(
FILESHARE_CONTAINER);
// Connect container
container.connect(serverID, null);
// Get fileshare adapter
IFileShareContainer fileshareContainer = (IFileShareContainer) container
.getAdapter(IFileShareContainer.class);
// Create fileshare listener
IFileShareListener listener = new IFileShareListener() {
public void handleFileShareEvent(IFileShareEvent event) {
System.out.println("handleChannelEvent(" + event + ")");
}
};
// Create ID for new fileshare instance
ID fileshareID = IDFactory.getDefault().createGUID();
// Create ID to specify remote file name...in this case make remote name same as local name
ID remoteFileID = IDFactory.getDefault().createID(
fileshareContainer.getFileNamespace(), filename);
// Create fileshare instance in container
IFileShare fileshare = fileshareContainer.createSender(fileshareID,
new FileInputStream(filename), remoteFileID, listener,
new HashMap());
// Start sending asynchronously...this actualy sends the local file 'filename'
// to all in container
fileshare.start();
</pre>
Here is example code that asynchronously retrieves a file from a web server:
<pre>
// Create container
IContainer container = ContainerFactory.getDefault().createContainer(
FILESHARE_CONTAINER);
// Connect container
container.connect(serverID, null);
// Get fileshare adapter
IFileShareContainer fileshareContainer = (IFileShareContainer) container
.getAdapter(IFileShareContainer.class);
// Create fileshare listener
IFileShareListener listener = new IFileShareListener() {
public void handleFileShareEvent(IFileShareEvent event) {
// Note...here is where the retrieved file contents
// Should be saved...when IFileShareRetrieveData events are received
System.out.println("handleChannelEvent(" + event + ")");
}
};
// Create ID for new fileshare instance
ID fileshareID = IDFactory.getDefault().createGUID();
// Create ID for the remote file...e.g. fileurl = 'http://www.eclipse.org/index.html'
ID fileID = IDFactory.getDefault().createID(
fileshareContainer.getFileNamespace(), fileurl);
// Create fileshare instance in container
IFileShare fileshare = fileshareContainer.createRetriever(fileshareID,
fileID, listener, new HashMap());
// Start receiving asynchronously...this actualy retrieves the remote file
// 'filename'
fileshare.start();
</pre>
</p>
</TD>
</TR>
<TR>
<TD vAlign=top align=left width="30%">
<p><br></p>
<P align=left>
<B>New example RobotApplication added to example clients</B>
</P>
</TD>
<TD vAlign=top width="70%">
<p><br></p>
<P>The <b>org.eclipse.ecf.example.clients</b> plugin has a new XMPP-based 'robot' in the <b>RobotApplication</b> class.</p>
</TD>
</TR>
</table>
</body>
</html>