From 05c7a25bb7b5bdedae8812ac3fdd9bf3b1189803 Mon Sep 17 00:00:00 2001 From: Tal Moran Date: Fri, 30 Jun 2017 02:28:03 +0300 Subject: [PATCH] Renamed proto files to use standard (lowercase-underscore) naming convention); added a separate proto for bb webapp --- .../bulletinboard/BatchDataContainer.java | 2 +- .../CachedBulletinBoardClient.java | 2 +- .../LocalBulletinBoardClient.java | 2 +- .../SimpleBulletinBoardClient.java | 4 +-- .../SimpleBulletinBoardSynchronizer.java | 2 +- .../SingleServerBulletinBoardClient.java | 2 +- .../ThreadedBulletinBoardClient.java | 2 +- .../ThreadedBulletinBoardSubscriber.java | 4 +-- .../MultiServerGetRedundancyWorker.java | 2 +- .../MultiServerPostBatchWorker.java | 2 +- .../MultiServerPostMessageWorker.java | 2 +- .../MultiServerReadBatchDataWorker.java | 2 +- .../MultiServerReadMessageWorker.java | 4 +-- .../MultiServerReadMessagesWorker.java | 2 +- .../SingleServerBeginBatchWorker.java | 2 +- .../SingleServerCloseBatchWorker.java | 2 +- .../SingleServerGenerateSyncQueryWorker.java | 4 +-- .../SingleServerGetRedundancyWorker.java | 2 +- .../SingleServerPostBatchWorker.java | 2 +- .../SingleServerPostMessageWorker.java | 2 +- .../SingleServerQuerySyncWorker.java | 4 +-- .../SingleServerReadBatchWorker.java | 2 +- .../SingleServerReadMessagesWorker.java | 8 ++--- .../BulletinBoardSynchronizerTest.java | 2 +- .../GenericBulletinBoardClientTester.java | 2 +- .../GenericSubscriptionClientTester.java | 2 +- bulletin-board-server/build.gradle | 1 + .../bulletinboard/service/HelloProtoBuf.java | 2 +- .../sqlserver/BulletinBoardSQLServer.java | 2 +- .../sqlserver/H2QueryProvider.java | 2 +- .../sqlserver/MySQLQueryProvider.java | 2 +- .../sqlserver/SQLiteQueryProvider.java | 2 +- .../mappers/BatchDataCallbackHandler.java | 2 +- .../mappers/BatchDataDigestHandler.java | 2 +- .../mappers/BeginBatchMessageMapper.java | 2 +- .../sqlserver/mappers/LongMapper.java | 2 +- .../mappers/MessageCallbackHandler.java | 2 +- .../sqlserver/mappers/MessageMapper.java | 4 +-- .../mappers/MessageStubCallbackHandler.java | 4 +-- .../sqlserver/mappers/MessageStubMapper.java | 4 +-- .../sqlserver/mappers/SignatureMapper.java | 4 +-- .../webapp/BulletinBoardWebApp.java | 31 ++++++++++++++++--- .../webapp/HelloProtoWebApp.java | 2 +- .../proto/meerkat/bulletin_board_webapp.proto | 25 +++++++++++++++ ...BulletinBoardSQLServerIntegrationTest.java | 2 +- .../GenericBulletinBoardServerTest.java | 2 +- .../HelloProtoIntegrationTest.java | 2 +- meerkat-common/src/main/java/Demo.java | 2 +- .../AsyncBulletinBoardClient.java | 2 +- .../bulletinboard/BulletinBoardClient.java | 2 +- .../bulletinboard/BulletinBoardConstants.java | 1 + .../bulletinboard/BulletinBoardDigest.java | 2 +- .../BulletinBoardMessageDeleter.java | 2 +- .../bulletinboard/BulletinBoardServer.java | 6 ++-- .../bulletinboard/BulletinBoardSignature.java | 4 +-- .../BulletinBoardSubscriber.java | 3 +- .../BulletinBoardSynchronizer.java | 2 +- .../java/meerkat/bulletinboard/Checksum.java | 3 +- .../DeletableBulletinBoardServer.java | 2 +- .../GenericBulletinBoardDigest.java | 5 +-- .../GenericBulletinBoardSignature.java | 6 +--- .../meerkat/bulletinboard/SimpleChecksum.java | 5 ++- .../src/main/java/meerkat/crypto/Digest.java | 2 +- .../meerkat/crypto/concrete/SHA256Digest.java | 2 +- .../util/BulletinBoardMessageComparator.java | 3 +- .../util/BulletinBoardMessageGenerator.java | 2 +- .../java/meerkat/util/BulletinBoardUtils.java | 2 +- ...proto => ballot_question_ui_element.proto} | 0 ...oardAPI.proto => bulletin_board_api.proto} | 2 +- .../BulletinBoardDigestTest.java | 2 +- .../java/meerkat/comm/MessageStreamTest.java | 2 +- .../meerkat/mixer/main/BatchConverter.java | 14 ++++----- .../java/meerkat/mixer/main/MainMixing.java | 4 +-- .../necessary/AsyncBulletinBoardClient.java | 2 +- .../mixer/necessary/BulletinBoardClient.java | 2 +- .../mixer/necessary/CompleteBatch.java | 2 +- ...ingStation.proto => polling_station.proto} | 0 .../main/java/meerkat/voting/gui/Main.java | 4 +-- .../voting/gui/configuration/Converter.java | 8 ++--- .../VotingBoothConfiguration.java | 14 ++++----- .../VotingBoothConfigurationCreator.java | 24 +++++++------- .../voting/gui/managment/VotersBallot.java | 4 +-- .../PicturesAnswersUpdater.java | 18 +++++------ .../SelectCandidateByPictureController.java | 6 ++-- .../StringsAnswersUpdater.java | 8 ++--- 85 files changed, 188 insertions(+), 155 deletions(-) create mode 100644 bulletin-board-server/src/main/proto/meerkat/bulletin_board_webapp.proto rename meerkat-common/src/main/proto/meerkat/{BallotQuestionUIElement.proto => ballot_question_ui_element.proto} (100%) rename meerkat-common/src/main/proto/meerkat/{BulletinBoardAPI.proto => bulletin_board_api.proto} (99%) rename scanner-api-common/src/main/proto/meerkat/{PollingStation.proto => polling_station.proto} (100%) 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/build.gradle b/bulletin-board-server/build.gradle index 22c77bb..f61f2d3 100644 --- a/bulletin-board-server/build.gradle +++ b/bulletin-board-server/build.gradle @@ -6,6 +6,7 @@ plugins { } apply plugin: 'org.akhikhl.gretty' +apply plugin: 'com.google.protobuf' apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' 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..c88874f 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 @@ -18,7 +18,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 +32,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,8 +46,10 @@ 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"); @@ -75,7 +80,23 @@ 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) + @POST + @Consumes(MEDIATYPE_PROTOBUF) + @Produces(MEDIATYPE_PROTOBUF) + public ServerStatus getStatus() throws CommunicationException { + 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/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/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..ed0a9fe 100644 --- a/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java +++ b/meerkat-common/src/main/java/meerkat/bulletinboard/BulletinBoardConstants.java @@ -7,6 +7,7 @@ public interface BulletinBoardConstants { // Relative addresses for Bulletin Board operations + public static final String STATUS_PATH = "/status"; public static final String BULLETIN_BOARD_SERVER_PATH = "/bbserver"; public static final String GENERATE_SYNC_QUERY_PATH = "/generatesyncquery"; public static final String READ_MESSAGES_PATH = "/readmessages"; 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/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/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/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();