IntrospectionModel

public class IntrospectionModel

A model of existing participants in an RSB-based system. The model is a collection of participant representations and can be observed. The implementation is thread-safe. In case multiple operations need to be atomic, clients can synchronize on this class.

Author

swrede, ssharma, jwienke

Methods

addObserver

public boolean addObserver(IntrospectionModelObserver observer)

Adds an observer to this model.

Parameters

observer – observer to add, not null

Returns

true if the oberserver was newly added

addParticipant

public void addParticipant(Participant participant, Participant parent)

Adds a participant to the model.

Parameters
  • participant – the new participant, not null

  • parent – optionally the parent participant or null if no parent exists

getParticipant

public ParticipantInfo getParticipant(ParticipantId participantId)

Queries the database of known participants for the participant with the given uuid and returns the associated ParticipantInfo instance. Remember to synchronize on this instance in case you want to ensure that the participant still exists in the model when you operate with it.

Parameters

participantId – the id of participant, not null

Returns

the associated participant info or null in case there is no participant with the given id

getParticipants

public Set<ParticipantInfo> getParticipants()

Returns the collection of participants. Clients need to ensure synchronization on this instance when using the returned collection.

Returns

set of participants

isEmpty

public boolean isEmpty()

Indicates whether any participants are known.

Returns

true if the model contains participants

removeObserver

public boolean removeObserver(IntrospectionModelObserver observer)

Removes an observer from this model.

Parameters

observer – observer to remove, not null

Returns

true if the observer existed and was removed

removeParticipant

public void removeParticipant(Participant participant)

Removes a participant from the model.

Parameters

participant – participant to remove, not null