com.lightstreamer.ls_client
Class SimpleTableInfo

java.lang.Object
  extended by com.lightstreamer.ls_client.SimpleTableInfo
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ExtendedTableInfo

public class SimpleTableInfo
extends java.lang.Object
implements java.lang.Cloneable

Contains the specification of a table to be subscribed to Lightstreamer Server.


Field Summary
static java.lang.String COMMAND
          String constant for COMMAND subscription mode.
static java.lang.String DISTINCT
          String constant for DISTINCT subscription mode.
static java.lang.String MERGE
          String constant for MERGE subscription mode.
static java.lang.String RAW
          String constant for RAW subscription mode.
 
Constructor Summary
SimpleTableInfo(java.lang.String group, java.lang.String mode, java.lang.String schema, boolean snap)
          Constructs a table specification with basic table attributes.
 
Method Summary
 java.lang.Object clone()
           
 int getBufferSize()
          Recalls the requested size for the Server ItemEventBuffer for all the items in the table.
 java.lang.String getDataAdapter()
          Recalls the name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items in the Table.
 int getDistinctSnapshotLength()
          Recalls the requested length for the snapshot to be received for all the items in the table, provided that their subscription mode is DISTINCT.
 int getEnd()
          Recalls the position of the last item in the Group to be considered.
 java.lang.String getGroup()
          Recalls the name of the Group of items contained in this table.
 java.lang.String getMode()
          Recalls the subscription mode for the items contained in this table.
 double getRequestedMaxFrequency()
          Recalls the requested maximum update frequency for all the items in the table.
 java.lang.String getSchema()
          Recalls the name of the Schema of fields used in this table.
 java.lang.String getSelector()
          Recalls the selector to be applied by the Server to the updates.
 int getStart()
          Recalls the position of the first item in the Group to be considered.
 boolean isSnapshot()
          Recalls whether or not the snapshot is being asked for the items contained in this table.
 boolean isUnfilteredDispatching()
          Recalls the filtering behavior for all the items in the table.
 void requestUnfilteredDispatching()
          Requests that events for the items in the table are dispatched in an unfiltered way.
 void setDataAdapter(java.lang.String dataAdapter)
          Specifies the name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items in the Group.
 void setRange(int start, int end)
          Specifies a subrange of the specified Group of items to be requested.
 void setRequestedBufferSize(int bufferSize)
          Sets the requested size for the Server ItemEventBuffer for all the items in the table.
 void setRequestedDistinctSnapshotLength(int snapshotLength)
          Sets the requested length for the snapshot to be received for all the items in the table.
 void setRequestedMaxFrequency(double maxFrequency)
          Sets the maximum update frequency for all the items in the table.
 void setSelector(java.lang.String selector)
          Specifies a selector to be applied by the Server to the updates pertaining to all the Items in the Group.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MERGE

public static final java.lang.String MERGE
String constant for MERGE subscription mode.

See Also:
Constant Field Values

DISTINCT

public static final java.lang.String DISTINCT
String constant for DISTINCT subscription mode.

See Also:
Constant Field Values

RAW

public static final java.lang.String RAW
String constant for RAW subscription mode.

See Also:
Constant Field Values

COMMAND

public static final java.lang.String COMMAND
String constant for COMMAND subscription mode.

See Also:
Constant Field Values
Constructor Detail

SimpleTableInfo

public SimpleTableInfo(java.lang.String group,
                       java.lang.String mode,
                       java.lang.String schema,
                       boolean snap)
                throws SubscrException
Constructs a table specification with basic table attributes.

Parameters:
group - Name of the Group of items in the table.
mode - Subscription mode for all items in the table. It should be equal to one of the constants defined in the class.
schema - Name of the Schema for all items in the table.
snap - If true, requires the snapshot for all items in the table. The snapshot can be requested only for MERGE, DISTINCT and COMMAND Items mode.
Throws:
SubscrException - Thrown if the snapshot request is not compatible with the supplied subscription mode.
Method Detail

getGroup

public java.lang.String getGroup()
Recalls the name of the Group of items contained in this table.

Returns:
a Group name.

getMode

public java.lang.String getMode()
Recalls the subscription mode for the items contained in this table.

Returns:
the name of a subscription mode.

getSchema

public java.lang.String getSchema()
Recalls the name of the Schema of fields used in this table.

Returns:
a Schema name.

isSnapshot

public boolean isSnapshot()
Recalls whether or not the snapshot is being asked for the items contained in this table.

Returns:
true if the snapshot is requested; false otherwise.

setDataAdapter

public void setDataAdapter(java.lang.String dataAdapter)
Specifies the name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items in the Group. If not called, the "DEFAULT" name is used.
The Data Adapter name is configured on the server side through the "name" attribute of the "data_provider" element, in the "adapters.xml" file that defines the Adapter Set (a missing attribute configures the "DEFAULT" name).
Note: If more than one Data Adapter is needed to supply all the items in a set of items, then it is not possible to group all the items of the set in a single logical table. Multiple logical tables have to be defined.

Parameters:
dataAdapter - the name of the Data Adapter. A null value is equivalent to the "DEFAULT" name.
See Also:
ConnectionInfo.adapter

getDataAdapter

public java.lang.String getDataAdapter()
Recalls the name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items in the Table.

Returns:
the name of a Data Adapter, or null, as an equivalent to the "DEFAULT" name.

setSelector

public void setSelector(java.lang.String selector)
Specifies a selector to be applied by the Server to the updates pertaining to all the Items in the Group.

Parameters:
selector - name of a Selector. It will be interpreted by the Metadata Adapter.

getSelector

public java.lang.String getSelector()
Recalls the selector to be applied by the Server to the updates.

Returns:
the name of a Selector, or null if no selector is applied.

setRange

public void setRange(int start,
                     int end)
Specifies a subrange of the specified Group of items to be requested.

Parameters:
start - 1-based Index of the first item in the Group.
end - 1-based Index of the last item in the Group.

getStart

public int getStart()
Recalls the position of the first item in the Group to be considered.

Returns:
a positive Index, or 0 if no constraint is set.

getEnd

public int getEnd()
Recalls the position of the last item in the Group to be considered.

Returns:
a positive Index, or 0 if no constraint is set.

setRequestedBufferSize

public void setRequestedBufferSize(int bufferSize)
                            throws SubscrException
Sets the requested size for the Server ItemEventBuffer for all the items in the table. If not specified, a 1 element buffer is meant if mode is MERGE and an unlimited buffer is meant if mode is DISTINCT. However, the real Server buffer size can be limited by the Metadata Adapter. The buffer size can be specified only for MERGE and DISTINCT Items mode. It is ignored if requestUnfilteredDispatching() is also called.

Parameters:
bufferSize - the size requested for the ItemEventBuffers; it should be greater than 0, or 0 to mean an unlimited buffer.
Throws:
SubscrException - Thrown if buffer size setting is not compatible with the supplied subscription mode.

getBufferSize

public int getBufferSize()
Recalls the requested size for the Server ItemEventBuffer for all the items in the table.
Note that the real Server buffer size can be different for each item, depending on the subscription mode, the Metadata Adapter implementation and the filtering specification.

Returns:
the requested buffer size, or 0 to mean an unlimited buffer, or -1 if no constraint is set.
See Also:
setRequestedBufferSize(int)

setRequestedMaxFrequency

public void setRequestedMaxFrequency(double maxFrequency)
                              throws SubscrException
Sets the maximum update frequency for all the items in the table. It can only be used in order to lower the frequency granted by the Metadata Adapter. The update frequency can be specified only for MERGE, DISTINCT and COMMAND Items mode; in the latter case, the frequency limit only applies to consecutive UPDATE events for the same key value. It is ignored if requestUnfilteredDispatching() is also called.

Parameters:
maxFrequency - the frequency requested for the items; it should be greater than 0.
Throws:
SubscrException - Thrown if maximum frequency setting is not compatible with the supplied subscription mode.
Edition Note:
A further global frequency limit is also imposed by the Server, if it is running in Presto edition; this specific limit also applies to RAW mode and to unfiltered dispatching.

getRequestedMaxFrequency

public double getRequestedMaxFrequency()
Recalls the requested maximum update frequency for all the items in the table.
Note that the real maximum update frequency can be different for each item, depending on the Metadata Adapter implementation and the filtering specification.

Returns:
the requested maximum update frequency, or 0 if no constraint is set.
See Also:
setRequestedMaxFrequency(double)

requestUnfilteredDispatching

public void requestUnfilteredDispatching()
                                  throws SubscrException
Requests that events for the items in the table are dispatched in an unfiltered way. This setting is stronger than the setting of the maximum update frequency and can lead to the subscription refusal by the Metadata Adapter. It is also stronger than the setting for the buffer size. The unfiltered dispatching can be specified only for MERGE, DISTINCT and COMMAND Items mode.

Throws:
SubscrException - Thrown if unfiltered dispatching is not compatible with the supplied subscription mode.

isUnfilteredDispatching

public boolean isUnfilteredDispatching()
Recalls the filtering behavior for all the items in the table.

Returns:
true for unfiltered dispatching, false otherwise.

setRequestedDistinctSnapshotLength

public void setRequestedDistinctSnapshotLength(int snapshotLength)
                                        throws SubscrException
Sets the requested length for the snapshot to be received for all the items in the table. If not specified, the snapshot length will be determined by the Server. The snapshot length can be specified only for DISTINCT Items mode.

Parameters:
snapshotLength - the length requested for the snapshot; it should be greater than 0.
Throws:
SubscrException - Thrown if snapshot length setting is not compatible with the supplied parameters.

getDistinctSnapshotLength

public int getDistinctSnapshotLength()
Recalls the requested length for the snapshot to be received for all the items in the table, provided that their subscription mode is DISTINCT.

Returns:
the requested snapshot length, or 0 if no constraint is set.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object