ATG On Social Network FaceBook/Twitter Integration

How about using social networking sites as a channel to sell our
products ?

Yes,we can share the Product/Sku Infromation  to any social networking sites. So anybody interested can access the URL and see the Products/Skus,Browse Catalogs and place orders through this channel

I have successfully integrated our code with the  below social networking sites.

1.Facebook

2.Twitter

This can be done basically by posting a link to Twitter or FaceBook and upon clicking the URL,this will redirect you back to the Product Catalog page of your Site.

ATG FaceBook Integration


I registered the URL with tinyUrl(www.tinyurl.com),as this option helps to cut short  big URL to  rather simpler one.

Below is the code snippet.
You just need to place this in your JSP files,dont forget to
create the image file for this.

<a target="_blank" href=http://www.facebook.com/sharer.php?

  url=${tinyUrl}" onclick="window.open(this.href,'','toolbar=0,
  resizable=yes, scrollbars=yes,
 
 status=0,width=600, height=430' );return false;">
  <img title="Add to Facebook" alt="Facebook" 
  src="images/facebook.gif" 
  style="width: 14px; height: 14px; border:0"> 
</a>


You can add your custom message in the text box provided above,
the message and the link will be posted to your wall after
clicking the 'Share Link' button

ATG Twitter Integration    
     
 
<a target="_blank" href="http://www.twitter.com/home?${tinyUrl}"
 
 onclick="window.open(this.href,'','toolbar=0, resizable=yes,
  scrollbars=yes,status=0, width=600, height=300' );return false;">
  <img title="Tweet this" alt="Twitter" src="images/twitter.gif"
  style="border:0" />
</a>

For Dynamically generate tinyUrl from your application,create a droplet and set the value tinyUrl in the request parameter.

Make sure you have the necessary ports opened to access the website URL.

Code

URL url = new URL("http://tinyurl.com/api-create.php?url=" + origUrl);
URLConnection connection = url.openConnection(); 
....Read the Generated tiny URL through BufferedReader and
set it to request parameter as below.
pRequest.setParameter("tinyUrl", tinyUrl);
pRequest.serviceLocalParameter("output", pRequest, pResponse);

FaceBook Sharer Image

Facebook Sharer Popup Page


atg.servlet.DynamoHttpServletRequest cannot be cast to atg.servlet.DynamoHttpServletRequest

I am always getting the below Exception when i deploy
any modifications in my Project using runAssembler.bat,
this issue occurs only when the  Jboss Server
is running while deploying the changes.

java.lang.ClassCastException: atg.servlet.DynamoHttpServletRequest cannot be cast to atg.servlet.DynamoHttpServletRequest
    at atg.servlet.DynamoServlet.service(DynamoServlet.java:126)
    at atg.taglib.dspjsp.DropletTag.invokeServlet(DropletTag.java:377)
    at atg.taglib.dspjsp.DropletTag.doAfterBody(DropletTag.java:666)
    at org.apache.jsp.en.catalog.share_jsp._jspService(share_jsp.java:291)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java


As per me the fix is stop the Server,Clean and Start again.Its working :),otherwise stop the Server before deploying and start again.But this behaviour can be changed from the Scripts also.
See modifications in Scripts as well.

startSQLRepository Console output

C:\ATG\ATG10.0.3\home\bin>startSQLRepository -m EmployeeRegistration -repository /empRegistration/repositories/EmployeeRegistrationRepository -outputSQL

Application Server: jboss
The following installed ATG components are being used to launch:
  ATGPlatform version 10.0.3 installed at C:\ATG\ATG10.0.3

Created ".\.\startDynamo.jar" in 84,640ms.
-------------------
JAVA_ARGS:  -Djava.security.policy=lib/java.policy -Datg.dynamo.home="." -Datg.dynamo.root=".\.." -Datg.dynamo.display= -Djava.protocol.handler.pkgs=atg.net.www.
-------------------
DYNAMO_MODULES: @@atg/env/Startup.modules@@
-------------------
CONFIGPATH: @@atg/env/Startup.configPath@@;.\.\PublishingAgent\deploymentconfig\live\config;..\DAS\config\dtmconfig.jar;localconfig;..\DAF\config\dafconfig.jar
-------------------
CLASSPATH:  .\locallib;C:\ATG\ATG10.0.3\EmployeeRegistration\classes;C:\ATG\ATG10.0.3\home\startDynamo.jar
-------------------
PATH:       C:\Oracle\product\11.1.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\ATG\ATG10.0.3\MySQL\win32\bin;C:\Program Files\Java\
**** info       Mon Feb 06 10:15:23 CET 2012    1328519723906   /empRegistration/repositories/EmployeeRegistrationRepository    SQL Repository startup complete

Nucleus running

-- drop table emp_info;

CREATE TABLE emp_info (
        id                      VARCHAR(254)    NOT NULL,
        emp_id                  INTEGER NULL,
        emp_name                VARCHAR(254)    NULL,
        emp_dept                VARCHAR(254)    NULL,
        PRIMARY KEY(id)
);

**** info       Mon Feb 06 10:15:24 CET 2012    1328519724562   /atg/dynamo/service/Scheduler   Scheduler shutting down.
**** info       Mon Feb 06 10:15:24 CET 2012    1328519724578   /atg/dynamo/service/Scheduler   Scheduler stopped.

open any client tool  to connect your database server,

execute the create table command,Done !!.

see also how to configure ATG to run startSQLRepository

Generate DDL/SQL using startSQLRepository

One of the beauty of ATG is,it can generate DDL 
from a Repository Definition file.
eg: Below is a sample repository EmployeeRegistration with 4 columns in the module EmployeeRegistration.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gsa-template SYSTEM "dynamosystemresource:/atg/dtds/gsa/gsa_1.0.dtd">
<gsa-template>
<item-descriptor name="EmployeeInfo">
  <table name="emp_info" type="primary" id-column-names="id">
    <property name="id" column-name="id" data-type="string"/>
    <property name="empId" column-name="emp_id" data-type="int"/>
    <property name="empName" column-name="emp_name" data-

    type="string"/>
    <property name="empDept" column-name="emp_dept" data-

    type="string"/>
  </table>
 </item-descriptor>
</gsa-template>

So to generate a DDL for this you need to simply execute the below line.

startSQLRepository -m EmployeeRegistration -repository
/empRegistration/repositories/EmployeeRegistrationRepository -outputSQL

You need to verify two things before executing this command

1. Your Database connector files are there in the classpath.

   You can  execute the command below to set up the 
   classpath in windows environment.This is faster.

   SET CLASSPATH=C:\ATG\ATG10.0.3\home\locallib\

   mysql-connector-java-5.X.XX-bin.jar;%CLASSPATH%

2. You have to put the  JTDatasource,fakeXADatasource components

   with appropriate connection details in the path
   C:\ATG\ATG10.0.3\home\localconfig\atg\dynamo\service\jdbc
JTDatasource.properties

The JTDatasource has to point to FaxeXADataSource.This component has to mapped to the class MonitoredDataSource.      
fakeXADatasource.properties
     $class=atg.service.jdbc.FakeXADataSource
       URL=jdbc:mysql://localhost:3306/employee
       user=atgtest
       password=atgtest
       driver=com.mysql.jdbc.Driver

See also the console output for this.


Console Output

Configure runAssembler for Eclipse

Option 1:
From the Eclipse Run -> External Tools - >External Tools configurations


You can see an option 'Program' on the left pane.Right click 'Program' and create New,Give a name, eg: Fullfillment.

Enter the location of the runAssembler.bat file
(C:\ATG\ATG10.0.3\home\bin\runAssembler.bat).
Refer screenshot below.

Enter the working directory,ideally this will be the
place where you need to install your .ear,.war files in the exploded format (C:\jboss-eap-5.0\jboss-as\server\Fullfillment\deploy).
Give  arguments,this will be  the ear file name and the
modules(your ATG module) and required modules to start the Deployment.

Fullfillment.ear -m  Fullfillment DSS DafEar DafEar.Admin
 












 

Option 2:

Alternatively,open the cmd prompt ,go to the path
C:\ATG\ATG10.0.3\home\bin
type the command -> runAssembler Fullefillment.ear -m  Fullfillment DSS DafEar DafEar.Admin

Option 3:

Third option is to configure an Ant script to assemble you ear like the example given below.

eg:build.xml

<taskdef onerror="report" name="assemble-jar"  classname="atg.appassembly.ant.CreateUnpackedEarTask"  classpath="C:/ATG/ATG10.0.3/home/lib/assembler.jar"/>

   <echo level="debug">Starting EAR Creation.</echo>

<target name="create-my-ear">
<assemble-jar overwrite="true" serverName="${target.server}" destinationFile="${production.ear.location}" dynamoModules="${assemble.modules}" dynamoRoot="${dynamo.root}"/>

</target>


eg:build.properties

target.server - Your Server (eg:ATGProduction)
production.ear.location - Your Ear file(eg:ATGProduction.ear)
assemble.modules - Your require modules(eg:Fullfillment,DSS,DafEar DafEar.Admin)
dynamo.root - C:\\ATG\\ATG10.0.3


You can also see how to 
Configure your ATG Server on Jboss


Running your ATG Server on Jboss

1.Double click on the New Jboss Server created by you 
  from the previous steps and open launch configuration.

Jboss Server Overview Screen in Eclipse

2.Click the tab arguments,add the below line

-c MyATGServer  -b 127.0.0.1.
-b 127.0.0.1 - > To resolve all the Services to localhost

VM Arguments -Dprogram.name=run.bat -Xms128m -Xmx512m  -XX:
MaxPermSize=256m depends upon your Hardware settings this can vary

Working Directory - C:/jboss-eap-5.0/jboss-as/bin

Now right click your New Jboss Server and Start Done !!!

Alternatively,open the cmd prompt ,go to the path
C:\jboss-eap-5.0\jboss-as\bin

type the command -> run -c MyATGServer -b -b 127.0.0.1

You may also see how to create your own ATG Server on Jboss

Setting up your Own ATG Server on Jboss

  I assume you have downloaded latest Version of Jboss

  Find below easy steps to create your ATG Server on Jboss and 
  get ready to deploy and run your Applications.

1. Copy the "default" Server Directory  present with the Jboss 

   Installation to your Newly created ATGServer  folder.
   (C:\jboss-eap-5.0\jboss-as\server\MyATGServer\)
  
   Folder structure for your "default" Jboss Server.
Folder structure for your default Jboss Server
  
2. After copying You may now able to see a folder 
"deploy" 
    inside your MyATGServer directory. 
    C:\jboss-eap-5.0\jboss-as\server\MyATGServer\deploy copied
    from the
"default"
Server.

3. Place/Create your Datasource related files under this folder  
    C:\jboss-eap-5.0\jboss-as\server\MyATGServer\deploy,
    There will be ideally 2 Datasource files.


4. Now go to your IDE,From Your Eclipse Servers section,
    create a new Server - Jboss xxx,(Address 127.0.0.1,Port
    8080,JNDI 1099),choose the appropriate version and leave  others
    to default,Finish.
   Also see the Configuration required to start  your runAssembler
   and Jboss Server from your Eclipse IDE
Related Posts Plugin for WordPress, Blogger...