ATG Interview Question Part-1


Question: ATG Form handler Basic
Answer:
1.If you are creating the custom form handler, make sure it extends GenericeFromhandler.
2.In your custom from handler must be define properties successURL,errorUrl and every property submitted with this fromhandler  must be respectively getters/setters method.
3.Each Submit button should have a preXXX(),handleXXX() and validation () method. In preXXX() avoid the most of cases but if you needed to specifically clear fromException vector, in the session scope component you can added you logic here.
4.Formhandlers scope must be request or session, request scope is always recommended. Sometimes we can define session scope.
5.Each and every jsp page should be associated with one from handler; it may be custom OOTB from handler.
6.Formhandlers should only refer to same scope or higher scope component i.e. session scope Formhandlers should never refer to any request scope component;
7.All page data should be passed through Formhandlers, avoid passing any attribute though request and session.
8.Set the priority of the field to "-10" for required input fields other than submit button, so that it gets invoked after all of the setters have been called
9.Set  the priority of the field to “-10” for required input fields other then submit button ,so that it gets invoked after all of the setters have been called.
10.Return true to be redirect to success page, the follow will be something like this
handleXXX() ,preXXX() return super.checkfromRedirect(successURL,errorURL,request,responce);

Question: What is repository cache modes –item descriptor inherited?
Answer: There are four types of cache mode.
1. Disable: No cache.
2. Simple: Simple Cache; default cache
3. Locked: locked cache. 
4. Distributed: Distributed cache.
We can specify cache mode for an item descriptor as well as its properties, if we specify cache mode for an item descriptor, it will become the default cache mode for all the properties inside that item descriptor unless specified otherwise.

See below example.

Here we are specifying the cache mode locked for the item descriptor 'account', but don’t want the 'balance' property to be cached which if not specified will inherit the cache mode of the item descriptor. So specifying the cache-mode as disabled for this property.

   


           
   

Question: ATG Lock cache How to lock caching work with ATG Repository?
Answer: Advantage: When data changed frequently.
               Disadvantage: deadlock.
Locked caching is based on write locks and read locks. If no servers have a write lock for an item, any number of servers may have a read lock on that item. When a server requests a write lock, all other servers are instructed to release their read locks. Once an item is write locked, no other servers may get a read lock or write lock until the first server releases its write lock. In other words, once a server has a write lock on an item, all access to that item is blocked until the write is completed.

Question: How to ATG class Path Usage and Duplicate class Files in JARS?
Answer: MANIFEST.MF file, this file will specify which order your Application Server has to load the CLASSPATH. So put your updated JAR files before the other one in this Property. Below is the example

ATG-Class-Path: lib/updated.jar lib/old.jar

Question: ATG Implicitly Modules?
Answer: 
1. atg_bootstrap.war: Nucleus is started by the module this also runs the servlet pipeline for DAF and DAS (for JHTML) modules.
DAF servlet pipeline will be used for serving JSP Pages and J2EE Servlet.
DAS Pipeline will be used for serving JHTML pages and Dynamo Servlet

2. atg_bootstrap_ejb.jar: You know how the ATG classes are loaded by the application which you can see inside the atg lib folder generally; there will be a EJB with a single session inside this module. The class loader of this session EJB will take care of loading the classes for ATG application.

3. atg_admin.war: ATG Component Browser or Dynamo Administration UI will be started using this module.

Question: describe order checkout flow?




























Question: Sequence Diagram for commerce pipeline?
Answer: The PipelineManager finds the requested chain. If the requested chain is enabled, PipelineManager calls runProcess () method on it and passes it the user data.
- The runProcess () method in the PipelineChain manages execution of the processors. If is not enabled, thrown exception.








Question Create Custom Servlet Pipeline, Provide one Example?
Answer:
Step 1: Write your servlet, extending InsertableServletImpl
Example: 
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import atg.servlet.*;
import atg.servlet.pipeline.*;

public class MyServlet extends InsertableServletImpl {
  public MyServlet () {}
  public void service (DynamoHttpServletRequest request,
                       DynamoHttpServletResponse response)
       throws IOException, ServletException
  {
    String pathInfo = request.getPathInfo ();
    // Insert here own logic
    passRequest (request, response);
  }

Step 2: Define global scope component in the Nucleus hierarchy. It does not really matter where you put your servlet in the component hierarchy (though the location affects references to other components if you use relative pathnames).
Step 3: Set the insertAfterServlet property of your servlet to point to the path of the pipeline servlet you want your servlet to follow. For example, if you want your servlet to follow the DynamoServlet in the pipeline, use:
                     insertAfterServlet=/atg/dynamo/servlet/pipeline/DynamoServlet
Step 4: Add the path to your servlet to the initialServices property of /atg/dynamo/servlet/Inital.initialServices
                     initialServices+=/myServlet