Class StatelessRemoteCall

  • Direct Known Subclasses:
    RemoteCall, StatelessRemoteCaller, StatelessRemoteRunner

    public class StatelessRemoteCall
    extends Object
    An implementation wrapper for stateless services. It runs on the server-side and applies the (optional) client version, application, and client IDs through its filters; it also handles logging and exception wrapping.
    Since:
    1.0.0
    Version:
    $Id: StatelessRemoteCall.java 17411 2017-04-28 14:50:38Z colin $
    Author:
    tlerios@marketcetera.com
    • Field Detail

      • DEFAULT_VERSION_FILTER

        public static final EqualsTagFilter DEFAULT_VERSION_FILTER
        The default version ID filter.
      • mVersionIdFilter

        private final TagFilter mVersionIdFilter
      • mAppIdFilter

        private final TagFilter mAppIdFilter
      • mClientIdFilter

        private final TagFilter mClientIdFilter
    • Constructor Detail

      • StatelessRemoteCall

        public StatelessRemoteCall​(TagFilter versionIdFilter,
                                   TagFilter appIdFilter,
                                   TagFilter clientIdFilter)
        Creates a new wrapper which applies the given filters to the client context.
        Parameters:
        versionIdFilter - The version ID filter, which may be null.
        appIdFilter - The application ID filter, which may be null.
        clientIdFilter - The client ID filter, which may be null.
      • StatelessRemoteCall

        public StatelessRemoteCall()
        Creates a new wrapper which applies a single filter to the client context. That filter ensures that the client's version ID is equal to the server's version ID.
    • Method Detail

      • getVersionIdFilter

        public TagFilter getVersionIdFilter()
        Returns the receiver's version ID filter.
        Returns:
        The filter, which may be null.
      • getAppIdFilter

        public TagFilter getAppIdFilter()
        Returns the receiver's application ID filter.
        Returns:
        The filter, which may be null.
      • getClientIdFilter

        public TagFilter getClientIdFilter()
        Returns the receiver's client ID filter.
        Returns:
        The filter, which may be null.
      • assertFilterMatch

        protected static void assertFilterMatch​(TagFilter filter,
                                                Tag tag)
                                         throws I18NException
        Asserts that the given filter matches the given tag.
        Parameters:
        filter - The filter, which may be null.
        tag - The tag, which may be null.
        Throws:
        I18NException - Thrown if there is a mismatch.
      • assertFilterMatch

        protected void assertFilterMatch​(StatelessClientContext context)
                                  throws I18NException
        Asserts that the given client context matches all of the receiver's filters.
        Parameters:
        context - The context.
        Throws:
        I18NException - Thrown if there is a mismatch.
      • startCall

        protected void startCall​(StatelessClientContext context)
        Called by subclasses before starting custom processing of a service call on behalf of the client with the given context.
        Parameters:
        context - The context.
      • handleSuccess

        protected void handleSuccess​(StatelessClientContext context)
        Called by subclasses after custom processing of a service call on behalf of the client with the given context completes successfully.
        Parameters:
        context - The context.
      • wrapFailure

        protected RemoteException wrapFailure​(StatelessClientContext context,
                                              Throwable t)
        Called by subclasses after custom processing of a service call on behalf of the client with the given context completes unsuccessfully. The failure is described by the given throwable.
        Parameters:
        context - The context.
        t - The throwable.