Internet Shop in Ajax: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Configuring Tomcat in order to deploy the web application ==
* Logging must be configured through log4j. A sample log4j.properties file is present in the doc/ directory of the project. Edit it and copy it to {CATALINA_HOME}/common/classes/ log4j.properties. Also install the log4j.jar file (see below).
* The Shop/ web application directory should be created, with the name of the development user (if this is only a production server, it should be done with the Tomcat user). The images directory and subdirectories should be created under the Tomcat user.
* The following libraries (JAR files) are needed. Note that some of them may be already present, this depends on your Tomcat distribution. The shared/lib and common/lib distinction is also not essential.
* Requested in WEB-INF/lib in your webapp directory:
** GWT servlet library (gwt-servlet.jar) '''[only in WEB-INF/lib]'''
* Requested in shared/lib directory:
** Hibernate library (hibernate3.jar)
** MySQL JDBC driver (jdbc-mysql.jar)
** Dozer library (dozer-3.2.1.jar)
* In addition, you may also have to add the following libraries, which seem to be dependencies of Hibernate:
** DOM4J library (dom4j.jar)
** Code Generation Library (cglib-nodep.jar). If you use the version with dependencies (cglib.jar), you will have to add additional libraries required by cglib (see below)
** Java Transaction API (jta.jar) '''[this must be downloaded from Sun's site. There is no MacPorts package on OS X.]'''
** Another Tool for Language Recognition (antlr.jar)
* Code Generation Library Dependencies (incomplete):
** ASM (many JARs, depending on the version of ASM chosen)
* Requested in common/lib directory:
** Apache Commons FileUpload (commons-fileupload.jar)
** Apache Commons IO (commons-io.jar)
** Apache Commons Collections (commons-collections.jar)
** Apache Commons BeanUtils (commons-beanutils.jar)
** Apache Commons Lang (commons-lang.jar)
** Log4j logging library (log4j.jar) - this is not strictly required as Tomcat can use JDK logging, but log4j is highly recommended
'''Important Note:''' Since they are JAR files, put them in lib/, not classes/ !
'''Warning:''' Put gwt-servlet.jar in WEB-INF/lib in your webapp directory. Placing this file in shared/lib won't work properly, you will have problems with the classloader (and ClassNotFound exceptions). This seems to be a GWT problem.
Note: Under Gentoo, it is recommended to install all these packages using Portage. Then create symlinks from the Tomcat directories to the actual JARs.
* You must create the "Shop" database under MySQL. This database will be used by Hibernate.
== Deployment Improvements ==
* Use Ant to package as a WAR.
* The symbolic link from public/images to the actual data directory should be automated by Ant.
== Build System ==
* The images directory (in public/) is what I call a "data directory", eg a directory that developers should not modify directly. It should not be under version control. In order for hosted mode to work, two symbolic links are created, in public/ and in build/hosted/tomcat/webapps/ROOT. These two links should point to the actual, physical location of this data directory.
* As we don't want to copy these symlinks (and thus their contents, in fact) to the local development server during deployment, we have to '''exclude''' them from the public path when using the GWT Compiler. This is done in the GWT XML modules.
== SQL Tables ==
== SQL Tables ==


Line 20: Line 74:
* Subcategory (boolean)
* Subcategory (boolean)


== Project Management ==


log4j.rootLogger=info, R
* Back office creation (simple)
log4j.appender.R=org.apache.log4j.RollingFileAppender
* Rudimentary Search implementation
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
* Style & Design
log4j.appender.R.MaxFileSize=10MB
* Real payment integration
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
 
 
 
### direct log messages to stdout ###
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Target=System.out
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
 
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
 
### set log levels - for more verbose logging change 'info' to 'debug' ###
 
log4j.logger.org.apache.catalina=warn, R
log4j.logger.org.hibernate=warn, R
 
#log4j.rootLogger=warn, stdout
 
#log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug
 
### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug
 
### log just the SQL
log4j.logger.org.hibernate.SQL=debug
 
### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug
 
### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug
 
### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug
 
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug


### log transaction activity
== Grails Evaluation ==
#log4j.logger.org.hibernate.transaction=debug


### log JDBC resource acquisition
Dependencies:
#log4j.logger.org.hibernate.jdbc=debug


### enable the following line if you want to track down connection ###
* Spring 2
### leakages when using DriverManagerConnectionProvider ###
* Groovy (currently using the embeddable version)
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
* Asm
* Commons-Lang version 2.1 (will not work with version 2.0 !!)
* Sitemesh 2.3
* !! Custom build of an old snapshot from Spring modules. Currently impossible to obtain, so the jar provided in the Grails distribution must be used.

Latest revision as of 17:34, 10 July 2008

Configuring Tomcat in order to deploy the web application

  • Logging must be configured through log4j. A sample log4j.properties file is present in the doc/ directory of the project. Edit it and copy it to {CATALINA_HOME}/common/classes/ log4j.properties. Also install the log4j.jar file (see below).
  • The Shop/ web application directory should be created, with the name of the development user (if this is only a production server, it should be done with the Tomcat user). The images directory and subdirectories should be created under the Tomcat user.
  • The following libraries (JAR files) are needed. Note that some of them may be already present, this depends on your Tomcat distribution. The shared/lib and common/lib distinction is also not essential.
  • Requested in WEB-INF/lib in your webapp directory:
    • GWT servlet library (gwt-servlet.jar) [only in WEB-INF/lib]
  • Requested in shared/lib directory:
    • Hibernate library (hibernate3.jar)
    • MySQL JDBC driver (jdbc-mysql.jar)
    • Dozer library (dozer-3.2.1.jar)
  • In addition, you may also have to add the following libraries, which seem to be dependencies of Hibernate:
    • DOM4J library (dom4j.jar)
    • Code Generation Library (cglib-nodep.jar). If you use the version with dependencies (cglib.jar), you will have to add additional libraries required by cglib (see below)
    • Java Transaction API (jta.jar) [this must be downloaded from Sun's site. There is no MacPorts package on OS X.]
    • Another Tool for Language Recognition (antlr.jar)
  • Code Generation Library Dependencies (incomplete):
    • ASM (many JARs, depending on the version of ASM chosen)
  • Requested in common/lib directory:
    • Apache Commons FileUpload (commons-fileupload.jar)
    • Apache Commons IO (commons-io.jar)
    • Apache Commons Collections (commons-collections.jar)
    • Apache Commons BeanUtils (commons-beanutils.jar)
    • Apache Commons Lang (commons-lang.jar)
    • Log4j logging library (log4j.jar) - this is not strictly required as Tomcat can use JDK logging, but log4j is highly recommended


Important Note: Since they are JAR files, put them in lib/, not classes/ !

Warning: Put gwt-servlet.jar in WEB-INF/lib in your webapp directory. Placing this file in shared/lib won't work properly, you will have problems with the classloader (and ClassNotFound exceptions). This seems to be a GWT problem.

Note: Under Gentoo, it is recommended to install all these packages using Portage. Then create symlinks from the Tomcat directories to the actual JARs.


  • You must create the "Shop" database under MySQL. This database will be used by Hibernate.

Deployment Improvements

  • Use Ant to package as a WAR.
  • The symbolic link from public/images to the actual data directory should be automated by Ant.

Build System

  • The images directory (in public/) is what I call a "data directory", eg a directory that developers should not modify directly. It should not be under version control. In order for hosted mode to work, two symbolic links are created, in public/ and in build/hosted/tomcat/webapps/ROOT. These two links should point to the actual, physical location of this data directory.
  • As we don't want to copy these symlinks (and thus their contents, in fact) to the local development server during deployment, we have to exclude them from the public path when using the GWT Compiler. This is done in the GWT XML modules.

SQL Tables

ShopItem

  • ID
  • ShopID
  • Price
  • Name
  • Auction / Sale
  • Image
  • Description
  • Status
  • DateEntered

ShopCategory

  • ShopID
  • Name
  • ID
  • Subcategory (boolean)

Project Management

  • Back office creation (simple)
  • Rudimentary Search implementation
  • Style & Design
  • Real payment integration

Grails Evaluation

Dependencies:

  • Spring 2
  • Groovy (currently using the embeddable version)
  • Asm
  • Commons-Lang version 2.1 (will not work with version 2.0 !!)
  • Sitemesh 2.3
  • !! Custom build of an old snapshot from Spring modules. Currently impossible to obtain, so the jar provided in the Grails distribution must be used.