
This chapter describes how to copy a work done on the eXo Platform server, such as creating navigations, node types and templates, to another eXo Platform servers through these topics:

* [Copy a site's content folder with its version history|#DEV.Cookbook.CopySitesContentFolderWithVersionHistory].
* [Copy navigation nodes of sites|#DEV.Cookbook.CopyNavigationNodesOfSites].
* [Copy templates of node types templates|#DEV.Cookbook.CopyTemplateOfNodeType].
* [Copy the WCM template|#DEV.Cookbook.CopyWCMTemplates].
* [Copy a Taxonomy tree.|#DEV.Cookbook.CopyTaxonomyTree].
* [Copy Metadata templates|#DEV.Cookbook.CopyMetadataTemplates].
* [Copy queries|#DEV.Cookbook.CopyQueries].
* [Copy scripts|#DEV.Cookbook.CopyScripts].
* [Copy drive configurations|#DEV.Cookbook.CopyDriveConfigurations].
* [Copy gadgets|#DEV.Cookbook.CopyGadgets].
* [Restart the server|#DEV.Cookbook.RestartServer].

The procedure of each step will be detailed as follows:

 {docbook}
 <citetitle>
 <para xml:id="DEV.Cookbook.CopySitesContentFolderWithVersionHistory">
 <emphasis role="bold">Step 1. Copy a site's content folder with its version history.</emphasis>
 </para>
 </citetitle>
 {docbook}

*1.* Go to the *Sites Management* drive.

*2.* Open the site node, for example "acme".

*3.* Click *Export Node* to export the node with its version history as below:

!images/how_to_copy_a_site/export_site_nodes2.png|align="center"!

*4.* Select *Export* and *Export Version History* to perform the exporting.

*5.* Navigate to the node where you want to import the file, click *Import Node* to open the *Import Node* form.

*6.* Select the exported nodes and version history to be imported.

!images/how_to_copy_a_site/import_site_nodes2.png|align="center"!

One pop-up message will appear to inform that you have imported successfully.


{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyNavigationNodesOfSites">
<emphasis role="bold">Step 2. Copy navigation nodes of sites.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Go to the *Content Administration* page and add a new drive to both target and source servers.

!images/how_to_copy_a_site/add_portal_system_drive.png|align="center"!

*2.* Export the navigation node.

!images/how_to_copy_a_site/export_site_navigations.png|align="center"!

*3.* Import the nodes navigation.

!images/how_to_copy_a_site/import_site_navigations.png|align="center"!


{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyTemplateOfNodeType">
<emphasis role="bold">Step 3. Copy templates of node types.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Add the *System* drive to both servers.

!images/how_to_copy_a_site/add_system_drive.png|align="center"!

*2.* Open _{noformat}system:/jcr:system/exo:namespaces/{namespace_name}{noformat}_, and export it.

!images/how_to_copy_a_site/export_namespace.png|align="center"!

*3.* Open _{noformat}system:/jcr:system/exo:namespaces/{noformat}_, and import the exported file as described in [*Step 2*|#DEV.Cookbook.CopyNavigationNodesOfSites].

!images/how_to_copy_a_site/import_namespace.png|align="center"!

*4.* Open _{noformat}system:/jcr:system/jcr:nodetypes/{node_type}{noformat}_, and export it.

!images/how_to_copy_a_site/export_node_type.png|align="center"!

*5.* Open _{noformat}system:/jcr:system/jcr:nodetypes/{noformat}_, and import the exported file as described in [*Step 4*|#DEV.Cookbook.CopyWCMTemplates].

!images/how_to_copy_a_site/import_nodetype.png|align="center"!

{note}
If you have some specific JCR namespaces and node types, you need to import them into the new server.
{note}



{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyWCMTemplates">
<emphasis role="bold">Step 4. Copy the WCM template.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Open the *DMS Administration* drive.

*2.* Open _{noformat}dms-system:/exo:ecm/templates/{node_type}{noformat}_, and export it.

!images/how_to_copy_a_site/export_node_type_templates.png|align="center"!

*3.* Open _{noformat}dms-system:/exo:ecm/templates/{noformat}_, and import the exported file.

!images/how_to_copy_a_site/import_node_type_templates.png|align="center"!

Also, for CLV/PCLV templates, you can find all template views defined in the _{noformat}dms-system:/exo:ecm/views{noformat}_ path with:

* userviews: this folder contains views of Sites Explorer with a set of actions.
* templates: where you can find all gtmpl templates of:
** Category Navigation Portlet templates.
** Content List Viewer (CLV) templates and its paginator templates.
** content-browser templates (Deprecated Portlet).
** ecm-explorer templates define how to display nodes in the Sites Explorer portlet, such as CoverFlow template, IconView template.
** Parameterized Content List Viewer (PCLV) templates and its paginator templates.
** *WCM Advanced Search* is used in the *WCM Search* portlet to define the form, layout, result and result's paginator.

If you want to reuse one of the non-predefined templates above, simply export and import it into the new server at the same place.

!images/how_to_copy_a_site/WCM_templates.png|align="center"!

{note}
If you have some specific WCM (CLV/PCLV) views and/or templates of node types, you will need to import them into the new server.
{note}


{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyTaxonomyTree">
<emphasis role="bold">Step 5. Copy a Taxonomy tree.</emphasis>
</para>
</citetitle>
{docbook}


By importing the whole site as described in the [*Copy the site content folder with its version history*|#DEV.Cookbook.CopySitesContentFolderWithVersionHistory] section, you will also have the Taxonomy tree imported. The default location where the site's Taxonomy is placed in a sub-folder named *category*. So, you do not need to export or import them because this step is automatically done. But the Taxonomy tree definition is still not fully imported in the new server. What you need to do is to add this Taxonomy tree definition by following those steps:

*1.* Open the *DMS Administration* drive in the new server.

*2.* Go to _{noformat}dms-system:/exo:ecm/exo:taxonomyTrees/definition/{noformat}_.

*3.* Add a symlink to the *Taxonomy Tree Root Node*, for example _{noformat}collaboration:/sites content/live/acme/categories/acme{noformat}_.

!images/how_to_copy_a_site/select_TaxonomyTree_rootNode.png|align="center"!

The name of symlink is displayed as "acme".

!images/how_to_copy_a_site/select_TaxonomyTree_rootNode2.png|align="center"!

The symlink will be generated as below:

!images/how_to_copy_a_site/select_TaxonomyTree_rootNode3.png|align="center"!

In some cases, to see changes, you need to clear the cache by disconnecting or restarting the server.

!images/how_to_copy_a_site/TaxonomyTree_added_successfully.png|align="center"!

{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyMetadataTemplates">
<emphasis role="bold">Step 6. Copy metadata templates.</emphasis>
</para>
</citetitle>
{docbook}


*1.* Open the *DMS Administration* drive in the new server.

*2.* Go to _{noformat}/exo:ecm/metadata/{meta_data_name}{noformat}_.

*3.* Export and import it in the same location in the new server again.



{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyQueries">
<emphasis role="bold">Step 7. Copy queries.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Open the *DMS Administration* drive in the new server.

*2.* Go to _{noformat}/exo:ecm/queries/{query_name}{noformat}_.

*3.* Export and import it in the same location in the new server again.

{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyScripts">
<emphasis role="bold">Step 8. Copy scripts.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Open the *DMS Administration* drive in the new server.

*2.* Go to _{noformat}/exo:ecm/scripts/ecm-explorer{noformat}_.

You will find three folders referring to the three types of groovy scripts in eXo Platform, including:

* action: The action scripts are launched when an ECM action triggers them. For more information, refer to *Actions Concept*.

* interceptor: Interceptor scripts are triggered before and/or after the JCR node is saved, or when a node is created or edited. They are used to either validate the value entered in a form or to manipulate the newly created node, for example, to map the new node with a forum thread or any other type of discussion areas.

* widget: Widget scripts are used to fill widgets, such as a select box in a dynamic way.

*3.* Export your customized script in the same location in the new server.

{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyDriveConfigurations">
<emphasis role="bold">Step 9. Copy drive configurations.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Open the *DMS Administration* drive in the new server.

*2.* Go to _{noformat}/exo:ecm/exo:drives/{drive_name}{noformat}_.

*3.* Export and import it in the same location in the new server again.

{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.CopyGadgets">
<emphasis role="bold">Step 10. Copy gadgets.</emphasis>
</para>
</citetitle>
{docbook}

*1.* Open the drive that points into the *Portal-System* Workspace.

*2.* Go to your gadget _{noformat}portal-system:/production/app:gadgets/{gadget_namee}{noformat}_.

*3.* Export and import it in the same location in the new server again.

{docbook}
<citetitle>
<para xml:id="DEV.Cookbook.RestartServer">
<emphasis role="bold">Step 11. Restart the server.</emphasis>
</para>
</citetitle>
{docbook}


After importing the site navigation nodes, the site may look quite broken, so you need to restart the server first. After the server is restarted, the site will look like:

!images/how_to_copy_a_site/acme_site_after_import_and_restart.png|align="center"!



