Showing posts with label ATG Repository. Show all posts
Showing posts with label ATG Repository. Show all posts

Versioning your Repository - Expert II

Step 6: Override the AssetResolver component.
Path: /atg/dynamo/service/AssetResolver

additionalAssetSources+=\
/my/
Library_production,\
/my/Address_production,\
/my/Library_staging,\
/my/Address_staging


Above added components appear in the Destination Repositories list in the Admin Console deployment.

Step 7: Override the VersionManagerService component.
Path: /atg/epub/version/VersionManagerService

versionedRepositories+=\
    Address=/my/Address,\
    Library=/my/Library

Above component manages and controls the versioning of assets.

Step 8: Override the ProductionRepositoryMapper component.
Path: /atg/repository/ProductionRepositoryMapper

repositoryMappings+=\
 
/my/Address=/my/Address_production,\
  /my/Library=/my/Library_production


This completes the versioning the repository through components. In next post, we will learn how to change the DDL's for Publishing Schema.

Versioning your Repository - Expert I

Versioning the Repository includes when you wants to manage the your repository items through BCC (Merchandising).

Follow the series of steps to register your repository in BCC.

Step 1: Place the RDF(Repository Defination File) in BCC Module.

Step 2: Place the Component file in BCC Module with following Contents in it.

Path: /my/Library.properties

$class=atg.adapter.gsa.GSARepositoryatg.adapter.version.VersionRepository
$scope=global
repositoryName=Library

# database access- for Publishing Schema, use JTDataSource
dataSource=/atg/dynamo/service/jdbc/SwitchingDataSourceJTDataSource
transactionManager=/atg/dynamo/transaction/TransactionManager

# our XML definitionFile
definitionFiles=/my/library.xml

# XML parsing
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory

# id generation
idGenerator=/atg/dynamo/service/IdGenerator

#Add Following two.
versionManager=/atg/epub/version/VersionManagerService
versionItemsByDefault=true


Step 3: Create the Production and Staging Components (Staging not needed, if you have only Production Workflow)

Path: /my/Library_production.properties

$class=atg.adapter.gsa.GSARepository
$scope=global
repositoryName=Library_production

# database access- use SwitchingDataSource
dataSource=/atg/dynamo/service/jdbc/SwitchingDataSource
transactionManager=/atg/dynamo/transaction/TransactionManager

# our XML definitionFile
definitionFiles=/my/library.xml

# XML parsing
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory

# id generation
idGenerator=/atg/dynamo/service/IdGenerator

lockManager=/atg/dynamo/service/ClientLockManager_production
foreignRepositoryMapper=/atg/repository/ProductionRepositoryMapper


Path: /my/Library_staging.properties

$class=atg.adapter.gsa.GSARepository
$scope=global
repositoryName=Library_staging

# database access- use JTDataSource_staging
dataSource=/atg/dynamo/service/jdbc/JTDataSource_staging
transactionManager=/atg/dynamo/transaction/TransactionManager

# our XML definitionFile
definitionFiles=/my/library.xml

# XML parsing
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory

# id generation
idGenerator=/atg/dynamo/service/IdGenerator

lockManager=/atg/dynamo/service/ClientLockManager_staging



Step 4: Override the ContentRepositories component.

/atg/registry/ContentRepositories

Step 5: Add your custom repositories to ContentRepositories component.



initialRepositories+=/my/Address,\
                              /my/Library
 

DisplayNames, sorting and Grouping- InterMediate II

Display Names using the Resource Bundle (Localising the Labels).

Define resource bundle using following attribute.
    <attribute name="resourceBundle" value="resourceBundleName"/>

ex: <attribute name="resourceBundle" value="my.Resource"/>

Localising the values can be applied at
  • Item-descriptor
  • Property
Labels that can be localised using resource bundle are
  • display-name ( to display-name-resource)
  • description ( to description-resource)
  • category ( to category-resource)
Item-descriptor <item-descriptor name="author" display-name-resource="author" >
<attribute name="resourceBundle" value="my.Resource"/>
.
.
.
</item-descriptor> 


Property
<property name="firstName" column-name="first_name" display-name-resource="firstName" data-type="string"/>
 <attribute name="resourceBundle" value="my.Resource"/>
</property> 

And Resource file would contain following content.
author=Author
firstName=First Name


Grouping Properties and Sorting them in groups.

Properties under each Item-descriptor can be grouped together using "category" attribute at property level.Category attribute can be localised using resource bundle.

<table name="BOOK_MASTER" type="primary" id-column-name="book_id">
        <property name="id" column-name="book_id"/>
        <property name="name" column-name="name" display-name="name" data-type="string" category="basics"/>
        <property name="description" column-name="description" display-name="description" data-type="big string"
category="basics"/>
        <property name="price" column-name="price" display-name="price" data-type="double"
category="additionalInfo"/>
        <property name="pages" column-name="pages" display-name="pages" data-type="int" category="additionalInfo"/>
       <property name="available" column-name="available" display-name="available" data-type="boolean" category="additionalInfo"/>
    </table>


In the above example, properties "name" and "description" are grouped under "Basics" category, and properties "price" , "pages" and "available" are under "AdditionalInfo" category.


Adding resource Bundle to category.
<property name="name" column-name="name" display-name="name" data-type="string" category-resource="basics">
 <attribute name="resourceBundle" value="my.Resource"/>
</property> 


And Resource file contains the value for basics.

To sort the properties under category, use the attribute "propertySortPriority" with value. Depending on the value(-ve to +ve), properties will be sorted. If not provided, will be sorted alphabetically. 

<property name="name" column-name="name" display-name="name" data-type="string" category-resource="basics">




<attribute name="resourceBundle" value="my.Resource"/>
 <attribute name="propertySortPriority" value="0"/>
</property>
 <property name="description" column-name="description" display-name="description" data-type="big string" category-resource="basics">
 <attribute name="resourceBundle" value="my.Resource"/>
  <attribute name="propertySortPriority" value="1"/>
</property>

In above example, property "name" would appear above property "description".

Where are display-names, grouping and sorting comes to help?

Ans: When viewing Items in BCC, ACC. 

Initialising your Repository to ATG Module - InterMediate I

To initialise your repository to ATG Module(Assuming that your ATG Module requires DAS DPS DSS DCS,

Step 1: Override the ContentRepositories component.

/atg/registry/ContentRepositories

Step 2: Add your custom repositories to ContentRepositories component.

initialRepositories+=/my/Address,\
                              /my/Library

If your repository uses Switching Data Soruce, Repository component would be up after SDS(Switching Data Source) component is up.


Using the StartSQLRepository - Beginners IV

StartSQLRepository can be used for following activites,
  1. Verifing the Data Defination XML is correctly formed and complies with the DTD.
  2. Generating the SQL Statements to create tables.
  3. Import the data into DB (Supports both versioned and non-versioned) and exporting the data.
Points 1 and 2 are covered as part of scope. Point 3 will be covered in coming up topics.

Steps for generating DDL using the  StartSQLRepository.


1.    Shut down all the nucleus instances running in machine.(JBOSS, JUNIT)
2.    Create the following folder structure(if not present).
                       <DYNAMO_HOME>\home\localconfig\atg\dynamo\service\jdbc
3.    Create JTDataSource.properties under jdbc folder and place the following content into file.
                        dataSource=/atg/dynamo/service/jdbc/FakeXADataSource
4.    Create FakeXADataSource.properties under jdbc folder and place the following content into file.
$class=atg.service.jdbc.FakeXADataSource
#Below contents vary according the DB
driver=oracle.jdbc.OracleDriver
URL=jdbc:oracle:thin:@<host>:<port>:<SID>
user=my_core
password=my_core

    Above contents can vary according to which DB, you want to refer.

5.    In the Component of your defination file, change the "datasource" to new path(applicable only if your repository was going to be versioned repository).
             dataSource=/atg/dynamo/service/jdbc/JTDataSource

6.   If your repository refers to any OOTB repository, override the OOTB component in <DYNAMO_HOME>\home\localconfig. And provide the "datasoruce"


            dataSource=/atg/dynamo/service/jdbc/JTDataSource

7.   User in FakeXADataSource.properties will be core database if its non-versioned database, else it would be one of switch DB.

8.    Run the startSQLRepository command from <DYNAMO_HOME>\home\bin
   startSQLRepository -m Module_name –repository RepositoryComponentPath -outputSQLFile Path of SQL FILE.

Ex: startSQLRepository -m MyStore -repository /my/Library -outputSQLFile c:\test.sql

P.S : startSQLRepository can be executed using the –server attribute and passing server instance of <DYNAMO_HOME>\home\bin. But servers should contain the above files.


 

Creating your own ATG Repository - Beginners- III

We will be covering the Multi Table, referencing other repositories and One to Many relation in between same repository.

Must read Points:
1. Multi table is used to maintain one to Many relations between Items.
2. Multi table can hold Map, List or Set of items.
3. One item-descriptor can hold N number of Multi tables.

Simple Table below explains concepts of Map, List and Set.


Type\Conditions
Data-type=
multi-column-name=
Set
“set”
Not Required
List
“list”
Seq_number of type “int”(acts as sequence)
Map
“map”
String which acts as key

4. component-item-type if multi valued property needs to be referenced, else component-data-type.
5. id-column-name should be same of primary table.

Step 1: Analyse the Table and data-type.



We will be using "set" to store the Books.

Step 2: Add the Multi column to "author" item.

<item-descriptor name="author" display-name="author" >
   
    <table name="AUTHOR_MASTER" type="primary" id-column-name="author_id">
    ........
    </table>
   
    <table name="AUTHOR_BOOKS" type="multi" id-column-names="author_id">
        <property name="books" column-names="book" display-name="books" data-type="set" component-item-type="book"/>
    </table>
</item-descriptor>

Step 3: Author has primary address, which references to Address Repository.




We will add one more column to primary table of "author" item and reference to Address Repository.

Step 4: Add column to Primary table of "author" item and reference.

<table name="AUTHOR_MASTER" type="primary" id-column-name="author_id">
    ........
    <property name="address" column-names="address" display-name="address" item-type="address" repository="/my/Address"/>
    </table>


repository will hold the referenced repository's Component Path.