Show / Hide Table of Contents

Class MetadataProviderAdapter

Provides a default implementation of all the functionality of a Metadata Adapter which allow a simple default behavior. Overriding this class may facilitate the coding of simple Adapters.

Inheritance
object
MetadataProviderAdapter
LiteralBasedProvider
Implements
IMetadataProvider
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Lightstreamer.Interfaces.Metadata
Assembly: DotNetStandardAdapter.dll
Syntax
public abstract class MetadataProviderAdapter : IMetadataProvider

Methods

GetAllowedBufferSize(string, string)

Called by Lightstreamer Kernel through the Remote Server to ask for the maximum allowed size of the buffer internally used to enqueue subsequent ItemUpdates for the same Item. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual int GetAllowedBufferSize(string user, string item)
Parameters
Type Name Description
string user

Not used.

string item

Not used.

Returns
Type Description
int

Always zero, to mean no size limit.

GetAllowedMaxBandwidth(string)

Called by Lightstreamer Kernel through the Remote Server to ask for the bandwidth amount to be allowed to a User for a push Session. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual double GetAllowedMaxBandwidth(string user)
Parameters
Type Name Description
string user

Not used.

Returns
Type Description
double

Always zero, to mean no bandwidth limit.

GetAllowedMaxItemFrequency(string, string)

Called by Lightstreamer Kernel through the Remote Server to ask for the ItemUpdate frequency to be allowed to a User for a specific Item. In this default implementation, the Metadata Adapter poses no restriction; this also enables unfiltered dispatching for Items subscribed in MERGE or DISTINCT mode.

Declaration
public virtual double GetAllowedMaxItemFrequency(string user, string item)
Parameters
Type Name Description
string user

Not used.

string item

Not used.

Returns
Type Description
double

Always zero, to mean no frequency limit.

GetDistinctSnapshotLength(string)

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. In this default implementation, 0 events are specified, so snapshot will not be managed.

Declaration
public virtual int GetDistinctSnapshotLength(string item)
Parameters
Type Name Description
string item

Not used.

Returns
Type Description
int

A value of 0, to mean that no events will be kept in order to satisfy snapshot requests.

GetItems(string, string, string)

Called by Lightstreamer Kernel through the Remote Server to resolve an Item Group name (or Item List specification) supplied in a Request. The names of the Items in the Group must be returned. For instance, the client could be allowed to specify the "NASDAQ100" Group name and, upon that, the list of all items corresponding to the stocks included in that index could be returned.

Possibly, the content of an Item Group may be dependant on the User who is issuing the Request or on the specific Session instance.

When an Item List specification is supplied, it is made of a space-separated list of the names of the Items in the List. This convention is used by some of the subscription methods provided by the various client libraries. The specifications for these methods require that "A LiteralBasedProvider or equivalent Metadata Adapter is needed on the Server in order to understand the Request". When any of these interface methods is used by client code accessing this Metadata Adapter, the supplied "group" argument should be inspected as a space-separated list of Item names and an array with these names in the same order should be returned.

Another typical case is when the same Item has different contents depending on the User that is issuing the request. On the Data Adapter side, different Items (one for each User) can be used; nevertheless, on the client side, the same name can be specified in the subscription request and the actual user-related name can be determined and returned here. For instance:

 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 Item List specification by client library code.

This method runs in the Server thread pool specific for the Data Adapter that supplies the involved Items, if defined.

Declaration
public abstract string[] GetItems(string user, string sessionID, string id)
Parameters
Type Name Description
string user

A User name.

string sessionID

The ID of a Session owned by the User.

string id
Returns
Type Description
string[]

An array with the names of the Items in the Group.

Exceptions
Type Condition
ItemsException

in case the supplied Item Group name (or Item List specification) is not recognized.

GetMinSourceFrequency(string)

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. In this default implementation, the Metadata Adapter can't set any minimum frequency; this also enables unfiltered dispatching for Items subscribed in MERGE or DISTINCT mode.

Declaration
public virtual double GetMinSourceFrequency(string item)
Parameters
Type Name Description
string item

Not used.

Returns
Type Description
double

Always zero, to mean that incoming ItemEvents must not be prefiltered.

GetSchema(string, string, string, string)

Called by Lightstreamer Kernel through the Remote Server to resolve a Field Schema name (or Field List specification) supplied in a Request. The names of the Fields in the Schema must be returned.

Possibly, the content of a Field Schema may be dependant on the User who is issuing the Request, on the specific Session instance or on the Item Group (or Item List) to which the Request is related.

When a A Field List specification is supplied, it is made of a space-separated list of the names of the Fields in the Schema. This convention is used by some of the subscription methods provided by the various client libraries. The specifications for these methods require that "A LiteralBasedProvider or equivalent Metadata Adapter is needed on the Server in order to understand the Request". When any of these interface methods is used by client code accessing this Metadata Adapter, the supplied "schema" argument should be inspected as a space-separated list of Field names and an array with these names in the same order should be returned; returning decorated or alternative Field names is also possible: they will be associated to the corresponding names used in the supplied Field List specification by client library code.

This method runs in the Server thread pool specific for the Data Adapter that supplies the involved Items, if defined.

Declaration
public abstract string[] GetSchema(string user, string sessionID, string id, string schema)
Parameters
Type Name Description
string user

A User name.

string sessionID

The ID of a Session owned by the User.

string id

The name of the Item Group (or specification of the Item List) whose Items the Schema is to be applied to.

string schema

A Field Schema name (or Field List specification).

Returns
Type Description
string[]

An array with the names of the Fields in the Schema.

Exceptions
Type Condition
ItemsException

in case the supplied Item Group name (or Item List specification) is not recognized.

SchemaException

in case the supplied Field Schema name (or Field List specification) is not recognized.

Init(IDictionary, string)

No-op initialization.

Declaration
public virtual void Init(IDictionary parameters, string configFile)
Parameters
Type Name Description
IDictionary parameters

Not used.

string configFile

Not used.

Exceptions
Type Condition
MetadataProviderException

never thrown in this case.

IsModeAllowed(string, string, Mode)

Called by Lightstreamer Kernel through the Remote Server to ask for the allowance of a publishing Mode for an Item. A publishing Mode can or cannot be allowed depending on the User. In this default implementation, the Metadata Adapter poses no restriction. As a consequence, conflicting Modes may be both allowed for the same Item, so the Clients should ensure that the same Item cannot be requested in two conflicting Modes.

Declaration
public virtual bool IsModeAllowed(string user, string item, Mode mode)
Parameters
Type Name Description
string user

Not used.

string item

Not used.

Mode mode

Not used.

Returns
Type Description
bool

Always true.

ModeMayBeAllowed(string, 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). In this default implementation, the Metadata Adapter poses no restriction. As a consequence, conflicting Modes may be both allowed for the same Item, so the Clients should ensure that the same Item cannot be requested in two conflicting Modes.

Declaration
public virtual bool ModeMayBeAllowed(string item, Mode mode)
Parameters
Type Name Description
string item

Not used.

Mode mode

Not used.

Returns
Type Description
bool

Always true.

NotifyMpnDeviceAccess(string, string, MpnDeviceInfo)

Called by Lightstreamer Kernel to check that a User is enabled to access the specified MPN device. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual void NotifyMpnDeviceAccess(string user, string sessionID, MpnDeviceInfo device)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

MpnDeviceInfo device

Not used.

Exceptions
Type Condition
CreditsException

never thrown in this case.

NotificationException

never thrown in this case.

NotifyMpnDeviceTokenChange(string, string, MpnDeviceInfo, string)

Called by Lightstreamer Kernel to check that a User is enabled to change the token of a MPN device. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual void NotifyMpnDeviceTokenChange(string user, string sessionID, MpnDeviceInfo device, string newDeviceToken)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

MpnDeviceInfo device

Not used.

string newDeviceToken

Not used.

Exceptions
Type Condition
CreditsException

never thrown in this case.

NotificationException

never thrown in this case.

NotifyMpnSubscriptionActivation(string, string, TableInfo, MpnSubscriptionInfo)

Called by Lightstreamer Kernel to check that a User is enabled to activate a Push Notification subscription. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual void NotifyMpnSubscriptionActivation(string user, string sessionID, TableInfo table, MpnSubscriptionInfo mpnSubscription)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

TableInfo table

Not used.

MpnSubscriptionInfo mpnSubscription

Not used.

Exceptions
Type Condition
CreditsException

never thrown in this case.

NotificationException

never thrown in this case.

NotifyNewSession(string, string, IDictionary)

Called by Lightstreamer Kernel through the Remote Server to check that a User is enabled to open a new push Session. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual void NotifyNewSession(string user, string sessionID, IDictionary clientContext)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

IDictionary clientContext

Not used.

Exceptions
Type Condition
CreditsException

never thrown in this case.

NotificationException

never thrown in this case.

NotifyNewTables(string, string, TableInfo[])

Called by Lightstreamer Kernel through the Remote Server to check that a User is enabled to add some Tables (i.e. Subscriptions) to a push Session. In this default implementation, the Metadata Adapter poses no restriction. Unless the WantsTablesNotification method is overridden, this method will never be called by Lightstreamer Kernel.

Declaration
public virtual void NotifyNewTables(string user, string sessionID, TableInfo[] tables)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

TableInfo[] tables

Not used.

Exceptions
Type Condition
CreditsException

never thrown in this case.

NotificationException

never thrown in this case.

NotifySessionClose(string)

Called by Lightstreamer Kernel through the Remote Server to notify the Metadata Adapter that a push Session has been closed. In this default implementation, the Metadata Adapter does nothing, because it doesn't need to remember the open Sessions.

Declaration
public virtual void NotifySessionClose(string sessionID)
Parameters
Type Name Description
string sessionID

Not used.

Exceptions
Type Condition
NotificationException

never thrown in this case.

NotifyTablesClose(string, TableInfo[])

Called by Lightstreamer Kernel through the Remote Server to notify the Metadata Adapter that some Tables (i.e. Subscriptions) have been removed from a push Session. In this default implementation, the Metadata Adapter does nothing, because it doesn't need to remember the Tables used. Unless the WantsTablesNotification method is overridden, this method will never be called by Lightstreamer Kernel.

Declaration
public virtual void NotifyTablesClose(string sessionID, TableInfo[] tables)
Parameters
Type Name Description
string sessionID

Not used.

TableInfo[] tables

Not used.

Exceptions
Type Condition
NotificationException

never thrown in this case.

NotifyUser(string, string)

2-arguments version of the User authentication method. In case the 3-arguments version of the method is not overridden, this version of the method is invoked. In this default implementation, the Metadata Adapter poses no restriction.

Declaration
public virtual void NotifyUser(string user, string password)
Parameters
Type Name Description
string user

Not used.

string password

Not used.

Exceptions
Type Condition
AccessException

never thrown in this case.

CreditsException

never thrown in this case.

NotifyUser(string, string, IDictionary)

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. In this default implementation, a simpler 2-arguments version of the method is invoked, where the httpHeaders argument is discarded. Note that, for authentication purposes, only the user and password arguments should be consulted.

Declaration
public virtual void NotifyUser(string user, string password, IDictionary httpHeaders)
Parameters
Type Name Description
string user

A User name.

string password

A password optionally required to validate the User.

IDictionary httpHeaders

An IDictionary-type value object that contains a name-value pair for each header found in the HTTP request that originated the call. Not used.

Exceptions
Type Condition
AccessException

never thrown in this case.

CreditsException

never thrown in this case.

NotifyUser(string, string, IDictionary, string)

Extended version of the User authentication method, called by Lightstreamer Kernel, through the Remote Server, in case the Server has been instructed (through the <use_client_auth> configuration flag) to acquire the client principal from the client TLS/SSL certificate, if available.

In this default implementation, the base 3-arguments version of the method is invoked, where the clientPrincipal argument is discarded. This also ensures backward compatibility with old adapter classes derived from this one.

Declaration
public virtual void NotifyUser(string user, string password, IDictionary httpHeaders, string clientPrincipal)
Parameters
Type Name Description
string user

A User name.

string password

A password optionally required to validate the User.

IDictionary httpHeaders

An IDictionary-type value object that contains a name-value pair for each header found in the HTTP request that originated the call. Not used.

string 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. Not used.

Exceptions
Type Condition
AccessException

never thrown in this case.

CreditsException

never thrown in this case.

NotifyUserMessage(string, string, string)

Called by Lightstreamer Kernel through the Remote Server to forward a message received by a User. In this default implementation, the Metadata Adapter does never accept the message.

Declaration
public virtual void NotifyUserMessage(string user, string sessionID, string message)
Parameters
Type Name Description
string user

Not used.

string sessionID

Not used.

string message

Not used.

Exceptions
Type Condition
CreditsException

always thrown in this case.

NotificationException

never thrown in this case.

WantsTablesNotification(string)

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. Subscription) is added or removed from a push Session owned by a supplied User. In this default implementation, the Metadata Adapter doesn't require such notifications.

Declaration
public virtual bool WantsTablesNotification(string user)
Parameters
Type Name Description
string user

Not used.

Returns
Type Description
bool

Always false, to prevent being notified with notifyNewTables and notifyTablesClose.

Implements

IMetadataProvider
In this article
Back to top Copyright (c) 2004-2023 Lightstreamer s.r.l.