public class MockServiceFactory extends Object implements ServiceFactory
Constructor and Description |
---|
MockServiceFactory() |
Modifier and Type | Method and Description |
---|---|
<T> T |
getService(Class<T> clazz)
|
<T> T |
getService(Class<T> clazz,
long timeout)
|
<T> T |
getService(Class<T> clazz,
Map<String,String> attributes,
long timeout)
Returns an implementation of the desired service API.
|
<T> T |
getService(Class<T> clazz,
String nodeName)
|
<T> T |
getService(Class<T> clazz,
String nodeName,
long timeout)
Returns an implementation of the desired service API.
|
TestInfo |
getTestInfo()
Get the test information that this MockServiceFactory is working with.
|
static void |
reset() |
public static void reset()
public <T> T getService(Class<T> clazz) throws AttivioException
ServiceFactory
ServiceFactory.getService(Class, String, long)
. Node will default to null
and timeout will be -1L
.getService
in interface ServiceFactory
AttivioException
public <T> T getService(Class<T> clazz, long timeout) throws AttivioException
ServiceFactory
ServiceFactory.getService(Class, String, long)
. Node will default to null
.getService
in interface ServiceFactory
AttivioException
public <T> T getService(Class<T> clazz, String nodeName) throws AttivioException
ServiceFactory
ServiceFactory.getService(Class, String, long)
. Timeout will default to -1L
.getService
in interface ServiceFactory
AttivioException
public <T> T getService(Class<T> clazz, String nodeName, long timeout) throws AttivioException
ServiceFactory
Returns an implementation of the desired service API.
Services come in two flavors. Some services are registered by a service provider and provide services through remote client implementations. Other services are built on an external platform such as a database. The latter are referred to as client-base services since from the AIE point of view, only a client is required. In either case, this method returns a (generally proxied) implementation that provides the service API.
The timeout parameter is applicable only to registered services. This is because client-based services are provided externally and the ServiceFactory has no way of knowing if those services are up or not. For registered services, the timeout applies to the time for that service to be registered with the system. This lets callers wait a bit (say during a startup situation) for the service to come online but not wait indefinitely.
When the timeout is in use, the service will be checked for registration every 100ms. A timeout < 0 will wait indefinitely. Regardless of the timeout, the availability of the service will always be tried at least once. That is, a low timeout or timeout of 0 will still succeed if the service is registered or is provided by a client-based API.
getService
in interface ServiceFactory
clazz
- the class type of the desired APInodeName
- name of the AIE node the service must be running on, or null
if any node is fine.timeout
- timeout in msnull
if unavailable within the timeout.AttivioException
public <T> T getService(Class<T> clazz, Map<String,String> attributes, long timeout) throws AttivioException
Returns an implementation of the desired service API.
Services come in two flavors. Some services are registered by a service provider and provide services through remote client implementations. Other services are built on an external platform such as a database. The latter are referred to as client-base services since from the AIE point of view, only a client is required. In either case, this method returns a (generally proxied) implementation that provides the service API.
The timeout parameter is applicable only to registered services. This is because client-based services are provided externally and the ServiceFactory has no way of knowing if those services are up or not. For registered services, the timeout applies to the time for that service to be registered with the system. This lets callers wait a bit (say during a startup situation) for the service to come online but not wait indefinitely.
When the timeout is in use, the service will be checked for registration every 100ms. A timeout < 0 will wait indefinitely. Regardless of the timeout, the availability of the service will always be tried at least once. That is, a low timeout or timeout of 0 will still succeed if the service is registered or is provided by a client-based API.
getService
in interface ServiceFactory
clazz
- the class type of the desired APIattributes
- map of attributes that must match the service, or null
or an empty map if any instance is fine. To
match by node name, use a key value of nodeName
and the the node name as the value.timeout
- timeout in msnull
if matching service unavailable within the timeout.AttivioException
public TestInfo getTestInfo()
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.