Search code examples
atgatg-dynamo

How to create a repository in ATG?


i would like to know how to create a new repository in ATG. like what all steps are needed to be included? Do i need to create a properties file?


Solution

  • In order to create a new repository, You need to follow these steps if you want to create a repository that uses sql database in as the datastore.

    1. Create a properties file
    2. Create tables you want to map to the repository
    3. Create a definition XML files to map repository item-descriptors and their properties to the respective tables.

    MyRepository.properties

    $class=atg.adapter.gsa.GSARepository
    repositoryName=MyRepository
    definitionFiles=atg/test/repositories/MyRepository.xml
    XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
    transactionManager=/atg/dynamo/transaction/TransactionManager
    idGenerator=/atg/dynamo/service/IdGenerator
    dataSource=/atg/dynamo/service/jdbc/JTDataSource
    lockManager=/atg/dynamo/service/ClientLockManager
    

    The above properties files ensures that a new repository component is created and MyRepository.xml will be marked as its definition file.

    The content of the MyRepository.xml file should be something like below...

    MyRepository.xml

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE gsa-template SYSTEM "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">
    <gsa-template>
        <header>
            <name>New Repository creation</name>
            <author>Jyothi Prasad Buddha</author>
        </header>
        <item-descriptor name="myRepo" cache-mode="simple">
            <table name="my_repo" type="primary" id-column-names="id">
                <!-- properties that may (or may not) be used as primary keys -->
                <property name="name" data-types="String" />
                <property name="age" data-types="int" />
            </table>
        </item-descriptor>
    </gsa-template>
    

    However you will have to create the the necessary tables before you start atg instance. The above xml files refers to a table named my_repo which has comlumns name and age.