Class JeeJoynrServiceLocator

  • All Implemented Interfaces:
    ServiceLocator

    public class JeeJoynrServiceLocator
    extends Object
    implements ServiceLocator
    JEE integration joynr service locator which uses a joynr proxy to provide an implementation for a service interface. The service interface is mapped to its joynr proxy, by expecting a UsedBy annotation is attached in the class hierarchy of the service interface. With this annotation, the proxy is found by the JeeJoynrServiceLocator.

    This class provides some helper methods for common use cases for obtaining a service proxy in the form of the various get methods. In order to have access to all features of the joynr proxy builder, such as specifying the stateless async use case or getting a CompletableFuture for the service proxy, use the ServiceLocator.ServiceProxyBuilder which can be obtained by calling builder(Class, String...) instead.

    Note that unless you use ServiceLocator.ServiceProxyBuilder.useFuture(), then the service proxy returned might not initially be connected to the desired provider while arbitration is ongoing. Any calls you make the service proxy in this state will be queued until such a time as the provider becomes available. If you want more fine-grained control over how to handle the provider not being available, becoming available or the arbitration failing, then call the useFuture() method before calling the build() method and add the relevant listeners to the resulting completable future.

    • Constructor Detail

      • JeeJoynrServiceLocator

        @Inject
        public JeeJoynrServiceLocator​(JoynrIntegrationBean joynrIntegrationBean)
    • Method Detail

      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         String domain)
        Deprecated.
        Description copied from interface: ServiceLocator
        Obtains a client proxy for the given service interface in the given domain. Calls ServiceLocator.get(Class, String, MessagingQos, DiscoveryQos) with default values for messaging and discovery quality of service.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the service interface for which to get a client proxy.
        domain - the domain in which the service implementation must be available.
        Returns:
        the client proxy, which can be used to call methods on the service service.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         String domain,
                         long ttl)
        Deprecated.
        Description copied from interface: ServiceLocator
        Like ServiceLocator.get(Class, String), but allows you to specify the maximum time-to-live for messages sent to the service. Calls ServiceLocator.get(Class, String, MessagingQos, DiscoveryQos), setting the TTL passed in on the messaging quality of service and providing default values for the discovery quality of service.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the service interface for which to get a client proxy.
        domain - the domain in which the service implementation must be available.
        ttl - the maximum time to live for messages sent via the service. If the time to live expires (the message takes longer to deliver), then an exception is thrown.
        Returns:
        the client proxy, which can be used to call methods on the service interface.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         Set<String> domains)
        Deprecated.
        Description copied from interface: ServiceLocator
        Obtains a client proxy for multiple services of the given service interface in the given domains. Calls ServiceLocator.get(Class, Set, MessagingQos, DiscoveryQos) with default values for messaging and discovery quality of service.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the BCI interface for which to get a client proxy.
        domains - the set of domains in which the service implementations must be available.
        Returns:
        the client proxy, which can be used to call methods on the BCI service.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         Set<String> domains,
                         long ttl)
        Deprecated.
        Description copied from interface: ServiceLocator
        Like ServiceLocator.get(Class, Set), but allows you to specify the maximum time-to-live for messages sent to the services. Calls ServiceLocator.get(Class, Set, MessagingQos, DiscoveryQos), setting the TTL passed in on the messaging quality of service and providing default values for the discovery quality of service.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the BCI interface for which to get a client proxy.
        domains - the set of domains in which the service implementations must be available.
        ttl - the maximum time to live for messages sent via the service. If the time to live expires (the message takes longer to deliver), then an exception is thrown.
        Returns:
        the client proxy, which can be used to call methods on the BCI service.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         String domain,
                         MessagingQos messagingQos,
                         DiscoveryQos discoveryQos)
        Deprecated.
        Description copied from interface: ServiceLocator
        Like ServiceLocator.get(Class, String), but allows you to specify the messaging and discovery quality of service information to use.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the service interface for which to get a client proxy.
        domain - the domain in which the service implementation must be available.
        messagingQos - the messaging quality of service information (including the time to live value) to use when communicating to the service.
        discoveryQos - the discovery quality of service information to use when communicating to the service.
        Returns:
        the client proxy, which can be used to call methods on the service service.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         Set<String> domains,
                         MessagingQos messagingQos,
                         DiscoveryQos discoveryQos)
        Deprecated.
        Description copied from interface: ServiceLocator
        Like ServiceLocator.get(Class, Set), but allows you to specify the messaging and discovery quality of service information to use.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the BCI interface for which to get a client proxy.
        domains - the set of domains in which the service implementations must be available.
        messagingQos - the messaging quality of service information (including the time to live value) to use when communicating to the service.
        discoveryQos - the discovery quality of service information to use when communicating to the service.
        Returns:
        the client proxy, which can be used to call methods on the BCI service.
      • get

        @Deprecated
        public <I> I get​(Class<I> serviceInterface,
                         Set<String> domains,
                         MessagingQos messagingQos,
                         DiscoveryQos discoveryQos,
                         String useCase)
        Deprecated.
        Description copied from interface: ServiceLocator
        Like ServiceLocator.get(Class, Set), but allows you to specify the messaging and discovery quality of service information to use, as well as the stateless async use case in order to identify the CallbackHandler bean to use for processing stateless async replies received for requests made from this proxy.
        Specified by:
        get in interface ServiceLocator
        Type Parameters:
        I - the service type
        Parameters:
        serviceInterface - the BCI interface for which to get a client proxy.
        domains - the set of domains in which the service implementations must be available.
        messagingQos - the messaging quality of service information (including the time to live value) to use when communicating to the service.
        discoveryQos - the discovery quality of service information to use when communicating to the service.
        useCase - the name of the use case for identifying the relevant CallbackHandler bean to use for processing stateless async replies received for requests made from this proxy.
        Returns:
        the client proxy, which can be used to call methods on the BCI service.
      • builder

        public <I> ServiceLocator.ServiceProxyBuilder<I> builder​(Class<I> serviceInterface,
                                                                 String... domains)
        Description copied from interface: ServiceLocator
        Create a ServiceLocator.ServiceProxyBuilder for the given service interface and domains.
        Specified by:
        builder in interface ServiceLocator
        Type Parameters:
        I - the type of the service interface for which a service proxy builder should be created.
        Parameters:
        serviceInterface - the service interface for which to create the service proxy builder.
        domains - the list of domains which the proxy will use for looking up the services to communicate with. At least one domain must be provided.
        Returns:
        the ServiceLocator.ServiceProxyBuilder which can be used to setup the configuration with which to build the service proxy.
      • getGuidedProxyBuilder

        public GuidedProxyBuilder getGuidedProxyBuilder​(Class<?> interfaceClass,
                                                        Set<String> domains)
        Description copied from interface: ServiceLocator
        Returns a guided proxy builder instance to build a proxy object for a selected provider in a given set of domains.
        Specified by:
        getGuidedProxyBuilder in interface ServiceLocator
        Parameters:
        interfaceClass - Interface the provider offers.
        domains - the set of domains to be considered when searching the providers.
        Returns:
        After configuration, the returned GuidedProxyBuilder can be used to discover providers and build a proxy instance for the selected provider.