Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 10d2358

Browse files
Update to latest protobufs from fabric-protos
Change-Id: I5660e25ac20faf872cd44cc5405294c12cc92b4a Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
1 parent 2e7eb12 commit 10d2358

File tree

83 files changed

+1455
-2028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1455
-2028
lines changed

pom.xml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
protobuf-java directly, you will be transitively depending on the
304304
protobuf-java version that grpc depends on.
305305
-->
306-
<protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
306+
<protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
307307
<pluginId>grpc-java</pluginId>
308308
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
309309
</pluginArtifact>
@@ -321,7 +321,7 @@
321321
<plugin>
322322
<groupId>org.apache.maven.plugins</groupId>
323323
<artifactId>maven-compiler-plugin</artifactId>
324-
<version>3.8.0</version>
324+
<version>3.8.1</version>
325325
<configuration>
326326
<source>1.8</source>
327327
<target>1.8</target>
@@ -331,6 +331,37 @@
331331
<arg>-Xlint</arg>
332332
</compilerArgs>
333333
</configuration>
334+
<executions>
335+
<execution> <!-- Default Maven execution for generated code with warnings and linting disabled -->
336+
<id>default-compile</id>
337+
<phase>compile</phase>
338+
<goals>
339+
<goal>compile</goal>
340+
</goals>
341+
<configuration>
342+
<includes>
343+
<include>org/hyperledger/fabric/protos/**/*.java</include>
344+
</includes>
345+
</configuration>
346+
</execution>
347+
<execution> <!-- Additional execution for all other code with warnings and linting enabled -->
348+
<id>compile-main</id>
349+
<phase>compile</phase>
350+
<goals>
351+
<goal>compile</goal>
352+
</goals>
353+
<configuration>
354+
<excludes>
355+
<exclude>org/hyperledger/fabric/protos/**/*.java</exclude>
356+
</excludes>
357+
<showDeprecation>true</showDeprecation>
358+
<showWarnings>true</showWarnings>
359+
<compilerArgs>
360+
<arg>-Xlint</arg>
361+
</compilerArgs>
362+
</configuration>
363+
</execution>
364+
</executions>
334365
</plugin>
335366
<plugin>
336367
<groupId>org.apache.maven.plugins</groupId>

src/main/java/org/hyperledger/fabric/sdk/BlockEvent.java

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import com.google.protobuf.InvalidProtocolBufferException;
2121
import org.hyperledger.fabric.protos.common.Common.Block;
22-
import org.hyperledger.fabric.protos.peer.PeerEvents;
22+
import org.hyperledger.fabric.protos.peer.EventsPackage;
2323
import org.hyperledger.fabric.sdk.exception.InvalidProtocolBufferRuntimeException;
2424

2525
/**
@@ -30,7 +30,7 @@
3030
public class BlockEvent extends BlockInfo {
3131
private final Peer peer;
3232

33-
BlockEvent(Peer peer, PeerEvents.DeliverResponse resp) {
33+
BlockEvent(Peer peer, EventsPackage.DeliverResponse resp) {
3434
super(resp);
3535
this.peer = peer;
3636
}
@@ -44,7 +44,6 @@ public Peer getPeer() {
4444
return peer;
4545
}
4646

47-
4847
TransactionEvent getTransactionEvent(int index) throws InvalidProtocolBufferException {
4948
TransactionEvent ret = null;
5049

@@ -65,7 +64,7 @@ public class TransactionEvent extends TransactionEnvelopeInfo {
6564
super(transactionEnvelopeInfo.getTransactionDeserializer());
6665
}
6766

68-
TransactionEvent(PeerEvents.FilteredTransaction filteredTransaction) {
67+
TransactionEvent(EventsPackage.FilteredTransaction filteredTransaction) {
6968
super(filteredTransaction);
7069
}
7170

@@ -74,40 +73,31 @@ public class TransactionEvent extends TransactionEnvelopeInfo {
7473
*
7574
* @return BlockEvent for this transaction.
7675
*/
77-
7876
public BlockEvent getBlockEvent() {
79-
8077
return BlockEvent.this;
81-
8278
}
8379

8480
/**
8581
* The peer that received this event.
8682
*
8783
* @return return peer producing the event.
8884
*/
89-
9085
public Peer getPeer() {
91-
9286
return BlockEvent.this.getPeer();
9387
}
9488
}
9589

9690
List<TransactionEvent> getTransactionEventsList() {
97-
9891
ArrayList<TransactionEvent> ret = new ArrayList<TransactionEvent>(getTransactionCount());
9992
for (TransactionEvent transactionEvent : getTransactionEvents()) {
10093
ret.add(transactionEvent);
10194
}
10295

10396
return ret;
104-
10597
}
10698

10799
public Iterable<TransactionEvent> getTransactionEvents() {
108-
109100
return new TransactionEventIterable();
110-
111101
}
112102

113103
class TransactionEventIterator implements Iterator<TransactionEvent> {
@@ -122,22 +112,17 @@ class TransactionEventIterator implements Iterator<TransactionEvent> {
122112
@Override
123113
public boolean hasNext() {
124114
return returned < max;
125-
126115
}
127116

128117
@Override
129118
public TransactionEvent next() {
130-
131119
TransactionEvent ret = null;
132120
// Filter for only transactions but today it's not really needed.
133121
// Blocks with transactions only has transactions or a single pdate.
134122
try {
135123
do {
136-
137124
ret = getTransactionEvent(ci++);
138-
139125
} while (ret == null);
140-
141126
} catch (InvalidProtocolBufferException e) {
142127
throw new InvalidProtocolBufferRuntimeException(e);
143128
}
@@ -147,7 +132,6 @@ public TransactionEvent next() {
147132
}
148133

149134
class TransactionEventIterable implements Iterable<TransactionEvent> {
150-
151135
@Override
152136
public Iterator<TransactionEvent> iterator() {
153137
return new TransactionEventIterator();

0 commit comments

Comments
 (0)