[go: up one dir, main page]

0% found this document useful (0 votes)
53 views32 pages

Module 2

Grails project structure includes directories for models, controllers, views, and configuration files. Data sources are configured through files or JNDI, and use connection pools. Logging is configured through Log4j. Command line utilities use Gant scripts to run tasks non-interactively. The IDEs Eclipse, GGTS, and IntelliJ integrate with Grails projects.

Uploaded by

Ashley Martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views32 pages

Module 2

Grails project structure includes directories for models, controllers, views, and configuration files. Data sources are configured through files or JNDI, and use connection pools. Logging is configured through Log4j. Command line utilities use Gant scripts to run tasks non-interactively. The IDEs Eclipse, GGTS, and IntelliJ integrate with Grails projects.

Uploaded by

Ashley Martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Module 2

Grails Project Structure


Module Overview

• Overview of a Grails project


• Directories for model classes, controllers, and views
• Data source configuration
• Logging
• Command line utilities
• IDE integration
Introduction To Grails
What is Grails?
Why Grails?
Why Grails?
The Grails Technology Stack
Built On Java Strenth
Convention Over Configuration
Facilities
Groovy Language
Database Connectivity
Domain Object Model
GORM
Controllers
Errors And Validation
Views And GSP
Overview of a Grails project

• The grails-app Folder


• Assets folder
• Conf folder
• Controllers folder
• i8n folder
• Init folder
• Views folder
• Domain folder
• Services folder
• Taglib folder
• Source Folder
Data source configuration

• Grails is built on Java technology setting up a data


source requires some knowledge of JDBC
• database other than H2 you need a JDBC driver
• Drivers typically come in the form of a JAR archive.
Data source configuration
More on dbCreate

• create - Drops the existing schemaCreates the schema on startup,


dropping existing tables, indexes, etc. first.
• create-drop - Same as create, but also drops the tables when the
application shuts down cleanly.
• update - Creates missing tables and indexes, and updates the current
schema without dropping any tables or data. Note that this can't
properly handle many schema changes like column renames (you're
left with the old column containing the existing data).
• validate - Makes no changes to your database. Compares the
configuration with the existing database schema and reports warnings.
• any other value - does nothing
DataSources and Environments
JNDI DataSources
Development time JNDI resource

• Tomcat plugin you can define JNDI resources


using the grails.naming.entries setting in grails-
app/conf/Config.groovy:
• JNDI data sources at development time is plugin
dependent
Development time JNDI resource
Logging

• Grails uses Log4j log system.


• add a log4j setting to the file grails-
app/conf/Config.groovy.
Logging Level

• off
• fatal
• error
• warn
• info
• debug
• trace
• all
Command line utilities

• Grails' command line system is built on Gant - a


simple Groovy wrapper around Apache Ant.

• Grails searches in the following directories for


Gant scripts to execute:
non-interactive mode

• When you run a script manually and it prompts


you for information.
• But when you run a script as part of an automated
process, there's no way to "answer" the questions.
• you can pass the --non-interactive switch to the
script command to tell Grails to accept the default
answer
Command Line - Interactive Mode
IDE Integration

• Eclipse IDE
• GGTS
• IntelliJ
Question

You might also like