Monday, December 19, 2011

ATG Repository Basic Concepts


What is an ATG Repository??
A repository is a data access layer that defines a generic representation of a data store. It simplifies the storage and retrieval of data. The manipulations of data are done through the Repository API. Application developers access data only using the interfaces such as Repository and RepositoryItem. Developers can create, modify, query and remove repository items. A repository item is more or less like a Java bean. The ATG platform  includes a set of models for repositories.

1. SQL Repository: uses the Generic SQL Adapter(GSA) to perform a mapping between ATG and data stored in a SQL database.
2.Versioned Repository: is an extension of SQL repository used in ATG Content Administration. It has versions for every set of data.For example a price for a product is edited, new entry will be made with a new version number instead of editing the price.

The SQL repository is implemented through the atg.adapter.gsa package. The main ATG component in the SQL repository is an instance of the atg.adapter.gsa.GSARepository class, which implements the interfaces atg.repository.MutableRepository and atg.repository.content.ContentRepository and which extends the class atg.repository.RepositoryImpl.
Lets keep aside the hardcore theory for now and move to more practical aspects of repositories.
A repository is a collection of repository items. In general, a repository item corresponds to the smallest uniquely identifiable entity in the underlying data store. Each repository item is made of properties and these properties store the data and thus makes a repository item. These properties of a repository item are defined inside the repository’s ITEM DESCRIPTORs. Properties of repository items may be single-valued or multi-valued.
Its still confusing…??? be patient,towards the end there is a something informative which will help you enhance your understanding.


What is an Item Descriptor?
Lets keep it simple with the help of an SQL Repository, for example, each database table have its own repository item descriptor. Sometimes a JOIN of multiple tables into a single item descriptor.
Points to Note:
ATG repositories support Java collections and hence we can store a List, Map or  Arrays.
ATG repositories allow one-one, one – many and many- many relationships.
Here is what i have promised: how to setup a repository..??
We have a database table (eg:  tb_tango).
Now create a property file which specifies the repository mapping xml file, class file, data Source etc. Lets name it as “sampleFile.properties“. The mapping xml(repositoryMapping.xml) file specifies the repository item desciptors. And the final step is registering the repository with dynamo


sampleFile.properties”
$class=atg.adapter.gsa.GSARepository
definitionFiles=Folder Structure/repositoryMapping.xml
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
transactionManager=/atg/dynamo/transaction/TransactionManager
idGenerator=/atg/dynamo/service/IdGenerator
dataSource=/atg/dynamo/service/jdbc/dataSourceFile
* The “dataSourceFile”  is yet another property file where the JDBC connections and database driver,server name, user, password etc are specified.


repositoryMapping.xml

<!DOCTYPE gsa-template PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN"
"http://www.atg.com/dtds/gsa/gsa_1.0.dtd">
<gsa-template>
<item-descriptor name="tango">
<table name="tb_tango" type="primary" id-column-name="id">
<property name="id" column-names="id" data-type="string"/>
<property name="profession" column-names="prof" data-type="string"/>
<property name="firstname" column-names="fname" data-type="string"/>
</table>
</item-descriptor>
</gsa-template>




4 comments:

Anonymous said...

Its mind blowing

Anonymous said...

great blog...so useful..hats off

Anonymous said...

Keep it up
hats off to your explaination

please write some blogs about ATG Control Center

Anonymous said...

very informaive

Popular Posts