ATG Nucleus

Nucleus is the ATG container for components, provides a heierarchical name space Each component has a unique full name so that pages and other components reference it.creates and initializes component instance on request.Nucleus components are standard JavaBeans. See below the example.

public class Animal{
String name;
int age;
public static void main(String [] args){
    Animal animal=new Animal();
    Animal.name= “Lion”; age=15
    System.out.println(Name is : +“animal.name”);
   System.out.println(Age is : +“animal. age”);
  }
}

Now what exactly did we do here?? 
We created a class Animal, added two variables, name and age to it. Then we created a main () method. Inside the main method we created an object of "Animal" class, set the variables, and we printed them.

Now, the output on our screen is something like:-

Name is: Lion
Age is:15

In our java class, we manually created an object of "Animal" class (see first line in the main method of above program).In ATG we have something called as nucleus, which does the job of creating objects on a "on-demand" basis. 

Depending on how you configure your component , Nucleus services creates objects on need basis and provides a reference for us to use.ATG Framework used IOC design pattern for creating the reference.

Nucleus, being the heart of ATG understands the memory usage and optimization and creates objects ONLY when required/necessary.
When you start up an application, Nucleus reads the configuration path, (a location where we keep our configuration files, which is generally the "config" folder of our ATG module).

For nucleus, to start our component at startup time (when ATG server starts), we add our component to initialServices.
For this, we need to create a configuration file Initial.properties anywhere in our config-path. Next we write the following as its contents:-

initialServices+=/atg/persons/Person.properties
NOTE:”+=” mean overawed the property..


No comments: