de.uka.ipd.consensus.impl
Class IncentiveManagerImpl

java.lang.Object
  extended byde.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
      extended byde.uka.ipd.consensus.impl.IncentiveManagerImpl
All Implemented Interfaces:
ConsensusFoundationManager, ConsensusFoundationModule, EventListener, EvolutionListener, IncentiveManager, OntologyListener, RatingListener

public class IncentiveManagerImpl
extends AbstractConsensusFoundationModule
implements IncentiveManager, RatingListener, OntologyListener, EvolutionListener

TODO

Version:
2006-06-14
Author:
Thomas Much

Constructor Summary
IncentiveManagerImpl()
           
 
Method Summary
 void addScoringListener(ScoringListener listener)
          Registers a new ScoringListener.
 void associationCreated(OntologyEvent event)
          Called by the OntologyManager when an association is created.
 void associationDeleted(EvolutionEvent event)
          Called by the EvolutionManager when an association is deleted.
 void associationTopicAdded(OntologyEvent event)
          Called by the OntologyManager when topic is added as a player to an association.
 void associationTopicRemoved(OntologyEvent event)
          Called by the OntologyManager when player topic is removed from an association.
 void attributeAdded(OntologyEvent event)
          Called by the OntologyManager when an attribute is added to a topic.
 void attributeRemoved(OntologyEvent event)
          Called by the OntologyManager when an attribute is removed from a topic.
 void attributeValueChanged(OntologyEvent event)
          Called by the OntologyManager when an attribute's value is changed.
 void conceptCommentChanged(OntologyEvent event)
          Called by the OntologyManager when the comment of a concept has changed.
 void conceptNameChanged(OntologyEvent event)
          Called by the OntologyManager when the name of a concept has changed.
 void conceptRatingChanged(RatingEvent event)
          Called by the RatingManager when an existing concept's rating was changed.
 void conceptRatingRemoved(RatingEvent event)
          Called by the RatingManager when a concept's rating was removed.
 void conceptRatingSet(RatingEvent event)
          Called by the RatingManager when a new rating was added to a concept.
 void conceptTypeChanged(OntologyEvent event)
          Called by the OntologyManager when a type is added to or removed from a concept.
protected  void fireScoringEvent(User source, int id, Concept concept, User ratedUser, Rating rating, double oldRatingValue, String oldValue, Topic oldType, Topic topic, Occurrence occurrence, Synonym synonym)
           
 double getInitialUserScore()
          Returns the initial score for newly created users.
 String getVersion()
          Returns a version string of the implementation of this module.
 void init(Properties config, LoggingManager logging, UserManager users, OntologyManager ontology)
          This method is called by the ConsensusFoundation constructor to initialize the IncentiveManager.
 void initCompleted(Properties config, ConsensusFoundationManager cfm)
          This method is called by the ConsensusFoundation constructor after all available modules have been initialized (i.e. their init() method has been called).
 void occurrenceChanged(OntologyEvent event)
          Called by the OntologyManager when an occurrence's value is changed.
 void occurrenceCreated(OntologyEvent event)
          Called by the OntologyManager when an occurrence is created.
 void occurrenceRemoved(OntologyEvent event)
          Called by the OntologyManager when an occurrence is removed from a topic.
 void removeScoringListener(ScoringListener listener)
          Removes a ScoringListener, if it is registered with the IncentiveManager (otherwise this call is ignored).
 void shutdown()
          Called by ConsensusFoundation.shutdown() when the application shuts down.
 void synonymAdded(OntologyEvent event)
          Called by the OntologyManager when a synonym is added to a base topic.
 void synonymRemoved(OntologyEvent event)
          Called by the OntologyManager when a synonym is removed from a base topic.
 void topicClassChanged(OntologyEvent event)
          Called by the OntologyManager when a superclass is added to or removed from a topic.
 void topicCreated(OntologyEvent event)
          Called by the OntologyManager when a topic is created.
 void topicDeleted(EvolutionEvent event)
          Called by the EvolutionManager when a topic is deleted.
 void topicsMerged(EvolutionEvent event)
          Called by the EvolutionManager when two topics are merged.
 void userRatingChanged(RatingEvent event)
          Called by the RatingManager when an existing user's rating was changed.
 void userRatingRemoved(RatingEvent event)
          Called by the RatingManager when a user's rating was removed.
 void userRatingSet(RatingEvent event)
          Called by the RatingManager when a new rating was added to an user.
 
Methods inherited from class de.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
finalize, getConsensusFoundationManager, getDynamicRightsManager, getEvolutionManager, getIncentiveManager, getLoggingManager, getOntologyManager, getRatingManager, getUserManager
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.uka.ipd.consensus.foundation.ConsensusFoundationModule
getConsensusFoundationManager
 

Constructor Detail

IncentiveManagerImpl

public IncentiveManagerImpl()
Method Detail

init

public void init(Properties config,
                 LoggingManager logging,
                 UserManager users,
                 OntologyManager ontology)
          throws Exception
Description copied from interface: IncentiveManager
This method is called by the ConsensusFoundation constructor to initialize the IncentiveManager.

Specified by:
init in interface IncentiveManager
Parameters:
config - all entries from ConsensusFoundation.properties
logging - the successfully initialized LoggingManager instance
users - the the successfully initialized UserManager instance
ontology - the the successfully initialized OntologyManager instance
Throws:
Exception - if any error occurs (startup of the application is aborted in this case)
See Also:
ConsensusFoundation.ConsensusFoundation()

initCompleted

public void initCompleted(Properties config,
                          ConsensusFoundationManager cfm)
                   throws Exception
Description copied from interface: ConsensusFoundationModule
This method is called by the ConsensusFoundation constructor after all available modules have been initialized (i.e. their init() method has been called). Here a module can perform some final initialization that is dependant on other modules.

Specified by:
initCompleted in interface ConsensusFoundationModule
Overrides:
initCompleted in class AbstractConsensusFoundationModule
Throws:
Exception

shutdown

public void shutdown()
Description copied from interface: ConsensusFoundationModule
Called by ConsensusFoundation.shutdown() when the application shuts down.

When implementing this method make sure that the shutdown code is executed only once even if this method is called multiple times.

Specified by:
shutdown in interface ConsensusFoundationModule
Overrides:
shutdown in class AbstractConsensusFoundationModule

getInitialUserScore

public double getInitialUserScore()
Description copied from interface: IncentiveManager
Returns the initial score for newly created users. Usually 0.

Specified by:
getInitialUserScore in interface IncentiveManager
Returns:
the initial score for newly created users

conceptRatingChanged

public void conceptRatingChanged(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when an existing concept's rating was changed.

Specified by:
conceptRatingChanged in interface RatingListener
Parameters:
event - the RatingEvent object containing the user, his rating and the rated concept

conceptRatingSet

public void conceptRatingSet(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when a new rating was added to a concept.

Specified by:
conceptRatingSet in interface RatingListener
Parameters:
event - the RatingEvent object containing the user, his rating and the rated concept

conceptRatingRemoved

public void conceptRatingRemoved(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when a concept's rating was removed.

Specified by:
conceptRatingRemoved in interface RatingListener
Parameters:
event - the RatingEvent object containing the user, the removed rating and the rated concept

userRatingChanged

public void userRatingChanged(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when an existing user's rating was changed.

Specified by:
userRatingChanged in interface RatingListener
Parameters:
event - the RatingEvent object containing the rating user, his rating and the rated user

userRatingSet

public void userRatingSet(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when a new rating was added to an user.

Specified by:
userRatingSet in interface RatingListener
Parameters:
event - the RatingEvent object containing the rating user, his rating and the rated user

userRatingRemoved

public void userRatingRemoved(RatingEvent event)
Description copied from interface: RatingListener
Called by the RatingManager when a user's rating was removed.

Specified by:
userRatingRemoved in interface RatingListener
Parameters:
event - the RatingEvent object containing the user, the removed rating and the rated user

topicCreated

public void topicCreated(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when a topic is created.

OntologyEvent.getConcept() returns the newly created topic.

Specified by:
topicCreated in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user and the newly created topic

associationCreated

public void associationCreated(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an association is created.

OntologyEvent.getConcept() returns the newly created association.

Specified by:
associationCreated in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user and the newly created association

conceptCommentChanged

public void conceptCommentChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when the comment of a concept has changed.

OntologyEvent.getConcept() returns the base concept, OntologyEvent.getOldValue() the comment's old value.

Specified by:
conceptCommentChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the concept and the comment's old value

conceptNameChanged

public void conceptNameChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when the name of a concept has changed.

OntologyEvent.getConcept() returns the base concept, OntologyEvent.getOldValue() the concept's old name.

Specified by:
conceptNameChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the concept and the concept's old name

conceptTypeChanged

public void conceptTypeChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when a type is added to or removed from a concept.

OntologyEvent.getConcept() returns the base concept, OntologyEvent.getOldType() the concept's old type. For topics, the old type is null if a new type is added.

Specified by:
conceptTypeChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the concept and the concept's old type

topicClassChanged

public void topicClassChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when a superclass is added to or removed from a topic.

OntologyEvent.getConcept() returns the base topic. OntologyEvent.getOldType() returns the topic's old superclass if it was removed, or null if a superclass was added.

Specified by:
topicClassChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the concept and the concept's old superclass

associationTopicAdded

public void associationTopicAdded(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when topic is added as a player to an association.

OntologyEvent.getConcept() returns the association, OntologyEvent.getTopic() the added topic.

Specified by:
associationTopicAdded in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the association and the added topic

associationTopicRemoved

public void associationTopicRemoved(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when player topic is removed from an association.

OntologyEvent.getConcept() returns the association, OntologyEvent.getTopic() the removed topic.

Specified by:
associationTopicRemoved in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the association and the removed topic

occurrenceCreated

public void occurrenceCreated(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an occurrence is created.

OntologyEvent.getConcept() returns the base topic, OntologyEvent.getOccurrence() the newly created occurrence.

Specified by:
occurrenceCreated in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the newly created occurrence

occurrenceChanged

public void occurrenceChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an occurrence's value is changed.

OntologyEvent.getConcept() returns the base topic, OntologyEvent.getOccurrence() the occurrence and OntologyEvent.getOldValue() the occurrence's old value.

Specified by:
occurrenceChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic, the occurrence and its old value

occurrenceRemoved

public void occurrenceRemoved(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an occurrence is removed from a topic.

OntologyEvent.getConcept() returns the base topic, OntologyEvent.getOccurrence() the removed occurrence.

Specified by:
occurrenceRemoved in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the removed occurrence

attributeAdded

public void attributeAdded(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an attribute is added to a topic.

OntologyEvent.getConcept() returns the added attribute, OntologyEvent.getTopic() the base topic.

Specified by:
attributeAdded in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the added attribute

attributeRemoved

public void attributeRemoved(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an attribute is removed from a topic.

OntologyEvent.getConcept() returns the removed attribute, OntologyEvent.getTopic() the base topic.

Specified by:
attributeRemoved in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the removed attribute

attributeValueChanged

public void attributeValueChanged(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when an attribute's value is changed.

OntologyEvent.getConcept() returns the attribute, OntologyEvent.getOldValue() the attribute's old value.

Specified by:
attributeValueChanged in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the attribute and its old value

synonymAdded

public void synonymAdded(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when a synonym is added to a base topic.

OntologyEvent.getConcept() returns the base topic, OntologyEvent.getSynonym() the Synonym object that contains both synonymous topics.

Specified by:
synonymAdded in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the synonym

synonymRemoved

public void synonymRemoved(OntologyEvent event)
Description copied from interface: OntologyListener
Called by the OntologyManager when a synonym is removed from a base topic.

OntologyEvent.getConcept() returns the base topic, OntologyEvent.getSynonym() the removed Synonym object that contains both synonymous topics.

Specified by:
synonymRemoved in interface OntologyListener
Parameters:
event - the OntologyEvent object containing the user, the topic and the synonym

associationDeleted

public void associationDeleted(EvolutionEvent event)
Description copied from interface: EvolutionListener
Called by the EvolutionManager when an association is deleted.

EvolutionEvent.getConcept() contains the deleted association.

Specified by:
associationDeleted in interface EvolutionListener
Parameters:
event - the EvolutionEvent object containing the user and the deleted association
See Also:
EvolutionManager.deleteAssociation(User, Association)

topicDeleted

public void topicDeleted(EvolutionEvent event)
Description copied from interface: EvolutionListener
Called by the EvolutionManager when a topic is deleted.

EvolutionEvent.getConcept() contains the deleted topic.

Specified by:
topicDeleted in interface EvolutionListener
Parameters:
event - the EvolutionEvent object containing the user and the deleted topic
See Also:
EvolutionManager.deleteTopic(User, Topic), EvolutionManager.deleteTopicAndSubtopics(User, Topic)

topicsMerged

public void topicsMerged(EvolutionEvent event)
Description copied from interface: EvolutionListener
Called by the EvolutionManager when two topics are merged.

EvolutionEvent.getConcept() contains one of the merged topics, EvolutionEvent.getTopic() the other.

Specified by:
topicsMerged in interface EvolutionListener
Parameters:
event - the EvolutionEvent object containing the user and the two merged topics
See Also:
EvolutionManager.mergeTopics(User, Topic, Topic)

addScoringListener

public void addScoringListener(ScoringListener listener)
Description copied from interface: IncentiveManager
Registers a new ScoringListener. You don't have to call this method explicitely, since you can declare ScoringListeners in ConsensusFoundation.properties.

Specified by:
addScoringListener in interface IncentiveManager
Parameters:
listener - the ScoringListener to be added
See Also:
ScoringListener

removeScoringListener

public void removeScoringListener(ScoringListener listener)
Description copied from interface: IncentiveManager
Removes a ScoringListener, if it is registered with the IncentiveManager (otherwise this call is ignored).

Specified by:
removeScoringListener in interface IncentiveManager
Parameters:
listener - the ScoringListener to be removed

fireScoringEvent

protected void fireScoringEvent(User source,
                                int id,
                                Concept concept,
                                User ratedUser,
                                Rating rating,
                                double oldRatingValue,
                                String oldValue,
                                Topic oldType,
                                Topic topic,
                                Occurrence occurrence,
                                Synonym synonym)

getVersion

public String getVersion()
Description copied from interface: ConsensusFoundationModule
Returns a version string of the implementation of this module.

Specified by:
getVersion in interface ConsensusFoundationModule
Returns:
the version of the module's implementation