Show / Hide Table of Contents

Class LiteralBasedProvider

Simple full implementation of a Metadata Adapter, made available in Lightstreamer SDK.

The class handles Item List specifications, a special case of Item Group name formed by simply concatenating the names of the Items contained in a List in a space separated way. Similarly, the class handles Field List specifications, a special case of Field Schema name formed by concatenating the names of the contained Fields.

The resource levels are assigned the same for all Items and Users, according with values that can be supplied together with adapter configuration.

The return of the GetAllowedMaxBandwidth method can be supplied in a "max_bandwidth" parameter; the return of the GetAllowedMaxItemFrequency method can be supplied in a "max_frequency" parameter; the return of the GetAllowedBufferSize method can be supplied in a "buffer_size" parameter; the return of the GetDistinctSnapshotLength method can be supplied in a "distinct_snapshot_length" tag. All resource limits not supplied are granted as unlimited but for distinct_snapshot_length, which defaults as 10.

There are no access restrictions, but an optional User name check is performed if a comma separated list of User names is supplied in an "allowed_users" parameter.

Inheritance
object
MetadataProviderAdapter
LiteralBasedProvider
Implements
IMetadataProvider
Inherited Members
MetadataProviderAdapter.NotifyUser(string, string, IDictionary, string)
MetadataProviderAdapter.IsModeAllowed(string, string, Mode)
MetadataProviderAdapter.ModeMayBeAllowed(string, Mode)
MetadataProviderAdapter.GetMinSourceFrequency(string)
MetadataProviderAdapter.NotifyUserMessage(string, string, string)
MetadataProviderAdapter.NotifyNewSession(string, string, IDictionary)
MetadataProviderAdapter.NotifySessionClose(string)
MetadataProviderAdapter.WantsTablesNotification(string)
MetadataProviderAdapter.NotifyNewTables(string, string, TableInfo[])
MetadataProviderAdapter.NotifyTablesClose(string, TableInfo[])
MetadataProviderAdapter.NotifyMpnDeviceAccess(string, string, MpnDeviceInfo)
MetadataProviderAdapter.NotifyMpnSubscriptionActivation(string, string, TableInfo, MpnSubscriptionInfo)
MetadataProviderAdapter.NotifyMpnDeviceTokenChange(string, string, MpnDeviceInfo, string)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Lightstreamer.Adapters.Metadata
Assembly: DotNetStandardAdapter.dll
Syntax
public class LiteralBasedProvider : MetadataProviderAdapter, IMetadataProvider

Constructors

LiteralBasedProvider()

Void constructor required by the Remote Server.

Declaration
public LiteralBasedProvider()

Methods

GetAllowedBufferSize(string, string)

Returns the size of the buffer internally used to enqueue subsequent ItemUpdates for the same Item.

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

A User name. Not used.

string item

An Item Name. Not used.

Returns
Type Description
int

The allowed buffer size, as supplied in the Metadata Adapter configuration.

Overrides
MetadataProviderAdapter.GetAllowedBufferSize(string, string)

GetAllowedMaxBandwidth(string)

Returns the bandwidth level to be allowed to a User for a push Session.

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

A User name. Not used.

Returns
Type Description
double

The bandwidth, in Kbit/sec, as supplied in the Metadata Adapter configuration.

Overrides
MetadataProviderAdapter.GetAllowedMaxBandwidth(string)

GetAllowedMaxItemFrequency(string, string)

Returns the ItemUpdate frequency to be allowed to a User for a specific Item.

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

A User name. Not used.

string item

An Item Name. Not used.

Returns
Type Description
double

The allowed Update frequency, in Updates/sec, as supplied in the Metadata Adapter configuration.

Overrides
MetadataProviderAdapter.GetAllowedMaxItemFrequency(string, string)

GetDistinctSnapshotLength(string)

Returns the maximum allowed length for a Snapshot of any Item that has been requested with publishing Mode DISTINCT.

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

An Item Name. Not used.

Returns
Type Description
int

The maximum allowed length for the Snapshot, as supplied in the Metadata Adapter configuration. In case no value has been supplied, a default value of 10 events is returned, which is thought to be enough to satisfy typical Client requests.

Overrides
MetadataProviderAdapter.GetDistinctSnapshotLength(string)

GetItems(string, string, string)

Resolves an Item List Specification supplied in a Request. The names of the Items in the List are returned. Item List Specifications are expected to be formed by simply concatenating the names of the contained Items, in a space separated way.

Declaration
public override string[] GetItems(string user, string sessionID, string itemList)
Parameters
Type Name Description
string user

A User name. Not used.

string sessionID

A Session ID. Not used.

string itemList

An Item List Specification.

Returns
Type Description
string[]

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

Overrides
MetadataProviderAdapter.GetItems(string, string, string)
Exceptions
Type Condition
ItemsException

never thrown in this case.

GetSchema(string, string, string, string)

Resolves a Field List specification supplied in a Request. The names of the Fields in the List are returned. Field List specifications are expected to be formed by simply concatenating the names of the contained Fields, in a space separated way.

Declaration
public override string[] GetSchema(string user, string sessionID, string itemList, string fieldList)
Parameters
Type Name Description
string user

A User name. Not used.

string sessionID

A Session ID. Not used.

string itemList

The specification of the Item List whose Items the Field List is to be applied to. Not used.

string fieldList

A Field List specification.

Returns
Type Description
string[]

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

Overrides
MetadataProviderAdapter.GetSchema(string, string, string, string)
Exceptions
Type Condition
SchemaException

never thrown in this case.

Init(IDictionary, string)

Reads configuration settings for user and resource constraints. If some setting is missing, the corresponding constraint is not set.

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

Can contain the configuration settings.

string configFile

Not used.

Overrides
MetadataProviderAdapter.Init(IDictionary, string)
Exceptions
Type Condition
MetadataProviderException

never thrown in this case.

NotifyUser(string, string)

Checks if a user is enabled to make Requests to the related Data Providers. If a list of User names has been configured, this list is checked. Otherwise, any User name is allowed. No password check is performed.

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

A User name.

string password

An optional password. Not used.

Overrides
MetadataProviderAdapter.NotifyUser(string, string)
Exceptions
Type Condition
AccessException

in case a list of User names has been configured and the supplied name does not belong to the list.

NotifyUser(string, string, IDictionary)

Checks if a user is enabled to make Requests to the related Data Providers. The check is deferred to a simpler 2-arguments version of the method, where the httpHeader argument is discarded. Note that, for authentication purposes, only the user and password arguments should be consulted.

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

A User name.

string password

An optional password. Not used.

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.

Overrides
MetadataProviderAdapter.NotifyUser(string, string, IDictionary)
Exceptions
Type Condition
AccessException

in case a list of User names has been configured and the supplied name does not belong to the list.

Implements

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