
org.yamcs.protobuf.AbstractServicesApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yamcs-api Show documentation
Show all versions of yamcs-api Show documentation
Used by external clients to communicate with Yamcs
package org.yamcs.protobuf;
import com.google.protobuf.Descriptors.MethodDescriptor;
import com.google.protobuf.Descriptors.ServiceDescriptor;
import com.google.protobuf.Empty;
import com.google.protobuf.Message;
import org.yamcs.api.Api;
import org.yamcs.api.Observer;
@javax.annotation.processing.Generated(value = "org.yamcs.maven.ServiceGenerator", date = "2025-02-13T11:12:59.907458251Z")
@SuppressWarnings("unchecked")
public abstract class AbstractServicesApi implements Api {
/**
*
* List services
*
*/
public abstract void listServices(T ctx, ListServicesRequest request, Observer observer);
/**
*
* Get a service
*
*/
public abstract void getService(T ctx, GetServiceRequest request, Observer observer);
/**
*
* Start a service
*
*/
public abstract void startService(T ctx, StartServiceRequest request, Observer observer);
/**
*
* Stop a service
*
* Once stopped, a service cannot be resumed. Instead a new service
* instance will be created and started.
*
*/
public abstract void stopService(T ctx, StopServiceRequest request, Observer observer);
@Override
public final ServiceDescriptor getDescriptorForType() {
return ServicesServiceProto.getDescriptor().getServices().get(0);
}
@Override
public final Message getRequestPrototype(MethodDescriptor method) {
if (method.getService() != getDescriptorForType()) {
throw new IllegalArgumentException("Method not contained by this service.");
}
switch (method.getIndex()) {
case 0:
return ListServicesRequest.getDefaultInstance();
case 1:
return GetServiceRequest.getDefaultInstance();
case 2:
return StartServiceRequest.getDefaultInstance();
case 3:
return StopServiceRequest.getDefaultInstance();
default:
throw new IllegalStateException();
}
}
@Override
public final Message getResponsePrototype(MethodDescriptor method) {
if (method.getService() != getDescriptorForType()) {
throw new IllegalArgumentException("Method not contained by this service.");
}
switch (method.getIndex()) {
case 0:
return ListServicesResponse.getDefaultInstance();
case 1:
return ServiceInfo.getDefaultInstance();
case 2:
return Empty.getDefaultInstance();
case 3:
return Empty.getDefaultInstance();
default:
throw new IllegalStateException();
}
}
@Override
public final void callMethod(MethodDescriptor method, T ctx, Message request, Observer future) {
if (method.getService() != getDescriptorForType()) {
throw new IllegalArgumentException("Method not contained by this service.");
}
switch (method.getIndex()) {
case 0:
listServices(ctx, (ListServicesRequest) request, (Observer)(Object) future);
return;
case 1:
getService(ctx, (GetServiceRequest) request, (Observer)(Object) future);
return;
case 2:
startService(ctx, (StartServiceRequest) request, (Observer)(Object) future);
return;
case 3:
stopService(ctx, (StopServiceRequest) request, (Observer)(Object) future);
return;
default:
throw new IllegalStateException();
}
}
@Override
public final Observer callMethod(MethodDescriptor method, T ctx, Observer future) {
if (method.getService() != getDescriptorForType()) {
throw new IllegalArgumentException("Method not contained by this service.");
}
switch (method.getIndex()) {
default:
throw new IllegalStateException();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy