44import net .sharksystem .asap .management .ASAPManagementStorageImpl ;
55import net .sharksystem .asap .protocol .*;
66import net .sharksystem .asap .util .Log ;
7+ import net .sharksystem .crypto .ASAPCommunicationCryptoSettings ;
78
89import java .io .IOException ;
910import java .io .InputStream ;
1819 * @author thsc
1920 */
2021public abstract class ASAPEngine extends ASAPStorageImpl implements ASAPStorage , ASAPProtocolEngine , ASAPManagementStorage {
21- private DefaultPeerSecurityAdministrator securityAdministrator = new DefaultPeerSecurityAdministrator ();
22+ private DefaultSecurityAdministrator securityAdministrator = new DefaultSecurityAdministrator ();
2223
2324 public static final String ANONYMOUS_OWNER = "anon" ;
2425 static String DEFAULT_OWNER = ANONYMOUS_OWNER ;
@@ -56,6 +57,22 @@ private void saveStatus() throws IOException {
5657 }
5758 }
5859
60+ PermissionControl getPermissionControl () {
61+ return this .securityAdministrator ;
62+ }
63+
64+ public ASAPEnginePermissionSettings getASAPEnginePermissionSettings () {
65+ return this .securityAdministrator ;
66+ }
67+
68+ public ASAPCommunicationSetting getASAPCommunicationControl () {
69+ return this .securityAdministrator ;
70+ }
71+
72+ public ASAPCommunicationCryptoSettings getASAPCommunicationCryptoSettings () {
73+ return this .securityAdministrator ;
74+ }
75+
5976 @ Override
6077 public ASAPChunkStorage getChunkStorage () {
6178 return this .chunkStorage ;
@@ -374,12 +391,12 @@ public void handleASAPOffer(ASAP_OfferPDU_1_0 asapOffer, ASAP_1_0 protocol, Outp
374391// }
375392 }
376393
377- public void handleASAPAssimilate (ASAP_AssimilationPDU_1_0 asapAssimiliationPDU , ASAP_1_0 protocol ,
394+ public void handleASAPAssimilate (ASAP_AssimilationPDU_1_0 asapAssimilationPDU , ASAP_1_0 protocol ,
378395 InputStream is , OutputStream os , ASAPChunkReceivedListener listener )
379396 throws ASAPException , IOException {
380397
381- String sender = asapAssimiliationPDU .getSender ();
382- int eraSender = asapAssimiliationPDU .getEra ();
398+ String sender = asapAssimilationPDU .getSender ();
399+ int eraSender = asapAssimilationPDU .getEra ();
383400
384401 //<<<<<<<<<<<<<<<<<<debug
385402 StringBuilder b = new StringBuilder ();
@@ -406,7 +423,7 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimiliationPDU,
406423
407424 try {
408425 // read URI
409- String uri = asapAssimiliationPDU .getChannelUri ();
426+ String uri = asapAssimilationPDU .getChannelUri ();
410427
411428 // get local target for data to come
412429 ASAPChunk localChunk = null ;
@@ -419,7 +436,7 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimiliationPDU,
419436 System .out .println (this .getLogStart ()
420437 + "asked to set up new channel: (uri/sender): " + uri + " | " + sender );
421438 // this channel is new to local peer - am I allowed to create it?
422- if (!this .securityAdministrator .allowedToCreateChannel (asapAssimiliationPDU )) {
439+ if (!this .securityAdministrator .allowedToCreateChannel (asapAssimilationPDU )) {
423440 System .out .println (this .getLogStart ()
424441 + ".. not allowed .. TODO not yet implemented .. always set up" );
425442
@@ -438,10 +455,10 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimiliationPDU,
438455 incomingChunk .copyMetaData (this .getChannel (uri ));
439456 }
440457
441- List <Integer > messageOffsets = asapAssimiliationPDU .getMessageOffsets ();
458+ List <Integer > messageOffsets = asapAssimilationPDU .getMessageOffsets ();
442459
443460 // iterate messages and stream into chunk
444- InputStream protocolInputStream = asapAssimiliationPDU .getInputStream ();
461+ InputStream protocolInputStream = asapAssimilationPDU .getInputStream ();
445462 long offset = 0 ;
446463 for (long nextOffset : messageOffsets ) {
447464 //<<<<<<<<<<<<<<<<<<debug
@@ -466,11 +483,11 @@ public void handleASAPAssimilate(ASAP_AssimilationPDU_1_0 asapAssimiliationPDU,
466483 b .append ("going to read last message: from offset " );
467484 b .append (offset );
468485 b .append (" to end of file - total length: " );
469- b .append (asapAssimiliationPDU .getLength ());
486+ b .append (asapAssimilationPDU .getLength ());
470487 System .out .println (b .toString ());
471488 //>>>>>>>>>>>>>>>>>>>debug
472489
473- incomingChunk .addMessage (protocolInputStream , asapAssimiliationPDU .getLength () - offset );
490+ incomingChunk .addMessage (protocolInputStream , asapAssimilationPDU .getLength () - offset );
474491 if (!changed ) { changed = true ; this .contentChanged ();}
475492
476493 // read all messages
@@ -664,7 +681,7 @@ private void sendChunks(CharSequence sender, String remotePeer, ASAPChunkStorage
664681 chunk .getOffsetList (),
665682 chunk .getMessageInputStream (),
666683 os ,
667- false );
684+ this . getASAPCommunicationCryptoSettings () );
668685
669686 // remember sent
670687 chunk .deliveredTo (remotePeer );
0 commit comments