{docbook}
<highlights>
    <itemizedlist>
      <listitem>
        <para>
          <emphasis role="bold">
            <link linkend="KSref.ExtensionPoints.ForumEventLifeCycle">ForumEventLifeCycle</link>
          </emphasis> </para>
          <para>Introduction to ForumEventLifeCycle that enables you to listen to the lifecycle of a forum, its configuration plug-in, and steps to use the ForumEventLifeCycle class.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">
            <link linkend="KSref.ExtensionPoints.AnswerEventLifeCycle">AnswerEventLifeCycle</link>
          </emphasis> </para>
          <para>Introduction to AnswerEventLifeCycle that installs event updates for the Answers data, its configuration plug-in, and steps to use the AnswerEventLifeCycle class.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">
            <link linkend="KSref.ExtensionPoints.BBCodeRenderer">BBCodeRenderer</link>
          </emphasis> </para>
          <para>Introduction to BBCodeRenderer that is used in the core of Knowledge to render BBCodes, its configuration file, and how to register BBCodeRenderer.</para>
      </listitem>
    </itemizedlist>
	</highlights>
{docbook}

There are some extension points in 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.

{docbook}
<para>
<prompt>
   <emphasis role="bold">See also</emphasis>
</prompt>
</para>
{docbook}

* [Internal API|#KSref.DeveloperReference.InternalAPI]
* [Wiki Service API|#KSref.DeveloperReference.WikiService]
* [FAQ Template Configuration|#KSref.DeveloperReference.FAQTemplateConfiguration]
* [Actions over a wiki page from external jars|#KSref.DeveloperReference.Extend_actions_over_a_wiki_page_from_external_jars]
* [JCR structure|#KSref.JCRStructure]


h1. ForumEventLifeCycle {anchor:id=KSref.ExtensionPoints.ForumEventLifeCycleRoleNotInToc}
{{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.

{docbook}
<para xml:id="KSref.ExtensionPoints.ForumEventLifeCycleConfiguration">
<citetitle>
<emphasis role="bold">
Configuration plug-in
</emphasis>
</citetitle>
</para>
{docbook}

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}


{docbook}
<para xml:id="KSref.ExtensionPoints.ForumEventLifeCycleTutorial">
<citetitle>
<emphasis role="bold">
Tutorial
</emphasis>
</citetitle>
</para>
{docbook}

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.AnswerEventLifeCycleRoleNotInToc}
{{AnswerEventLifeCycle}} installs event updates for the Answers data that is injected while saving answers, saving questions or posting comments.


{docbook}
<para xml:id="KSref.ExtensionPoints.AnswerEventLifeCycleConfiguration">
<citetitle>
<emphasis role="bold">
Configuration plug-in
</emphasis>
</citetitle>
</para>
{docbook}

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}}.

{docbook}
<para xml:id="KSref.ExtensionPoints.AnswerEventLifeCycleTutorial">
<citetitle>
<emphasis role="bold">
Tutorial
</emphasis>
</citetitle>
</para>
{docbook}

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.BBCodeRendererRoleNotInToc}
{{BBCodeRenderer}} is used in the core of 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}}.