diff --git a/.gitignore b/.gitignore index ad9846b..e6957bb 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,20 @@ out /meerkat_election_params_tempfile.dat /meerkat_booth_system_messages.dat local.properties +# Angular junk +*/tmp +*/dist +*/out-tsc +*/node_modules +*/e2e/*.js +*/e2e/*.map +*/.sass-cache +*/connect.lock +*/coverage +*/libpeerconnection.log +npm-debug.log +testem.log +*/typings +bundle.js +bundle.d.ts + diff --git a/build.gradle-template b/build.gradle-template index 60a340c..92f08f9 100644 --- a/build.gradle-template +++ b/build.gradle-template @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version "1.0.2" - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/bulletin-board-client/build.gradle b/bulletin-board-client/build.gradle index b32df6a..c28b700 100644 --- a/bulletin-board-client/build.gradle +++ b/bulletin-board-client/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/BatchDataContainer.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/BatchDataContainer.java index 1026529..659d91f 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/BatchDataContainer.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/BatchDataContainer.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard; -import meerkat.protobuf.BulletinBoardAPI.BatchChunk; +import meerkat.protobuf.BulletinBoardApi.BatchChunk; import meerkat.bulletinboard.AsyncBulletinBoardClient.BatchIdentifier; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/CachedBulletinBoardClient.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/CachedBulletinBoardClient.java index cdb86cb..76b883f 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/CachedBulletinBoardClient.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/CachedBulletinBoardClient.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; import com.google.protobuf.Timestamp; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.Signature; import meerkat.protobuf.Voting.*; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/LocalBulletinBoardClient.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/LocalBulletinBoardClient.java index 2b904ed..3387e5b 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/LocalBulletinBoardClient.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/LocalBulletinBoardClient.java @@ -8,7 +8,7 @@ import meerkat.comm.MessageInputStream; import meerkat.comm.MessageInputStream.MessageInputStreamFactory; import meerkat.comm.MessageOutputStream; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.Signature; import meerkat.protobuf.Voting.*; import meerkat.util.BulletinBoardUtils; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardClient.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardClient.java index a274f53..3bfafe3 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardClient.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardClient.java @@ -6,8 +6,8 @@ import com.google.protobuf.Int64Value; import meerkat.bulletinboard.workers.singleserver.*; import meerkat.comm.CommunicationException; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Voting.*; import meerkat.rest.*; import meerkat.util.BulletinBoardUtils; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardSynchronizer.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardSynchronizer.java index 5cdf73b..9f058b1 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardSynchronizer.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SimpleBulletinBoardSynchronizer.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; import com.google.protobuf.ByteString; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardUtils; import java.util.LinkedList; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SingleServerBulletinBoardClient.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SingleServerBulletinBoardClient.java index e732059..5625b2c 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/SingleServerBulletinBoardClient.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/SingleServerBulletinBoardClient.java @@ -9,7 +9,7 @@ import com.google.protobuf.Timestamp; import meerkat.bulletinboard.workers.singleserver.*; import meerkat.comm.CommunicationException; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto; import meerkat.protobuf.Voting.BulletinBoardClientParams; import meerkat.util.BulletinBoardUtils; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardClient.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardClient.java index 9dd85b9..2feaba9 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardClient.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardClient.java @@ -4,7 +4,7 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.protobuf.Timestamp; import meerkat.bulletinboard.workers.multiserver.*; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.Signature; import meerkat.protobuf.Voting.*; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardSubscriber.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardSubscriber.java index 252d6e3..ea22e1a 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardSubscriber.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/ThreadedBulletinBoardSubscriber.java @@ -3,10 +3,10 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; import com.google.protobuf.Timestamp; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardUtils; -import static meerkat.protobuf.BulletinBoardAPI.FilterType.*; +import static meerkat.protobuf.BulletinBoardApi.FilterType.*; import java.util.*; import java.util.concurrent.Semaphore; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerGetRedundancyWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerGetRedundancyWorker.java index b76a94f..5a20361 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerGetRedundancyWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerGetRedundancyWorker.java @@ -4,7 +4,7 @@ import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.MultiServerWorker; import meerkat.bulletinboard.SingleServerBulletinBoardClient; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.Iterator; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostBatchWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostBatchWorker.java index b938f52..d682008 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostBatchWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostBatchWorker.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver; import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.SingleServerBulletinBoardClient; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostMessageWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostMessageWorker.java index 6d3d702..cb8a75d 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostMessageWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerPostMessageWorker.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver; import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.SingleServerBulletinBoardClient; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadBatchDataWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadBatchDataWorker.java index 769702a..517d878 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadBatchDataWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadBatchDataWorker.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver; import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.SingleServerBulletinBoardClient; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessageWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessageWorker.java index f84d67e..2f43fe7 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessageWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessageWorker.java @@ -2,8 +2,8 @@ package meerkat.bulletinboard.workers.multiserver; import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.SingleServerBulletinBoardClient; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.MessageID; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessagesWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessagesWorker.java index 980d869..96a806c 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessagesWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/multiserver/MultiServerReadMessagesWorker.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver; import com.google.common.util.concurrent.FutureCallback; import meerkat.bulletinboard.SingleServerBulletinBoardClient; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerBeginBatchWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerBeginBatchWorker.java index e08b360..62c47cd 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerBeginBatchWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerBeginBatchWorker.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver; import com.google.protobuf.Int64Value; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.BeginBatchMessage; +import meerkat.protobuf.BulletinBoardApi.BeginBatchMessage; import meerkat.rest.Constants; import javax.ws.rs.ProcessingException; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerCloseBatchWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerCloseBatchWorker.java index 83e27c2..d859d67 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerCloseBatchWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerCloseBatchWorker.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.workers.singleserver; -import meerkat.protobuf.BulletinBoardAPI.CloseBatchMessage; +import meerkat.protobuf.BulletinBoardApi.CloseBatchMessage; import static meerkat.bulletinboard.BulletinBoardConstants.CLOSE_BATCH_PATH; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGenerateSyncQueryWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGenerateSyncQueryWorker.java index 71d90e0..6ddfdd1 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGenerateSyncQueryWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGenerateSyncQueryWorker.java @@ -3,8 +3,8 @@ package meerkat.bulletinboard.workers.singleserver; import com.google.protobuf.Int64Value; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.SyncQuery; -import meerkat.protobuf.BulletinBoardAPI.GenerateSyncQueryParams; +import meerkat.protobuf.BulletinBoardApi.SyncQuery; +import meerkat.protobuf.BulletinBoardApi.GenerateSyncQueryParams; import meerkat.rest.Constants; import javax.ws.rs.ProcessingException; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGetRedundancyWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGetRedundancyWorker.java index 23c07af..b664c9d 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGetRedundancyWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerGetRedundancyWorker.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; import meerkat.comm.MessageInputStream; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.rest.Constants; import javax.ws.rs.client.Client; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostBatchWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostBatchWorker.java index dfb42a7..d3ddf8c 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostBatchWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostBatchWorker.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.workers.singleserver; -import meerkat.protobuf.BulletinBoardAPI.BatchMessage; +import meerkat.protobuf.BulletinBoardApi.BatchMessage; import static meerkat.bulletinboard.BulletinBoardConstants.POST_BATCH_PATH; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostMessageWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostMessageWorker.java index 454d720..5142d4c 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostMessageWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerPostMessageWorker.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.workers.singleserver; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; import static meerkat.bulletinboard.BulletinBoardConstants.POST_MESSAGE_PATH; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerQuerySyncWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerQuerySyncWorker.java index 3a9873d..e86550f 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerQuerySyncWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerQuerySyncWorker.java @@ -2,8 +2,8 @@ package meerkat.bulletinboard.workers.singleserver; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.SyncQuery; -import meerkat.protobuf.BulletinBoardAPI.SyncQueryResponse; +import meerkat.protobuf.BulletinBoardApi.SyncQuery; +import meerkat.protobuf.BulletinBoardApi.SyncQueryResponse; import meerkat.rest.Constants; import javax.ws.rs.ProcessingException; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadBatchWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadBatchWorker.java index 8bc4bcd..12f2e80 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadBatchWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadBatchWorker.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; import meerkat.comm.MessageInputStream; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.rest.Constants; import javax.ws.rs.client.Client; diff --git a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadMessagesWorker.java b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadMessagesWorker.java index d8525ab..32c97f0 100644 --- a/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadMessagesWorker.java +++ b/bulletin-board-client/src/main/java/meerkat/bulletinboard/workers/singleserver/SingleServerReadMessagesWorker.java @@ -3,10 +3,10 @@ package meerkat.bulletinboard.workers.singleserver; import meerkat.bulletinboard.SingleServerWorker; import meerkat.comm.CommunicationException; import meerkat.comm.MessageInputStream; -import meerkat.protobuf.BulletinBoardAPI; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessageList; -import meerkat.protobuf.BulletinBoardAPI.MessageFilterList; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessageList; +import meerkat.protobuf.BulletinBoardApi.MessageFilterList; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; import meerkat.rest.Constants; import javax.ws.rs.ProcessingException; diff --git a/bulletin-board-client/src/test/java/meerkat/bulletinboard/BulletinBoardSynchronizerTest.java b/bulletin-board-client/src/test/java/meerkat/bulletinboard/BulletinBoardSynchronizerTest.java index 19e7ae5..dfbe491 100644 --- a/bulletin-board-client/src/test/java/meerkat/bulletinboard/BulletinBoardSynchronizerTest.java +++ b/bulletin-board-client/src/test/java/meerkat/bulletinboard/BulletinBoardSynchronizerTest.java @@ -11,7 +11,7 @@ import meerkat.bulletinboard.sqlserver.H2QueryProvider; import meerkat.comm.CommunicationException; import meerkat.crypto.concrete.ECDSASignature; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardMessageComparator; import meerkat.util.BulletinBoardMessageGenerator; import org.junit.*; diff --git a/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericBulletinBoardClientTester.java b/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericBulletinBoardClientTester.java index 7ded2e4..4ce9251 100644 --- a/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericBulletinBoardClientTester.java +++ b/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericBulletinBoardClientTester.java @@ -6,7 +6,7 @@ import com.google.protobuf.Timestamp; import meerkat.comm.CommunicationException; import meerkat.crypto.concrete.ECDSASignature; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto; import meerkat.util.BulletinBoardMessageComparator; import meerkat.util.BulletinBoardMessageGenerator; diff --git a/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericSubscriptionClientTester.java b/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericSubscriptionClientTester.java index 6d02914..fa7927e 100644 --- a/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericSubscriptionClientTester.java +++ b/bulletin-board-client/src/test/java/meerkat/bulletinboard/GenericSubscriptionClientTester.java @@ -5,7 +5,7 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Timestamp; import meerkat.comm.CommunicationException; import meerkat.crypto.concrete.ECDSASignature; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardMessageComparator; import meerkat.util.BulletinBoardMessageGenerator; diff --git a/bulletin-board-server-frontend/.angular-cli.json b/bulletin-board-server-frontend/.angular-cli.json new file mode 100644 index 0000000..23ffead --- /dev/null +++ b/bulletin-board-server-frontend/.angular-cli.json @@ -0,0 +1,57 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "bulletin-board-server-frontend" + }, + "apps": [ + { + "root": "src", + "outDir": "dist", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "test": "test.ts", + "tsconfig": "tsconfig.app.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "styles.css" + ], + "scripts": [], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": { + "protractor": { + "config": "./protractor.conf.js" + } + }, + "lint": [ + { + "project": "src/tsconfig.app.json" + }, + { + "project": "src/tsconfig.spec.json" + }, + { + "project": "e2e/tsconfig.e2e.json" + } + ], + "test": { + "karma": { + "config": "./karma.conf.js" + } + }, + "defaults": { + "styleExt": "css", + "component": {} + } +} diff --git a/bulletin-board-server-frontend/.editorconfig b/bulletin-board-server-frontend/.editorconfig new file mode 100644 index 0000000..6e87a00 --- /dev/null +++ b/bulletin-board-server-frontend/.editorconfig @@ -0,0 +1,13 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/bulletin-board-server-frontend/.gitignore b/bulletin-board-server-frontend/.gitignore new file mode 100644 index 0000000..54bfd20 --- /dev/null +++ b/bulletin-board-server-frontend/.gitignore @@ -0,0 +1,42 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc + +# dependencies +/node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +testem.log +/typings + +# e2e +/e2e/*.js +/e2e/*.map + +# System Files +.DS_Store +Thumbs.db diff --git a/bulletin-board-server-frontend/README.md b/bulletin-board-server-frontend/README.md new file mode 100644 index 0000000..280da2e --- /dev/null +++ b/bulletin-board-server-frontend/README.md @@ -0,0 +1,28 @@ +# BulletinBoardServerFrontend + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.2.0. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). +Before running the tests make sure you are serving the app via `ng serve`. + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/bulletin-board-server-frontend/build.gradle b/bulletin-board-server-frontend/build.gradle new file mode 100644 index 0000000..3810624 --- /dev/null +++ b/bulletin-board-server-frontend/build.gradle @@ -0,0 +1,60 @@ +plugins { + id "com.moowork.node" version "1.2.0" +} + +node { + download = true; +} + +ext { + bundlejs = "src/app/bundle.js" + bundlets = "src/app/bundle.d.ts" +} + +//task installAngularCli(type: NpmTask) { +// args = ['install', '@angular/cli'] +//} +//npm_install.dependsOn(installAngularCli); + +task printProtos { + doLast { + println getProtoFiles().join(" ") + } +} +printProtos.description = "List all the .proto files we can find." + + +def getProtoFiles() { + def protoFiles = [] + + rootProject.subprojects { proj -> + if (proj.hasProperty('sourceSets') && proj.sourceSets.hasProperty('main') && + proj.sourceSets.main.hasProperty('proto')) { + protoFiles = protoFiles + proj.sourceSets.main.proto.getFiles(); + } + } + return protoFiles; +} + + +task generateProtobufBundle(type: NpmTask) { + doFirst { + // We need do this in doFirst since getProtoFiles won't find all subprojects + // until after configuration is complete + def protoFiles = getProtoFiles() + generateProtobufBundle.args = ['run', 'protoc', '--' ] + protoFiles; + } + + dependsOn npm_install +} +generateProtobufBundle.description = "Generate the bundle.js/bundle.d.ts files containing compiled protobufs" + + +npm_run_build.dependsOn(npm_install) +npm_run_build.dependsOn(generateProtobufBundle) +npm_start.dependsOn(generateProtobufBundle) + + +// It would be nice if this worked, but it seems to get stuck: +//npm_start.dependsOn(project(':bulletin-board-server').jettyStart); + diff --git a/bulletin-board-server-frontend/e2e/app.e2e-spec.ts b/bulletin-board-server-frontend/e2e/app.e2e-spec.ts new file mode 100644 index 0000000..d53b473 --- /dev/null +++ b/bulletin-board-server-frontend/e2e/app.e2e-spec.ts @@ -0,0 +1,14 @@ +import { BulletinBoardServerFrontendPage } from './app.po'; + +describe('bulletin-board-server-frontend App', () => { + let page: BulletinBoardServerFrontendPage; + + beforeEach(() => { + page = new BulletinBoardServerFrontendPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getParagraphText()).toEqual('Welcome to app!!'); + }); +}); diff --git a/bulletin-board-server-frontend/e2e/app.po.ts b/bulletin-board-server-frontend/e2e/app.po.ts new file mode 100644 index 0000000..df1e7ee --- /dev/null +++ b/bulletin-board-server-frontend/e2e/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class BulletinBoardServerFrontendPage { + navigateTo() { + return browser.get('/'); + } + + getParagraphText() { + return element(by.css('app-root h1')).getText(); + } +} diff --git a/bulletin-board-server-frontend/e2e/tsconfig.e2e.json b/bulletin-board-server-frontend/e2e/tsconfig.e2e.json new file mode 100644 index 0000000..39b800f --- /dev/null +++ b/bulletin-board-server-frontend/e2e/tsconfig.e2e.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/e2e", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} diff --git a/bulletin-board-server-frontend/generate-protobuf.js b/bulletin-board-server-frontend/generate-protobuf.js new file mode 100755 index 0000000..eeb255e --- /dev/null +++ b/bulletin-board-server-frontend/generate-protobuf.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node +const { execFileSync } = require('child_process'); + +const bundlejs = 'src/app/bundle.js' +const bundlets = 'src/app/bundle.d.ts' + +var pbjs_args = [ + '-t', 'static-module', '-w', 'commonjs', '-o', bundlejs +].concat(process.argv.slice(2)); + +console.log("Running pbjs " + pbjs_args.join(" ")); +var out = execFileSync('pbjs', pbjs_args); +console.log("" + out); + +var pbts_args = [ + '-o', bundlets, bundlejs +]; + +console.log("Running pbts " + pbts_args.join(" ")); +out = execFileSync('pbts', pbts_args); +console.log("" + out); diff --git a/bulletin-board-server-frontend/gradlew b/bulletin-board-server-frontend/gradlew new file mode 120000 index 0000000..502f5a2 --- /dev/null +++ b/bulletin-board-server-frontend/gradlew @@ -0,0 +1 @@ +../gradlew \ No newline at end of file diff --git a/bulletin-board-server-frontend/karma.conf.js b/bulletin-board-server-frontend/karma.conf.js new file mode 100644 index 0000000..4d9ab9d --- /dev/null +++ b/bulletin-board-server-frontend/karma.conf.js @@ -0,0 +1,33 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/0.13/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular/cli'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular/cli/plugins/karma') + ], + client:{ + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + reports: [ 'html', 'lcovonly' ], + fixWebpackSourcePaths: true + }, + angularCli: { + environment: 'dev' + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; diff --git a/bulletin-board-server-frontend/package.json b/bulletin-board-server-frontend/package.json new file mode 100644 index 0000000..58d7e8a --- /dev/null +++ b/bulletin-board-server-frontend/package.json @@ -0,0 +1,53 @@ +{ + "name": "bulletin-board-server-frontend", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "ng": "ng", + "start": "ng serve --proxy-config proxy.conf.json", + "build": "ng build", + "test": "ng test", + "lint": "ng e2e", + "pbts": "pbts", + "pbjs": "pbjs", + "protoc" : "./generate-protobuf.js" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.0.0", + "@angular/common": "^4.0.0", + "@angular/compiler": "^4.0.0", + "@angular/core": "^4.0.0", + "@angular/forms": "^4.0.0", + "@angular/http": "^4.0.0", + "@angular/platform-browser": "^4.0.0", + "@angular/platform-browser-dynamic": "^4.0.0", + "@angular/router": "^4.0.0", + "@types/long": "^3.0.31", + "core-js": "^2.4.1", + "protobufjs": "^6.8.0", + "rxjs": "^5.1.0", + "zone.js": "^0.8.4" + }, + "devDependencies": { + "@angular/cli": "^1.2.0", + "@angular/compiler-cli": "^4.0.0", + "@angular/language-service": "^4.0.0", + "@types/jasmine": "~2.5.53", + "@types/jasminewd2": "~2.0.2", + "@types/node": "~6.0.60", + "codelyzer": "~3.0.1", + "jasmine-core": "~2.6.2", + "jasmine-spec-reporter": "~4.1.0", + "karma": "~1.7.0", + "karma-chrome-launcher": "~2.1.1", + "karma-cli": "~1.0.1", + "karma-coverage-istanbul-reporter": "^1.2.1", + "karma-jasmine": "~1.1.0", + "karma-jasmine-html-reporter": "^0.2.2", + "protractor": "~5.1.2", + "ts-node": "~3.0.4", + "tslint": "~5.3.2", + "typescript": "~2.3.3" + } +} diff --git a/bulletin-board-server-frontend/protractor.conf.js b/bulletin-board-server-frontend/protractor.conf.js new file mode 100644 index 0000000..7ee3b5e --- /dev/null +++ b/bulletin-board-server-frontend/protractor.conf.js @@ -0,0 +1,28 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './e2e/**/*.e2e-spec.ts' + ], + capabilities: { + 'browserName': 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: 'e2e/tsconfig.e2e.json' + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; diff --git a/bulletin-board-server-frontend/proxy.conf.json b/bulletin-board-server-frontend/proxy.conf.json new file mode 100644 index 0000000..96b7df7 --- /dev/null +++ b/bulletin-board-server-frontend/proxy.conf.json @@ -0,0 +1,6 @@ +{ + "/bbserver" : { + "target" : "http://localhost:8081/", + "secure" : false + } +} diff --git a/bulletin-board-server-frontend/src/app/app.component.css b/bulletin-board-server-frontend/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/bulletin-board-server-frontend/src/app/app.component.html b/bulletin-board-server-frontend/src/app/app.component.html new file mode 100644 index 0000000..be9af19 --- /dev/null +++ b/bulletin-board-server-frontend/src/app/app.component.html @@ -0,0 +1,12 @@ + +
+

+ Welcome to {{title}}!! +

+ +

Current status: {{status}}

+ +
+ {{errorMessage}} +
+ diff --git a/bulletin-board-server-frontend/src/app/app.component.spec.ts b/bulletin-board-server-frontend/src/app/app.component.spec.ts new file mode 100644 index 0000000..7d2799c --- /dev/null +++ b/bulletin-board-server-frontend/src/app/app.component.spec.ts @@ -0,0 +1,32 @@ +import { TestBed, async } from '@angular/core/testing'; + +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + }).compileComponents(); + })); + + it('should create the app', async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); + + it(`should have as title 'app'`, async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('app'); + })); + + it('should render title in a h1 tag', async(() => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!!'); + })); +}); diff --git a/bulletin-board-server-frontend/src/app/app.component.ts b/bulletin-board-server-frontend/src/app/app.component.ts new file mode 100644 index 0000000..708f65d --- /dev/null +++ b/bulletin-board-server-frontend/src/app/app.component.ts @@ -0,0 +1,55 @@ +import {Component, OnInit} from '@angular/core'; +import {IntervalObservable} from "rxjs/observable/IntervalObservable"; +import {BBService} from "./bb.service"; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'], + providers: [BBService] +}) + +export class AppComponent implements OnInit { + + title = 'Bulletin-Board Server'; + status = 'Not connected'; + errorMessage = ''; + + private alive: boolean; // used to unsubscribe from the IntervalObservable + // when OnDestroy is called. + + constructor(private bbservice : BBService) { } + + + ngOnInit(): void { + + // Get initial status + this.bbservice.getStatus().subscribe( + status => { this.status = status.name; this.errorMessage = ""; }, + error => { this.status = "Not connected"; this.errorMessage = error; } + ); + + this.alive = true; + // Get new status every second + let o = IntervalObservable.create(1000) + //.takeWhile(() => this.alive) // only fires when component is alive + .subscribe(n => { + if (!this.alive) { + o.unsubscribe(); + return; + } + this.bbservice.getStatus().subscribe( + status => { this.status = status.name + " " + n; this.errorMessage = ""; }, + error => { this.errorMessage = error; this.status = "Not connected"; } + ); + }); + } + + + ngOnDestroy(){ + this.alive = false; // switches your IntervalObservable off + } + +} + + diff --git a/bulletin-board-server-frontend/src/app/app.module.ts b/bulletin-board-server-frontend/src/app/app.module.ts new file mode 100644 index 0000000..b15df26 --- /dev/null +++ b/bulletin-board-server-frontend/src/app/app.module.ts @@ -0,0 +1,20 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { HttpModule } from '@angular/http'; + +import { AppComponent } from './app.component'; +import {BBService} from "./bb.service"; + + +@NgModule({ + declarations: [ + AppComponent, + ], + imports: [ + BrowserModule, + HttpModule, + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/bulletin-board-server-frontend/src/app/bb.service.ts b/bulletin-board-server-frontend/src/app/bb.service.ts new file mode 100644 index 0000000..9dcd749 --- /dev/null +++ b/bulletin-board-server-frontend/src/app/bb.service.ts @@ -0,0 +1,36 @@ +/// +import { Injectable } from '@angular/core'; +import {Headers, Http, RequestOptions, ResponseContentType} from '@angular/http'; + +import { meerkat } from "./bundle.js"; +import {Observable} from "rxjs/Observable"; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/operator/map'; + + @Injectable() + export class BBService { + private headers = new Headers({'Content-Type': 'application/x-protobuf'}); + private bbUrl = '/bbserver'; // URL to web api + private statusPath = '/status'; + + constructor(private http: Http) { } + + getStatus(): Observable { + let options = new RequestOptions({ + responseType: ResponseContentType.ArrayBuffer + }); + + let res = this.http.get(this.bbUrl + this.statusPath, options); + + return res + .catch(this.handleError) + .map(x => { + return meerkat.ServerStatus.decode(new Uint8Array(x.arrayBuffer())); + }); + } + + private handleError(error: any): Promise { + console.error('An error occurred', error); // for demo purposes only + return Promise.reject(error.message || error); + } + } diff --git a/bulletin-board-server-frontend/src/assets/.gitkeep b/bulletin-board-server-frontend/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/bulletin-board-server-frontend/src/assets/meerkat-logo.svg b/bulletin-board-server-frontend/src/assets/meerkat-logo.svg new file mode 100644 index 0000000..4cf5302 --- /dev/null +++ b/bulletin-board-server-frontend/src/assets/meerkat-logo.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/bulletin-board-server-frontend/src/environments/environment.prod.ts b/bulletin-board-server-frontend/src/environments/environment.prod.ts new file mode 100644 index 0000000..3612073 --- /dev/null +++ b/bulletin-board-server-frontend/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/bulletin-board-server-frontend/src/environments/environment.ts b/bulletin-board-server-frontend/src/environments/environment.ts new file mode 100644 index 0000000..b7f639a --- /dev/null +++ b/bulletin-board-server-frontend/src/environments/environment.ts @@ -0,0 +1,8 @@ +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/bulletin-board-server-frontend/src/favicon.ico b/bulletin-board-server-frontend/src/favicon.ico new file mode 100644 index 0000000..8081c7c Binary files /dev/null and b/bulletin-board-server-frontend/src/favicon.ico differ diff --git a/bulletin-board-server-frontend/src/index.html b/bulletin-board-server-frontend/src/index.html new file mode 100644 index 0000000..59427d2 --- /dev/null +++ b/bulletin-board-server-frontend/src/index.html @@ -0,0 +1,14 @@ + + + + + BulletinBoardServerFrontend + + + + + + + + + diff --git a/bulletin-board-server-frontend/src/main.ts b/bulletin-board-server-frontend/src/main.ts new file mode 100644 index 0000000..a9ca1ca --- /dev/null +++ b/bulletin-board-server-frontend/src/main.ts @@ -0,0 +1,11 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/bulletin-board-server-frontend/src/polyfills.ts b/bulletin-board-server-frontend/src/polyfills.ts new file mode 100644 index 0000000..7831e97 --- /dev/null +++ b/bulletin-board-server-frontend/src/polyfills.ts @@ -0,0 +1,72 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + + +/** + * Required to support Web Animations `@angular/animation`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ +// import 'intl/locale-data/jsonp/en'; diff --git a/bulletin-board-server-frontend/src/styles.css b/bulletin-board-server-frontend/src/styles.css new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/bulletin-board-server-frontend/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/bulletin-board-server-frontend/src/test.ts b/bulletin-board-server-frontend/src/test.ts new file mode 100644 index 0000000..cd612ee --- /dev/null +++ b/bulletin-board-server-frontend/src/test.ts @@ -0,0 +1,32 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/long-stack-trace-zone'; +import 'zone.js/dist/proxy.js'; +import 'zone.js/dist/sync-test'; +import 'zone.js/dist/jasmine-patch'; +import 'zone.js/dist/async-test'; +import 'zone.js/dist/fake-async-test'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. +declare const __karma__: any; +declare const require: any; + +// Prevent Karma from running prematurely. +__karma__.loaded = function () {}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); +// Finally, start Karma to run the tests. +__karma__.start(); diff --git a/bulletin-board-server-frontend/src/tsconfig.app.json b/bulletin-board-server-frontend/src/tsconfig.app.json new file mode 100644 index 0000000..5e2507d --- /dev/null +++ b/bulletin-board-server-frontend/src/tsconfig.app.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "es2015", + "baseUrl": "", + "types": [] + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/bulletin-board-server-frontend/src/tsconfig.spec.json b/bulletin-board-server-frontend/src/tsconfig.spec.json new file mode 100644 index 0000000..510e3f1 --- /dev/null +++ b/bulletin-board-server-frontend/src/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "module": "commonjs", + "target": "es5", + "baseUrl": "", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/bulletin-board-server-frontend/src/typings.d.ts b/bulletin-board-server-frontend/src/typings.d.ts new file mode 100644 index 0000000..ef5c7bd --- /dev/null +++ b/bulletin-board-server-frontend/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/bulletin-board-server-frontend/tsconfig.json b/bulletin-board-server-frontend/tsconfig.json new file mode 100644 index 0000000..a35a8ee --- /dev/null +++ b/bulletin-board-server-frontend/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "baseUrl": "src", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2016", + "dom" + ] + } +} diff --git a/bulletin-board-server-frontend/tslint.json b/bulletin-board-server-frontend/tslint.json new file mode 100644 index 0000000..dd117b3 --- /dev/null +++ b/bulletin-board-server-frontend/tslint.json @@ -0,0 +1,135 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer" + ], + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + "static-before-instance", + "variables-before-functions" + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "typeof-compare": true, + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true, + "no-access-missing-member": true, + "templates-use-public": true, + "invoke-injectable": true + } +} diff --git a/bulletin-board-server/build.gradle b/bulletin-board-server/build.gradle index 22c77bb..3d14a63 100644 --- a/bulletin-board-server/build.gradle +++ b/bulletin-board-server/build.gradle @@ -1,14 +1,16 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' - id 'org.akhikhl.gretty' version "1.2.4" + id 'com.google.protobuf' version '0.8.1' + id 'org.akhikhl.gretty' version "2.0.0" } apply plugin: 'org.akhikhl.gretty' +apply plugin: 'com.google.protobuf' apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' +apply plugin: 'war' //apply plugin: 'application' @@ -50,13 +52,24 @@ dependencies { compile 'org.apache.commons:commons-dbcp2:2.0.+' // Servlets - compile 'javax.servlet:javax.servlet-api:3.0.+' +// compile 'javax.servlet:javax.servlet-api:3.0.+' // Depend on test resources from meerkat-common testCompile project(path: ':meerkat-common', configuration: 'testOutput') testCompile 'junit:junit:4.+' } +ext { + frontendProject = project(":bulletin-board-server-frontend") +} + +war { + from frontendProject.projectDir.toPath().resolve("dist").toString() +} + +frontendProject.afterEvaluate { + war.dependsOn frontendProject.npm_run_build +} test { exclude '**/*SQLite*Test*' diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/service/HelloProtoBuf.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/service/HelloProtoBuf.java index 772e7dd..e2bdbdb 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/service/HelloProtoBuf.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/service/HelloProtoBuf.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard.service; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import meerkat.protobuf.Crypto; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.Arrays; import java.util.List; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/BulletinBoardSQLServer.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/BulletinBoardSQLServer.java index bf99259..7e206e9 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/BulletinBoardSQLServer.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/BulletinBoardSQLServer.java @@ -18,7 +18,7 @@ import meerkat.comm.MessageOutputStream; import meerkat.crypto.DigitalSignature; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Comm; import meerkat.protobuf.Crypto.Signature; import meerkat.protobuf.Crypto.SignatureVerificationKey; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/H2QueryProvider.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/H2QueryProvider.java index 872e226..153e65e 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/H2QueryProvider.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/H2QueryProvider.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.sqlserver; -import meerkat.protobuf.BulletinBoardAPI.FilterType; +import meerkat.protobuf.BulletinBoardApi.FilterType; import org.apache.commons.dbcp2.BasicDataSource; import javax.sql.DataSource; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/MySQLQueryProvider.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/MySQLQueryProvider.java index 097095f..c06bb4b 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/MySQLQueryProvider.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/MySQLQueryProvider.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard.sqlserver; import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer.SQLQueryProvider; -import meerkat.protobuf.BulletinBoardAPI.FilterType; +import meerkat.protobuf.BulletinBoardApi.FilterType; import org.apache.commons.dbcp2.BasicDataSource; import javax.sql.DataSource; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/SQLiteQueryProvider.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/SQLiteQueryProvider.java index 9f68955..07d3461 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/SQLiteQueryProvider.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/SQLiteQueryProvider.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.sqlserver; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import org.apache.commons.dbcp2.BasicDataSource; import org.sqlite.SQLiteDataSource; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataCallbackHandler.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataCallbackHandler.java index 69d7bae..ea8cff9 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataCallbackHandler.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataCallbackHandler.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard.sqlserver.mappers; import meerkat.comm.MessageOutputStream; -import meerkat.protobuf.BulletinBoardAPI.BatchChunk; +import meerkat.protobuf.BulletinBoardApi.BatchChunk; import org.springframework.jdbc.core.RowCallbackHandler; import java.io.IOException; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataDigestHandler.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataDigestHandler.java index ae55d5c..5ddc56d 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataDigestHandler.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BatchDataDigestHandler.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard.sqlserver.mappers; import meerkat.bulletinboard.BulletinBoardDigest; -import meerkat.protobuf.BulletinBoardAPI.BatchChunk; +import meerkat.protobuf.BulletinBoardApi.BatchChunk; import org.springframework.jdbc.core.RowCallbackHandler; import java.io.IOException; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BeginBatchMessageMapper.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BeginBatchMessageMapper.java index 0f72ec9..13b57d2 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BeginBatchMessageMapper.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/BeginBatchMessageMapper.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard.sqlserver.mappers; import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.BulletinBoardAPI.BeginBatchMessage; +import meerkat.protobuf.BulletinBoardApi.BeginBatchMessage; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/LongMapper.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/LongMapper.java index 1ec0d98..0f5e28a 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/LongMapper.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/LongMapper.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard.sqlserver.mappers; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.MessageID; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageCallbackHandler.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageCallbackHandler.java index 71ba742..ccef3a2 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageCallbackHandler.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageCallbackHandler.java @@ -4,7 +4,7 @@ import com.google.protobuf.InvalidProtocolBufferException; import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer.*; import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer.SQLQueryProvider.*; import meerkat.comm.MessageOutputStream; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto; import org.springframework.jdbc.core.RowCallbackHandler; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageMapper.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageMapper.java index fdc1fa8..9cf49f8 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageMapper.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageMapper.java @@ -1,8 +1,8 @@ package meerkat.bulletinboard.sqlserver.mappers; import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.UnsignedBulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubCallbackHandler.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubCallbackHandler.java index f81cc76..168cdd1 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubCallbackHandler.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubCallbackHandler.java @@ -4,8 +4,8 @@ import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer.SQLQueryProvider.QueryType; import meerkat.comm.MessageOutputStream; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.UnsignedBulletinBoardMessage; import meerkat.protobuf.Crypto; import meerkat.util.BulletinBoardUtils; import org.springframework.jdbc.core.RowCallbackHandler; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubMapper.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubMapper.java index e9174e5..980f444 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubMapper.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/MessageStubMapper.java @@ -2,8 +2,8 @@ package meerkat.bulletinboard.sqlserver.mappers; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.UnsignedBulletinBoardMessage; import meerkat.util.BulletinBoardUtils; import org.springframework.jdbc.core.RowMapper; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/SignatureMapper.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/SignatureMapper.java index 60015c1..6d0c9bb 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/SignatureMapper.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/sqlserver/mappers/SignatureMapper.java @@ -1,8 +1,8 @@ package meerkat.bulletinboard.sqlserver.mappers; import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.UnsignedBulletinBoardMessage; import meerkat.protobuf.Crypto.Signature; import org.springframework.jdbc.core.RowMapper; diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/BulletinBoardWebApp.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/BulletinBoardWebApp.java index 8e9d161..baa9fe0 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/BulletinBoardWebApp.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/BulletinBoardWebApp.java @@ -3,6 +3,7 @@ package meerkat.bulletinboard.webapp; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; +import javax.servlet.http.HttpServletResponse; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; @@ -18,7 +19,10 @@ import meerkat.bulletinboard.sqlserver.MySQLQueryProvider; import meerkat.bulletinboard.sqlserver.SQLiteQueryProvider; import meerkat.comm.CommunicationException; import meerkat.comm.MessageOutputStream; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; +import meerkat.protobuf.BulletinBoardWebapp.*; + + import static meerkat.bulletinboard.BulletinBoardConstants.*; import static meerkat.rest.Constants.*; @@ -29,7 +33,7 @@ import java.io.OutputStream; * An implementation of the BulletinBoardServer which functions as a WebApp */ @Path(BULLETIN_BOARD_SERVER_PATH) -public class BulletinBoardWebApp implements BulletinBoardServer, ServletContextListener{ +public class BulletinBoardWebApp implements BulletinBoardServer, ServletContextListener { private static final String BULLETIN_BOARD_ATTRIBUTE_NAME = "bulletinBoard"; @@ -43,22 +47,24 @@ public class BulletinBoardWebApp implements BulletinBoardServer, ServletContextL public void init(){ bulletinBoard = (BulletinBoardServer) servletContext.getAttribute(BULLETIN_BOARD_ATTRIBUTE_NAME); } - - @Override + + + + @Override public void contextInitialized(ServletContextEvent servletContextEvent) { ServletContext servletContext = servletContextEvent.getServletContext(); String dbType = servletContext.getInitParameter("dbType"); String dbName = servletContext.getInitParameter("dbName"); - if ("SQLite".equals(dbType)){ + if ("SQLite".equalsIgnoreCase(dbType)){ bulletinBoard = new BulletinBoardSQLServer(new SQLiteQueryProvider(dbName)); - } else if ("H2".equals(dbType)) { + } else if ("H2".equalsIgnoreCase(dbType)) { bulletinBoard = new BulletinBoardSQLServer(new H2QueryProvider(dbName)); - } else if ("MySQL".equals(dbType)) { + } else if ("MySQL".equalsIgnoreCase(dbType)) { String dbAddress = servletContext.getInitParameter("dbAddress"); int dbPort = Integer.parseInt(servletContext.getInitParameter("dbPort")); @@ -75,7 +81,24 @@ public class BulletinBoardWebApp implements BulletinBoardServer, ServletContextL System.err.println(e.getMessage()); } } - + + + /** + * Get the current status of the bulletin board server. + * @return + * @throws CommunicationException + */ + @Path(STATUS_PATH) + @GET + @Consumes(MEDIATYPE_PROTOBUF) + @Produces(MEDIATYPE_PROTOBUF) + public ServerStatus getStatus(@Context HttpServletResponse response) throws CommunicationException { + // response.setHeader("Access-Control-Allow-Origin", "*"); // TODO: Remove + return ServerStatus.newBuilder() + .setName("Hello") + .build(); + } + @Path(POST_MESSAGE_PATH) @POST @Consumes(MEDIATYPE_PROTOBUF) diff --git a/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/HelloProtoWebApp.java b/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/HelloProtoWebApp.java index bf748c5..c9cd3b7 100644 --- a/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/HelloProtoWebApp.java +++ b/bulletin-board-server/src/main/java/meerkat/bulletinboard/webapp/HelloProtoWebApp.java @@ -4,7 +4,7 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Message; import meerkat.bulletinboard.service.HelloProtoBuf; import meerkat.protobuf.Crypto.*; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.rest.Constants; import javax.annotation.PostConstruct; diff --git a/bulletin-board-server/src/main/proto/meerkat/bulletin_board_webapp.proto b/bulletin-board-server/src/main/proto/meerkat/bulletin_board_webapp.proto new file mode 100644 index 0000000..3bf5653 --- /dev/null +++ b/bulletin-board-server/src/main/proto/meerkat/bulletin_board_webapp.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package meerkat; + +option java_package = "meerkat.protobuf"; + +import 'meerkat/crypto.proto'; +import 'meerkat/bulletin_board_api.proto'; +import 'google/protobuf/timestamp.proto'; + + +// Status of the bulletin board server +message ServerStatus { + enum Mode { + MODE_SETUP_AUTH = 0; // Waiting for authorization setup + MODE_SETUP_DB = 1; // Needs to complete setup + MODE_RUNNING = 2; // Setup is complete + } + + Mode mode = 1; + + string name = 2; // Human-readable name + + SignatureVerificationKey pk = 3; // The server's signing public-key +} diff --git a/bulletin-board-server/src/main/webapp/WEB-INF/web.xml b/bulletin-board-server/src/main/webapp/WEB-INF/web.xml index 226aa3b..d9452f5 100644 --- a/bulletin-board-server/src/main/webapp/WEB-INF/web.xml +++ b/bulletin-board-server/src/main/webapp/WEB-INF/web.xml @@ -1,6 +1,6 @@ - Jersey Hello World + bbserver org.glassfish.jersey.servlet.ServletContainer @@ -11,7 +11,11 @@ 1 - Jersey Hello World + bbserver + /bbserver/* + + + default /* diff --git a/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardSQLServerIntegrationTest.java b/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardSQLServerIntegrationTest.java index 8d5e0c0..b88a61d 100644 --- a/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardSQLServerIntegrationTest.java +++ b/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardSQLServerIntegrationTest.java @@ -8,7 +8,7 @@ import com.google.protobuf.TextFormat; import com.google.protobuf.Timestamp; import meerkat.comm.MessageInputStream; import meerkat.protobuf.Crypto.*; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Comm.*; import static meerkat.bulletinboard.BulletinBoardConstants.*; import meerkat.rest.Constants; diff --git a/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java b/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java index eafd80c..3824165 100644 --- a/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java +++ b/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java @@ -28,7 +28,7 @@ import meerkat.comm.MessageOutputStream; import meerkat.comm.MessageInputStream.MessageInputStreamFactory; import meerkat.crypto.concrete.ECDSASignature; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardMessageComparator; import meerkat.util.BulletinBoardMessageGenerator; import meerkat.util.BulletinBoardUtils; diff --git a/bulletin-board-server/src/test/java/meerkat/bulletinboard/HelloProtoIntegrationTest.java b/bulletin-board-server/src/test/java/meerkat/bulletinboard/HelloProtoIntegrationTest.java index c7b16df..b597113 100644 --- a/bulletin-board-server/src/test/java/meerkat/bulletinboard/HelloProtoIntegrationTest.java +++ b/bulletin-board-server/src/test/java/meerkat/bulletinboard/HelloProtoIntegrationTest.java @@ -1,6 +1,6 @@ package meerkat.bulletinboard; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.rest.Constants; import meerkat.rest.ProtobufMessageBodyReader; import meerkat.rest.ProtobufMessageBodyWriter; diff --git a/distributed-key-generation/build.gradle b/distributed-key-generation/build.gradle index e99a878..82e05fc 100644 --- a/distributed-key-generation/build.gradle +++ b/distributed-key-generation/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/meerkat-common/build.gradle b/meerkat-common/build.gradle index 8e432fe..f13e1c1 100644 --- a/meerkat-common/build.gradle +++ b/meerkat-common/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/meerkat-common/src/main/java/Demo.java b/meerkat-common/src/main/java/Demo.java index 130adcc..d1e588c 100644 --- a/meerkat-common/src/main/java/Demo.java +++ b/meerkat-common/src/main/java/Demo.java @@ -1,5 +1,5 @@ import com.google.protobuf.ByteString; -import static meerkat.protobuf.BulletinBoardAPI.*; +import static meerkat.protobuf.BulletinBoardApi.*; import java.io.IOException; /** diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/AsyncBulletinBoardClient.java b/meerkat-common/src/main/java/meerkat/bulletinboard/AsyncBulletinBoardClient.java index ab71a76..451dc27 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/AsyncBulletinBoardClient.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/AsyncBulletinBoardClient.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; import com.google.protobuf.Timestamp; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.Signature; import java.util.List; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardClient.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardClient.java index c03051c..18160c8 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardClient.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardClient.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard; import meerkat.comm.CommunicationException; import meerkat.protobuf.Voting.*; -import static meerkat.protobuf.BulletinBoardAPI.*; +import static meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java index 9404165..87c5e7b 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java @@ -7,7 +7,8 @@ public interface BulletinBoardConstants { // Relative addresses for Bulletin Board operations - public static final String BULLETIN_BOARD_SERVER_PATH = "/bbserver"; + public static final String STATUS_PATH = "/status"; + public static final String BULLETIN_BOARD_SERVER_PATH = "/"; // The actual prefix is set in web.xml public static final String GENERATE_SYNC_QUERY_PATH = "/generatesyncquery"; public static final String READ_MESSAGES_PATH = "/readmessages"; public static final String COUNT_MESSAGES_PATH = "/countmessages"; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardDigest.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardDigest.java index 3e47c23..b7f11d4 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardDigest.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardDigest.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard; import meerkat.crypto.Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardMessageDeleter.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardMessageDeleter.java index cf57975..847a60c 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardMessageDeleter.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardMessageDeleter.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; /** * Created by Arbel Deutsch Peled on 13-Apr-16. diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardServer.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardServer.java index 40f8ab3..f043420 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardServer.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardServer.java @@ -5,7 +5,7 @@ import com.google.protobuf.Int32Value; import com.google.protobuf.Int64Value; import meerkat.comm.CommunicationException; import meerkat.comm.MessageOutputStream; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; /** @@ -15,7 +15,7 @@ import meerkat.protobuf.BulletinBoardAPI.*; * An implementation of this interface may use any DB and be hosted on any machine. */ -public interface BulletinBoardServer{ +public interface BulletinBoardServer { /** * This method initializes the server by reading the signature data and storing it @@ -23,7 +23,7 @@ public interface BulletinBoardServer{ * @throws CommunicationException on DB connection error */ public void init() throws CommunicationException; - + /** * Post a message to bulletin board. * @param msg is the actual (signed) message diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSignature.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSignature.java index ba018ca..4fe6e0c 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSignature.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSignature.java @@ -1,9 +1,7 @@ package meerkat.bulletinboard; import meerkat.crypto.DigitalSignature; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; -import meerkat.protobuf.Crypto; +import meerkat.protobuf.BulletinBoardApi.*; import java.security.SignatureException; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSubscriber.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSubscriber.java index 85eb2cc..fc9f75a 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSubscriber.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSubscriber.java @@ -1,8 +1,7 @@ package meerkat.bulletinboard; import com.google.common.util.concurrent.FutureCallback; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.MessageFilterList; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSynchronizer.java b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSynchronizer.java index c25d737..a281254 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSynchronizer.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardSynchronizer.java @@ -1,7 +1,7 @@ package meerkat.bulletinboard; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import com.google.common.util.concurrent.FutureCallback; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/Checksum.java b/meerkat-common/src/main/java/meerkat/bulletinboard/Checksum.java index b8ddb0b..48a6caa 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/Checksum.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/Checksum.java @@ -2,8 +2,7 @@ package meerkat.bulletinboard; import com.google.protobuf.ByteString; import meerkat.crypto.Digest; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.Collection; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/DeletableBulletinBoardServer.java b/meerkat-common/src/main/java/meerkat/bulletinboard/DeletableBulletinBoardServer.java index cfff084..44d9665 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/DeletableBulletinBoardServer.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/DeletableBulletinBoardServer.java @@ -2,7 +2,7 @@ package meerkat.bulletinboard; import com.google.protobuf.BoolValue; import meerkat.comm.CommunicationException; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; /** * Created by Arbel Deutsch Peled on 13-Apr-16. diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardDigest.java b/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardDigest.java index fb7bd3f..1ab4c23 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardDigest.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardDigest.java @@ -1,12 +1,9 @@ package meerkat.bulletinboard; import com.google.protobuf.ByteString; -import com.google.protobuf.BytesValue; import com.google.protobuf.Message; import meerkat.crypto.Digest; -import meerkat.protobuf.BulletinBoardAPI; -import meerkat.protobuf.BulletinBoardAPI.*; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.*; /** diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardSignature.java b/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardSignature.java index 3899e0d..6ed15c9 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardSignature.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/GenericBulletinBoardSignature.java @@ -2,12 +2,8 @@ package meerkat.bulletinboard; import com.google.protobuf.ByteString; import com.google.protobuf.Message; -import meerkat.crypto.Digest; import meerkat.crypto.DigitalSignature; -import meerkat.protobuf.BulletinBoardAPI; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; -import meerkat.protobuf.BulletinBoardAPI.MessageID; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto; import java.io.IOException; diff --git a/meerkat-common/src/main/java/meerkat/bulletinboard/SimpleChecksum.java b/meerkat-common/src/main/java/meerkat/bulletinboard/SimpleChecksum.java index 90d7ae5..0808b45 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/SimpleChecksum.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/SimpleChecksum.java @@ -2,8 +2,7 @@ package meerkat.bulletinboard; import com.google.protobuf.ByteString; import meerkat.crypto.Digest; -import meerkat.protobuf.BulletinBoardAPI.MessageID; -import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.Collection; @@ -11,7 +10,7 @@ import java.util.Collection; * Created by Arbel Deutsch Peled on 01-Mar-16. * Implementation of Checksum via bitwise XOR of the bytes of message IDs */ -public class SimpleChecksum implements Checksum{ +public class SimpleChecksum implements Checksum { private Digest digest; private long checksum; diff --git a/meerkat-common/src/main/java/meerkat/crypto/Digest.java b/meerkat-common/src/main/java/meerkat/crypto/Digest.java index e5202d6..8fcd886 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/Digest.java +++ b/meerkat-common/src/main/java/meerkat/crypto/Digest.java @@ -1,7 +1,7 @@ package meerkat.crypto; import com.google.protobuf.Message; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.MessageID; import java.security.MessageDigest; diff --git a/meerkat-common/src/main/java/meerkat/crypto/concrete/SHA256Digest.java b/meerkat-common/src/main/java/meerkat/crypto/concrete/SHA256Digest.java index 88f417c..5fbca37 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/concrete/SHA256Digest.java +++ b/meerkat-common/src/main/java/meerkat/crypto/concrete/SHA256Digest.java @@ -3,7 +3,7 @@ package meerkat.crypto.concrete; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import meerkat.crypto.Digest; -import meerkat.protobuf.BulletinBoardAPI.MessageID; +import meerkat.protobuf.BulletinBoardApi.MessageID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageComparator.java b/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageComparator.java index 7005568..4633512 100644 --- a/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageComparator.java +++ b/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageComparator.java @@ -1,7 +1,6 @@ package meerkat.util; -import meerkat.protobuf.BulletinBoardAPI; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.*; import java.util.Comparator; diff --git a/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageGenerator.java b/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageGenerator.java index 5969a1e..634d5e3 100644 --- a/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageGenerator.java +++ b/meerkat-common/src/main/java/meerkat/util/BulletinBoardMessageGenerator.java @@ -2,7 +2,7 @@ package meerkat.util; import com.google.protobuf.ByteString; import meerkat.crypto.DigitalSignature; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import com.google.protobuf.Timestamp; import java.math.BigInteger; diff --git a/meerkat-common/src/main/java/meerkat/util/BulletinBoardUtils.java b/meerkat-common/src/main/java/meerkat/util/BulletinBoardUtils.java index a83f755..8807b0e 100644 --- a/meerkat-common/src/main/java/meerkat/util/BulletinBoardUtils.java +++ b/meerkat-common/src/main/java/meerkat/util/BulletinBoardUtils.java @@ -2,7 +2,7 @@ package meerkat.util; import com.google.protobuf.ByteString; import com.google.protobuf.Int64Value; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.ArrayList; import java.util.LinkedList; diff --git a/meerkat-common/src/main/proto/meerkat/BallotQuestionUIElement.proto b/meerkat-common/src/main/proto/meerkat/ballot_question_ui_element.proto similarity index 100% rename from meerkat-common/src/main/proto/meerkat/BallotQuestionUIElement.proto rename to meerkat-common/src/main/proto/meerkat/ballot_question_ui_element.proto diff --git a/meerkat-common/src/main/proto/meerkat/BulletinBoardAPI.proto b/meerkat-common/src/main/proto/meerkat/bulletin_board_api.proto similarity index 99% rename from meerkat-common/src/main/proto/meerkat/BulletinBoardAPI.proto rename to meerkat-common/src/main/proto/meerkat/bulletin_board_api.proto index 2cd7f6e..f5f4bf5 100644 --- a/meerkat-common/src/main/proto/meerkat/BulletinBoardAPI.proto +++ b/meerkat-common/src/main/proto/meerkat/bulletin_board_api.proto @@ -4,7 +4,7 @@ package meerkat; option java_package = "meerkat.protobuf"; - import 'meerkat/crypto.proto'; +import 'meerkat/crypto.proto'; import 'google/protobuf/timestamp.proto'; message BoolMsg { diff --git a/meerkat-common/src/test/java/meerkat/bulletinboard/BulletinBoardDigestTest.java b/meerkat-common/src/test/java/meerkat/bulletinboard/BulletinBoardDigestTest.java index 277bda1..869667a 100644 --- a/meerkat-common/src/test/java/meerkat/bulletinboard/BulletinBoardDigestTest.java +++ b/meerkat-common/src/test/java/meerkat/bulletinboard/BulletinBoardDigestTest.java @@ -3,7 +3,7 @@ package meerkat.bulletinboard; import com.google.protobuf.ByteString; import meerkat.crypto.concrete.ECDSASignature; import meerkat.crypto.concrete.SHA256Digest; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.util.BulletinBoardMessageGenerator; import meerkat.util.BulletinBoardUtils; import org.junit.Before; diff --git a/meerkat-common/src/test/java/meerkat/comm/MessageStreamTest.java b/meerkat-common/src/test/java/meerkat/comm/MessageStreamTest.java index 27eeca3..206abde 100644 --- a/meerkat-common/src/test/java/meerkat/comm/MessageStreamTest.java +++ b/meerkat-common/src/test/java/meerkat/comm/MessageStreamTest.java @@ -2,7 +2,7 @@ package meerkat.comm; import com.google.protobuf.*; import meerkat.comm.MessageInputStream.MessageInputStreamFactory; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto; import meerkat.util.BulletinBoardMessageComparator; import org.junit.Test; diff --git a/mixer/build.gradle b/mixer/build.gradle index 52e388a..b254d5a 100644 --- a/mixer/build.gradle +++ b/mixer/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java b/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java index ea78f80..4d5ba5e 100644 --- a/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java +++ b/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java @@ -1,7 +1,7 @@ package meerkat.mixer.main; import meerkat.mixer.MixerOutput; -import meerkat.protobuf.BulletinBoardAPI; +import meerkat.protobuf.BulletinBoardApi; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; @@ -18,29 +18,29 @@ public class BatchConverter { * @param mixerOutput * @return meerkat.mixProverVerifier.network output as list of batch data */ - public List MixerOutput2BatchChunk(MixerOutput mixerOutput) { + public List MixerOutput2BatchChunk(MixerOutput mixerOutput) { - List result = new ArrayList(); + List result = new ArrayList(); Mixing.MixBatchHeader header = Mixing.MixBatchHeader.newBuilder() .setLogN(mixerOutput.getLogN()) .setLayers(mixerOutput.getNumLayers()) .build(); - result.add(BulletinBoardAPI.BatchChunk.newBuilder() + result.add(BulletinBoardApi.BatchChunk.newBuilder() .setData(header.toByteString()) .build()); for (Mixing.Mix2Proof[] zkpLayer : mixerOutput.getProofs()) { for (Mixing.Mix2Proof zkp : zkpLayer) { - result.add(BulletinBoardAPI.BatchChunk.newBuilder() + result.add(BulletinBoardApi.BatchChunk.newBuilder() .setData(zkp.toByteString()) .build()); } } for (Crypto.RerandomizableEncryptedMessage[] encryptionLayer : mixerOutput.getEncryptedMessages()) { for (Crypto.RerandomizableEncryptedMessage encryption : encryptionLayer) { - result.add(BulletinBoardAPI.BatchChunk.newBuilder() + result.add(BulletinBoardApi.BatchChunk.newBuilder() .setData(encryption.toByteString()) .build()); } @@ -55,7 +55,7 @@ public class BatchConverter { * @throws Exception */ public MixerOutput BatchChunkList2MixerOutput - (List batchChunkList) throws Exception { + (List batchChunkList) throws Exception { Mixing.MixBatchHeader header = Mixing.MixBatchHeader.parseFrom(batchChunkList.remove(0).getData()); diff --git a/mixer/src/main/java/meerkat/mixer/main/MainMixing.java b/mixer/src/main/java/meerkat/mixer/main/MainMixing.java index f32cb9f..dfe6eb5 100644 --- a/mixer/src/main/java/meerkat/mixer/main/MainMixing.java +++ b/mixer/src/main/java/meerkat/mixer/main/MainMixing.java @@ -3,7 +3,7 @@ package meerkat.mixer.main; import meerkat.mixer.MixGenerator; import meerkat.mixer.MixerOutput; import meerkat.mixer.proofs.Mix2nizk; -import meerkat.protobuf.BulletinBoardAPI; +import meerkat.protobuf.BulletinBoardApi; import meerkat.protobuf.Crypto; import meerkat.mixer.necessary.AsyncBulletinBoardClient; @@ -95,7 +95,7 @@ public class MainMixing { , int batchId, AsyncBulletinBoardClient.ClientCallback callback) { BatchConverter batchConverter = new BatchConverter(); - List batchChunkList = batchConverter.MixerOutput2BatchChunk(mixerOutput); + List batchChunkList = batchConverter.MixerOutput2BatchChunk(mixerOutput); asyncBulletinBoardClient.postBatch(id, batchId, batchChunkList, callback); } diff --git a/mixer/src/main/java/meerkat/mixer/necessary/AsyncBulletinBoardClient.java b/mixer/src/main/java/meerkat/mixer/necessary/AsyncBulletinBoardClient.java index 208c7c7..a6d6924 100644 --- a/mixer/src/main/java/meerkat/mixer/necessary/AsyncBulletinBoardClient.java +++ b/mixer/src/main/java/meerkat/mixer/necessary/AsyncBulletinBoardClient.java @@ -1,6 +1,6 @@ package meerkat.mixer.necessary; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import java.util.List; diff --git a/mixer/src/main/java/meerkat/mixer/necessary/BulletinBoardClient.java b/mixer/src/main/java/meerkat/mixer/necessary/BulletinBoardClient.java index aebe469..0770f7a 100644 --- a/mixer/src/main/java/meerkat/mixer/necessary/BulletinBoardClient.java +++ b/mixer/src/main/java/meerkat/mixer/necessary/BulletinBoardClient.java @@ -5,7 +5,7 @@ import meerkat.protobuf.Voting.BulletinBoardClientParams; import java.util.List; -import static meerkat.protobuf.BulletinBoardAPI.*; +import static meerkat.protobuf.BulletinBoardApi.*; /** * Created by talm on 24/10/15. diff --git a/mixer/src/main/java/meerkat/mixer/necessary/CompleteBatch.java b/mixer/src/main/java/meerkat/mixer/necessary/CompleteBatch.java index 4e18d43..a628fe3 100644 --- a/mixer/src/main/java/meerkat/mixer/necessary/CompleteBatch.java +++ b/mixer/src/main/java/meerkat/mixer/necessary/CompleteBatch.java @@ -1,7 +1,7 @@ package meerkat.mixer.necessary; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.protobuf.BulletinBoardApi.*; import meerkat.protobuf.Crypto.*; import java.util.LinkedList; diff --git a/polling-station/build.gradle b/polling-station/build.gradle index 6527c1d..df3c2d8 100644 --- a/polling-station/build.gradle +++ b/polling-station/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/restful-api-common/build.gradle b/restful-api-common/build.gradle index b838cdb..0e16c49 100644 --- a/restful-api-common/build.gradle +++ b/restful-api-common/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/scanner-api-common/build.gradle b/scanner-api-common/build.gradle index a6fa1b5..996aada 100644 --- a/scanner-api-common/build.gradle +++ b/scanner-api-common/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version "1.0.2" - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/scanner-api-common/src/main/proto/meerkat/PollingStation.proto b/scanner-api-common/src/main/proto/meerkat/polling_station.proto similarity index 100% rename from scanner-api-common/src/main/proto/meerkat/PollingStation.proto rename to scanner-api-common/src/main/proto/meerkat/polling_station.proto diff --git a/settings.gradle b/settings.gradle index 299a873..cc1056c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,6 +10,7 @@ include 'mixer' include 'bulletin-board-client' include 'distributed-key-generation' include 'voting-booth-gui' +include 'bulletin-board-server-frontend' // Only include the android projects if the android SDK directory is set // we assume that if you have a local.properties file it contains diff --git a/voting-booth-gui/build.gradle b/voting-booth-gui/build.gradle index 96ed70d..395beb7 100644 --- a/voting-booth-gui/build.gradle +++ b/voting-booth-gui/build.gradle @@ -1,7 +1,7 @@ plugins { id "us.kirchmeier.capsule" version "1.0.2" - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java' diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/Main.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/Main.java index 0cab1fd..1cd95f1 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/Main.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/Main.java @@ -2,7 +2,7 @@ package meerkat.voting.gui; import javafx.application.Application; import javafx.stage.Stage; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import meerkat.voting.gui.configuration.VotingBoothConfiguration; import meerkat.voting.gui.managment.ChainBuilder; import org.json.JSONException; @@ -30,7 +30,7 @@ public class Main extends Application { */ private VotingBoothConfiguration GetConfig() throws IOException, JSONException, URISyntaxException { FileInputStream fis = new FileInputStream(getClass().getResource(DEFAULT_CONFIGURATION_PATH).getPath()); - BallotQuestionUIElementOuterClass.BallotQuestionsUIElements read_questions = BallotQuestionUIElementOuterClass.BallotQuestionsUIElements.parseFrom(fis); + BallotQuestionUiElement.BallotQuestionsUIElements read_questions = BallotQuestionUiElement.BallotQuestionsUIElements.parseFrom(fis); VotingBoothConfiguration votingBoothConfiguration = new VotingBoothConfiguration(); votingBoothConfiguration.NameSelectionQuestion = read_questions.getQuestions(1); votingBoothConfiguration.NameSelectionByPictureQuestion = read_questions.getQuestions(0); diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java index f6336d0..b72ead1 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/Converter.java @@ -2,7 +2,7 @@ package meerkat.voting.gui.configuration; import joptsimple.OptionParser; import joptsimple.OptionSet; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement.*; import org.json.JSONException; import java.io.FileOutputStream; @@ -39,10 +39,8 @@ public class Converter { */ private static void ConvertJsonIntoBinaryFile(VotingBoothConfiguration configuration, String outputPath) throws IOException { FileOutputStream fileOutputStream = new FileOutputStream(outputPath); - BallotQuestionUIElementOuterClass.BallotQuestionsUIElements read_questions = - BallotQuestionUIElementOuterClass - .BallotQuestionsUIElements - .newBuilder() + BallotQuestionsUIElements read_questions = + BallotQuestionsUIElements.newBuilder() .addQuestions(configuration.NameSelectionByPictureQuestion) .addQuestions(configuration.NameSelectionQuestion) .build(); diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfiguration.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfiguration.java index 8eda170..1cf1565 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfiguration.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfiguration.java @@ -1,7 +1,7 @@ package meerkat.voting.gui.configuration; import javafx.embed.swing.SwingFXUtils; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -11,8 +11,8 @@ import java.awt.image.BufferedImage; * This object contains all the questions and configurations needed for the voting-booth-gui work */ public class VotingBoothConfiguration { - public BallotQuestionUIElementOuterClass.BallotQuestionUIElement NameSelectionQuestion; - public BallotQuestionUIElementOuterClass.BallotQuestionUIElement NameSelectionByPictureQuestion; + public BallotQuestionUiElement.BallotQuestionUIElement NameSelectionQuestion; + public BallotQuestionUiElement.BallotQuestionUIElement NameSelectionByPictureQuestion; /** * Checks that the configuration that have been given is valud @@ -29,12 +29,12 @@ public class VotingBoothConfiguration { return false; } // check that both the types of the questions answers are supported - if (BallotQuestionUIElementOuterClass.ValueType.forNumber(NameSelectionByPictureQuestion.getAnswers().getAnswersType()) == null || - BallotQuestionUIElementOuterClass.ValueType.forNumber(NameSelectionQuestion.getAnswers().getAnswersType()) == null ){ + if (BallotQuestionUiElement.ValueType.forNumber(NameSelectionByPictureQuestion.getAnswers().getAnswersType()) == null || + BallotQuestionUiElement.ValueType.forNumber(NameSelectionQuestion.getAnswers().getAnswersType()) == null ){ return false; } // Check that all the given answers are valid bte strings that can be converted into strings - for (BallotQuestionUIElementOuterClass.UIAnswer answer: NameSelectionQuestion.getAnswers().getAnswers().getAnswersList()){ + for (BallotQuestionUiElement.UIAnswer answer: NameSelectionQuestion.getAnswers().getAnswers().getAnswersList()){ try { answer.getAnswer().toStringUtf8(); if (answer.getDescription() == null) { @@ -45,7 +45,7 @@ public class VotingBoothConfiguration { } } // Check that all given byteStrings that are pictures can be converted into pictures - for (BallotQuestionUIElementOuterClass.UIAnswer answer :NameSelectionByPictureQuestion.getAnswers().getAnswers().getAnswersList()){ + for (BallotQuestionUiElement.UIAnswer answer :NameSelectionByPictureQuestion.getAnswers().getAnswers().getAnswersList()){ try { BufferedImage bufferedImage = ImageIO.read(answer.getAnswer().newInput()); SwingFXUtils.toFXImage(bufferedImage, null); diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java index f9695dd..9fb8249 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/configuration/VotingBoothConfigurationCreator.java @@ -1,7 +1,7 @@ package meerkat.voting.gui.configuration; import com.google.protobuf.ByteString; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import org.factcenter.qilin.util.Pair; import org.json.JSONArray; import org.json.JSONException; @@ -47,7 +47,7 @@ public class VotingBoothConfigurationCreator { throw new IOException(WRONG_QUESTIONS_AMOUNT_ERROR_MESSAGE); } else { try { - BallotQuestionUIElementOuterClass.BallotQuestionUIElement ballotQuestionUIElement = this.convertJSONObjToBallotQuestion(array.getJSONObject(0)); + BallotQuestionUiElement.BallotQuestionUIElement ballotQuestionUIElement = this.convertJSONObjToBallotQuestion(array.getJSONObject(0)); config.NameSelectionQuestion = ballotQuestionUIElement; ballotQuestionUIElement = this.convertJSONObjToBallotQuestion(array.getJSONObject(1)); @@ -81,7 +81,7 @@ public class VotingBoothConfigurationCreator { * @param object the object to convert * @return BallotQuestion parsed fron JSONObject */ - private BallotQuestionUIElementOuterClass.BallotQuestionUIElement convertJSONObjToBallotQuestion(JSONObject object) throws JSONException, IOException { + private BallotQuestionUiElement.BallotQuestionUIElement convertJSONObjToBallotQuestion(JSONObject object) throws JSONException, IOException { boolean randomize = object.getBoolean("randomize"); // Question part @@ -101,23 +101,23 @@ public class VotingBoothConfigurationCreator { } // Create the UIQuestion and set the values parsed from jason - BallotQuestionUIElementOuterClass.UIQuestion uiQuestion = BallotQuestionUIElementOuterClass.UIQuestion.newBuilder() + BallotQuestionUiElement.UIQuestion uiQuestion = BallotQuestionUiElement.UIQuestion.newBuilder() .setQuestionType(questionType) - .setQuestion(BallotQuestionUIElementOuterClass.Question.newBuilder() + .setQuestion(BallotQuestionUiElement.Question.newBuilder() .setQuestion(questionValue)) .build(); // Create UIAnswers and set the values parsed from jason - BallotQuestionUIElementOuterClass.UIAnswers.Builder uiAnswersBuilder = BallotQuestionUIElementOuterClass.UIAnswers.newBuilder() + BallotQuestionUiElement.UIAnswers.Builder uiAnswersBuilder = BallotQuestionUiElement.UIAnswers.newBuilder() .setAnswersType(answersType); - BallotQuestionUIElementOuterClass.ListOfAnswers.Builder listOfAnswers = BallotQuestionUIElementOuterClass.ListOfAnswers.newBuilder(); + BallotQuestionUiElement.ListOfAnswers.Builder listOfAnswers = BallotQuestionUiElement.ListOfAnswers.newBuilder(); for(Pair pair: answersPairs){ listOfAnswers.addAnswers(ConvertPairIntoUIAnswer(pair)); } uiAnswersBuilder.setAnswers(listOfAnswers); this.logger.debug("Converted the json object into ballot question object.\n" + object); - return BallotQuestionUIElementOuterClass.BallotQuestionUIElement.newBuilder() + return BallotQuestionUiElement.BallotQuestionUIElement.newBuilder() .setQuestion(uiQuestion) .setAnswers(uiAnswersBuilder.build()) .setRandomizeListOrder(randomize) @@ -129,8 +129,8 @@ public class VotingBoothConfigurationCreator { * @param pair A pair of byteString which is the answer and string which is the description of the answer * @return UIAnswer */ - private BallotQuestionUIElementOuterClass.UIAnswer ConvertPairIntoUIAnswer(Pair pair) { - return BallotQuestionUIElementOuterClass.UIAnswer.newBuilder() + private BallotQuestionUiElement.UIAnswer ConvertPairIntoUIAnswer(Pair pair) { + return BallotQuestionUiElement.UIAnswer.newBuilder() .setAnswer(pair.a) .setDescription(pair.b) .build(); @@ -144,10 +144,10 @@ public class VotingBoothConfigurationCreator { * @throws IOException will be thrown if the given type is unsupported */ private ByteString convertToByteStringBasedOnType(int questionType, JSONObject value) throws IOException, JSONException { - if (questionType == BallotQuestionUIElementOuterClass.ValueType.TEXT_TYPE.getNumber()) { + if (questionType == BallotQuestionUiElement.ValueType.TEXT_TYPE.getNumber()) { return ByteString.copyFromUtf8(value.getString("answer")); } - if (questionType == BallotQuestionUIElementOuterClass.ValueType.IMAGE_TYPE.getNumber()) { + if (questionType == BallotQuestionUiElement.ValueType.IMAGE_TYPE.getNumber()) { return ByteString.copyFrom(getImageBytes(value.getString("answer"))); } else { diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java index ee569e2..734cc3c 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java @@ -1,6 +1,6 @@ package meerkat.voting.gui.managment; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import java.util.List; @@ -15,7 +15,7 @@ import java.util.List; public class VotersBallot { public List VoterChannel; public String VotersNameSelection; - public BallotQuestionUIElementOuterClass.UIAnswer VotersImageSelection; + public BallotQuestionUiElement.UIAnswer VotersImageSelection; /** * Gets the name of the candidate the voter choose diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/PicturesAnswersUpdater.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/PicturesAnswersUpdater.java index dfdcd47..427a006 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/PicturesAnswersUpdater.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/PicturesAnswersUpdater.java @@ -13,7 +13,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; import javafx.stage.Stage; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,8 +36,8 @@ class PicturesAnswersUpdater implements EventHandler{ private Stage currentStage; private int columIndex; - private List allAvailableAnswers; - private FutureCallback imageUpdate; + private List allAvailableAnswers; + private FutureCallback imageUpdate; PicturesAnswersUpdater(Stage primaryStage) { this.currentStage = primaryStage; @@ -52,7 +52,7 @@ class PicturesAnswersUpdater implements EventHandler{ * Sets the call back object which will be called every time the voter choose different candidate picture * @param imageUpdate the callback object itself */ - public void SetImageUpdate(FutureCallback imageUpdate){ + public void SetImageUpdate(FutureCallback imageUpdate){ this.imageUpdate = imageUpdate; } @@ -61,14 +61,14 @@ class PicturesAnswersUpdater implements EventHandler{ * * @param question the ballot question that contains all the pictures that are the answers */ - void UpdateAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) { + void UpdateAnswers(BallotQuestionUiElement.BallotQuestionUIElement question) { this.RemoveAllAnswers(); - List answers = new ArrayList<>(question.getAnswers().getAnswers().getAnswersList()); + List answers = new ArrayList<>(question.getAnswers().getAnswers().getAnswersList()); if (question.getRandomizeListOrder()) { Collections.shuffle(answers); } - for (BallotQuestionUIElementOuterClass.UIAnswer answer: answers){ + for (BallotQuestionUiElement.UIAnswer answer: answers){ try { this.allAvailableAnswers.add(answer); this.AddAnswer(answer); @@ -104,7 +104,7 @@ class PicturesAnswersUpdater implements EventHandler{ * @param location the location of the picture * @return GridPane which contains string and check box */ - private GridPane GetAnswerElement(BallotQuestionUIElementOuterClass.UIAnswer answer, int location) throws IOException { + private GridPane GetAnswerElement(BallotQuestionUiElement.UIAnswer answer, int location) throws IOException { GridPane gridPane = new GridPane(); BufferedImage bufferedImage = ImageIO.read(answer.getAnswer().newInput()); @@ -139,7 +139,7 @@ class PicturesAnswersUpdater implements EventHandler{ * * @param answer the binaryData string to represent to the user */ - private void AddAnswer(BallotQuestionUIElementOuterClass.UIAnswer answer) throws IOException { + private void AddAnswer(BallotQuestionUiElement.UIAnswer answer) throws IOException { GridPane container = this.GetAnswersContainer(); this.columIndex++; diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java index b7041ac..bfc4713 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_by_picture/SelectCandidateByPictureController.java @@ -3,7 +3,7 @@ package meerkat.voting.gui.panels.select_candidate_by_picture; import com.google.common.util.concurrent.FutureCallback; import javafx.fxml.FXML; import javafx.scene.input.MouseEvent; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import meerkat.voting.gui.managment.TwoWayNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +12,7 @@ import org.slf4j.LoggerFactory; * Created by Vladimir Eliezer Tokarev on 8/27/2016. * SelectCandidateNameController handle the behavior of select by picture screen */ -public class SelectCandidateByPictureController extends TwoWayNode implements FutureCallback { +public class SelectCandidateByPictureController extends TwoWayNode implements FutureCallback { private final Logger logger = LoggerFactory.getLogger(SelectCandidateByPictureController.class); @@ -50,7 +50,7 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu } @Override - public void onSuccess(BallotQuestionUIElementOuterClass.UIAnswer result) { + public void onSuccess(BallotQuestionUiElement.UIAnswer result) { this.votersBallot.VotersImageSelection = result; } diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/StringsAnswersUpdater.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/StringsAnswersUpdater.java index 6246a62..065d0ed 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/StringsAnswersUpdater.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/select_candidate_name/StringsAnswersUpdater.java @@ -7,7 +7,7 @@ import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.layout.GridPane; import javafx.stage.Stage; -import meerkat.protobuf.BallotQuestionUIElementOuterClass; +import meerkat.protobuf.BallotQuestionUiElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,16 +104,16 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{ * Checks if the answers should be randomized, if they are then randomize them * @param question the questions that have all the information to be reporesneted */ - void UpdateAnswers(BallotQuestionUIElementOuterClass.BallotQuestionUIElement question) { + void UpdateAnswers(BallotQuestionUiElement.BallotQuestionUIElement question) { this.RemoveAllAnswers(); - List answers = + List answers = new ArrayList<>(question.getAnswers().getAnswers().getAnswersList()); if (question.getRandomizeListOrder()){ Collections.shuffle(answers); } - for (BallotQuestionUIElementOuterClass.UIAnswer answer: answers){ + for (BallotQuestionUiElement.UIAnswer answer: answers){ this.AddAnswer(answer.getAnswer().toStringUtf8()); } this.currentStage.show(); diff --git a/voting-booth/build.gradle b/voting-booth/build.gradle index 75feb87..c654245 100644 --- a/voting-booth/build.gradle +++ b/voting-booth/build.gradle @@ -1,6 +1,6 @@ plugins { id "us.kirchmeier.capsule" version '1.0.2' - id 'com.google.protobuf' version '0.8.0' + id 'com.google.protobuf' version '0.8.1' } apply plugin: 'java'