Dependency Injection
i)Constructor Injection (type3 IoC)
ii)Setter Injection (type2 IoC)
iii)Interface Injection (type1 IoC)
Saturday, February 24, 2007
Hibern8 a few
Hibernate features
*)automatic dirty checking - updates the object if not the database when the state of the object is changed 'inside a transaction'
*) cascading save - making a new object persistent by automatically if its referenced by an already persistent object
*)
Hibernate Interfaces
====================
*)Session, Transaction, Query - to perform basic CRUD and querying
*)Configuration - to configure hibernate
*)Interceptor, Lifecycle and Validatable - Callback interfaces , to react to events
*)UserType, CompositeUserType, IdentifierGenerator - extension to hibernate's mapping functionality
Session Interface
-are not thread safe, should be used by only one thread at a time (singleton)
SessionFactory Interface
- the application obtains session instances from SessionFactory
will require one sessionFactory for each database connection
terminology
===========
*)container managed transaction(CMT) - used to control transactions in a managed environment with J2EE
*)automatic dirty checking - updates the object if not the database when the state of the object is changed 'inside a transaction'
*) cascading save - making a new object persistent by automatically if its referenced by an already persistent object
*)
Hibernate Interfaces
====================
*)Session, Transaction, Query - to perform basic CRUD and querying
*)Configuration - to configure hibernate
*)Interceptor, Lifecycle and Validatable - Callback interfaces , to react to events
*)UserType, CompositeUserType, IdentifierGenerator - extension to hibernate's mapping functionality
Session Interface
-are not thread safe, should be used by only one thread at a time (singleton)
SessionFactory Interface
- the application obtains session instances from SessionFactory
will require one sessionFactory for each database connection
terminology
===========
*)container managed transaction(CMT) - used to control transactions in a managed environment with J2EE
Spring minimal info
Spring is an Application Container
The main Spring beans
i)Data source bean - org.springframework.jdbc.datasource.DriverManagerDataSource
ii)Session factory bean - org.springframework.orm.hibernate3.LocalSessionFactoryBean
iii)business beans
The main Spring beans
i)Data source bean - org.springframework.jdbc.datasource.DriverManagerDataSource
ii)Session factory bean - org.springframework.orm.hibernate3.LocalSessionFactoryBean
iii)business beans
Vector Vs Arraylist
1. Use ArrayList and synchronize (but only as needed).
There is a big advantage to using Collections objects everywhere--
you can often have functions return Collection and not need to know
that your implementation is ArrayList--so that later you can substitute
some other kind of Collection as the implementation and not affect the calling code.
Also, you probably won't need synchronization in most cases.
Any Collection that is request-scoped will be accessed single-threaded
(unless you are creating Threads as part of the request).
You might only need to synchronize session-scoped collections, of which there should be few, if any.
There is a big advantage to using Collections objects everywhere--
you can often have functions return Collection and not need to know
that your implementation is ArrayList--so that later you can substitute
some other kind of Collection as the implementation and not affect the calling code.
Also, you probably won't need synchronization in most cases.
Any Collection that is request-scoped will be accessed single-threaded
(unless you are creating Threads as part of the request).
You might only need to synchronize session-scoped collections, of which there should be few, if any.
Java Web application
WEB APPLICATION
* A web application is a collection of servlets , html pages, classes and other resources that can be bundled and run on multiple (web) containers.
* Each web application has one and only one ServletContext.
The contents of a web application
i)Servlets
ii)JS pages
iii)Utility Classes
iv)Static documents (HTML)
v)Client Classes
vi)Meta info about web application
The Web Application Deployment Descriptor (web.xml)
The elements in web.xml incude the following in order
i)ServletContext init parameters
ii)Localized Content
iii)Session Configuration
iv)Servlet / JSP Definitions
v)Sevlet / JSP mappings
vi)Mime Type Mappings
vii)Welcome File List
viii)Error pages
ix)Security
* A web application is a collection of servlets , html pages, classes and other resources that can be bundled and run on multiple (web) containers.
* Each web application has one and only one ServletContext.
The contents of a web application
i)Servlets
ii)JS pages
iii)Utility Classes
iv)Static documents (HTML)
v)Client Classes
vi)Meta info about web application
The Web Application Deployment Descriptor (web.xml)
The elements in web.xml incude the following in order
i)ServletContext init parameters
ii)Localized Content
iii)Session Configuration
iv)Servlet / JSP Definitions
v)Sevlet / JSP mappings
vi)Mime Type Mappings
vii)Welcome File List
viii)Error pages
ix)Security
Webwork Details
WEBWORK
----------
WebWork is a Java web-application development framework. It is built specifically with developer productivity and code simplicity in mind, providing robust support for building reusable UI templates, such as form controls, UI themes, internationalization, dynamic form parameter mapping to JavaBeans, robust client and server side validation, and much more
WebWork is a powerful web-based MVC framework built on top of a command pattern framework API called XWork. The true power of Webwork is its underlying concept of simplicity and interoperability. Using WebWork will help minimize code and allow developers to concentrate more on business logic and modeling, rather than the plumbing oftern required when building web-based applications.
XWORK
--------
XWork is a command-pattern framework that is used to power WebWork as well as other applications. XWork provides an Inversion of Control container, a powerful expression language, data type conversion, validation, and pluggable configuration.
ServletDispatcher
-------------------
public class ServletDispatcher
extends HttpServlet
implements WebWorkStatics
Main dispatcher servlet in WebWork2 which acts as the controller in the MVC paradigm.
When a request enters the servlet the following things will happen:
1. The action name is parsed from the servlet path (i.e., /foo/bar/MyAction.action -> MyAction).
2. A context consisting of the request, response, parameters, session and application properties is created.
3. An XWork ActionProxy object is instantiated (wraps an Action) using the action name, path, and context then executed.
4. Action output will channel back through the response to the user.
Any errors occurring during the action execution will result in a HttpServletResponse.SC_INTERNAL_SERVER_ERROR error and any resource errors (i.e., invalid action name or missing JSP page) will result in a HttpServletResponse.SC_NOT_FOUND error.
****************OGNL is the Object Graph Navigation Language*************
Functions
---------
Handle page flow, validation, MVC structure, HTML form to java object mapping, JSP taglibs etc.
----------
WebWork is a Java web-application development framework. It is built specifically with developer productivity and code simplicity in mind, providing robust support for building reusable UI templates, such as form controls, UI themes, internationalization, dynamic form parameter mapping to JavaBeans, robust client and server side validation, and much more
WebWork is a powerful web-based MVC framework built on top of a command pattern framework API called XWork. The true power of Webwork is its underlying concept of simplicity and interoperability. Using WebWork will help minimize code and allow developers to concentrate more on business logic and modeling, rather than the plumbing oftern required when building web-based applications.
XWORK
--------
XWork is a command-pattern framework that is used to power WebWork as well as other applications. XWork provides an Inversion of Control container, a powerful expression language, data type conversion, validation, and pluggable configuration.
ServletDispatcher
-------------------
public class ServletDispatcher
extends HttpServlet
implements WebWorkStatics
Main dispatcher servlet in WebWork2 which acts as the controller in the MVC paradigm.
When a request enters the servlet the following things will happen:
1. The action name is parsed from the servlet path (i.e., /foo/bar/MyAction.action -> MyAction).
2. A context consisting of the request, response, parameters, session and application properties is created.
3. An XWork ActionProxy object is instantiated (wraps an Action) using the action name, path, and context then executed.
4. Action output will channel back through the response to the user.
Any errors occurring during the action execution will result in a HttpServletResponse.SC_INTERNAL_SERVER_ERROR error and any resource errors (i.e., invalid action name or missing JSP page) will result in a HttpServletResponse.SC_NOT_FOUND error.
****************OGNL is the Object Graph Navigation Language*************
Functions
---------
Handle page flow, validation, MVC structure, HTML form to java object mapping, JSP taglibs etc.
Subscribe to:
Posts (Atom)