Class SmartDataDistributionChannel
- java.lang.Object
-
- org.mases.datadistributionmanager.SmartDataDistributionChannel
-
- All Implemented Interfaces:
ISmartDataDistributionChannel
,ISmartDataDistributionChannelInfo
public class SmartDataDistributionChannel extends java.lang.Object implements ISmartDataDistributionChannel
Main class managing channel
-
-
Field Summary
Fields Modifier and Type Field Description long
DDM_NO_TIMESTAMP
No timestamp value
-
Constructor Summary
Constructors Constructor Description SmartDataDistributionChannel()
Ctor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(IConditionOrErrorListener listener)
Adds aIConditionOrErrorListener
listenervoid
addListener(IDataAvailableListener listener)
Adds aIDataAvailableListener
listenerOPERATION_RESULT
ChangeDirectionOnChannel(DDM_CHANNEL_DIRECTION direction)
Change direction of the channeljava.lang.String
getChannelName()
The name of the channellong
getOffset()
The last available message offset associated to the datajava.lang.String
GetParameter(java.lang.String paramName)
Get parameter from channeljava.lang.String
GetParameter(DDM_GENERAL_PARAMETER paramId)
Get parameter from channellong
getTimestamp()
The last available message timestamp associated to the dataOPERATION_RESULT
Lock(int timeout)
Locks the channelvoid
OnConditionOrError(OPERATION_RESULT errorCode, int nativeCode, java.lang.String subSystemReason)
Called when an event condition is raised from subsystemvoid
OnDataAvailable(java.lang.String key, byte[] buffer)
Called when a data is availablevoid
OnUnderlyingEvent(long opaque, long channelHandle, java.lang.String topicName, int condition, boolean isDataAvailable, java.lang.String key, byte[] buffer, int nativeCode, java.lang.String subSystemReason, long timestamp, long offset)
void
OnUnderlyingEvent(long opaque, long channelHandle, UnderlyingEvent uEvent)
byte[]
ReadFromChannel(long offset, long length)
Reads from the channelvoid
removeListener(IConditionOrErrorListener listener)
Removes aIConditionOrErrorListener
listenervoid
removeListener(IDataAvailableListener listener)
Removes aIDataAvailableListener
listenerOPERATION_RESULT
SeekChannel(long position)
Seek the channel using absolute offsetOPERATION_RESULT
SeekChannel(long position, DDM_SEEKCONTEXT context, DDM_SEEKKIND kind)
Seek the channel using absolute or relative offsetOPERATION_RESULT
SeekChannel(long position, DDM_SEEKKIND kind)
Seek the channel using absolute or relative offsetOPERATION_RESULT
SeekChannel(java.time.Duration position)
Seek the channel by a relative time expressed asDuration
starting from latest known timestampOPERATION_RESULT
SeekChannel(java.util.Date position)
Seek the channel to an absolute timestampvoid
SetParameter(java.lang.String paramName, java.lang.String paramValue)
Set parameter on channelvoid
SetParameter(DDM_GENERAL_PARAMETER paramId, java.lang.String paramValue)
Set parameter on channelOPERATION_RESULT
StartChannel(int timeout)
Starts the channelOPERATION_RESULT
StopChannel(int timeout)
Stops the channelOPERATION_RESULT
Unlock()
Unlocks the channelOPERATION_RESULT
WriteOnChannel(byte[] buffer)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String value)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, byte[] buffer)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll, long timestamp)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, java.lang.String value)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, java.lang.String value, boolean waitAll)
Writes on the channelOPERATION_RESULT
WriteOnChannel(java.lang.String key, java.lang.String value, boolean waitAll, long timestamp)
Writes on the channel
-
-
-
Field Detail
-
DDM_NO_TIMESTAMP
public final long DDM_NO_TIMESTAMP
No timestamp value- See Also:
- Constant Field Values
-
-
Method Detail
-
StartChannel
public OPERATION_RESULT StartChannel(int timeout)
Description copied from interface:ISmartDataDistributionChannel
Starts the channel- Specified by:
StartChannel
in interfaceISmartDataDistributionChannel
- Parameters:
timeout
- Timeout in ms- Returns:
OPERATION_RESULT
-
StopChannel
public OPERATION_RESULT StopChannel(int timeout)
Description copied from interface:ISmartDataDistributionChannel
Stops the channel- Specified by:
StopChannel
in interfaceISmartDataDistributionChannel
- Parameters:
timeout
- Timeout in ms- Returns:
OPERATION_RESULT
-
SetParameter
public void SetParameter(java.lang.String paramName, java.lang.String paramValue)
Description copied from interface:ISmartDataDistributionChannel
Set parameter on channel- Specified by:
SetParameter
in interfaceISmartDataDistributionChannel
- Parameters:
paramName
- Parameter name to setparamValue
- Parameter value to set
-
SetParameter
public void SetParameter(DDM_GENERAL_PARAMETER paramId, java.lang.String paramValue)
Description copied from interface:ISmartDataDistributionChannel
Set parameter on channel- Specified by:
SetParameter
in interfaceISmartDataDistributionChannel
- Parameters:
paramId
- ParameterDDM_GENERAL_PARAMETER
to setparamValue
- Parameter value to set
-
GetParameter
public java.lang.String GetParameter(java.lang.String paramName)
Description copied from interface:ISmartDataDistributionChannel
Get parameter from channel- Specified by:
GetParameter
in interfaceISmartDataDistributionChannel
- Parameters:
paramName
- Parameter name to get- Returns:
- Parameter value
-
GetParameter
public java.lang.String GetParameter(DDM_GENERAL_PARAMETER paramId)
Description copied from interface:ISmartDataDistributionChannel
Get parameter from channel- Specified by:
GetParameter
in interfaceISmartDataDistributionChannel
- Parameters:
paramId
- ParameterDDM_GENERAL_PARAMETER
to get- Returns:
- Parameter value
-
Lock
public OPERATION_RESULT Lock(int timeout)
Description copied from interface:ISmartDataDistributionChannel
Locks the channel- Specified by:
Lock
in interfaceISmartDataDistributionChannel
- Parameters:
timeout
- Timeout in ms- Returns:
OPERATION_RESULT
-
Unlock
public OPERATION_RESULT Unlock()
Description copied from interface:ISmartDataDistributionChannel
Unlocks the channel- Specified by:
Unlock
in interfaceISmartDataDistributionChannel
- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(long position)
Description copied from interface:ISmartDataDistributionChannel
Seek the channel using absolute offset- Specified by:
SeekChannel
in interfaceISmartDataDistributionChannel
- Parameters:
position
- Seek offset poisition- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(long position, DDM_SEEKKIND kind)
Description copied from interface:ISmartDataDistributionChannel
Seek the channel using absolute or relative offset- Specified by:
SeekChannel
in interfaceISmartDataDistributionChannel
- Parameters:
position
- Seek offset poisitionkind
-DDM_SEEKKIND
to use- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(java.util.Date position)
Description copied from interface:ISmartDataDistributionChannel
Seek the channel to an absolute timestamp- Specified by:
SeekChannel
in interfaceISmartDataDistributionChannel
- Parameters:
position
- Seek timestamp to an absolute poisition- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(java.time.Duration position)
Description copied from interface:ISmartDataDistributionChannel
Seek the channel by a relative time expressed asDuration
starting from latest known timestamp- Specified by:
SeekChannel
in interfaceISmartDataDistributionChannel
- Parameters:
position
- Seek timestamp relative poisition- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(long position, DDM_SEEKCONTEXT context, DDM_SEEKKIND kind)
Description copied from interface:ISmartDataDistributionChannel
Seek the channel using absolute or relative offset- Specified by:
SeekChannel
in interfaceISmartDataDistributionChannel
- Parameters:
position
- Seek offset poisitioncontext
-DDM_SEEKCONTEXT
to usekind
-DDM_SEEKKIND
to use- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String value)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
value
- TheString
to write in the channel- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, java.lang.String value)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usevalue
- TheString
to write in the channel- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, java.lang.String value, boolean waitAll)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usevalue
- TheString
to write in the channelwaitAll
- waits all write in the distributed environment- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, java.lang.String value, boolean waitAll, long timestamp)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usevalue
- TheString
to write in the channelwaitAll
- waits all write in the distributed environmenttimestamp
- timestamp to apply- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(byte[] buffer)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
buffer
- The buffer to write in the channel- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, byte[] buffer)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usebuffer
- The buffer to write in the channel- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usebuffer
- The buffer to write in the channelwaitAll
- waits all write in the distributed environment- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll, long timestamp)
Description copied from interface:ISmartDataDistributionChannel
Writes on the channel- Specified by:
WriteOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
key
- The key to usebuffer
- The buffer to write in the channelwaitAll
- waits all write in the distributed environmenttimestamp
- timestamp to apply- Returns:
OPERATION_RESULT
-
ReadFromChannel
public byte[] ReadFromChannel(long offset, long length)
Description copied from interface:ISmartDataDistributionChannel
Reads from the channel- Specified by:
ReadFromChannel
in interfaceISmartDataDistributionChannel
- Parameters:
offset
- offset in the streamlength
- number of elements- Returns:
- an array of
byte
-
ChangeDirectionOnChannel
public OPERATION_RESULT ChangeDirectionOnChannel(DDM_CHANNEL_DIRECTION direction)
Description copied from interface:ISmartDataDistributionChannel
Change direction of the channel- Specified by:
ChangeDirectionOnChannel
in interfaceISmartDataDistributionChannel
- Parameters:
direction
-DDM_CHANNEL_DIRECTION
- Returns:
OPERATION_RESULT
-
addListener
public void addListener(IDataAvailableListener listener)
Description copied from interface:ISmartDataDistributionChannel
Adds aIDataAvailableListener
listener- Specified by:
addListener
in interfaceISmartDataDistributionChannel
- Parameters:
listener
-IDataAvailableListener
listener to add
-
removeListener
public void removeListener(IDataAvailableListener listener)
Description copied from interface:ISmartDataDistributionChannel
Removes aIDataAvailableListener
listener- Specified by:
removeListener
in interfaceISmartDataDistributionChannel
- Parameters:
listener
-IDataAvailableListener
listener to remove
-
OnDataAvailable
public void OnDataAvailable(java.lang.String key, byte[] buffer)
Called when a data is available- Parameters:
key
- Message keybuffer
- Message buffer
-
addListener
public void addListener(IConditionOrErrorListener listener)
Description copied from interface:ISmartDataDistributionChannel
Adds aIConditionOrErrorListener
listener- Specified by:
addListener
in interfaceISmartDataDistributionChannel
- Parameters:
listener
-IConditionOrErrorListener
listener to add
-
removeListener
public void removeListener(IConditionOrErrorListener listener)
Description copied from interface:ISmartDataDistributionChannel
Removes aIConditionOrErrorListener
listener- Specified by:
removeListener
in interfaceISmartDataDistributionChannel
- Parameters:
listener
-IConditionOrErrorListener
listener to remove
-
OnConditionOrError
public void OnConditionOrError(OPERATION_RESULT errorCode, int nativeCode, java.lang.String subSystemReason)
Called when an event condition is raised from subsystem- Parameters:
errorCode
- The error code reportednativeCode
- The native code associated to the error if availablesubSystemReason
- A String with a reason from subsystem
-
getChannelName
public java.lang.String getChannelName()
Description copied from interface:ISmartDataDistributionChannelInfo
The name of the channel- Specified by:
getChannelName
in interfaceISmartDataDistributionChannelInfo
- Returns:
- The name of the channel
-
getTimestamp
public long getTimestamp()
Description copied from interface:ISmartDataDistributionChannelInfo
The last available message timestamp associated to the data- Specified by:
getTimestamp
in interfaceISmartDataDistributionChannelInfo
- Returns:
- The last available message timestamp associated to the data: Milliseconds since epoch (UTC).
-
getOffset
public long getOffset()
Description copied from interface:ISmartDataDistributionChannelInfo
The last available message offset associated to the data- Specified by:
getOffset
in interfaceISmartDataDistributionChannelInfo
- Returns:
- The last available message offset associated to the data
-
OnUnderlyingEvent
public void OnUnderlyingEvent(long opaque, long channelHandle, UnderlyingEvent uEvent)
-
OnUnderlyingEvent
public final void OnUnderlyingEvent(long opaque, long channelHandle, java.lang.String topicName, int condition, boolean isDataAvailable, java.lang.String key, byte[] buffer, int nativeCode, java.lang.String subSystemReason, long timestamp, long offset)
-
-