There are some extension points in eXo Knowledge, so that you can control how these components work by implementing or extending default implementations, then reconfigure these new components in the _configuration.xml_ file.

h1. ForumEventLifeCycle {anchor:id=KSref.ExtensionPoints.ForumEventLifeCycle}
h2. Overview {anchor:id=KSref.ExtensionPoints.ForumEventLifeCycle.Overview}

{{ForumEventLifeCycle}} enables you to listen to the lifecycle of a forum. By implementing ForumEventLifeCycle, you can be notified of new posts and replies, categories and topics. This installation will be injected when the data flow is called to save data. 

h2. Configuration plug-in {anchor:id=KSref.ExtensionPoints.ForumEventLifeCycleConfiguration}

You can find the configuration file of this component at: _ext/social-integration/src/main/resources/conf/portal/configuration.xml_.

For example, to add a Forum to a space of the Social application and keep new activities of Forum (such as new posts and topics) updated to the activities of space, do as follows:	

{code:xml}
<external-component-plugins>
  <target-component>org.exoplatform.forum.service.ForumService</target-component>
  <component-plugin>
    <name>ForumEventListener</name>
    <set-method>addListenerPlugin</set-method>
    <type>org.exoplatform.ks.ext.impl.ForumSpaceActivityPublisher</type>
  </component-plugin>
</external-component-plugins>
{code}

h2. Tutorial {anchor:id=KSref.ExtensionPoints.ForumEventLifeCycleTutorial}
To use *ForumEventLifeCycle* class, do the following steps:

*1.* Create a new class that extends _ForumEventListener_.

For example: class _ABCActivityPublisher_

{code:java}
public class ABCActivityPublisher extends ForumEventListener {
..............
}
{code}
*2.* Override fuctions in this created class. In each function, you can write anythings to meet your needs.

{code:java}
public class ABCActivityPublisher extends ForumEventListener {

  public void saveCategory(Category category){
    ....
  }

  public void saveForum(Forum forum){
    ....
  }

  public void addTopic(Topic topic, String categoryId, String forumId)){
    ....
  }

  public void updateTopic(Topic topic, String categoryId, String forumId){
    ....
  }

  public void addPost(Post post, String categoryId, String forumId, String topicId){
    ....
  }

  public void updatePost(Post post, String categoryId, String forumId, String topicId){
    ....
  }
}
{code}

* The function _saveCategory_ is called when a category is added and/or edited.

* The function _saveForum_ is called when a forum is added and/or edited.

* The function _addTopic_ is called when a topic is added.

* The function _updateTopic_ is called when a topic is updated.

* The function _addPost_ is called when a post is added.

* The function _updatePost_ is called when a post is updated.

*3.* Add a new configuration to the _configuration.xml_ file with the type that is the class created in the *Step 1*.

{code:xml}
<external-component-plugins>
  <target-component>org.exoplatform.forum.service.ForumService</target-component>
  <component-plugin>
    <name>ForumEventListener</name>
    <set-method>addListenerPlugin</set-method>
    <type>{package}.{class name}</type>
  <!-- example
  <type>org.exoplatform.ks.ext.impl.ABCActivityPublisher</type>
  -->
  </component-plugin>
</external-component-plugins>
{code}


h1. AnswerEventLifeCycle {anchor:id=KSref.ExtensionPoints.AnswerEventLifeCycle}
h2. Overview {anchor:id=KSref.ExtensionPoints.AnswerEventLifeCycle.Overview}
{{AnswerEventLifeCycle}} installs event updates for the Answers data that is injected while saving answers, saving questions or posting comments.

h2. Configuration plug-in {anchor:id=KSref.ExtensionPoints.AnswerEventLifeCycleConfiguration}

You can find the configuration file of this component at:_ext/social-integration/src/main/resources/conf/portal/configuration.xml_.

For example, to add Answers to a space of the Social application and keep new activities of Answers updated to the activities of space, do as follows:

{code:xml}
<external-component-plugins>
  <target-component>org.exoplatform.faq.service.FAQService</target-component>
  <component-plugin>
    <name>AnswerEventListener</name>
    <set-method>addListenerPlugin</set-method>
    <type>org.exoplatform.ks.ext.impl.AnswersSpaceActivityPublisher</type>
  </component-plugin>
</external-component-plugins>
{code}

In which, {{AnswersSpaceActivityPublisher}} is the class to implement {{ForumEventLifeCycle}}.

h2. Tutorial {anchor:id=KSref.ExtensionPoints.AnswerEventLifeCycleTutorial}

To use the *AnswerEventLifeCycle* class, do the following steps:

*1.* Create a new class that extends _AnswerEventListener_.

For example: _ABCActivityPublisher_

{code:java}
public class ABCActivityPublisher extends AnswerEventListener {
  ....
}
{code}

*2.* Override fuctions in this created class. In each function, you can write anything to meet your needs.

{code:java}
public class ABCActivityPublisher extends AnswerEventListener {

  public void saveQuestion(Question question, boolean isNew){
    ....
  }

  public void saveAnswer(String questionId, Answer answer, boolean isNew){
    ....
  }

  public void saveAnswer(String questionId, Answer[] answers, boolean isNew){
    ....
  }

  public void saveComment(String questionId, Comment comment, boolean isNew){
    ....
  }
}
{code}

* The function _saveQuestion_ is called when a question is added and/or edited.
* The function _saveAnswer_ is called when an answer is added and/or edited.
* The function _saveAnswer_ is called when answers are added and/or edited.
* The function _saveComment_ is called when a comment is added and/or edited.



*3.* Add a new configuration to the _configuration.xml_ file with the type that is the class created in the *Step 1*.

{code:xml}
<external-component-plugins>
  <target-component>org.exoplatform.faq.service.FAQService</target-component>
  <component-plugin>
    <name>AnswerEventListener</name>
    <set-method>addListenerPlugin</set-method>
    <type>{package}.{class name}</type>
  <!-- example
  <type>org.exoplatform.ks.ext.impl.ABCActivityPublisher</type>
  -->
  </component-plugin>
</external-component-plugins>
{code}

h1. BBCodeRenderer {anchor:id=KSref.ExtensionPoints.BBCodeRenderer}

{{BBCodeRenderer}} is used in the core of eXo Knowledge to render BBCodes. In which, the data input is text, containing BBCode tags. The data output will be BBCode tags which have been encrypted into HTML tags.

You can find the configuration file of this component at: _extension/webapp/src/main/webapp/WEB-INF/ks-extension/ks/forum/bbcodes-configuration.xml_.

For example, to register BBCodeRenderer, do as follows:

{code:xml}
<external-component-plugins>
  <target-component>org.exoplatform.ks.rendering.MarkupRenderingService</target-component>
  <component-plugin>
    <name>BBCodeRenderer</name>
    <set-method>registerRenderer</set-method>
    <type>org.exoplatform.ks.rendering.spi.RendererPlugin</type>
    <description>BBCode renderer</description>
    <init-params>
      <object-param>
        <name>renderer</name>
        <description>Extended BBCodeRenderer</description>
        <object type="org.exoplatform.ks.bbcode.core.BBCodeRenderer">
          <field name="bbCodeProvider">
            <object type="org.exoplatform.ks.bbcode.core.ExtendedBBCodeProvider"/>
          </field>
        </object>
      </object-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
{code}

In which, {{ExtendedBBCodeProvider}} is the class to implement {{BBCodeProvider}}.