Renamed proto files to use standard (lowercase-underscore) naming convention); added a separate proto for bb webapp

bb-server
Tal Moran 2017-06-30 02:28:03 +03:00
parent 68e1737f22
commit 05c7a25bb7
85 changed files with 188 additions and 155 deletions

View File

@ -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;

View File

@ -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.*;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.*;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.*;

View File

@ -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;

View File

@ -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;

View File

@ -6,6 +6,7 @@ plugins {
}
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'com.google.protobuf'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,5 +1,5 @@
import com.google.protobuf.ByteString;
import static meerkat.protobuf.BulletinBoardAPI.*;
import static meerkat.protobuf.BulletinBoardApi.*;
import java.io.IOException;
/**

View File

@ -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;

View File

@ -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;

View File

@ -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";

View File

@ -1,7 +1,7 @@
package meerkat.bulletinboard;
import meerkat.crypto.Digest;
import meerkat.protobuf.BulletinBoardAPI.*;
import meerkat.protobuf.BulletinBoardApi.*;
import java.util.List;

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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.*;
/**

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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<BulletinBoardAPI.BatchChunk> MixerOutput2BatchChunk(MixerOutput mixerOutput) {
public List<BulletinBoardApi.BatchChunk> MixerOutput2BatchChunk(MixerOutput mixerOutput) {
List<BulletinBoardAPI.BatchChunk> result = new ArrayList<BulletinBoardAPI.BatchChunk>();
List<BulletinBoardApi.BatchChunk> result = new ArrayList<BulletinBoardApi.BatchChunk>();
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<BulletinBoardAPI.BatchChunk> batchChunkList) throws Exception {
(List<BulletinBoardApi.BatchChunk> batchChunkList) throws Exception {
Mixing.MixBatchHeader header = Mixing.MixBatchHeader.parseFrom(batchChunkList.remove(0).getData());

View File

@ -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<BulletinBoardAPI.BatchChunk> batchChunkList = batchConverter.MixerOutput2BatchChunk(mixerOutput);
List<BulletinBoardApi.BatchChunk> batchChunkList = batchConverter.MixerOutput2BatchChunk(mixerOutput);
asyncBulletinBoardClient.postBatch(id, batchId, batchChunkList, callback);
}

View File

@ -1,6 +1,6 @@
package meerkat.mixer.necessary;
import meerkat.protobuf.BulletinBoardAPI.*;
import meerkat.protobuf.BulletinBoardApi.*;
import java.util.List;

View File

@ -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.

View File

@ -1,7 +1,7 @@
package meerkat.mixer.necessary;
import meerkat.protobuf.BulletinBoardAPI.*;
import meerkat.protobuf.BulletinBoardApi.*;
import meerkat.protobuf.Crypto.*;
import java.util.LinkedList;

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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<ByteString, String> 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<ByteString, String> pair) {
return BallotQuestionUIElementOuterClass.UIAnswer.newBuilder()
private BallotQuestionUiElement.UIAnswer ConvertPairIntoUIAnswer(Pair<ByteString, String> 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 {

View File

@ -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<Integer> VoterChannel;
public String VotersNameSelection;
public BallotQuestionUIElementOuterClass.UIAnswer VotersImageSelection;
public BallotQuestionUiElement.UIAnswer VotersImageSelection;
/**
* Gets the name of the candidate the voter choose

View File

@ -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<BallotQuestionUIElementOuterClass.UIAnswer> allAvailableAnswers;
private FutureCallback<BallotQuestionUIElementOuterClass.UIAnswer> imageUpdate;
private List<BallotQuestionUiElement.UIAnswer> allAvailableAnswers;
private FutureCallback<BallotQuestionUiElement.UIAnswer> 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<BallotQuestionUIElementOuterClass.UIAnswer> imageUpdate){
public void SetImageUpdate(FutureCallback<BallotQuestionUiElement.UIAnswer> 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<BallotQuestionUIElementOuterClass.UIAnswer> answers = new ArrayList<>(question.getAnswers().getAnswers().getAnswersList());
List<BallotQuestionUiElement.UIAnswer> 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++;

View File

@ -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<BallotQuestionUIElementOuterClass.UIAnswer> {
public class SelectCandidateByPictureController extends TwoWayNode implements FutureCallback<BallotQuestionUiElement.UIAnswer> {
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;
}

View File

@ -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<BallotQuestionUIElementOuterClass.UIAnswer> answers =
List<BallotQuestionUiElement.UIAnswer> 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();