This document describes the process for adding a schema to XNAT to handle new data types, a common task in adding new data to IR.  In general, the process involves two steps: updating the XNAT back end with a schema and updating the XNAT front end to handle the data type(s) described by the new schema.  Instructions that refer to this document should give a schema file (in NITRCSRC/promotion/schemas; something like "candi_share.xsd"), a data type (something like ir:CandiShareSegData), and singular and plural names for the data type (e.g. Segmentation/Segmentations).

These instructions are adapted from the "Adding custom data types to XNAT" section of http://docs.xnat.org/Customizing+XNAT.

BACK END UPDATE

Set XNAT_HOME to the base of the XNAT build directory.

Create $XNAT_HOME/projects/ir/src/schemas/nitrc and copy the schema file (e.g. candi_share.xsd) to this directory.

Add the following line to <Models> in $XNAT_HOME/projects/ir/InstanceSettings.xml, where FILENAME is replaced by the name of the schema file:

    <Data_Model File_Name="FILENAME" File_Location="%XDAT_PROJECT%/schemas/nitrc" DB="%DB_NAME%"/>

Update the XNAT build:

    cd $XNAT_HOME
    export JAVA_HOME=/usr/java/default/
    sh bin/update.sh

Update the XNAT database:

    psql -U xnat < $HOME/deployments/ir/sql/ir-update.sql

    Deploy the updated webapp:

    cd .../NITRCSRC/feddata2/xnat
    slide
    /etc/rc.d/init.d/tomcat5 stop
    cp deployments/ir/target/ir.war  /usr/share/tomcat5/webapps/
    /etc/rc.d/init.d/tomcat5 start
    exit

FRONT END UPDATE

1) Disable nitrc login module by commenting out AUTHENTICATION_CLASS in the file /usr/share/tomcat5/webapps/ir/WEB-INF/conf/authentication.properties
2) Go to http://test.nitrc.org/ir/app/template/Login.vm
3) Login with admin/admin


4) Go to Administer -> Data Types -> Setup Additional Data Type.  Select the data type (e.g. ir:CandiShareSegData); on the first configuration page, use the defaults except:

    Is this Data Type Secure?  set to false

    Singular Name              set to the singular name (e.g. Segmentation)

    Plural Name                set to the plural name (e.g. Segmentations)

Leave all the defaults on the next configuration page, then select "edit" and set "Is Secure 'Read'?" to false.

5) Repeat step 4 for CandiShareRegData. Use Registration and Registrations for the singular/plural names.

6) Restore the nitrc login module from step 1.
