Class EventStreamRPCServiceModel

  • Direct Known Subclasses:
    GreengrassCoreIPCServiceModel

    public abstract class EventStreamRPCServiceModel
    extends Object
    Implementers of this service model are expected to likely be singletons. There should be little value to having more than one, though between different instances properly constructed for a service, they can be used interchangeably
    • Field Detail

      • CONTENT_TYPE_APPLICATION_TEXT

        public static final String CONTENT_TYPE_APPLICATION_TEXT
        Content type application text string
        See Also:
        Constant Field Values
      • CONTENT_TYPE_APPLICATION_JSON

        public static final String CONTENT_TYPE_APPLICATION_JSON
        Content type application json string
        See Also:
        Constant Field Values
      • SERVICE_MODEL_TYPE_HEADER

        public static final String SERVICE_MODEL_TYPE_HEADER
        Service model type header
        See Also:
        Constant Field Values
    • Constructor Detail

      • EventStreamRPCServiceModel

        public EventStreamRPCServiceModel()
    • Method Detail

      • blobTypeEquals

        public static boolean blobTypeEquals​(Optional<byte[]> lhs,
                                             Optional<byte[]> rhs)
        Used to compare two members of a blob shape for equality. Array equals nesting inside of an Optional doesn't work Note: Generated code for equals method of Smithy shapes relies on this
        Parameters:
        lhs - The first to compare
        rhs - The second to compare
        Returns:
        True if both are equal, false otherwise
      • getServiceName

        public abstract String getServiceName()
        For getting the actual service name
        Returns:
        The name of the service as a string
      • getApplicationModelClass

        public final Optional<Class<? extends EventStreamJsonMessage>> getApplicationModelClass​(String applicationModelType)
        Returns the application model class
        Parameters:
        applicationModelType - The application model
        Returns:
        The class of the given application model
      • getAllOperations

        public abstract Collection<String> getAllOperations()
        Retreives all operations on the service
        Returns:
        All operations on the service
      • getOperationModelContext

        public abstract OperationModelContext getOperationModelContext​(String operationName)
        Retrieves the operation model context for a given operation name on the service This may not be a useful interface as generated code will typically pull a known operation model context Public visibility is useful for testing
        Parameters:
        operationName - The name of the operation
        Returns:
        The operation context associated with the given operation name
      • toJsonString

        public String toJsonString​(EventStreamJsonMessage message)
        Converts the given EventStreamJsonMessage to a JSON string
        Parameters:
        message - The message to convert
        Returns:
        A JSON string
      • getStaticGson

        public static com.google.gson.Gson getStaticGson()
        In situations where the framework needs to do some JSON processing without a specific service/operation in context
        Returns:
        the static Gson instance capable of processing the basics of EventStreamableJsonMessage
      • fromJson

        public EventStreamJsonMessage fromJson​(String applicationModelType,
                                               byte[] payload)
        Creates a EventStreamJsonMessage from the given application model type string and payload. Uses this service's specific model class to create the EventStreamJsonMessage.
        Parameters:
        applicationModelType - The application model type string
        payload - The payload
        Returns:
        A EventStreamMessage
      • fromJson

        public <T extends EventStreamJsonMessage> T fromJson​(Class<T> clazz,
                                                             byte[] payload)
        Creates a EventStreamJsonMessage of type T from the given application model class and payload.
        Type Parameters:
        T - The type to convert the result to
        Parameters:
        clazz - The class
        payload - The payload
        Returns:
        A EventStreamMessage of type T