public class LiteralBasedProvider extends MetadataProviderAdapter
<!-- Mandatory. Define the Metadata Provider. -->
<metadata_provider>
<!-- Mandatory. Java class name of the adapter. -->
<adapter_class>com.lightstreamer.adapters.metadata.LiteralBasedProvider</adapter_class>
......
<!-- Optional. List of initialization parameters specific for LiteralBasedProvider. -->
<!-- Optional.
Define values to be returned in getAllowedMaxBandwidth(),
getAllowedMaxItemFrequency(), getAllowedBufferSize() and
getDistinctSnapshotLength() methods, for any User and Item
supplied. -->
<!--
<param name="max_bandwidth">40</param>
<param name="max_frequency">3</param>
<param name="buffer_size">30</param>
<param name="distinct_snapshot_length">10</param>
-->
<!-- Optional.
Define comma-separated list of User names to be checked
for allowance by the notifyUser() method. -->
<!--
<param name="allowed_users">user123,user456</param>
-->
<!-- Optional.
Define how the modeMayBeAllowed method should behave, by
associating to each item the modes in which it can be managed
by the Server.
Each pair of parameters of the form "item_family_<n>" and
"modes_for_item_family_<n>" define respectively the item name
pattern (in java.util.regex.Pattern format) and the allowed
modes (in comma separated format) for a family of items.
Each item is assigned to the first family that matches its name.
If no families are specified at all, then modeMayBeAllowed
always returns true, though this is not recommended, because
the Server does not support more than one mode out of MERGE,
DISTINCT, and COMMAND for the same item. In such a case, the
Server would just manage each item in the mode specified by the
first Client request it receives for the item and would be up to
the Clients to ensure that the same item cannot be requested in
two conflicting Modes. -->
<param name="item_family_1">item.*</param>
<param name="modes_for_item_family_1">MERGE</param>
<!--
<param name="item_family_2">portfolio.*</param>
<param name="modes_for_item_family_2">COMMAND</param>
-->
</metadata_provider>
The source code of the Adapter is provided on GitHub:
https://github.com/Lightstreamer/Lightstreamer-example-ReusableMetadata-adapter-javaConstructor and Description |
---|
LiteralBasedProvider()
Void constructor required by Lightstreamer Kernel.
|
Modifier and Type | Method and Description |
---|---|
int |
getAllowedBufferSize(java.lang.String user,
java.lang.String item)
Returns the size of the buffer internally used to enqueue subsequent
ItemUpdates for the same Item.
|
double |
getAllowedMaxBandwidth(java.lang.String user)
Returns the bandwidth level to be allowed to a User for a push Session.
|
double |
getAllowedMaxItemFrequency(java.lang.String user,
java.lang.String item)
Returns the ItemUpdate frequency to be allowed to a User for a specific
Item.
|
int |
getDistinctSnapshotLength(java.lang.String item)
Returns the maximum allowed length for a Snapshot of any Item that
has been requested with publishing Mode DISTINCT.
|
java.lang.String[] |
getItems(java.lang.String user,
java.lang.String itemList)
Resolves an Item List specification supplied in a Request.
|
java.lang.String[] |
getItems(java.lang.String user,
java.lang.String sessionID,
java.lang.String itemList)
Resolves an Item List specification supplied in a Request.
|
double |
getMinSourceFrequency(java.lang.String item)
Returns the minimum ItemEvent frequency from the supplier Data Adapter at which
the events for an Item are guaranteed to be delivered to the Clients
without loss of information.
|
java.lang.String[] |
getSchema(java.lang.String user,
java.lang.String itemList,
java.lang.String fieldList)
Resolves a Field List specification supplied in a Request.
|
java.lang.String[] |
getSchema(java.lang.String user,
java.lang.String sessionID,
java.lang.String itemList,
java.lang.String fieldList)
Resolves a Field List specification supplied in a Request.
|
void |
init(java.util.Map params,
java.io.File dir)
Reads configuration settings for user and resource constraints.
|
boolean |
modeMayBeAllowed(java.lang.String item,
Mode mode)
Called by Lightstreamer Kernel to ask for the allowance of a publishing
Mode for an Item.
|
void |
notifyUser(java.lang.String user,
java.lang.String password)
Checks if a user is enabled to make Requests to the related Data
Providers.
|
void |
notifyUser(java.lang.String user,
java.lang.String password,
java.util.Map httpHeaders)
Checks if a user is enabled to make Requests to the related Data
Providers.
|
customizeUpdate, enableUpdateCustomization, isModeAllowed, isSelected, isSelectorAllowed, notifyMpnDeviceAccess, notifyMpnDeviceTokenChange, notifyMpnSubscriptionActivation, notifyNewSession, notifyNewSession, notifyNewTables, notifySessionClose, notifyTablesClose, notifyUser, notifyUserMessage, wantsTablesNotification
public LiteralBasedProvider()
public void init(java.util.Map params, java.io.File dir) throws MetadataProviderException
init
in interface MetadataProvider
init
in class MetadataProviderAdapter
params
- Can contain the configuration settings.dir
- Not used.MetadataProviderException
- in case of configuration errors.public java.lang.String[] getItems(java.lang.String user, java.lang.String sessionID, java.lang.String itemList) throws ItemsException
user
- A User name.sessionID
- A Session ID. Not used.itemList
- An Item List specification.ItemsException
- never thrownpublic java.lang.String[] getItems(java.lang.String user, java.lang.String itemList) throws ItemsException
user
- A User name. Not used.itemList
- An Item List specification.ItemsException
- never thrown.public java.lang.String[] getSchema(java.lang.String user, java.lang.String sessionID, java.lang.String itemList, java.lang.String fieldList) throws SchemaException
user
- A User name.sessionID
- A Session ID. Not used.itemList
- The specification of the Item List whose Items the Field List
is to be applied to.fieldList
- A Field List specification.SchemaException
- never thrownpublic java.lang.String[] getSchema(java.lang.String user, java.lang.String itemList, java.lang.String fieldList) throws SchemaException
user
- A User name. Not used.itemList
- The specification of the Item List whose Items the Field List
is to be applied to. Not used.fieldList
- A Field List specification.SchemaException
- never thrown.public void notifyUser(java.lang.String user, java.lang.String password, java.util.Map httpHeaders) throws AccessException, CreditsException
notifyUser
in interface MetadataProvider
notifyUser
in class MetadataProviderAdapter
user
- A User name.password
- An optional password.httpHeaders
- A Map that contains a name-value pair for each
header found in the HTTP request that originated the call. Not used.AccessException
- if a list of User names has been configured
and the supplied name does not belong to the list.CreditsException
- never thrown.MetadataProvider.notifyUser(String, String, Map, String)
public void notifyUser(java.lang.String user, java.lang.String password) throws AccessException, CreditsException
notifyUser
in class MetadataProviderAdapter
user
- A User name.password
- An optional password. Not used.AccessException
- if a list of User names has been configured
and the supplied name does not belong to the list.CreditsException
- never thrown.public double getAllowedMaxBandwidth(java.lang.String user)
getAllowedMaxBandwidth
in interface MetadataProvider
getAllowedMaxBandwidth
in class MetadataProviderAdapter
user
- A User name. Not used.public double getAllowedMaxItemFrequency(java.lang.String user, java.lang.String item)
getAllowedMaxItemFrequency
in interface MetadataProvider
getAllowedMaxItemFrequency
in class MetadataProviderAdapter
user
- A User name. Not used.item
- An Item Name. Not used.public int getAllowedBufferSize(java.lang.String user, java.lang.String item)
getAllowedBufferSize
in interface MetadataProvider
getAllowedBufferSize
in class MetadataProviderAdapter
user
- A User name. Not used.item
- An Item Name. Not used.public double getMinSourceFrequency(java.lang.String item)
getMinSourceFrequency
in interface MetadataProvider
getMinSourceFrequency
in class MetadataProviderAdapter
item
- not used.public int getDistinctSnapshotLength(java.lang.String item)
getDistinctSnapshotLength
in interface MetadataProvider
getDistinctSnapshotLength
in class MetadataProviderAdapter
item
- An Item Name.public boolean modeMayBeAllowed(java.lang.String item, Mode mode)
modeMayBeAllowed
in interface MetadataProvider
modeMayBeAllowed
in class MetadataProviderAdapter
item
- An Item name.mode
- A publishing Mode.