1111 * {@link #of(AntidotePB.ApbStaticReadObjects)} and {@link #of(AntidotePB.ApbStaticUpdateObjects)}.
1212 */
1313public abstract class AntidoteRequest <Response > extends AntidoteMessage {
14+
15+
1416 /**
1517 * A transformer for all possible cases of Antidote requests.
1618 * <p>
@@ -20,14 +22,14 @@ public abstract class AntidoteRequest<Response> extends AntidoteMessage {
2022 * @see AntidoteRequest#accept(Handler)
2123 */
2224 public interface Handler <V > {
25+
2326 default V handle (AntidotePB .ApbReadObjects op ) {
2427 throw new ExtractionError ("Unexpected message: " + op );
2528 }
2629
2730 default V handle (AntidotePB .ApbUpdateObjects op ) {
2831 throw new ExtractionError ("Unexpected message: " + op );
2932 }
30-
3133 default V handle (AntidotePB .ApbStartTransaction op ) {
3234 throw new ExtractionError ("Unexpected message: " + op );
3335 }
@@ -47,8 +49,19 @@ default V handle(AntidotePB.ApbStaticReadObjects op) {
4749 default V handle (AntidotePB .ApbStaticUpdateObjects op ) {
4850 throw new ExtractionError ("Unexpected message: " + op );
4951 }
50- }
5152
53+ default V handle (AntidotePB .ApbCreateDC op ) {
54+ throw new ExtractionError ("Unexpected message: " + op );
55+ }
56+
57+ default V handle (AntidotePB .ApbConnectToDcs op ) {
58+ throw new ExtractionError ("Unexpected message: " + op );
59+ }
60+
61+ default V handle (AntidotePB .ApbGetConnectionDescriptor op ) {
62+ throw new ExtractionError ("Unexpected message: " + op );
63+ }
64+ }
5265 /**
5366 * An exception thrown by response extractors when response type does not match.
5467 *
@@ -64,12 +77,11 @@ public static class ExtractionError extends RuntimeException {
6477 public ExtractionError (String message ) {
6578 super (message );
6679 }
67- }
6880
81+ }
6982 public static MsgReadObjects of (AntidotePB .ApbReadObjects op ) {
7083 return new MsgReadObjects (op );
7184 }
72-
7385 public static MsgUpdateObjects of (AntidotePB .ApbUpdateObjects op ) {
7486 return new MsgUpdateObjects (op );
7587 }
@@ -94,6 +106,18 @@ public static MsgStaticUpdateObjects of(AntidotePB.ApbStaticUpdateObjects op) {
94106 return new MsgStaticUpdateObjects (op );
95107 }
96108
109+ public static MsgCreateDC of (AntidotePB .ApbCreateDC op ) {
110+ return new MsgCreateDC (op );
111+ }
112+
113+ public static MsgConnectToDCs of (AntidotePB .ApbConnectToDcs op ) {
114+ return new MsgConnectToDCs (op );
115+ }
116+
117+ public static MsgGetConnectionDescriptor of (AntidotePB .ApbGetConnectionDescriptor op ) {
118+ return new MsgGetConnectionDescriptor (op );
119+ }
120+
97121 /**
98122 * Handle the request using the given request transformer.
99123 *
@@ -344,4 +368,92 @@ public String toString() {
344368 '}' ;
345369 }
346370 }
371+
372+ private static class MsgCreateDC extends AntidoteRequest <AntidotePB .ApbOperationResp > {
373+ private AntidotePB .ApbCreateDC op ;
374+
375+ public static class Extractor implements Handler <AntidotePB .ApbCreateDC > {
376+
377+
378+ @ Override
379+ public AntidotePB .ApbCreateDC handle (AntidotePB .ApbCreateDC op ) {
380+ return op ;
381+ }
382+ }
383+
384+ private MsgCreateDC (AntidotePB .ApbCreateDC op ) {
385+ this .op = op ;
386+ }
387+
388+ @ Override
389+ public <V > V accept (Handler <V > handler ) {
390+ return handler .handle (op );
391+ }
392+
393+ @ Override
394+ public AntidoteResponse .Handler <AntidotePB .ApbOperationResp > readResponseExtractor () {
395+ return new AntidoteResponse .MsgOperationResp .Extractor ();
396+ }
397+
398+ @ Override
399+ public String toString () {
400+ return "MsgCreateDC{" +
401+ "op=" + op +
402+ '}' ;
403+ }
404+ }
405+
406+ private static class MsgConnectToDCs extends AntidoteRequest <AntidotePB .ApbOperationResp > {
407+ private final AntidotePB .ApbConnectToDcs op ;
408+
409+ public static class Extractor implements Handler <AntidotePB .ApbConnectToDcs > {
410+
411+
412+ @ Override
413+ public AntidotePB .ApbConnectToDcs handle (AntidotePB .ApbConnectToDcs op ) {
414+ return op ;
415+ }
416+ }
417+
418+ private MsgConnectToDCs (AntidotePB .ApbConnectToDcs apbConnectToDcs ) {
419+ this .op = apbConnectToDcs ;
420+ }
421+
422+ @ Override
423+ public <V > V accept (Handler <V > handler ) {
424+ return handler .handle (op );
425+ }
426+
427+ @ Override
428+ public AntidoteResponse .Handler <AntidotePB .ApbOperationResp > readResponseExtractor () {
429+ return new AntidoteResponse .MsgOperationResp .Extractor ();
430+ }
431+ }
432+
433+ private static class MsgGetConnectionDescriptor extends AntidoteRequest <AntidotePB .ApbGetConnectionDescriptorResponse > {
434+ private final AntidotePB .ApbGetConnectionDescriptor op ;
435+
436+ public static class Extractor implements Handler <AntidotePB .ApbGetConnectionDescriptor > {
437+
438+
439+ @ Override
440+ public AntidotePB .ApbGetConnectionDescriptor handle (AntidotePB .ApbGetConnectionDescriptor op ) {
441+ return op ;
442+ }
443+ }
444+
445+ private MsgGetConnectionDescriptor (AntidotePB .ApbGetConnectionDescriptor op ) {
446+ this .op = op ;
447+ }
448+
449+ @ Override
450+ public <V > V accept (Handler <V > handler ) {
451+ return handler .handle (op );
452+ }
453+
454+ @ Override
455+ public AntidoteResponse .Handler <AntidotePB .ApbGetConnectionDescriptorResponse > readResponseExtractor () {
456+ return new AntidoteResponse .MsgGetConnectionDescriptorResponse .Extractor ();
457+ }
458+ }
347459}
0 commit comments