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 longDDM_NO_TIMESTAMPNo timestamp value
-
Constructor Summary
Constructors Constructor Description SmartDataDistributionChannel()Ctor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(IConditionOrErrorListener listener)Adds aIConditionOrErrorListenerlistenervoidaddListener(IDataAvailableListener listener)Adds aIDataAvailableListenerlistenerOPERATION_RESULTChangeDirectionOnChannel(DDM_CHANNEL_DIRECTION direction)Change direction of the channeljava.lang.StringgetChannelName()The name of the channellonggetOffset()The last available message offset associated to the datajava.lang.StringGetParameter(java.lang.String paramName)Get parameter from channeljava.lang.StringGetParameter(DDM_GENERAL_PARAMETER paramId)Get parameter from channellonggetTimestamp()The last available message timestamp associated to the dataOPERATION_RESULTLock(int timeout)Locks the channelvoidOnConditionOrError(OPERATION_RESULT errorCode, int nativeCode, java.lang.String subSystemReason)Called when an event condition is raised from subsystemvoidOnDataAvailable(java.lang.String key, byte[] buffer)Called when a data is availablevoidOnUnderlyingEvent(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)voidOnUnderlyingEvent(long opaque, long channelHandle, UnderlyingEvent uEvent)byte[]ReadFromChannel(long offset, long length)Reads from the channelvoidremoveListener(IConditionOrErrorListener listener)Removes aIConditionOrErrorListenerlistenervoidremoveListener(IDataAvailableListener listener)Removes aIDataAvailableListenerlistenerOPERATION_RESULTSeekChannel(long position)Seek the channel using absolute offsetOPERATION_RESULTSeekChannel(long position, DDM_SEEKCONTEXT context, DDM_SEEKKIND kind)Seek the channel using absolute or relative offsetOPERATION_RESULTSeekChannel(long position, DDM_SEEKKIND kind)Seek the channel using absolute or relative offsetOPERATION_RESULTSeekChannel(java.time.Duration position)Seek the channel by a relative time expressed asDurationstarting from latest known timestampOPERATION_RESULTSeekChannel(java.util.Date position)Seek the channel to an absolute timestampvoidSetParameter(java.lang.String paramName, java.lang.String paramValue)Set parameter on channelvoidSetParameter(DDM_GENERAL_PARAMETER paramId, java.lang.String paramValue)Set parameter on channelOPERATION_RESULTStartChannel(int timeout)Starts the channelOPERATION_RESULTStopChannel(int timeout)Stops the channelOPERATION_RESULTUnlock()Unlocks the channelOPERATION_RESULTWriteOnChannel(byte[] buffer)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String value)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String key, byte[] buffer)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String key, byte[] buffer, boolean waitAll, long timestamp)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String key, java.lang.String value)Writes on the channelOPERATION_RESULTWriteOnChannel(java.lang.String key, java.lang.String value, boolean waitAll)Writes on the channelOPERATION_RESULTWriteOnChannel(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:ISmartDataDistributionChannelStarts the channel- Specified by:
StartChannelin interfaceISmartDataDistributionChannel- Parameters:
timeout- Timeout in ms- Returns:
OPERATION_RESULT
-
StopChannel
public OPERATION_RESULT StopChannel(int timeout)
Description copied from interface:ISmartDataDistributionChannelStops the channel- Specified by:
StopChannelin 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:ISmartDataDistributionChannelSet parameter on channel- Specified by:
SetParameterin 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:ISmartDataDistributionChannelSet parameter on channel- Specified by:
SetParameterin interfaceISmartDataDistributionChannel- Parameters:
paramId- ParameterDDM_GENERAL_PARAMETERto setparamValue- Parameter value to set
-
GetParameter
public java.lang.String GetParameter(java.lang.String paramName)
Description copied from interface:ISmartDataDistributionChannelGet parameter from channel- Specified by:
GetParameterin interfaceISmartDataDistributionChannel- Parameters:
paramName- Parameter name to get- Returns:
- Parameter value
-
GetParameter
public java.lang.String GetParameter(DDM_GENERAL_PARAMETER paramId)
Description copied from interface:ISmartDataDistributionChannelGet parameter from channel- Specified by:
GetParameterin interfaceISmartDataDistributionChannel- Parameters:
paramId- ParameterDDM_GENERAL_PARAMETERto get- Returns:
- Parameter value
-
Lock
public OPERATION_RESULT Lock(int timeout)
Description copied from interface:ISmartDataDistributionChannelLocks the channel- Specified by:
Lockin interfaceISmartDataDistributionChannel- Parameters:
timeout- Timeout in ms- Returns:
OPERATION_RESULT
-
Unlock
public OPERATION_RESULT Unlock()
Description copied from interface:ISmartDataDistributionChannelUnlocks the channel- Specified by:
Unlockin interfaceISmartDataDistributionChannel- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(long position)
Description copied from interface:ISmartDataDistributionChannelSeek the channel using absolute offset- Specified by:
SeekChannelin interfaceISmartDataDistributionChannel- Parameters:
position- Seek offset poisition- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(long position, DDM_SEEKKIND kind)
Description copied from interface:ISmartDataDistributionChannelSeek the channel using absolute or relative offset- Specified by:
SeekChannelin interfaceISmartDataDistributionChannel- Parameters:
position- Seek offset poisitionkind-DDM_SEEKKINDto use- Returns:
OPERATION_RESULT
-
SeekChannel
public OPERATION_RESULT SeekChannel(java.util.Date position)
Description copied from interface:ISmartDataDistributionChannelSeek the channel to an absolute timestamp- Specified by:
SeekChannelin 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:ISmartDataDistributionChannelSeek the channel by a relative time expressed asDurationstarting from latest known timestamp- Specified by:
SeekChannelin 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:ISmartDataDistributionChannelSeek the channel using absolute or relative offset- Specified by:
SeekChannelin interfaceISmartDataDistributionChannel- Parameters:
position- Seek offset poisitioncontext-DDM_SEEKCONTEXTto usekind-DDM_SEEKKINDto use- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String value)
Description copied from interface:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin interfaceISmartDataDistributionChannel- Parameters:
value- TheStringto write in the channel- Returns:
OPERATION_RESULT
-
WriteOnChannel
public OPERATION_RESULT WriteOnChannel(java.lang.String key, java.lang.String value)
Description copied from interface:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin interfaceISmartDataDistributionChannel- Parameters:
key- The key to usevalue- TheStringto 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin interfaceISmartDataDistributionChannel- Parameters:
key- The key to usevalue- TheStringto 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin interfaceISmartDataDistributionChannel- Parameters:
key- The key to usevalue- TheStringto 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin 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:ISmartDataDistributionChannelWrites on the channel- Specified by:
WriteOnChannelin 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:ISmartDataDistributionChannelReads from the channel- Specified by:
ReadFromChannelin 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:ISmartDataDistributionChannelChange direction of the channel- Specified by:
ChangeDirectionOnChannelin interfaceISmartDataDistributionChannel- Parameters:
direction-DDM_CHANNEL_DIRECTION- Returns:
OPERATION_RESULT
-
addListener
public void addListener(IDataAvailableListener listener)
Description copied from interface:ISmartDataDistributionChannelAdds aIDataAvailableListenerlistener- Specified by:
addListenerin interfaceISmartDataDistributionChannel- Parameters:
listener-IDataAvailableListenerlistener to add
-
removeListener
public void removeListener(IDataAvailableListener listener)
Description copied from interface:ISmartDataDistributionChannelRemoves aIDataAvailableListenerlistener- Specified by:
removeListenerin interfaceISmartDataDistributionChannel- Parameters:
listener-IDataAvailableListenerlistener 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:ISmartDataDistributionChannelAdds aIConditionOrErrorListenerlistener- Specified by:
addListenerin interfaceISmartDataDistributionChannel- Parameters:
listener-IConditionOrErrorListenerlistener to add
-
removeListener
public void removeListener(IConditionOrErrorListener listener)
Description copied from interface:ISmartDataDistributionChannelRemoves aIConditionOrErrorListenerlistener- Specified by:
removeListenerin interfaceISmartDataDistributionChannel- Parameters:
listener-IConditionOrErrorListenerlistener 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:ISmartDataDistributionChannelInfoThe name of the channel- Specified by:
getChannelNamein interfaceISmartDataDistributionChannelInfo- Returns:
- The name of the channel
-
getTimestamp
public long getTimestamp()
Description copied from interface:ISmartDataDistributionChannelInfoThe last available message timestamp associated to the data- Specified by:
getTimestampin interfaceISmartDataDistributionChannelInfo- Returns:
- The last available message timestamp associated to the data: Milliseconds since epoch (UTC).
-
getOffset
public long getOffset()
Description copied from interface:ISmartDataDistributionChannelInfoThe last available message offset associated to the data- Specified by:
getOffsetin 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)
-
-