public interface MetadataProvider
MetadataProviderServer
instance.
Modifier and Type | Method and Description |
---|---|
int |
getAllowedBufferSize(String user,
String item)
Called by Lightstreamer Kernel through the Remote Server to ask
for the maximum size allowed for the buffer internally used to
enqueue subsequent ItemUpdates for the same Item.
|
double |
getAllowedMaxBandwidth(String user)
Called by Lightstreamer Kernel through the Remote Server to ask for the bandwidth level to be
allowed to a User for a push Session.
|
double |
getAllowedMaxItemFrequency(String user,
String item)
Called by Lightstreamer Kernel through the Remote Server to ask
for the ItemUpdate frequency to be allowed to a User for a
specific Item.
|
int |
getDistinctSnapshotLength(String item)
Called by Lightstreamer Kernel through the Remote Server to ask
for the maximum allowed length for a Snapshot of an Item that
has been requested with publishing Mode DISTINCT.
|
String[] |
getItems(String user,
String sessionID,
String group)
Called by Lightstreamer Kernel through the Remote Server to resolve an
Item Group name (or Item List specification) supplied in
a Request.
|
double |
getMinSourceFrequency(String item)
Called by Lightstreamer Kernel through the Remote Server to ask
for the minimum ItemEvent frequency from the Data Adapter at
which the events for an Item are guaranteed to be delivered to the Clients without loss of information.
|
String[] |
getSchema(String user,
String sessionID,
String group,
String schema)
Called by Lightstreamer Kernel through the Remote Server to resolve a Field
Schema name (or Field List specification) supplied in
a Request.
|
void |
init(Map<String,String> parameters,
String configFile)
Called by Lightstreamer Kernel through the Remote Server to provide initialization information
to the Metadata Adapter.
|
boolean |
isModeAllowed(String user,
String item,
Mode mode)
Called by Lightstreamer Kernel through the Remote Server to ask
for the allowance of a publishing Mode for an Item.
|
boolean |
modeMayBeAllowed(String item,
Mode mode)
Called by Lightstreamer Kernel through the Remote Server to ask
for the allowance of a publishing Mode for an Item (for at
least one User).
|
void |
notifyMpnDeviceAccess(String user,
String sessionID,
MpnDeviceInfo device)
Called by Lightstreamer Kernel through the Remote Server to check that a User is enabled to access
the specified MPN device.
|
void |
notifyMpnDeviceTokenChange(String user,
String sessionID,
MpnDeviceInfo device,
String newDeviceToken)
Called by Lightstreamer Kernel through the Remote Server to check that a User is enabled to change
the token of an MPN device.
|
void |
notifyMpnSubscriptionActivation(String user,
String sessionID,
TableInfo table,
MpnSubscriptionInfo mpnSubscription)
Called by Lightstreamer Kernel through the Remote Server to check that a User is enabled
to activate a Push Notification subscription.
|
void |
notifyNewSession(String user,
String sessionID,
Map<String,String> clientContext)
Called by Lightstreamer Kernel through the Remote Server to check
that a User is enabled to open a new push Session.
|
void |
notifyNewTables(String user,
String sessionID,
TableInfo[] tables)
Called by Lightstreamer Kernel through the Remote Server to check
that a User is enabled to add some Tables (i.e.
|
void |
notifySessionClose(String sessionID)
Called by Lightstreamer Kernel through the Remote Server to notify
the Metadata Adapter that a push Session has been closed.
|
void |
notifyTablesClose(String sessionID,
TableInfo[] tables)
Called by Lightstreamer Kernel through the Remote Server to notify
the Metadata Adapter that some Tables (i.e.
|
void |
notifyUser(String user,
String password,
Map<String,String> httpHeaders)
Called by Lightstreamer Kernel through the Remote Server
as a preliminary check that a user is
enabled to make Requests to the related Data Providers.
|
void |
notifyUser(String user,
String password,
Map<String,String> httpHeaders,
String clientPrincipal)
Called by Lightstreamer Kernel, through the Remote Server,
instead of calling the 3-arguments version, in case the Server
has been instructed to acquire the client principal from the client TLS/SSL
certificate through the <use_client_auth> configuration flag.
|
void |
notifyUserMessage(String user,
String sessionID,
String message)
Called by Lightstreamer Kernel through the Remote Server to forward
a message received by a User.
|
boolean |
wantsTablesNotification(String user)
Called by Lightstreamer Kernel through the Remote Server to know
whether the Metadata Adapter must or must not be notified any time a Table
(i.e.
|
void init(@Nonnull Map<String,String> parameters, @Nullable String configFile) throws MetadataProviderException
parameters
- A Map-type value object that contains name-value pairs
corresponding to the parameters elements supplied for the Metadata Adapter configuration.
Both names and values are represented as String objects. MetadataProviderServer.setAdapterParams(java.util.Map<java.lang.String, java.lang.String>)
method of the MetadataProviderServer instance.
More parameters can be added by leveraging the "init_remote" parameter
in the Proxy Adapter configuration.configFile
- The path on the local disk of the Metadata Adapter configuration file.
Can be null if not specified.
The file path can be supplied through the MetadataProviderServer.setAdapterConfig(java.lang.String)
method of the used MetadataProviderServer instance.MetadataProviderException
- in case an error occurs that prevents the correct behavior of the Metadata Adapter.void notifyUser(@Nullable String user, @Nullable String password, @Nonnull Map<String,String> httpHeaders) throws AccessException, CreditsException
user
- A User name.password
- A password optionally required to validate the User.httpHeaders
- A Map-type value object that contains a name-value
pair for each header found in the HTTP request that originated the call.
The header names are reported in lower-case form. AccessException
- if the User name is not known or the supplied
password is not correct.CreditsException
- if the User is known but is not enabled to
make further Requests at the moment.notifyUser(String, String, Map, String)
void notifyUser(@Nullable String user, @Nullable String password, @Nonnull Map<String,String> httpHeaders, @Nullable String clientPrincipal) throws AccessException, CreditsException
user
- A User name.password
- A password optionally required to validate the User.httpHeaders
- A Map-type value object that contains a name-value
pair for each header found in the HTTP request that originated the call.clientPrincipal
- the identification name reported in the client
TLS/SSL certificate supplied on the socket connection used to issue the
request that originated the call; it can be null if client has not
authenticated itself or the authentication has failed.AccessException
- if the User name is not known or the supplied
password is not correct.CreditsException
- if the User is known but is not enabled to
make further Requests at the moment.notifyUser(String, String, Map, String)
@Nonnull String[] getItems(@Nullable String user, @Nonnull String sessionID, @Nonnull String group) throws ItemsException
if (group.equals("portfolio")) {
String itemName = "PF_" + user;
return new String[] { itemName };
} else if (group.startsWith("PF_")) {
// protection from unauthorized use of user-specific items
throw new ItemsException("Unexpected group name");
}
Obviously, the two above techniques can be combined, hence any
element of an Item List can be replaced with a decorated or alternative
Item name: the related updates will be associated to the original name
used in the supplied Item List specification by client library code.
user
- A User name.sessionID
- The ID of a Session owned by the User.group
- An Item Group name (or Item List specification).ItemsException
- if the supplied Item Group name (or Item List specification) is not recognized.@Nonnull String[] getSchema(@Nullable String user, @Nonnull String sessionID, @Nonnull String group, @Nonnull String schema) throws ItemsException, SchemaException
user
- A User name.sessionID
- The ID of a Session owned by the User.group
- The name of the Item Group (or specification of the Item List)
whose Items the Schema is to be applied to.schema
- A Field Schema name (or Field List specification).ItemsException
- if the supplied Item Group name (or Item List specification) is not recognized.SchemaException
- if the supplied Field Schema name (or Field List specification) is not recognized.double getAllowedMaxBandwidth(@Nullable String user)
user
- A User name.double getAllowedMaxItemFrequency(@Nullable String user, @Nonnull String item)
user
- A User name.item
- An Item Name.int getAllowedBufferSize(@Nullable String user, @Nonnull String item)
user
- A User name.item
- An Item Name.boolean isModeAllowed(@Nullable String user, @Nonnull String item, @Nonnull Mode mode)
user
- A User name.item
- An Item Name.mode
- A publishing Mode.boolean modeMayBeAllowed(@Nonnull String item, @Nonnull Mode mode)
item
- An Item Name.mode
- A publishing Mode.double getMinSourceFrequency(@Nonnull String item)
item
- An Item Name.int getDistinctSnapshotLength(@Nonnull String item)
item
- An Item Name.void notifyUserMessage(@Nullable String user, @Nonnull String sessionID, @Nonnull String message) throws CreditsException, NotificationException
user
- A User name.sessionID
- The ID of a Session owned by the User.message
- A non-null string.CreditsException
- in case the User is not enabled to send
the message or the message cannot be correctly managed.NotificationException
- in case something is wrong in the
parameters, such as a nonexistent Session ID.void notifyNewSession(@Nullable String user, @Nonnull String sessionID, @Nonnull Map<String,String> clientContext) throws CreditsException, NotificationException
user
- A User name.sessionID
- The ID of a new Session.clientContext
- A value object that contains name-value
pairs with various information about the request context.
All values are supplied as strings. Information related to a client
connection refers to the HTTP request that originated the call.
Available keys are:
CreditsException
- in case the User is not enabled to open the new Session.
If it's possible that the User would be enabled as soon as
another Session were closed, then a ConflictingSessionException
can be thrown, in which the ID of the other Session must be
specified.
In this case, a second invocation of the method with the same
"REQUEST_ID" and a different Session ID will be received.NotificationException
- in case something is wrong in the parameters, such as the ID
of a Session already open for this or a different User.void notifySessionClose(@Nonnull String sessionID) throws NotificationException
sessionID
- A Session ID.NotificationException
- in case something is wrong in the parameters, such as the ID of a Session
that is not currently open.boolean wantsTablesNotification(@Nullable String user)
user
- A User name.void notifyNewTables(@Nullable String user, @Nonnull String sessionID, @Nonnull TableInfo[] tables) throws NotificationException, CreditsException
user
- A User name.sessionID
- The ID of a Session owned by the User.tables
- An array of TableInfo instances, each of them containing the details of a Table
(i.e. Subscription) to be added to the Session.
The elements in the array represent Tables (i.e.: Subscriptions) whose
subscription is requested atomically by the client. A single element
should be expected in the array, unless clients based on a very old
version of a client library or text protocol may be in use.CreditsException
- in case the User is not allowed to add the specified Tables (i.e. Subscriptions) to the Session.NotificationException
- in case something is wrong in the
parameters, such as the ID of a Session that is not currently open
or inconsistent information about a Table (i.e. Subscription).void notifyTablesClose(@Nonnull String sessionID, @Nonnull TableInfo[] tables) throws NotificationException
sessionID
- A Session ID.tables
- An array of TableInfo instances, each of them containing the details of a Table
(i.e. Subscription) that has been removed from the Session.
The supplied array is in 1:1 correspondance with the array supplied by
notifyNewTables in a previous call;
the correspondance can be recognized by matching the getWinIndex return value
of the included TableInfo objects (if multiple objects are included,
it must be the same for all of them).NotificationException
- in case something is wrong in the parameters, such as the ID of a Session
that is not currently open or a Table (i.e. Subscription) that is not contained in the Session.void notifyMpnDeviceAccess(@Nullable String user, @Nonnull String sessionID, @Nonnull MpnDeviceInfo device) throws CreditsException, NotificationException
user
- A User name.sessionID
- The ID of a Session owned by the User.device
- Specifies an MPN device.CreditsException
- if the User is not allowed to access the
specified MPN device in the Session.NotificationException
- if something is wrong in the parameters,
such as inconsistent information about the device.void notifyMpnSubscriptionActivation(@Nullable String user, @Nonnull String sessionID, @Nonnull TableInfo table, @Nonnull MpnSubscriptionInfo mpnSubscription) throws CreditsException, NotificationException
user
- A User name.sessionID
- The ID of a Session owned by the User. The session ID is
provided for a thorough validation of the Table information, but Push
Notification subscriptions are persistent and survive the session. Thus,
any association between this Session ID and this Push Notification
subscription should be considered temporary.table
- A TableInfo instance, containing the details of a Table
(i.e.: Subscription) for which Push Notification have to be activated.mpnSubscription
- An MpnSubscriptionInfo instance, containing the
details of a Push Notification to be activated.CreditsException
- if the User is not allowed to activate the
specified Push Notification in the Session.NotificationException
- if something is wrong in the parameters,
such as inconsistent information about a Table (i.e.: Subscription) or
a Push Notification.void notifyMpnDeviceTokenChange(@Nullable String user, @Nonnull String sessionID, @Nonnull MpnDeviceInfo device, @Nonnull String newDeviceToken) throws CreditsException, NotificationException
user
- A User name.sessionID
- The ID of a Session owned by the User.device
- Specifies an MPN device.newDeviceToken
- The new token being assigned to the device.CreditsException
- if the User is not allowed to change the
specified device token.NotificationException
- if something is wrong in the parameters,
such as inconsistent information about the device.Copyright © 2021. All rights reserved.