Blog from an ATG Developer

May 22, 2009

White Space problem in ATG Application

Filed under: ATG, JSP — madhulal @ 9:11 am
Tags: , , ,

We had an issue in one of the previous projects. The problem is that the html page getting generated has more white spaces and the resulting html size is too much. We can avoid this thing by modifying the deployment descriptor.

<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>

Also we can use the following pattern to reduce white spaces alternatively in dsp pages.

<dspel:page
><dspel:droplet name=”/test”
><dspel:oparam name=”output”
>Name: <dspel:valueof param=”test”
/></dspel:oparam
></dspel:droplet
></dspel:page>

Another approach is to use JSP comments instead of new lines.

<dspel:page><%–
–%><dspel:droplet name=”/test”><%–
–%><dspel:oparam name=”output”><%–
–%>Name: <dspel:valueof param=”test”/><%–
–%></dspel:oparam><%–
–%></dspel:droplet><%–
–%></dspel:page>

NB:- I know the code fragments provided in the topics are very low in readability. Please blame WordPress….

Reference:
1. http://betweengo.com/2008/08/22/trim-white-space-from-jsp/
2. http://www.caucho.com/resin-3.0/jsp/faq.xtp

May 14, 2009

Encryption in ATG

Filed under: ATG, Encryption — madhulal @ 11:39 am

The Out of the box implementation uses the MD5 encryption algorithm.  Suppose we need to have some other encryption algorithm over MD5. My requirement was to add SHA-256 over the already encrypted value with MD5. The following are the changes I had done to get it done.

The component which does the encryption is DigestPasswordHasher. We need to override the encryptPassword() method.

The attached is the code fragment used . The copy and paste of the code seems weird. So I am attaching the file.

See it here.

ATG User Input Sample Code

Filed under: ATG, Learning — madhulal @ 11:09 am

The attached file contains the code for getting the user inputs. The jsp file gets the input from user in various forms.

1. Text field
2,. Checkbox
3. Dropdowns
4. Radio buttons

The zip file contains the FormHandler other than the jsp file.
Download it

April 19, 2009

Getting Started with ATG – jBoss and Oracle

Filed under: ATG, Learning, Work Related — madhulal @ 2:55 pm
Tags: ,
When I write this note, the present ATG version is 9. For couple of days, being in the comfort of home, I have been trying to create a new project in ATG9 on Windows Xp. I have just finished it successfully. So the steps are as follows.

  1. Extract jboss-4.2.0.GA.zip to one of your locale drives.

  2. Install the j2dk you require. I installed jdk1.5.0_11.

  3. Start the installation of ATG9.

    1. We need to specify the application server(jBoss) and jdk paths.

    2. Let the rest be the defaults.

    3. Finish the installation.

    4. Copy the license files to ATG/ATG9.0/home/localconfig

    5. ATG recommends using the following setting for jBoss

JAVA_OPTS=”-server -Xms2048m -Xmx3072m -XX:MaxPermSize=768m

-XX:MaxNewSize=768m -Dsun.rmi.dgc.server.gcInterval=3600000 –

Dsun.rmi.client.gcInterval=3600000″

  1. Now the DB. I hate this part. It took most of my time.

    1. I chose Oracle10g as my DB.

    2. No adventures. Go with the Basic Installation.

    3. Finish the installation. It will create a sample db too.

    4. Now go to Start Menu -> All Programs -> Oracle – OraDb10g_home1 ->Configuration and Migration Tools . Click on the Database Configuration Assistant.

    5. This will help you to create a new db. No adventures again. Just give the db name(SID will be the same). Go till the last screen, which has a ‘Password Management ‘ button.

    6. Click on it. Give the desired passwords for the SYS and SYSTEM users and unlock the required users.

    7. Then finish and exit the Oracle installation.

    8. Start SQLPlus or some Oracle Client. I prefer sqldeveloper.(Freeware).

    9. Connect to the newly created DB with SYS/ with role selected as DBA.

    10. Our aim is to create a user for the project specific use. For this purpose we need to create a new tablespace. The following sql script will create the tablespace named ts_learn.

      create tablespace ts_learn logging datafile ‘G:\Learrning\Oracle\product\10.2.0\oradata\learn\ts_learn.dbf’ size 32m autoextend on next 32m maxsize 2048m extent management local;

    11. Now we can create an user in this tablespace for our project. sql is as follows

      create user learn1 identified by learn1 default tablespace ts_learn;

    12. Grant DBA role to the newly created user

      grant dba to learn1;

    13. Now we can disconnect the SYSTEM user and connect using the newly created user(learn1).

    14. Here we need to create tables required for our new project. Since our project is based on ATG, we need the tables that ATG uses. ATG uses mainly four modules – DAS, DPS, DSS and DCS. We need to put all the tables these modules use. The DDLs are provided with ATG. We can find them in sql\install\folder of each Module. For example, in the case of DCS and our Oracle, we have to execute the following script.ATG\ATG9.0\DCS\sql\install\oracle\dcs_ddl.sql.

    15. We need to execute them in exactly following order – DAS, DPS, DSS and DCS. Otherwise we will get some errors. Some of the tables in these modules are inter related.

    16. So at last we are done with DB part. Now we have most of the tables as empty.

  1. So the tough db part is over. Now we need to make the application up. ATG used to come with heir own server called DAS(Dynamo Application Server). But nowadays they have stopped them and also support for it is also closed. Now they are promoting jBoss. Even though they support IBM websphere, they don’t want to promote it as they also have some product similar to ATG.

  2. During the ATG installation, it creates a new server called “atg” in jboss server folder. This is nothing but a folder with name ‘atg’ with a number of files and folders. We are going to create a new server. It is very simple. Just create one more folder say ‘learning’. Copy all the contents from ‘atg’ folder to the newly created folder. We are going to deploy our project to this folder.

  3. Now we need something to work on. Eclipse. Download it. There are so many plugins provided by ATG to make life easier.

  4. For easy to use, I have created an eclipse project, you can download it and import it to Eclipse after extracting it. Download it here.

  5. Check for the META_INF, build.properties, build.xml and username.properties for configuration things.

  6. It involves a bit of configuration. Change the name by searching for it. Change the server name. Change the context root etc. (dynamoJ2EESpecifier.xml)

  7. Set the required environment variables - DYNAMO_HOME, JBOSS_HOME and JAVA_HOME.

  8. Build the application. The build creates a new module and then creates a .ear and .war files in the jboss server directory specified.

  9. Copy the jboss\server\learning\atg-oracle-ds.xml to \server\deploy folder. This is used for the connection to the database. Edit this file to change the db details. This is referred in JTDataSource.properties. Also copy the jdbc jar file to lib folder.

  10. Now we can start the new application. We need to start the jboss with the sew server we created. In our case that will be run -c . Check for the server successful start up(We can use ATGLogColorizer.exe to make the errors bloody ). Most common errors are regarding the db issues. If you find them modify the atg-oracle-ds.xml.

  11. Done, access the web page using http://localhost:8080/. I have put an index file which will show up. http://localhost:8080/dyn/admin will take you to ATG admin pages (Credentials: admin/admin).

    Should you have questions regarding any aspects of this, please feel free to contact me.

Blog at WordPress.com.