diff --git a/bundle-core/src/main/java/com/ddd/model/ADU.java b/bundle-core/src/main/java/com/ddd/model/ADU.java deleted file mode 100644 index 357e5130e1..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/ADU.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ddd.model; - -import java.io.File; -import java.util.Objects; -import java.lang.Comparable; - -public class ADU implements Comparable { - - private File source; - - private final String appId; - - private final long aduId; - - private long size; - - private String clientId; - - public ADU(File source, String appId, long aduId, long size, String clientId) { - this.source = source; - this.appId = appId; - this.aduId = aduId; - this.size = size; - this.clientId = clientId; - } - - public ADU(File source, String appId, long aduId, long size) { - this.source = source; - this.appId = appId; - this.aduId = aduId; - this.size = size; - } - - public File getSource() { - return this.source; - } - - public long getSize() { - return this.size; - } - - public String getAppId() { - return this.appId; - } - - public long getADUId() { - return this.aduId; - } - - public String getClientId() { - return this.clientId; - } - - public void setSource(File source) { - this.source = source; - } - - public void setSize(long size) { - this.size = size; - } - - @Override - public int hashCode() { - return Objects.hash(this.aduId, this.appId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (this.getClass() != obj.getClass()) { - return false; - } - ADU other = (ADU) obj; - return this.aduId == other.aduId && Objects.equals(this.appId, other.appId); - } - - @Override - public int compareTo(ADU o) { - int ret = appId.compareTo(o.getAppId()); - if (ret == 0) { - ret = (int) (aduId - o.getADUId()); - } - return ret; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/ADUStream.java b/bundle-core/src/main/java/com/ddd/model/ADUStream.java deleted file mode 100644 index 2cd6599a2e..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/ADUStream.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ddd.model; - -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; - -public interface ADUStream { - - public int read(byte[] b); - - public void close(); -} - -class ADUStreamImpl implements ADUStream { - - private BufferedInputStream bufferedInputStream; - - public ADUStreamImpl() { - try { - this.bufferedInputStream = new BufferedInputStream(new FileInputStream("")); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - @Override - public int read(byte[] b) { - try { - return this.bufferedInputStream.read(b); - } catch (IOException e) { - e.printStackTrace(); - } - return 0; - } - - @Override - public void close() { - try { - this.bufferedInputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/Acknowledgement.java b/bundle-core/src/main/java/com/ddd/model/Acknowledgement.java deleted file mode 100644 index 6c28075678..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/Acknowledgement.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ddd.model; - -import java.util.Objects; - -public class Acknowledgement { - - private final String bundleId; - - private final long size; - - public Acknowledgement(String bundleId) { - this.bundleId = bundleId; - this.size = bundleId.getBytes().length; - } - - public String getBundleId() { - return this.bundleId; - } - - public long getSize() { - return this.size; - } - - @Override - public int hashCode() { - return Objects.hash(this.bundleId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (this.getClass() != obj.getClass()) { - return false; - } - Acknowledgement other = (Acknowledgement) obj; - return Objects.equals(this.bundleId, other.bundleId); - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/Bundle.java b/bundle-core/src/main/java/com/ddd/model/Bundle.java deleted file mode 100644 index e49ba634aa..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/Bundle.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class Bundle { - private final File source; - - public Bundle(File source) { - this.source = source; - } - - public File getSource() { - return this.source; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/BundleDTO.java b/bundle-core/src/main/java/com/ddd/model/BundleDTO.java deleted file mode 100644 index c15075159e..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/BundleDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ddd.model; - -public class BundleDTO { - - private String bundleId; - private Bundle bundle; - - public String getBundleId() { - return this.bundleId; - } - - public Bundle getBundle() { - return this.bundle; - } - - public BundleDTO(String bundleId, Bundle bundle) { - this.bundleId = bundleId; - this.bundle = bundle; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/BundleTransferDTO.java b/bundle-core/src/main/java/com/ddd/model/BundleTransferDTO.java deleted file mode 100644 index ed21d45932..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/BundleTransferDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ddd.model; - -import java.util.List; -import java.util.Set; - -public class BundleTransferDTO { - - private Set deletionSet; - - private List bundles; - - public BundleTransferDTO(Set deletionSet, List bundles) { - this.deletionSet = deletionSet; - this.bundles = bundles; - } - - public Set getDeletionSet() { - return this.deletionSet; - } - - public List getBundles() { - return this.bundles; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/BundleWrapper.java b/bundle-core/src/main/java/com/ddd/model/BundleWrapper.java deleted file mode 100644 index b03de7f465..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/BundleWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class BundleWrapper { - private String bundleId; - private EncryptionHeader encHeader; - private EncryptedBundle encbundle; - private File payloadSignature; - private File source; - - public BundleWrapper(String bundleId, EncryptionHeader encHeader, EncryptedBundle encbundle, File source, - File payloadSignature) { - this.bundleId = bundleId; - this.encHeader = encHeader; - this.encbundle = encbundle; - this.source = source; - this.payloadSignature = payloadSignature; - } - - public String getBundleId() { - return bundleId; - } - - public EncryptionHeader getEncHeader() { - return encHeader; - } - - public EncryptedBundle getEncbundle() { - return encbundle; - } - - public File getSource() { - return source; - } - - public File getPayloadSignature() { - return payloadSignature; - } -} \ No newline at end of file diff --git a/bundle-core/src/main/java/com/ddd/model/EncryptedBundle.java b/bundle-core/src/main/java/com/ddd/model/EncryptedBundle.java deleted file mode 100644 index 6b9e4287be..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/EncryptedBundle.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class EncryptedBundle { - private File source; - - public EncryptedBundle(File source) { - this.source = source; - } - - public File getSource() { - return source; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/EncryptedPayload.java b/bundle-core/src/main/java/com/ddd/model/EncryptedPayload.java deleted file mode 100644 index 34fd24df62..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/EncryptedPayload.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class EncryptedPayload { - private final String bundleId; - private final File source; - - public EncryptedPayload(String bundleId, File source) { - this.bundleId = bundleId; - this.source = source; - } - - public String getBundleId() { - return this.bundleId; - } - - public File getSource() { - return this.source; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/EncryptionHeader.java b/bundle-core/src/main/java/com/ddd/model/EncryptionHeader.java deleted file mode 100644 index 3543515f21..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/EncryptionHeader.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ddd.model; - -import lombok.Builder; -import lombok.Data; -import lombok.Getter; - -import java.io.File; - -@Data -@Getter -@Builder -public class EncryptionHeader { - private final File serverSignedPreKey; - private final File serverIdentityKey; - private final File serverRatchetKey; - private File clientBaseKey; - private File clientIdentityKey; -} diff --git a/bundle-core/src/main/java/com/ddd/model/Metadata.java b/bundle-core/src/main/java/com/ddd/model/Metadata.java deleted file mode 100644 index 82fe28da8f..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/Metadata.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ddd.model; - -public class Metadata { - //last messageId added by the app - public long lastAddedMessageId; - - //last messageId sent successfully via DTN - public long lastSentMessageId; - - //last messageId received via DTN - public long lastReceivedMessageId; - - //latest messageId processed by the application - public long lastProcessedMessageId; - - public Metadata(long lastAddedMessageId, long lastSentMessageId, long lastReceivedMessageId, - long lastProcessedMessageId) { - this.lastAddedMessageId = lastAddedMessageId; - this.lastSentMessageId = lastSentMessageId; - this.lastReceivedMessageId = lastReceivedMessageId; - this.lastProcessedMessageId = lastProcessedMessageId; - } -} \ No newline at end of file diff --git a/bundle-core/src/main/java/com/ddd/model/Payload.java b/bundle-core/src/main/java/com/ddd/model/Payload.java deleted file mode 100644 index 2904d95358..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/Payload.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class Payload { - private final String bundleId; - private final File source; - - public Payload(String bundleId, File source) { - this.bundleId = bundleId; - this.source = source; - } - - public String getBundleId() { - return this.bundleId; - } - - public File getSource() { - return this.source; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/UncompressedBundle.java b/bundle-core/src/main/java/com/ddd/model/UncompressedBundle.java deleted file mode 100644 index 94c9b7e836..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/UncompressedBundle.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ddd.model; - -import java.io.File; - -public class UncompressedBundle { - - private final String bundleId; - private final File source; - - private final EncryptionHeader encryptionHeader; - private final EncryptedPayload encryptedPayload; - private final File payloadSignature; - - public UncompressedBundle(String bundleId, File source, EncryptionHeader encryptionHeader, - EncryptedPayload encryptedPayload, File payloadSignature) { - this.bundleId = bundleId; - this.source = source; - this.encryptionHeader = encryptionHeader; - this.encryptedPayload = encryptedPayload; - this.payloadSignature = payloadSignature; - } - - public String getBundleId() { - return this.bundleId; - } - - public File getSource() { - return this.source; - } - - public EncryptionHeader getEncryptionHeader() { - return this.encryptionHeader; - } - - public EncryptedPayload getEncryptedPayload() { - return this.encryptedPayload; - } - - public File getPayloadSignature() { - return payloadSignature; - } -} diff --git a/bundle-core/src/main/java/com/ddd/model/UncompressedPayload.java b/bundle-core/src/main/java/com/ddd/model/UncompressedPayload.java deleted file mode 100644 index c49aee9561..0000000000 --- a/bundle-core/src/main/java/com/ddd/model/UncompressedPayload.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ddd.model; - -import java.io.File; -import java.util.List; - -public class UncompressedPayload { - - private final File source; - - public File getSource() { - return this.source; - } - - private final String bundleId; - - private final Acknowledgement ackRecord; - - private final List ADUs; - - public UncompressedPayload(String bundleId, Acknowledgement ackRecord, List ADUs, File source) { - this.bundleId = bundleId; - this.ackRecord = ackRecord; - this.ADUs = ADUs; - this.source = source; - } - - public String getBundleId() { - return this.bundleId; - } - - public Acknowledgement getAckRecord() { - return this.ackRecord; - } - - public List getADUs() { - return this.ADUs; - } - - public static class Builder { - - private File source; - - private String bundleId; - - private Acknowledgement ackRecord; - - private List ADUs; - - public String getBundleId() { - return this.bundleId; - } - - public Acknowledgement getAckRecord() { - return this.ackRecord; - } - - public List getADUs() { - return this.ADUs; - } - - public File getSource() { - return this.source; - } - - public Builder setAckRecord(Acknowledgement ackRecord) { - this.ackRecord = ackRecord; - return this; - } - - public Builder setADUs(List ADUs) { - this.ADUs = ADUs; - return this; - } - - public Builder setBundleId(String bundleId) { - this.bundleId = bundleId; - return this; - } - - public Builder setSource(File source) { - this.source = source; - return this; - } - - public UncompressedPayload build() { - return new UncompressedPayload(this.bundleId, this.ackRecord, this.ADUs, this.source); - } - } -} diff --git a/bundle-core/src/main/java/com/ddd/utils/Constants.java b/bundle-core/src/main/java/com/ddd/utils/Constants.java deleted file mode 100644 index 0907527912..0000000000 --- a/bundle-core/src/main/java/com/ddd/utils/Constants.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ddd.utils; - -public class Constants { - public static final String bwh="Ben was here"; - /* Bundle contents */ - public static final String BUNDLE_ADU_DIRECTORY_NAME = "ADU"; - - public static final String BUNDLE_IDENTIFIER_FILE_NAME = "bundle_identifier.txt"; - - public static final String BUNDLE_ACKNOWLEDGEMENT_FILE_NAME = "acknowledgement.txt"; - - public static final String BUNDLE_ENCRYPTED_PAYLOAD_FILE_NAME = "payload"; -}