public class LocalProvider extends Object implements ApiProvider, SyncApiIntrospection
LocalProvider
class is a local (in-process) implementation
of the ApiProvider
interface.
Thread-safety: This class is thread-safe.
Modifier and Type | Field and Description |
---|---|
static String |
LOCAL_PROVIDER_DEFAULT_NAME |
Constructor and Description |
---|
LocalProvider(String name)
Calls
LocalProvider(String, List) with an empty list of
ApiInterface s, automatically deploying introspection
services. |
LocalProvider(String name,
List<ApiInterface> ifaces)
Calls
LocalProvider(String, List, boolean)
automatically deploying introspection services. |
LocalProvider(String name,
List<ApiInterface> ifaces,
boolean deployIntrospectionServices)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addInterface(ApiInterface iface)
Adds the specified API interface to the provider.
|
void |
addInterfaces(List<ApiInterface> ifaces)
Adds a list of API interface to the provider.
|
ProviderDefinition |
getDefinition(ExecutionContext ctx)
Returns the definition for this API provider.
|
InterfaceDefinition |
getInterface(ExecutionContext ctx,
InterfaceIdentifier iface)
Returns interface definition for a given interface identifier.
|
Set<InterfaceIdentifier> |
getInterfaceIdentifiers(ExecutionContext ctx)
Returns the set of interface identifiers supported by this provider.
|
MethodDefinition |
getMethod(ExecutionContext ctx,
MethodIdentifier methodId)
Returns method definitions for a given method identifier.
|
void |
invoke(String serviceId,
String operationId,
DataValue input,
ExecutionContext ctx,
AsyncHandle<MethodResult> asyncHandle)
Invokes the specified operation using the provided input and
execution context.
|
public static final String LOCAL_PROVIDER_DEFAULT_NAME
public LocalProvider(String name)
LocalProvider(String, List)
with an empty list of
ApiInterface
s, automatically deploying introspection
services.public LocalProvider(String name, List<ApiInterface> ifaces)
LocalProvider(String, List, boolean)
automatically deploying introspection services.public LocalProvider(String name, List<ApiInterface> ifaces, boolean deployIntrospectionServices)
invoke(String, String, DataValue, ExecutionContext, AsyncHandle)
.name
- name of the providerifaces
- list of ApiInterface
s to register
with this providerdeployIntrospectionServices
- whether to automatically deploy
introspection servicespublic void addInterface(ApiInterface iface)
iface
- API interface to add; must not be null
IllegalArgumentException
- if API interface with the same ID as
iface
is already registeredpublic void addInterfaces(List<ApiInterface> ifaces)
ifaces
- list of ApiInterface
s to register
with this provider; must not be null
IllegalArgumentException
- if an API interface with the same ID as some
iface
is already registeredpublic ProviderDefinition getDefinition(ExecutionContext ctx)
SyncApiIntrospection
getDefinition
in interface SyncApiIntrospection
ctx
- execution context for the invocationpublic Set<InterfaceIdentifier> getInterfaceIdentifiers(ExecutionContext ctx)
SyncApiIntrospection
getInterfaceIdentifiers
in interface SyncApiIntrospection
ctx
- execution context for the invocationpublic InterfaceDefinition getInterface(ExecutionContext ctx, InterfaceIdentifier iface)
SyncApiIntrospection
getInterface
in interface SyncApiIntrospection
ctx
- execution context for the invocationiface
- interface identifierpublic MethodDefinition getMethod(ExecutionContext ctx, MethodIdentifier methodId)
SyncApiIntrospection
null
if no such method is availablegetMethod
in interface SyncApiIntrospection
ctx
- execution context for the invocationmethodId
- method identifierMethodDefinition
instance or null
is not found for the specified identifierpublic void invoke(String serviceId, String operationId, DataValue input, ExecutionContext ctx, AsyncHandle<MethodResult> asyncHandle)
ApiProvider
Target method is identified by serviceId
and
operationId
.
invoke
in interface ApiProvider
serviceId
- identifier of the target serviceoperationId
- identifier of the target operationinput
- operation input parametersctx
- execution context for the invocationasyncHandle
- handle used to asynchronously "return" the result
or error of the invocationCopyright © 2015. All Rights Reserved.