de.uka.ipd.consensus.impl
Class EvolutionManagerImpl

java.lang.Object
  extended byde.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
      extended byde.uka.ipd.consensus.impl.EvolutionManagerImpl
All Implemented Interfaces:
ConsensusFoundationManager, ConsensusFoundationModule, EvolutionManager

public class EvolutionManagerImpl
extends AbstractConsensusFoundationModule
implements EvolutionManager

TODO

Version:
2006-06-14
Author:
Thomas Much

Constructor Summary
EvolutionManagerImpl()
           
 
Method Summary
 void addEvolutionListener(EvolutionListener listener)
          Registers a new EvolutionListener.
 void deleteAssociation(User user, Association assoc)
          Deletes an association and all dependant elements (e.g. topics, if it makes sense).
 void deleteAttribute(User user, Topic topic, Attribute attr)
          Deletes an attribute (and all dependant elements if there are any).
 void deleteTopic(User user, Topic topic)
          Deletes a topic and all dependant elements (attributes and, if it makes sense, associations), but not the subtopics of the topic.
 void deleteTopicAndSubtopics(User user, Topic topic)
          Deletes a topic and all dependant elements, including the subtopics of the topic.
 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 EvolutionManager.
 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).
 Topic makeClass(User user, Topic instance)
          Converts an instance topic into a class topic.
 Topic makeInstance(User user, Topic cls)
          Converts an instance topic into a class topic.
 Topic mergeTopics(User user, Topic topic1, Topic topic2)
          Merges two topics.
 void removeEvolutionListener(EvolutionListener listener)
          Removes an EvolutionListener, if it is registered with the EvolutionManager (otherwise this call is ignored).
 void shutdown()
          Called by ConsensusFoundation.shutdown() when the application shuts down.
 
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

EvolutionManagerImpl

public EvolutionManagerImpl()
Method Detail

init

public void init(Properties config,
                 LoggingManager logging,
                 UserManager users,
                 OntologyManager ontology)
          throws Exception
Description copied from interface: EvolutionManager

This method is called by the ConsensusFoundation constructor to initialize the EvolutionManager.

Specified by:
init in interface EvolutionManager
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

deleteTopic

public void deleteTopic(User user,
                        Topic topic)
                 throws EvolutionManagerException,
                        DynamicRightsManagerException
Description copied from interface: EvolutionManager
Deletes a topic and all dependant elements (attributes and, if it makes sense, associations), but not the subtopics of the topic. Especially for class topics this means that subclasses have to be moved higher in the hierarchy somehow.

Specified by:
deleteTopic in interface EvolutionManager
Parameters:
user - the user who wants to delete the topic
topic - the topic to be deleted
Throws:
EvolutionManagerException - if the topic could not be deleted
DynamicRightsManagerException - if the user is not allowed to delete the topic
See Also:
Topic.isClassTopic(), DynamicRightsManager.mayDeleteTopic(User, Topic), OntologyManager.deleteTopic(Topic), EvolutionManager.deleteTopicAndSubtopics(User, Topic)

deleteTopicAndSubtopics

public void deleteTopicAndSubtopics(User user,
                                    Topic topic)
                             throws EvolutionManagerException,
                                    DynamicRightsManagerException
Description copied from interface: EvolutionManager
Deletes a topic and all dependant elements, including the subtopics of the topic. This method must take care if there are cycles in the topic hierarchy.

Specified by:
deleteTopicAndSubtopics in interface EvolutionManager
Parameters:
user - the user who wants to delete the topic
topic - the topic to be deleted
Throws:
EvolutionManagerException - if the topic and its subtopics could not be deleted
DynamicRightsManagerException - if the user is not allowed to delete the topic and its subtopics
See Also:
DynamicRightsManager.mayDeleteTopic(User, Topic), OntologyManager.deleteTopic(Topic), EvolutionManager.deleteTopic(User, Topic)

deleteAssociation

public void deleteAssociation(User user,
                              Association assoc)
                       throws EvolutionManagerException,
                              DynamicRightsManagerException
Description copied from interface: EvolutionManager
Deletes an association and all dependant elements (e.g. topics, if it makes sense).

Specified by:
deleteAssociation in interface EvolutionManager
Parameters:
user - the user who wants to delete the association
assoc - the association to be deleted
Throws:
EvolutionManagerException - if the association could not be deleted
DynamicRightsManagerException - if the user is not allowed to delete the association
See Also:
DynamicRightsManager.mayDeleteAssociation(User, Association), OntologyManager.deleteAssociation(Association)

deleteAttribute

public void deleteAttribute(User user,
                            Topic topic,
                            Attribute attr)
                     throws EvolutionManagerException,
                            DynamicRightsManagerException
Description copied from interface: EvolutionManager
Deletes an attribute (and all dependant elements if there are any).

Specified by:
deleteAttribute in interface EvolutionManager
Parameters:
user - the user who wants to delete the attribute
topic - the topic from which the attribute will be removed
attr - the attribute to be deleted
Throws:
EvolutionManagerException - if the attribute could not be deleted
DynamicRightsManagerException - if the user is not allowed to delete the attribute
See Also:
OntologyManager.deleteAttribute(Attribute)

mergeTopics

public Topic mergeTopics(User user,
                         Topic topic1,
                         Topic topic2)
                  throws EvolutionManagerException,
                         DynamicRightsManagerException
Description copied from interface: EvolutionManager
Merges two topics.

Note that the topic returned is not necessarily one of the argument topics. An implementation may decide to return a newly created topic.

Specified by:
mergeTopics in interface EvolutionManager
Parameters:
user - the user who wants to merge the topics
topic1 - the first topic to be merged
topic2 - the second topic to be merged
Returns:
the merged topic
Throws:
DynamicRightsManagerException - if the user is not allowed to merge the topics
EvolutionManagerException - if the two topics could not be merged
See Also:
DynamicRightsManager.mayMergeTopics(User, Topic, Topic)

makeClass

public Topic makeClass(User user,
                       Topic instance)
                throws EvolutionManagerException,
                       DynamicRightsManagerException
Description copied from interface: EvolutionManager
Converts an instance topic into a class topic.

Specified by:
makeClass in interface EvolutionManager
Parameters:
user - the user who wants to convert the topic into a class topic
instance - the instance topic to be converted
Returns:
the converted class topic
Throws:
DynamicRightsManagerException - if the user is not allowed to convert the topic
EvolutionManagerException - if the instance topic could not be converted into a class topic
See Also:
Topic.isClassTopic()

makeInstance

public Topic makeInstance(User user,
                          Topic cls)
                   throws EvolutionManagerException,
                          DynamicRightsManagerException
Description copied from interface: EvolutionManager
Converts an instance topic into a class topic.

This is more than just calling Topic.setClassTopic() since the implementation has to take care what happens with subclasses of the class topic.

Specified by:
makeInstance in interface EvolutionManager
Parameters:
user - the user who wants to convert the topic into an instance topic
cls - the class topic to be converted
Returns:
the converted instance topic
Throws:
DynamicRightsManagerException - if the user is not allowed to convert the topic
EvolutionManagerException - if the class topic could not be converted into an instance topic
See Also:
Topic.isClassTopic()

addEvolutionListener

public void addEvolutionListener(EvolutionListener listener)
Description copied from interface: EvolutionManager
Registers a new EvolutionListener.

Specified by:
addEvolutionListener in interface EvolutionManager
Parameters:
listener - the EvolutionListener to be added

removeEvolutionListener

public void removeEvolutionListener(EvolutionListener listener)
Description copied from interface: EvolutionManager
Removes an EvolutionListener, if it is registered with the EvolutionManager (otherwise this call is ignored).

Specified by:
removeEvolutionListener in interface EvolutionManager
Parameters:
listener - the EvolutionListener to be removed

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