Skip to content

Commit eb63773

Browse files
committed
working on java doc
1 parent 655d6c5 commit eb63773

File tree

5 files changed

+119
-3
lines changed

5 files changed

+119
-3
lines changed

src/net/sharksystem/asp3/ASP3Chunk.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import java.util.List;
66

77
/**
8-
* A chunk represent a set of messages which are issued to a
9-
* topic (described by an UIR).
8+
* A chunk represents a set of messages addressed by an URI.
9+
*
1010
*
1111
* @author thsc
12+
* @see ASPChunkStorage for more details
1213
*/
1314
public interface ASP3Chunk {
1415

src/net/sharksystem/asp3/ASP3ChunkStorage.java

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,118 @@
55

66
/**
77
*
8+
* Communication break down in ad-hoc networks is normal and no failure.
9+
* That chunk storage is meant to keep messages which are produced by an
10+
* app for later transmission.
11+
*
12+
* Messages which cannot be sent to their recipients can be stored in ASP3 chunks.
13+
* Each chunk is addressed with an URI (comparable to URIs e.g. in Android
14+
* Content Provider)
15+
*
16+
* Applications can easlily store their messages by calling add(URI, message).
17+
* That message is stored in a chunk addressed by the URI.
18+
*
19+
* Each chunk has a recipient list which can be changed anytime. The ASP3Engine
20+
* uses those information for sending such stored messages whenever a peer
21+
* establishes a connection.
22+
*
23+
* It is recommended to use ASP3EngineFS to set up that framework.
24+
* Create a ASP3Engine like this
25+
*
26+
* <pre>
27+
* ASP3Reader reader = ...;
28+
* ASP3ChunkStorage myStorage = ASP3EngineFS.getASP3Engine("EngineName", "ChunkStorageRootFolder", reader);
29+
* </pre>
30+
*
31+
* An ASP3Reader must be implemented prior using that framework. Objects of
32+
* that class are called whenever another peer transmits messages to the
33+
* local peer. @seeASP3Reader
34+
*
35+
* Chunks are structured by eras. In most cases, application developers don't
36+
* have to care about era management at all. If so, take care. Eras are usually
37+
* changed by the ASPEngine whenever a peer (re-) connects. In that case, the
38+
* current era is declared to be finished and an new era is opened.
39+
* Any new message is now tagged as message from that new era. The ASP3Engine
40+
* transmitts all message to the peer which are stored after the final
41+
* encounter. If no encounter ever happend - all avaiable messages are
42+
* transmitted.
43+
*
44+
* @see ASPEngine
45+
* @see ASP3Reader
46+
*
847
* @author thsc
948
*/
1049
public interface ASP3ChunkStorage extends ASP3Storage {
1150

51+
/**
52+
* Adds a recipient to chunk recipient list.
53+
* @param urlTarget chunk address
54+
* @param recipient recipient to add
55+
* @throws IOException
56+
*/
1257
public void addRecipient(CharSequence urlTarget, CharSequence recipient) throws IOException;
58+
59+
/**
60+
/**
61+
* Set a list of recipients for chunk. A former list is dropped.
62+
*
63+
* @param urlTarget chunk address
64+
* @param recipients new list of recipients
65+
* @throws IOException
66+
*/
1367
public void setRecipients(CharSequence urlTarget, List<CharSequence> recipients) throws IOException;
68+
69+
/**
70+
* Removes recipients
71+
* @param urlTarget chunk address
72+
* @param recipients list of recipients to be removed
73+
* @throws IOException
74+
*/
1475
public void removeRecipient(CharSequence urlTarget, CharSequence recipients) throws IOException;
1576

77+
/**
78+
* Add a message to that chunk.
79+
* @param urlTarget chunk address
80+
* @param message Message to be kept for later transmission
81+
* @throws IOException
82+
*/
1683
public void add(CharSequence urlTarget, CharSequence message) throws IOException;
1784

85+
/**
86+
* Create a new era
87+
*/
1888
public void newEra();
1989

90+
/**
91+
* Get oldest era available on that peer.
92+
* @return
93+
*/
2094
public int getOldestEra();
95+
96+
/**
97+
* Get current era.
98+
* @return
99+
*/
21100
public int getEra();
101+
102+
/**
103+
* Get next era number. Era numbers are organized in a circle. Number 0
104+
* follows Integer.MAXVALUE. That method takes care of that fact.
105+
* No change is made on current era.
106+
*
107+
* @param era
108+
* @return
109+
*/
22110
public int getNextEra(int era);
111+
112+
/**
113+
* Get previous era number. Era numbers are organized in a circle. Er
114+
* number 0 is proceeded by era number Integer.MAXVALUE.
115+
* That method takes care of that fact.
116+
* No change is made on current era.
117+
*
118+
* @param era
119+
* @return
120+
*/
23121
public int getPreviousEra(int era);
24122
}

src/net/sharksystem/asp3/ASP3Engine.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
import java.util.List;
1212

1313
/**
14-
*
14+
* That ASP3Engine manages exchange of stored messages with peers.
15+
* See ASPChunkStorage for details.
16+
*
17+
* @see ASP3ChunkStorage
18+
* @see ASP3Reader
1519
* @author thsc
1620
*/
1721
public class ASP3Engine implements ASP3ChunkStorage, ASP3ProtocolEngine {

src/net/sharksystem/asp3/ASP3EngineFS.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.HashMap;
1010

1111
/**
12+
* ASP3Engine that stores data in file system.
1213
* @author thsc
1314
*/
1415
public class ASP3EngineFS extends ASP3Engine {

src/net/sharksystem/asp3/ASP3Reader.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
package net.sharksystem.asp3;
22

33
/**
4+
* Developers have to implement a class implementing that interface
5+
* before using that framework. ASP3 is menat to store and forward
6+
* messages in dynamic ad-hoc networks. ASP3 does not process those
7+
* messages - that's applications specific.
8+
*
9+
* That interfaces is used by ASP3Engine as callback interface. The
10+
* engine retrieves message from other peers and calls methods declared
11+
* in that interface.
412
*
13+
* Developers must implement that callback class before using that framework
14+
*
15+
* @see ASP3Engine
16+
* @see ASP3ChunkStorage
517
* @author thsc
618
*/
719
public interface ASP3Reader {

0 commit comments

Comments
 (0)