|
1 | 1 | package net.sharksystem.asap; |
2 | 2 |
|
3 | | -import net.sharksystem.asap.protocol.*; |
4 | | -import net.sharksystem.crypto.BasicKeyStore; |
5 | | - |
6 | | -import java.io.IOException; |
7 | | -import java.io.OutputStream; |
8 | | -import java.util.Set; |
9 | | - |
10 | | -/** |
11 | | - * There is an ASAPEngine that stores its data with a filesystem. |
12 | | - * One significant parameter is a root directory. |
13 | | - * |
14 | | - * It is good practice to use a different root for each application. |
15 | | - * |
16 | | - * It is also common that more than one ASAP based app is running |
17 | | - * on one machine. Thus, different ASAP filesystem based engine are |
18 | | - * to deal with the data depending on the ASAP format. |
19 | | - * |
20 | | - * That interface hides those different engines. |
21 | | - */ |
22 | | -public interface ASAPPeer extends ASAPConnectionHandler { |
23 | | - long DEFAULT_MAX_PROCESSING_TIME = Long.MAX_VALUE; |
24 | | - |
25 | | - /** |
26 | | - * get an existing engine |
27 | | - * @param format |
28 | | - * @return |
29 | | - * @throws ASAPException engine does not exist |
30 | | - * @throws IOException |
31 | | - */ |
32 | | - ASAPEngine getEngineByFormat(CharSequence format) throws ASAPException, IOException; |
33 | | - |
34 | | - /** |
35 | | - * return already existing or create an engine for a given format / application name |
36 | | - * @param format |
37 | | - * @return |
38 | | - * @throws ASAPException |
39 | | - * @throws IOException |
40 | | - */ |
41 | | - ASAPEngine createEngineByFormat(CharSequence format) throws ASAPException, IOException; |
42 | | - |
43 | | - ASAPChunkReceivedListener getListenerByFormat(CharSequence format) throws ASAPException; |
44 | | - |
45 | | - /** |
46 | | - * get or create engine for a given application - mainly means: setup folder |
47 | | - * @param format |
48 | | - * @return |
49 | | - */ |
50 | | - ASAPEngine getASAPEngine(CharSequence format) throws IOException, ASAPException; |
51 | | - |
52 | | - void pushInterests(OutputStream os) throws IOException, ASAPException; |
53 | | - |
54 | | - Set<CharSequence> getOnlinePeers(); |
55 | | - |
56 | | - boolean existASAPConnection(CharSequence recipient); |
57 | | - |
58 | | - ASAPConnection getASAPConnection(CharSequence recipient); |
59 | | - |
60 | | - CharSequence getOwner(); |
61 | | - |
62 | | - void newEra() throws IOException, ASAPException; |
63 | | - |
64 | | - void setASAPChunkReceivedListener(CharSequence appName, ASAPChunkReceivedListener listener) throws ASAPException; |
65 | | - |
66 | | - void addOnlinePeersChangedListener(ASAPOnlinePeersChangedListener listener); |
67 | | - |
68 | | - void removeOnlinePeersChangedListener(ASAPOnlinePeersChangedListener listener); |
69 | | - |
70 | | - /** |
71 | | - * @return true if the asap management engine is up and running |
72 | | - */ |
73 | | - boolean isASAPManagementEngineRunning(); |
74 | | - |
75 | | - EngineSetting getEngineSettings(CharSequence format) throws ASAPException; |
76 | | - |
77 | | - /** |
78 | | - * @return all formats currently supported by this mulit engine |
79 | | - */ |
80 | | - Set<CharSequence> getFormats(); |
81 | | - |
82 | | - void activateOnlineMessages(); |
83 | | - void deactivateOnlineMessages(); |
84 | | - |
85 | | - /** |
86 | | - * This message is only transmitted with open connections. Message is not stored. Nothing happens if no open |
87 | | - * connection is present. |
88 | | - * @param format |
89 | | - * @param urlTarget |
90 | | - * @param recipients |
91 | | - * @param messageAsBytes |
92 | | - * @param era |
93 | | - * @throws IOException |
94 | | - * @throws ASAPException |
95 | | - */ |
96 | | - void sendOnlineASAPAssimilateMessage(CharSequence format, CharSequence urlTarget, Set<CharSequence> recipients, |
97 | | - byte[] messageAsBytes, int era) throws IOException, ASAPException; |
98 | | - |
99 | | - void sendOnlineASAPAssimilateMessage(CharSequence format, CharSequence urlTarget, Set<CharSequence> recipients, |
100 | | - byte[] messageAsBytes) throws IOException, ASAPException; |
101 | | - |
102 | | - void sendOnlineASAPAssimilateMessage(CharSequence format, CharSequence urlTarget, byte[] messageAsBytes) |
103 | | - throws IOException, ASAPException; |
104 | | - |
105 | | - void setASAPBasicKeyStorage(BasicKeyStore basicKeyStore); |
106 | | - |
107 | | - ASAPCommunicationSetting getASAPCommunicationControl(); |
108 | | - |
109 | | - BasicKeyStore getBasicCryptoParameters() throws ASAPSecurityException; |
110 | | - |
111 | | - void setSecurityAdministrator(DefaultSecurityAdministrator securityAdministrator); |
| 3 | +public interface ASAPPeer extends |
| 4 | + ASAPMessageSender, |
| 5 | + ASAPEnvironmentChangesListenerManagement, |
| 6 | + ASAPMessageReceivedListenerManagement |
| 7 | +{ |
| 8 | + CharSequence getPeerName(); |
112 | 9 | } |
0 commit comments