public class SystemService
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SystemService.Builder
A
SystemService builder which encapsulates common logic for building its dependencies. |
static class |
SystemService.EndpointNode |
| Modifier and Type | Field and Description |
|---|---|
static int |
DUPLICATE_SERVICE_REGISTER_COUNT |
static java.lang.String |
MIME_JSON |
| Constructor and Description |
|---|
SystemService(ApiConfigLoader configLoader,
java.lang.String appName,
ApiConfigWriter configWriter,
boolean isIllegalArgumentBackendError)
Constructs a
SystemService with no registered services. |
SystemService(ApiConfigLoader configLoader,
java.lang.String appName,
ApiConfigWriter configWriter,
java.lang.Object[] services,
boolean isIllegalArgumentBackendError)
Constructs a
SystemService and registers the provided services. |
| Modifier and Type | Method and Description |
|---|---|
static SystemService.Builder |
builder() |
java.lang.Object |
findService(java.lang.String name)
Finds a service object with the
name |
java.lang.reflect.Method |
findServiceMethod(java.lang.Object service,
java.lang.String methodName)
Finds a method object with the given
methodName on the service object. |
java.util.Map<ApiKey,java.lang.String> |
getApiConfigs()
Generates wire-format configuration for all loaded APIs.
|
com.google.common.collect.ImmutableList<SystemService.EndpointNode> |
getEndpoints() |
ApiSerializationConfig |
getSerializationConfig(java.lang.String serviceName)
Gets the serialization configuration for the API corresponding to the named service.
|
void |
invokeServiceMethod(java.lang.Object service,
java.lang.reflect.Method method,
ParamReader paramReader,
ResultWriter resultWriter)
Invokes a
method on a service given a paramReader to read parameters
and a resultWriter to write result. |
int |
registerService(java.lang.Class<?> serviceClass,
java.lang.Object service)
Registers a service class.
|
int |
registerService(java.lang.Object service) |
EndpointMethod |
resolveService(java.lang.String serviceName,
java.lang.String methodName)
Finds a service object with the
serviceName or null if not found. |
<T> SystemService.EndpointNode |
updateEndpointConfig(T endpoint,
ApiConfig newConfig,
SystemService.EndpointNode oldNode) |
public static final java.lang.String MIME_JSON
public static final int DUPLICATE_SERVICE_REGISTER_COUNT
public SystemService(ApiConfigLoader configLoader, java.lang.String appName, ApiConfigWriter configWriter, java.lang.Object[] services, boolean isIllegalArgumentBackendError) throws ApiConfigException
SystemService and registers the provided services.configLoader - The loader used to read annotation from service classesappName - The application's idservices - The service classes to be registeredApiConfigExceptionpublic SystemService(ApiConfigLoader configLoader, java.lang.String appName, ApiConfigWriter configWriter, boolean isIllegalArgumentBackendError) throws ApiConfigException
SystemService with no registered services.configLoader - The loader used to read annotation from service classesappName - The application's idApiConfigExceptionpublic int registerService(java.lang.Class<?> serviceClass,
java.lang.Object service)
throws ApiConfigException
serviceClass - is the class to start parsing endpointsservice - Service objectApiConfigExceptionpublic int registerService(java.lang.Object service)
throws ApiConfigException
ApiConfigExceptionpublic <T> SystemService.EndpointNode updateEndpointConfig(T endpoint, ApiConfig newConfig, @Nullable SystemService.EndpointNode oldNode)
public EndpointMethod resolveService(java.lang.String serviceName, java.lang.String methodName) throws ServiceException
serviceName or null if not found.serviceName - either a full class name or a simple name of a service objectmethodName - the method name of a service objectServiceException - when more than one service is mapped to the same name or
when the named service does not existpublic ApiSerializationConfig getSerializationConfig(java.lang.String serviceName)
public java.lang.Object findService(java.lang.String name)
throws ServiceException
nameServiceException - when more than one service is mapped to the same name or
when the named service does not existpublic java.lang.reflect.Method findServiceMethod(java.lang.Object service,
java.lang.String methodName)
throws ServiceException
methodName on the service object.ServiceException - if method does not existpublic void invokeServiceMethod(java.lang.Object service,
java.lang.reflect.Method method,
ParamReader paramReader,
ResultWriter resultWriter)
throws java.io.IOException
method on a service given a paramReader to read parameters
and a resultWriter to write result.java.io.IOExceptionpublic java.util.Map<ApiKey,java.lang.String> getApiConfigs() throws ApiConfigException
ApiKeys to wire-formatted configuration strings.ApiConfigExceptionpublic com.google.common.collect.ImmutableList<SystemService.EndpointNode> getEndpoints()
public static SystemService.Builder builder()