The Initialization plug-in component defines the default Forum data in the *.xml* file, including categories, forums, topics and posts.

When the Forum Service runs, it will get values which are returned from the Initialization plug-in component to initialize default data of the Forum.

h1. Configuration {anchor:id=KSref.ForumInitializer.Configuration}
This section covers the following topics:
* [Default forum data|#KSref.ForumInitializer.DefaultForumData]
* [Forum array|#KSref.ForumInitializer.ForumArray]
* [Forum topics|#KSref.ForumInitializer.ForumTopics]

h2. Default forum data {anchor:id=KSref.ForumInitializer.DefaultForumData}

The default forum data is configured in the _{{{war:webapp/WEB-INF/conf/ksdemo/ks/services-configuration.xml}}}_ file.

In particular, when the ForumService starts, the Initialization plug-in component is called. Next, the _services-configuration.xml_ file is executed. The component-plugin named _addInitialDefaultDataPlugin_ will refer to _org.exoplatform.forum.service.conf.InitializeForumPlugin_ to execute some objects to create default data for the Forum application. 

{code:xml}
<component-plugin>
  <name>default.data</name>
  <set-method>addInitialDefaultDataPlugin</set-method>
  <type>org.exoplatform.forum.service.conf.InitializeForumPlugin</type>
  <description>description</description>
  <init-params>
    <object-param>
      <name>livedemo.default.configuration</name>
      <description>initial data for live demo</description>
      <object type="org.exoplatform.forum.service.conf.ForumInitialData">
        <field name="categories">
          <collection type="java.util.ArrayList">
            <value>
              <object type="org.exoplatform.forum.service.conf.CategoryData">
                <field name="owner">
                  <string>root</string>
                </field>
                <field name="name">
                  <string>Knowledge Suite</string>
                </field>
                <field name="description">
                  <string>All about eXo KS</string>
                </field>
                <field name="forums">
                  <collection type="java.util.ArrayList">
                    <value>
                      <object type="org.exoplatform.forum.service.conf.ForumData">
                        <field name="owner"><string>root</string></field>
                        <field name="name"><string>Live demo</string></field>
                        <field name="description"><string>Questions about this demo</string></field>
                        <field name="topics">
                          <collection type="java.util.ArrayList">
                            <value>
                              <object type="org.exoplatform.forum.service.conf.TopicData">
                                <field name="name"><string>Demo data policy</string></field>
                                <field name="icon"><string>Shield</string></field>
                                <field name="owner"><string>root</string></field>
                                <field name="content"><string>
                                Welcome to eXo Knowledge Suite live demo!
                                We hope you enjoy discovering eXo Forum and FAQ applications features. 
                                You don't need to be logged in to see the applications in action.
                                But the power of KS lies in the rich set of admin/moderation features.
                                We didn't want you to miss them so, when you [b][url="/portal/public/classic/register"]
                                create a demo account[/url][/b], you will be granted full permissions.
                                Anybody can become an administrator or a moderator and play in the sandbox!
                                As a consequence, the data for this forum (including the accounts) is not meant to stay.
                                [b][center]WE MAY RESET FORUMS AND FAQS ANYTIME[/center][/b]
                                Enjoy and don't forget to send feedback at [email]ks@exoplatform.com[/email]</string></field>
                              </object>
                            </value>
                          </collection>
                        </field>
                      </object>
                    </value>
                  </collection>
                </field>
              </object>
            </value>
          </collection>
        </field>
      </object>
    </object-param>
  </init-params>
</component-plugin>
{code}


* In which,
|| Name || Set-method || Type || Description ||
| *default.data* | {{addInitialDataPlugin}} | {{org.exoplatform.forum. service.conf. InitializeForumPlugin}} | The initial default data of Forum. |

* Init-param
|| Name || Possible value || Default value || Description |
| *livedemo.default. configuration* | {{object}} | {{org.exoplatform.forum. service.conf. ForumInitialData}} | The initial data for live demo. |


* Category array

After the _org.exoplatform.forum.service.conf.InitializeForumPlugin_ object has been executed, the _org.exoplatform.forum.service.conf.ForumInitialData_ object will be called. It returns a category array. The value of category array is defined by the _org.exoplatform.forum.service.conf.CategoryData_ object as below:

{code:xml}
<object-param>
  <name>livedemo.default.configuration</name>
  <description>initial data for live demo</description>
  <object type="org.exoplatform.forum.service.conf.ForumInitialData">
    <field name="categories">
      <collection type="java.util.ArrayList">
        <value>
          <object type="org.exoplatform.forum.service.conf.CategoryData">
            <field name="owner">
              <string>root</string>
            </field>
            <field name="name">
              <string>Knowledge Suite</string>
            </field>
            <field name="description">
              <string>All about eXo KS</string>
            </field>
            ...
          </object>
        </value>
      </collection>
     </field>
  </object>
</object-param>
{code}

* Category includes some basic data which are defined in the *field* tag with a specific name as below:

{code:xml}                              
<field name="owner">
  <string>root</string>
</field>
<field name="name">
  <string>Knowledge Suite</string>
</field>
<field name="description">
  <string>All about eXo KS</string>
</field>
{code}

In which:

|| Field || Possible value || Default value || Description ||
| *owner* | {{user id}} | {{root}} | The creator of Category. |
| *name* | {{string}} | {{Knowledge Suite}} | The title of Category. |
| *description* | {{string}} | {{All about eXo KS}} | The brief description of Category. |

* Modify values of Category

Values of the default Category can be changed by editing text values in the _string_ tag of each _field_ by the other one.
In the sample code above, the _org.exoplatform.forum.service.conf.CategoryData_ object is called. It means that only one default Category is defined. If you want to define more default Categories, repeat calling the _org.exoplatform.forum.service.conf.CategoryData_ object and define values for the new Category with the sample code as below:

{code:xml}
<value>
  <object type="org.exoplatform.forum.service.conf.CategoryData">
    <field name= " ">                             
      ...  
    </field> 
  </object>
</value>
{code}

h2. Forum array {anchor:id=KSref.ForumInitializer.ForumArray}

Category may contain one or more Forums. The value of the Forum is defined in the *forums* field. It returns a forum array. The value of forum array is defined by the *org.exoplatform.forum.service.conf.ForumData* object as below:

{code:xml}
<field name="forums">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.forum.service.conf.ForumData">
        <field name="owner"><string>root</string></field>
        <field name="name"><string>Live demo</string></field>
        <field name="description"><string>Questions about this demo</string></field>
        ...
      </object>
    </value>
  </collection>
</field>
{code}

- Basic Forum data

Forum includes some basic data which are defined in the *field* tag with the specific name as above.

In which:

|| Field || Possible value || Default value || Description ||
| *owner* | {{user id}} | {{root}} | The creator of default Forum. |
| *name* | {{string}} | {{Live demo}} | The name or title of default Forum. |
| *description* | {{string}} | {{Questions about this demo}} | The brief description of default Forum. |

The default Forum values can be changed by editing text values in the _string_ tag of each _field_ by the other one.

In the sample code above, the _org.exoplatform.forum.service.conf.ForumData_ object is called only one time. It means that only one default Forum is defined inside the default Category named _Knowledge Suite_. If you want to define more default Forums, repeat calling the _org.exoplatform.forum.service.conf.ForumData_ object and define values for the new Forum with the sample code as below:

{code:xml}
<value>
  <object type="org.exoplatform.forum.service.conf.ForumData">
    <field name=" ">
      ...
    </field>
  </object>
</value>
{code}

h2. Forum topics {anchor:id=KSref.ForumInitializer.ForumTopics}

* Forum may contain one or more topics. The value of topic is defined in the *topics* field. It returns a topic array. The value of topic array is defined by the _org.exoplatform.forum.service.conf.TopicData_ object as below:

{code:xml}
<field name="topics">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.forum.service.conf.TopicData">
        <field name="name"><string>Demo data policy</string></field>
        <field name="icon"><string>Tux</string></field>
        <field name="owner"><string>root</string></field>
        <field name="content"><string>Welcome to eXo Forum live demo. ... at anytime.</string></field>
        ...
      </object>
    </value>
  </collection>
</field>
{code}

A topic includes some basic data which are defined in the _field_ tag with a specific name as above.

In which:

|| Field || Possible value || Default value || Description ||
| *name* | {{string}} | {{Demo data policy}} | The name or title of default topic. |
| *icon* | {{string}}| {{Tux}} | The default icon of default topic. |
| *owner* | {{user id}} | {{root }} | The creator of default topic. |
| *content* | {{string}} | {{Welcome to eXo Forum live demo...at anytime.}} | The main content of default topic. |

The values of default topic can be changed by editing text values in the _string_ tag of each _field_.

With the sample code above, the _org.exoplatform.forum.service.conf.TopicData_ object is called only one time. It means that only one default topic is defined inside the default Forum named _Live demo_. If you want to define more default topics, repeat calling the _org.exoplatform.forum.service.conf.TopicData_ object and define values for the new topic with the sample code as below:

{code:xml}
<value>
  <object type="org.exoplatform.forum.service.conf.TopicData">
    <field name=" ">
      ...
    </field> 
  </object>
</value>
{code}

* Topic may contain one or more posts. The value of the post is defined in the _posts_ field. It returns a post array. The value of the post array is defined by the _org.exoplatform.forum.service.conf.PostData_ object as below:

{code:xml}
<field name="posts">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.forum.service.conf.PostData">
        <field name="name"><string>Reply: Demo data policy</string></field>
        <field name="icon"><string>IconsView</string></field>
        <field name="owner"><string>root</string></field>
        <field name="content"><string>Enjoy and don't forget to send feedback at ks@exoplatform.com</string></field>
        ...
      </object>
    </value>
  </collection>
</field>
{code}

A post includes some basic data which are defined in the _field_ tag with a specific name as above.

In which:

|| Field || Possible value || Default value || Description ||
| *name* | {{string}} | {{Reply: Demo data policy}} | The name or title of default post.|
| *icon* | {{string}} | {{IconsView }} | The default icon of default post.|
| *ownwer* | {{user id}} | {{root}} | The creator of default post.|
| *content* | {{string}} | {{Enjoy and don't forget to send feedback at ks@exoplatform.com }} | The main content of default post.|

The default post values can be changed by editing text values in the _string_ tag of each _field_.

With the sample code above, the *org.exoplatform.forum.service.conf.PostData* object is called only one time. It means that only one default post is defined inside the default topic named *Demo data policy*. If you want to define more default posts, repeat calling the *org.exoplatform.forum.service.conf.PostData* object and define values for the new post with the sample code as below:

{code:xml}
<value>
  <object type="org.exoplatform.forum.service.conf.PostData">
    <field name=" ">
      ...
    </field> 
  </object>
</value>
{code}

By default, the default Forum data can only be changed by modifying the _services-configuration.xml_ file.

At runtime, the new changes in the _services-configuration.xml_ file will be executed and updated. The default Forum data will be created correspondingly.

h1. Initial Data Plugin {anchor:id=KSref.ForumInitializer.InitialDataPlugin}

The Initial Data plugin is configured in the _services-configuration.xml_ file.
In details, at runtime of Forum Service, the Initialization plugin component is called, the _services-configuration.xml_ file will be executed. The component-plugin named _addInitialDataPlugin_ will refer to _org.exoplatform.forum.service.conf.ForumInitialDataPlugin_ to import some objects to create data for the Forum service.
The default data in the .zip or .xml file is initialized as follows:

{code:xml}
<component-plugin>
  <name>technical.forum</name>
  <set-method>addInitialDataPlugin</set-method>
  <type>org.exoplatform.forum.service.conf.ForumInitialDataPlugin</type>
  <description>Initialize</description>
  <init-params>
    <values-param>
      <name>locations</name>
      <description>location where Forum export format file is stored</description>
      <value>war:/data/forum/data-full-forum.zip</value>
      <!-- value>war:/data/forum/forumCategory.xml</value -->
    </values-param>
  </init-params>
</component-plugin>
{code}

- In which:

|| Name || Set-Method || Type || Description ||
| *technical.forum* | {{addInitialDataPlugin}} | {{org.exoplatform.forum.service.conf.ForumInitialDataPlugin}} | Initialize the data plugin. |

- Init-params
|| Name || Possible values || Default value || Description ||
| *locations* | {{String}} | {{war:/data/forum/data-full-forum.zip}} | The location where the Forum export format file is stored. |