ART#104 - What are ATG Components?



Now there is a lot of stuff and terms in ATG which we must understand before we start writing the code..

What is a component and how do i create one?

Components are basically the building blocks of ATG. Practically, a component is a configuration file (a simple text file with .properties extension), which uses a java class.
ATG has specified a specific standard (or syntax), for these configuration files, so that they can use java classes to execute some logic.
So basically, to create this building block known as a component, we need a java class and a configuration file. Now the question is "HOW!!!!". Read on...

Let us create a basic java file, which extends a class "GenericService" which is present out-of-the-box in ATG API. Now mostly we extend GenericService as it has some methods which we mostly require for ATG components. Please note that it is not necessary to extend GenericService.

My Java Class: (put this class in a package in "src" location of your ATG module)

  • It extends GenericeService (optional)
  • It has two variables, viz. name and age.
  • For all variables, we MUST have setters and getters fulfilling JavaBeans standard. (required)
  • For a component, we MUST have a public default constructor (even if it does nothing).
  • Your java class ( should look like:-

package com.mypackage;
public class Person{
String name;
int age;

public Person() {}
public String getName() {return name;}
public void setName(String name) {;}
public int getAge() {return age;}
public void setAge(int age) {this.age=age;}

Now that we have created our java class in the package "com.mypackage" in "src" location of our ATG module, we need to create a corresponding configuration file in our config-path location of our atg module (generally "config" folder in ATG module).

My configuration file: (this file needs to be put in "config" folder {or whatever your config-path is} of your ATG module):-

  • It MUST have a $class variable referencing to your java class (with a fully qualified package name). Our java class is created in "com.mypackage".
  • There are some other out-of-the-box variables which can be written in a configuration file and start with a "$". (for example $scope)
  • The value of the variables defined in the java class are configured here.
  • The file must be placed in config-path of your ATG module (generally "config" folder). For example (<ATG_MODULE>/config/atg/persons/
  • Your configuration file ( should look like:-

Now, our configuration file refers to the class  com.mypackage.Person, and sets the "name" variable as "Stephen" and "age" variable as 20.
Therefore, whenever this component will start, it will initialize these variables with the values present in the configuration file.

Now, please note that ATG identifies and resolves a component by its configuration file. ATG looks for configuration files in the "config-path".
 Now, as per ATG, your component is located at below location:-
It extracts the class from the configuration file, and sets the values of its variables from the configuration file. If a variable is present in the java class, with a setter and getter (which qualify the JavaBeans standard), and no corresponding value is specified in the configuration file, the variable is initialized with the default value as specified by Java standards. (For example, a boolean variable in a class, which has not been specified in the corresponding configuration file, will be initialized with "false". Similarly, a string variable will be initialized with "null"). 

Now, we are aware what ATG components are, and we know how to create them. Still, we have no clue, how would it work, or how would the java code we wrote come into play? Well, we just don't need to worry about that yet.. we will discuss that stuff in our later articles.
Let us move on to a bigger topic "The Nucleus" which would clear many of our doubts... on..




  1. Monis,

    Can we use a parameterized constructor in our component .please tell the reason if yes or no.

  2. Let us go back to basic Java first.
    1. A parametrized constructor, is used to initialize object of a class, with some values, which you pass in the constructor.
    2. If you do NOT provide any constructor, java provides a default constructor(non-parametrized) automatically.
    3. However, if you create a parametrized constructor, java will NOT provide a default (non-parametrized) automatically.

    Now, lets see the ATG perspective of a COMPONENT
    1. Nucleus will always need to have a default (non-parametrized) consructor.
    2. If you do not provide a default constructor, nucleus will not be able to initialize it.
    3. With above being mandatory, if you create ONLY a parametrized constructor, JAVA will not provide a default constructor, and nucleus will not be able to initialize it.
    4. If you DO NOT provide any constructor whatsoever, java will provide a default one.
    5. Therefore, if you create a parametrized constructor, you MUST ALSO create a default constructor manually (as Java will not provide it)
    In this case, it would compile and work as necessary.

    NOTE: Ideally, there should not be any need of a parametrized constructor. Simply because, parametrized constructors take some parameters and are expected to set values of some data members (most of the cases).
    These data members of a class, can be initialized using configuration files with default values.

    Therefore, creating a parametrized constructor would be a very wrong design.
    But, the simple answer to your question is:-
    "Yes, we can have a parametrized constructor for a component's class, but we also have to provide a default constructor manually."

    Let me know if you have any further queries.

    1. I am not convinced with this point :
      1. Nucleus will always need to have a default (non-parametrized) consructor.
      I have created components without providing default constructors without providing the default constructor and it works well.

    2. This comment has been removed by the author.

    3. my 4th point above is the answer to your comment.

  3. Please explain the 3 types of parameters in droplets?

    1. Hi Justin,

      Please refer to the article:-

      You'll find answers to most of your questions here.

  4. Awesome blog brother. Just spotted a typo. Please correct it if you get a chance.
    "done need"

  5. Hi Monis,
    I have successfully deployed CRS 11.1 application in my local. I wanted to edit the existing code , so how can i set up CRS App in eclipse for further modifications.Also please suggest me the Jboss and eclipse version for ATG 11.1.

    1. Hi Sabha,

      You can import the code inside the CRS folder(inside your ATG folder) to your eclipse. From there you can edit the code, re-assemble the EAR and start the server. This way you can play around with CRS.



Get All The Latest Updates Delivered Straight Into Your Inbox For Free!