fixed build so android-scanner compiles; changed android-scanner to use meerkat scanner API rather than custom REST library
parent
62349f9fe7
commit
24e3556320
|
@ -24,8 +24,13 @@ android {
|
|||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
// Enabling multidex support.
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
debuggable true
|
||||
|
@ -37,9 +42,17 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
substitute module('org.glassfish.hk2.external:javax.inject:2.4.0-b34') with module('javax.inject:javax.inject:1')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
// compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
compile project(':meerkat-common')
|
||||
compile project(':scanner-api-common')
|
||||
|
||||
compile 'com.android.support:appcompat-v7:25.0.1'
|
||||
// compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
|
||||
|
@ -48,13 +61,13 @@ dependencies {
|
|||
// Google protobufs
|
||||
compile 'com.google.protobuf:protobuf-java:3.+'
|
||||
// Retrofit
|
||||
compile 'com.squareup.retrofit2:retrofit:2.1.0'
|
||||
compile 'com.squareup.retrofit2:converter-protobuf:2.2.0'
|
||||
// compile 'com.squareup.retrofit2:retrofit:2.1.0'
|
||||
// compile 'com.squareup.retrofit2:converter-protobuf:2.2.0'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
// exclude group: 'com.android.support', module: 'support-annotations'
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package RestClient;
|
||||
|
||||
import com.google.protobuf.BoolValue;
|
||||
|
||||
import meerkat.protobuf.PollingStation;
|
||||
import static meerkat.rest.Constants.MEDIATYPE_PROTOBUF;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface APIService {
|
||||
|
||||
@POST("/scan")
|
||||
Call<BoolValue> sendScan(@Body PollingStation.ScannedData post);
|
||||
// Call<PollingStation.ScannedData> sendScan(@Body PollingStation.ScannedData post);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package RestClient;
|
||||
|
||||
public class ApiUtils {
|
||||
|
||||
private ApiUtils() {}
|
||||
private static final String ADDRESS = "http://192.168.43.79";
|
||||
private static final String SUB_ADDRESS = "";
|
||||
private static final int PORT = 8080;
|
||||
|
||||
// public static final String BASE_URL = "http://jsonplaceholder.typicode.com/";
|
||||
public static final String BASE_URL = ADDRESS + ":" + PORT + SUB_ADDRESS;
|
||||
public static APIService getAPIService() {
|
||||
|
||||
return RetrofitClient.getClient(BASE_URL).create(APIService.class);
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package RestClient;
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.protobuf.ProtoConverterFactory;
|
||||
|
||||
public class RetrofitClient {
|
||||
|
||||
private static Retrofit retrofit = null;
|
||||
|
||||
public static Retrofit getClient(String baseUrl) {
|
||||
if (retrofit==null) {
|
||||
retrofit = new Retrofit.Builder()
|
||||
.baseUrl(baseUrl)
|
||||
.addConverterFactory(ProtoConverterFactory.create())
|
||||
.build();
|
||||
}
|
||||
return retrofit;
|
||||
}
|
||||
}
|
|
@ -1,51 +1,33 @@
|
|||
package com.meerkat.laura.fakescannerapp;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.StrictMode;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.protobuf.BoolValue;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import RestClient.APIService;
|
||||
import RestClient.ApiUtils;
|
||||
import meerkat.pollingstation.ScannerClientAPI;
|
||||
import meerkat.protobuf.PollingStation;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
// TODO: Make this configurable
|
||||
private static final String PSC_ADDRESS = "http://127.0.0.1/";
|
||||
private static final String PSC_SUB_ADDRESS = "";
|
||||
private static final String PSC_PATH = "/";
|
||||
private static final int PSC_PORT = 8880;
|
||||
|
||||
private Button scanBtn;
|
||||
private TextView formatTxt, contentTxt, responseTxt;
|
||||
|
||||
private APIService mAPIService;
|
||||
ScannerClientAPI scannerClientAPI;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -57,7 +39,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
contentTxt = (TextView)findViewById(R.id.scan_content);
|
||||
responseTxt = (TextView)findViewById(R.id.server_response);
|
||||
|
||||
mAPIService = ApiUtils.getAPIService();
|
||||
scannerClientAPI = new ScannerClientAPI(PSC_ADDRESS, PSC_SUB_ADDRESS, PSC_PORT, PSC_PATH);
|
||||
scanBtn.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
@ -96,24 +78,11 @@ public void sendPost(String scanContent) {
|
|||
// .setChannel(ByteString.copyFrom(body))
|
||||
// .build();
|
||||
|
||||
mAPIService.sendScan(scannedData).enqueue(new Callback<BoolValue>() {
|
||||
@Override
|
||||
public void onResponse(Call<BoolValue> call, Response<BoolValue> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
showResponse("response="+response.body().getValue());
|
||||
Log.i("MainActivity", "post submitted to API.");
|
||||
} else {
|
||||
showResponse("Error HTTP code="+response.code());
|
||||
Log.i("MainActivity", "post submitted to API but respnse with http error code.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BoolValue> call, Throwable t) {
|
||||
Log.e("MainActivity", "Unable to submit post to API.");
|
||||
}
|
||||
});
|
||||
if (scannerClientAPI.sendScan(scannedData)) {
|
||||
Log.i("MainActivity", "post submitted to API.");
|
||||
} else {
|
||||
Log.e("MainActivity", "Unable to submit post to API.");
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package meerkat.pollingstation;
|
||||
|
||||
public interface PollingStationConstants {
|
||||
|
||||
// Relative addresses for Scanner operations
|
||||
|
||||
public static final String POLLING_STATION_WEB_SCANNER_SCAN_PATH = "/scan";
|
||||
public static final String POLLING_STATION_WEB_SCANNER_ERROR_PATH = "/error";
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,679 +0,0 @@
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: meerkat/comm.proto
|
||||
|
||||
package meerkat.protobuf;
|
||||
|
||||
public final class Comm {
|
||||
private Comm() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
}
|
||||
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
registerAllExtensions(
|
||||
(com.google.protobuf.ExtensionRegistryLite) registry);
|
||||
}
|
||||
public interface BroadcastMessageOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:meerkat.BroadcastMessage)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>int32 sender = 1;</code>
|
||||
*/
|
||||
int getSender();
|
||||
|
||||
/**
|
||||
* <code>int32 destination = 2;</code>
|
||||
*/
|
||||
int getDestination();
|
||||
|
||||
/**
|
||||
* <code>bool is_private = 3;</code>
|
||||
*/
|
||||
boolean getIsPrivate();
|
||||
|
||||
/**
|
||||
* <code>bytes payload = 5;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString getPayload();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code meerkat.BroadcastMessage}
|
||||
*/
|
||||
public static final class BroadcastMessage extends
|
||||
com.google.protobuf.GeneratedMessageV3 implements
|
||||
// @@protoc_insertion_point(message_implements:meerkat.BroadcastMessage)
|
||||
BroadcastMessageOrBuilder {
|
||||
// Use BroadcastMessage.newBuilder() to construct.
|
||||
private BroadcastMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private BroadcastMessage() {
|
||||
sender_ = 0;
|
||||
destination_ = 0;
|
||||
isPrivate_ = false;
|
||||
payload_ = com.google.protobuf.ByteString.EMPTY;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
|
||||
}
|
||||
private BroadcastMessage(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
this();
|
||||
int mutable_bitField0_ = 0;
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
default: {
|
||||
if (!input.skipField(tag)) {
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
|
||||
sender_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
|
||||
destination_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
|
||||
isPrivate_ = input.readBool();
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
|
||||
payload_ = input.readBytes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(this);
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||
e).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return meerkat.protobuf.Comm.internal_static_meerkat_BroadcastMessage_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return meerkat.protobuf.Comm.internal_static_meerkat_BroadcastMessage_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
meerkat.protobuf.Comm.BroadcastMessage.class, meerkat.protobuf.Comm.BroadcastMessage.Builder.class);
|
||||
}
|
||||
|
||||
public static final int SENDER_FIELD_NUMBER = 1;
|
||||
private int sender_;
|
||||
/**
|
||||
* <code>int32 sender = 1;</code>
|
||||
*/
|
||||
public int getSender() {
|
||||
return sender_;
|
||||
}
|
||||
|
||||
public static final int DESTINATION_FIELD_NUMBER = 2;
|
||||
private int destination_;
|
||||
/**
|
||||
* <code>int32 destination = 2;</code>
|
||||
*/
|
||||
public int getDestination() {
|
||||
return destination_;
|
||||
}
|
||||
|
||||
public static final int IS_PRIVATE_FIELD_NUMBER = 3;
|
||||
private boolean isPrivate_;
|
||||
/**
|
||||
* <code>bool is_private = 3;</code>
|
||||
*/
|
||||
public boolean getIsPrivate() {
|
||||
return isPrivate_;
|
||||
}
|
||||
|
||||
public static final int PAYLOAD_FIELD_NUMBER = 5;
|
||||
private com.google.protobuf.ByteString payload_;
|
||||
/**
|
||||
* <code>bytes payload = 5;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getPayload() {
|
||||
return payload_;
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
if (sender_ != 0) {
|
||||
output.writeInt32(1, sender_);
|
||||
}
|
||||
if (destination_ != 0) {
|
||||
output.writeInt32(2, destination_);
|
||||
}
|
||||
if (isPrivate_ != false) {
|
||||
output.writeBool(3, isPrivate_);
|
||||
}
|
||||
if (!payload_.isEmpty()) {
|
||||
output.writeBytes(5, payload_);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (sender_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(1, sender_);
|
||||
}
|
||||
if (destination_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(2, destination_);
|
||||
}
|
||||
if (isPrivate_ != false) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBoolSize(3, isPrivate_);
|
||||
}
|
||||
if (!payload_.isEmpty()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBytesSize(5, payload_);
|
||||
}
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
@java.lang.Override
|
||||
public boolean equals(final java.lang.Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof meerkat.protobuf.Comm.BroadcastMessage)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
meerkat.protobuf.Comm.BroadcastMessage other = (meerkat.protobuf.Comm.BroadcastMessage) obj;
|
||||
|
||||
boolean result = true;
|
||||
result = result && (getSender()
|
||||
== other.getSender());
|
||||
result = result && (getDestination()
|
||||
== other.getDestination());
|
||||
result = result && (getIsPrivate()
|
||||
== other.getIsPrivate());
|
||||
result = result && getPayload()
|
||||
.equals(other.getPayload());
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int hashCode() {
|
||||
if (memoizedHashCode != 0) {
|
||||
return memoizedHashCode;
|
||||
}
|
||||
int hash = 41;
|
||||
hash = (19 * hash) + getDescriptor().hashCode();
|
||||
hash = (37 * hash) + SENDER_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getSender();
|
||||
hash = (37 * hash) + DESTINATION_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getDestination();
|
||||
hash = (37 * hash) + IS_PRIVATE_FIELD_NUMBER;
|
||||
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
|
||||
getIsPrivate());
|
||||
hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getPayload().hashCode();
|
||||
hash = (29 * hash) + unknownFields.hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(meerkat.protobuf.Comm.BroadcastMessage prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code meerkat.BroadcastMessage}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:meerkat.BroadcastMessage)
|
||||
meerkat.protobuf.Comm.BroadcastMessageOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return meerkat.protobuf.Comm.internal_static_meerkat_BroadcastMessage_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return meerkat.protobuf.Comm.internal_static_meerkat_BroadcastMessage_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
meerkat.protobuf.Comm.BroadcastMessage.class, meerkat.protobuf.Comm.BroadcastMessage.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using meerkat.protobuf.Comm.BroadcastMessage.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
super(parent);
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessageV3
|
||||
.alwaysUseFieldBuilders) {
|
||||
}
|
||||
}
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
sender_ = 0;
|
||||
|
||||
destination_ = 0;
|
||||
|
||||
isPrivate_ = false;
|
||||
|
||||
payload_ = com.google.protobuf.ByteString.EMPTY;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return meerkat.protobuf.Comm.internal_static_meerkat_BroadcastMessage_descriptor;
|
||||
}
|
||||
|
||||
public meerkat.protobuf.Comm.BroadcastMessage getDefaultInstanceForType() {
|
||||
return meerkat.protobuf.Comm.BroadcastMessage.getDefaultInstance();
|
||||
}
|
||||
|
||||
public meerkat.protobuf.Comm.BroadcastMessage build() {
|
||||
meerkat.protobuf.Comm.BroadcastMessage result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public meerkat.protobuf.Comm.BroadcastMessage buildPartial() {
|
||||
meerkat.protobuf.Comm.BroadcastMessage result = new meerkat.protobuf.Comm.BroadcastMessage(this);
|
||||
result.sender_ = sender_;
|
||||
result.destination_ = destination_;
|
||||
result.isPrivate_ = isPrivate_;
|
||||
result.payload_ = payload_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return (Builder) super.clone();
|
||||
}
|
||||
public Builder setField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
Object value) {
|
||||
return (Builder) super.setField(field, value);
|
||||
}
|
||||
public Builder clearField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field) {
|
||||
return (Builder) super.clearField(field);
|
||||
}
|
||||
public Builder clearOneof(
|
||||
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
|
||||
return (Builder) super.clearOneof(oneof);
|
||||
}
|
||||
public Builder setRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
int index, Object value) {
|
||||
return (Builder) super.setRepeatedField(field, index, value);
|
||||
}
|
||||
public Builder addRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
Object value) {
|
||||
return (Builder) super.addRepeatedField(field, value);
|
||||
}
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof meerkat.protobuf.Comm.BroadcastMessage) {
|
||||
return mergeFrom((meerkat.protobuf.Comm.BroadcastMessage)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(meerkat.protobuf.Comm.BroadcastMessage other) {
|
||||
if (other == meerkat.protobuf.Comm.BroadcastMessage.getDefaultInstance()) return this;
|
||||
if (other.getSender() != 0) {
|
||||
setSender(other.getSender());
|
||||
}
|
||||
if (other.getDestination() != 0) {
|
||||
setDestination(other.getDestination());
|
||||
}
|
||||
if (other.getIsPrivate() != false) {
|
||||
setIsPrivate(other.getIsPrivate());
|
||||
}
|
||||
if (other.getPayload() != com.google.protobuf.ByteString.EMPTY) {
|
||||
setPayload(other.getPayload());
|
||||
}
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
meerkat.protobuf.Comm.BroadcastMessage parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (meerkat.protobuf.Comm.BroadcastMessage) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private int sender_ ;
|
||||
/**
|
||||
* <code>int32 sender = 1;</code>
|
||||
*/
|
||||
public int getSender() {
|
||||
return sender_;
|
||||
}
|
||||
/**
|
||||
* <code>int32 sender = 1;</code>
|
||||
*/
|
||||
public Builder setSender(int value) {
|
||||
|
||||
sender_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>int32 sender = 1;</code>
|
||||
*/
|
||||
public Builder clearSender() {
|
||||
|
||||
sender_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private int destination_ ;
|
||||
/**
|
||||
* <code>int32 destination = 2;</code>
|
||||
*/
|
||||
public int getDestination() {
|
||||
return destination_;
|
||||
}
|
||||
/**
|
||||
* <code>int32 destination = 2;</code>
|
||||
*/
|
||||
public Builder setDestination(int value) {
|
||||
|
||||
destination_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>int32 destination = 2;</code>
|
||||
*/
|
||||
public Builder clearDestination() {
|
||||
|
||||
destination_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean isPrivate_ ;
|
||||
/**
|
||||
* <code>bool is_private = 3;</code>
|
||||
*/
|
||||
public boolean getIsPrivate() {
|
||||
return isPrivate_;
|
||||
}
|
||||
/**
|
||||
* <code>bool is_private = 3;</code>
|
||||
*/
|
||||
public Builder setIsPrivate(boolean value) {
|
||||
|
||||
isPrivate_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>bool is_private = 3;</code>
|
||||
*/
|
||||
public Builder clearIsPrivate() {
|
||||
|
||||
isPrivate_ = false;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private com.google.protobuf.ByteString payload_ = com.google.protobuf.ByteString.EMPTY;
|
||||
/**
|
||||
* <code>bytes payload = 5;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getPayload() {
|
||||
return payload_;
|
||||
}
|
||||
/**
|
||||
* <code>bytes payload = 5;</code>
|
||||
*/
|
||||
public Builder setPayload(com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
payload_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>bytes payload = 5;</code>
|
||||
*/
|
||||
public Builder clearPayload() {
|
||||
|
||||
payload_ = getDefaultInstance().getPayload();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:meerkat.BroadcastMessage)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:meerkat.BroadcastMessage)
|
||||
private static final meerkat.protobuf.Comm.BroadcastMessage DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new meerkat.protobuf.Comm.BroadcastMessage();
|
||||
}
|
||||
|
||||
public static meerkat.protobuf.Comm.BroadcastMessage getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<BroadcastMessage>
|
||||
PARSER = new com.google.protobuf.AbstractParser<BroadcastMessage>() {
|
||||
public BroadcastMessage parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new BroadcastMessage(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<BroadcastMessage> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<BroadcastMessage> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
public meerkat.protobuf.Comm.BroadcastMessage getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_meerkat_BroadcastMessage_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_meerkat_BroadcastMessage_fieldAccessorTable;
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||
descriptor;
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\022meerkat/comm.proto\022\007meerkat\"\\\n\020Broadca" +
|
||||
"stMessage\022\016\n\006sender\030\001 \001(\005\022\023\n\013destination" +
|
||||
"\030\002 \001(\005\022\022\n\nis_private\030\003 \001(\010\022\017\n\007payload\030\005 " +
|
||||
"\001(\014B\022\n\020meerkat.protobufb\006proto3"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
public com.google.protobuf.ExtensionRegistry assignDescriptors(
|
||||
com.google.protobuf.Descriptors.FileDescriptor root) {
|
||||
descriptor = root;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
}, assigner);
|
||||
internal_static_meerkat_BroadcastMessage_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_meerkat_BroadcastMessage_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_meerkat_BroadcastMessage_descriptor,
|
||||
new java.lang.String[] { "Sender", "Destination", "IsPrivate", "Payload", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +0,0 @@
|
|||
package meerkat.rest;
|
||||
|
||||
/**
|
||||
* Created by talm on 10/11/15.
|
||||
*/
|
||||
public interface Constants {
|
||||
public static final String MEDIATYPE_PROTOBUF = "application/x-protobuf";
|
||||
}
|
|
@ -182,13 +182,15 @@ repositories {
|
|||
mavenCentral()
|
||||
}
|
||||
|
||||
task "info" << {
|
||||
task "info" {
|
||||
doLast {
|
||||
println "Project: ${project.name}"
|
||||
println "Description: ${project.description}"
|
||||
println "Description: ${project.description}"
|
||||
println "--------------------------"
|
||||
println "GroupId: $groupId"
|
||||
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
||||
println ""
|
||||
}
|
||||
}
|
||||
info.description 'Print some information about project parameters'
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ apply plugin: 'maven-publish'
|
|||
|
||||
mainClassName='Demo'
|
||||
|
||||
// We may need to use this code from Java.
|
||||
targetCompatibility = '1.7'
|
||||
sourceCompatibility = '1.7'
|
||||
|
||||
|
||||
// Is this a snapshot version?
|
||||
ext { isSnapshot = false }
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ dependencies {
|
|||
// Meerkat common
|
||||
compile project(':meerkat-common')
|
||||
compile project(':restful-api-common')
|
||||
compile project(':scanner-api-common')
|
||||
|
||||
// Servlets
|
||||
compile 'org.eclipse.jetty:jetty-server:9.3.+'
|
||||
|
|
|
@ -14,6 +14,11 @@ apply plugin: 'idea'
|
|||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
// We may need to use this code from Java.
|
||||
targetCompatibility = '1.7'
|
||||
sourceCompatibility = '1.7'
|
||||
|
||||
|
||||
// Is this a snapshot version?
|
||||
ext { isSnapshot = false }
|
||||
|
||||
|
|
|
@ -0,0 +1,233 @@
|
|||
|
||||
plugins {
|
||||
id "us.kirchmeier.capsule" version "1.0.2"
|
||||
id 'com.google.protobuf' version '0.8.0'
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
// Uncomment the lines below to define an application
|
||||
// (this will also allow you to build a "fatCapsule" which includes
|
||||
// the entire application, including all dependencies in a single jar)
|
||||
//apply plugin: 'application'
|
||||
//mainClassName='your.main.ApplicationClass'
|
||||
|
||||
|
||||
// We may need to use this code from Java.
|
||||
targetCompatibility = '1.7'
|
||||
sourceCompatibility = '1.7'
|
||||
|
||||
|
||||
// Is this a snapshot version?
|
||||
ext { isSnapshot = false }
|
||||
|
||||
ext {
|
||||
groupId = 'org.factcenter.meerkat'
|
||||
nexusRepository = "https://cs.idc.ac.il/nexus/content/groups/${isSnapshot ? 'unstable' : 'public'}/"
|
||||
|
||||
// Credentials for IDC nexus repositories (needed only for using unstable repositories and publishing)
|
||||
// Should be set in ${HOME}/.gradle/gradle.properties
|
||||
|
||||
// Credentials for publishing repositories
|
||||
publishRepository = "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
|
||||
publishUser = project.hasProperty('publishUser') ? project.property('publishUser') : ""
|
||||
publishPassword = project.hasProperty('publishPassword') ? project.property('publishPassword') : ""
|
||||
}
|
||||
|
||||
description = "Common files for polling-station scanner client API"
|
||||
|
||||
// Your project version
|
||||
version = "0.0"
|
||||
|
||||
version += "${isSnapshot ? '-SNAPSHOT' : ''}"
|
||||
|
||||
|
||||
dependencies {
|
||||
// Meerkat common
|
||||
compile project(':meerkat-common')
|
||||
compile project(':restful-api-common')
|
||||
|
||||
// Logging
|
||||
compile 'org.slf4j:slf4j-api:1.7.7'
|
||||
runtime 'ch.qos.logback:logback-classic:1.1.2'
|
||||
runtime 'ch.qos.logback:logback-core:1.1.2'
|
||||
|
||||
// Google protobufs
|
||||
compile 'com.google.protobuf:protobuf-java:3.+'
|
||||
|
||||
testCompile 'junit:junit:4.+'
|
||||
|
||||
runtime 'org.codehaus.groovy:groovy:2.4.+'
|
||||
}
|
||||
|
||||
|
||||
/*==== You probably don't have to edit below this line =======*/
|
||||
|
||||
// Setup test configuration that can appear as a dependency in
|
||||
// other subprojects
|
||||
configurations {
|
||||
testOutput.extendsFrom (testCompile)
|
||||
}
|
||||
|
||||
task testJar(type: Jar, dependsOn: testClasses) {
|
||||
classifier = 'tests'
|
||||
from sourceSets.test.output
|
||||
}
|
||||
|
||||
artifacts {
|
||||
testOutput testJar
|
||||
}
|
||||
|
||||
// The run task added by the application plugin
|
||||
// is also of type JavaExec.
|
||||
tasks.withType(JavaExec) {
|
||||
// Assign all Java system properties from
|
||||
// the command line to the JavaExec task.
|
||||
systemProperties System.properties
|
||||
}
|
||||
|
||||
|
||||
protobuf {
|
||||
// Configure the protoc executable
|
||||
protoc {
|
||||
// Download from repositories
|
||||
artifact = 'com.google.protobuf:protoc:3.+'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
idea {
|
||||
module {
|
||||
project.sourceSets.each { sourceSet ->
|
||||
|
||||
def srcDir = "${protobuf.generatedFilesBaseDir}/$sourceSet.name/java"
|
||||
|
||||
println "Adding $srcDir"
|
||||
// add protobuf generated sources to generated source dir.
|
||||
if ("test".equals(sourceSet.name)) {
|
||||
testSourceDirs += file(srcDir)
|
||||
} else {
|
||||
sourceDirs += file(srcDir)
|
||||
}
|
||||
generatedSourceDirs += file(srcDir)
|
||||
|
||||
}
|
||||
|
||||
// Don't exclude build directory
|
||||
excludeDirs -= file(buildDir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*===================================
|
||||
* "Fat" Build targets
|
||||
*===================================*/
|
||||
|
||||
|
||||
if (project.hasProperty('mainClassName') && (mainClassName != null)) {
|
||||
|
||||
task mavenCapsule(type: MavenCapsule) {
|
||||
description = "Generate a capsule jar that automatically downloads and caches dependencies when run."
|
||||
applicationClass mainClassName
|
||||
destinationDir = buildDir
|
||||
}
|
||||
|
||||
task fatCapsule(type: FatCapsule) {
|
||||
description = "Generate a single capsule jar containing everything. Use -Pfatmain=... to override main class"
|
||||
|
||||
destinationDir = buildDir
|
||||
|
||||
def fatMain
|
||||
|
||||
if (this.hasProperty('fatmain')) {
|
||||
fatMain = fatmain
|
||||
appendix = "fat-${fatMain}"
|
||||
} else {
|
||||
fatMain = mainClassName
|
||||
appendix = "fat"
|
||||
}
|
||||
|
||||
applicationClass fatMain
|
||||
|
||||
def testJar = this.hasProperty('test')
|
||||
|
||||
if (testJar) {
|
||||
from sourceSets.test.output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*===================================
|
||||
* Repositories
|
||||
*===================================*/
|
||||
|
||||
repositories {
|
||||
|
||||
// Prefer the local nexus repository (it may have 3rd party artifacts not found in mavenCentral)
|
||||
maven {
|
||||
url nexusRepository
|
||||
|
||||
if (isSnapshot) {
|
||||
credentials { username
|
||||
password
|
||||
|
||||
username nexusUser
|
||||
password nexusPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use local maven repository
|
||||
mavenLocal()
|
||||
|
||||
// Use 'maven central' for other dependencies.
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
task "info" {
|
||||
doLast {
|
||||
println "Project: ${project.name}"
|
||||
println "Description: ${project.description}"
|
||||
println "--------------------------"
|
||||
println "GroupId: $groupId"
|
||||
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
||||
println ""
|
||||
}
|
||||
}
|
||||
info.description 'Print some information about project parameters'
|
||||
|
||||
/*===================================
|
||||
* Publishing
|
||||
*===================================*/
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId project.groupId
|
||||
pom.withXml {
|
||||
asNode().appendNode('description', project.description)
|
||||
}
|
||||
from project.components.java
|
||||
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url publishRepository
|
||||
credentials { username
|
||||
password
|
||||
|
||||
username publishUser
|
||||
password publishPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
../gradlew
|
|
@ -3,6 +3,7 @@ include 'voting-booth'
|
|||
include 'bulletin-board-server'
|
||||
include 'polling-station'
|
||||
include 'restful-api-common'
|
||||
include 'scanner-api-common'
|
||||
include 'mixer'
|
||||
include 'bulletin-board-client'
|
||||
include 'distributed-key-generation'
|
||||
|
|
Loading…
Reference in New Issue