John Keats
Walt Whitman
Review of the Aravind Adiga’s novel The White Tiger
Greek Myth in “PYGMALION”
Review of the novel-POLLYANNA.
CULTURAL, SOCIAL, AND LITERARY EXPLORATIONS IN INDIAN FEMINIST WRITERS AND THEIR RELEVANCE TODAY NECTAR IN A SIEVE - KAMALAMARKANDAYA
In Rukmani's quest for dignity, hunger is a potent enemy. Fear of hunger,she says,torments the peace of every peasant who lives by the vagaries of the wind and rain. Tired of constant hunger , her elder sons break ip the family to seek new lives in a new land. Another son resorts to robbery and is kiled for it, leaving to grieve for his mea ingless life. Her daughter chooses the degradation of prostitution over the degradation of starvation. Rukmani nealy becomes a murderer,thinking Kunthi has come to steal the last of their rice. In the city, Rukmani observes the suplican ts at the temple pushing and shoving like animals to secure their share of food. Similarly, beggar children snarl and fight like beasts over a scraped drop in the street. Rukmani indicts both the industrialization of the village,represented by the tannery, and the laws of land ownership impoverish and displace peasants like her and Nathan. In Nectar in a sieve, hunger breeds thieves,prostitutes,murderers and subhuman beasts. Not only nature's whims but also the choices of an unjust society produces the shameful misery of starvation.
Maudlin Memoirs
Shakespeare and super-natural elements:
Margaret Laurence’s women of two novels, The Stone angel and A jest of God.
Philosophical Tone in Robert Frost’s Poem, “Stopping by woods on a snowy evening”.
“the woods are lovely, dark and deep
View of Romantic Period in English Literature(1798-1837)
The one of the finest poems of Williamwordsworth proved he was the great poet of the period. The "Daffodils" the poem ever written by anybody. He look a flower illustrated highest theme in a such a flower . Daffodils was the golden yellowish flower.
In garden the daffodils tossed their head in the soft breeze blowing there. As a poet the daffodils was not a simple flower but he thought it gave a comfort and consolation to the pensive state of mind. Because of the point of view wordsworth secure the highest peak in the Romantic Period.
So WilliamWordsworth was the worshipper and high priest of "Nature".
Jack of all trade-"Shakespeare"
The first one is Hamlet - delaying things. KingHamlet father of Hamlet was poisoned by his own wife and his brother. The news sent to Hamlet and he came for the funeral. Hamlet got shocked about his father's sudden death. But he came to know the secret about the death of his father and the conspirators were nothing but his own mother and his uncle. So he decided to took revenge both of them.He made a plan with the help of his friends,but he delayed the action for some chances. This delaying acts created a lot of enemies to Hamlet.
The next Othello - Suspicious. Othello, a black moor in Venice. Desdemona, a beautiful lady and king's daughter. The love affair between them was known to king, so he made arrangement for his daughter. However she refused that marriage proposals but his father didn't lent his ears to her wish. So she eloped with othello. The news gave so much disappointed to the king. But both of them lead a peaceful life. Iago, a villain spin a web for the peaceful life of Othello,because already Iago was disgust by him.He insisted to Othello about the illegal act of Desdemona. Othello got irritated and warned Iago. But very soon the circumstances grew against Desdemona.Foolishly he believed the words of Iago and he didn't gave any reason,and killed her.So this proved the suspicious act of Othello.
The third one King Lear-Though he was a great king but he has a lack of judgement. He had three daughters namely Goneril, Regan and Cordelia. The first two got married and their plan was to kept all the property of king for them. Once King called all the three daughters to the throne and asked them how much he was loved by them besides he told that he gave all the property to those who loved him much.The first daughter told that she loved him so much,the second one told that her love was greater than anybody. The next turn came to Cordelia, She openly reveal if she got married her affection was her husband but now affection to her father. Suddenly king got angry and scolded her and told that all the property only for the first two daughters.Cordelia didn't showed any reaction to her father and he only got so much frustrated to her daughter. This showed the foolish act King Lear.
Finally in Macbeth showed that over-ambitious. Macbeth was trusted Captain to his king. He was praised by him very often. Once Macbeth was induced by three witches that there was a lot of chances to become king. So these words changed Macbeth and he discussed about his wife. she gave a plot to kill a king in the castle,because king told that he came that night so both of them got happy and the plan was finished by Macbeth smoothly. But afterwards Macbeth couldn't sleep because he killed the king while sleeping. Lady Macbeth got sonambulism disease and she suicide herself. This proved the over-ambitious of Macbeth.
Shakespeare is rooted for introduced all supernatural character in his plays. He only hold the three unities in his play "THE TEMPEST".
Spring Batch Architecture
Spring Accumulation Architectonics assuming Basement and Beheading Layers. Potential beheading action implementations abutment altered platforms and end-user goals from the aforementioned blocks of business argumentation in the Appliance Layer.
Spring Accumulation provides an Basement band in the anatomy of low akin tools. There is additionally a simple beheading environment, appliance the basement in its implementation. The beheading ambiance provides able-bodied appearance for traceability and administration of the accumulation lifecycle. A key ambition is that the administration of the accumulation action (locating a job and its input, starting, scheduling, restarting, and assuredly processing to created results) should be as accessible as accessible for developers.
The Basement provides the adeptness to accumulation operations together, and to retry an allotment of assignment if there is an exception. Both requirements accept a transactional flavour, and agnate concepts are accordant (propagation, synchronisation). They additionally both accommodate themselves to the arrangement programming archetypal accepted in Spring, c.f. TransactionTemplate, JdbcTemplate, JmsTemplate.
The Amount bore is the batch-focused area and implementation. It provides a able-bodied set of chip appearance including job processing statistics, job barrage and restart to accredit the administration of the abounding lifecycle of acceptable accumulation processing.
A cardinal of sample jobs are packaged in a abstracted Samples bore to added acutely clear the acceptance and capabilities of the Amount module.
The runtime dependencies of basement and amount are apparent in the amount below.
Spring Accumulation runtime dependencies, assuming how a applicant appliance (as per the samples) can be congenital in agreement of added modules.
Spring Batch Introduction
India drop to No. 3 in ODI rankings, Dhoni remains No. 1
India have slipped to the third position in the latest ICC ODI rankings following their embarrassing 200-run loss to New Zealand in the first ODI of the tri-series in Dambulla on Tuesday.
New Zealand have replaced India to grab the second position. New Zealand are just one point ahead of India who stand at third spot with 116 points after their fourth biggest defeat by runs margin.
The third team of the tri-series, Sri Lanka are at the sixth position.
ICC Rankings
Australia remain on top with 132 points. South Africa (115) and England (113) are at fifth and sixth position.
However, Indian skipper MS Dhoni retains the No. 1 spot in the list of ODI batsmen rankings. South Africa's AB de Villiers and Australia's Mike Hussey are No. 2 and No. 3 respectively.
Master blaster Sachin Tendulkar, who has been rested for the tri-series, is the only second Indian in the list of top-10 ODI batsmen.
India's dashing opener Virender Sehwag sits on the 16th place, followed by compatriots Virat Kohli and Yuvraj Singh.
Among the bowlers, New Zealand skipper Daniel Vettori is the World No. 1 in ODIs. Vettori skipped the tri-series to be with his wife for the birth of his second child. Indian off-spinner Harbhajan Singh is at eleventh position.
Bangladesh's former skipper Shakib Al Hasan remains World No. 1 all-rounder with Pakistan's Shahid Afridi and Australia's Shane Watson holding the second and third spots.
Yuvraj Singh is the only Indian to feature in the list of top-10 all-rounders. He sits at No. 7 spot.
About online casino
The steps you have to follow to play online casino games are as given below,
1. by sitting in your home just open an account with any of the online casinos.
2. fill the details about you in the following site to get sign up.
3. after entering into the site choose your favorite casino online to start your play.
The online casino games which are most popular are Best casino 2009, AMEX MC Casino Best New Casip, Best Casino 2008, Best Slots and etc,.. Among these games Best casino 2009 is the oldest and also most popular games in gambling. Best casino 2009 can be played in both land-based and as well as in online casinos. It’s so easy to play and the new comers can easily understand the guidelines given in the following site. The Best Slots games run in both online and offline and the main features of the video poker consits of both traditional Online Veges and slots. You can start by playing this game in just creating a hand of five cards and by increasing the odds level you can win.
While you entering in this casinoscandinavia.com you get a clear information about the online casino games and our proper guidance will lead you to win.
About onlie casino
The steps you have to follow to play online casino games are as given below,
1. by sitting in your home just open an account with any of the online casinos.
2. fill the details about you in the following site to get sign up.
3. after entering into the site choose your favourite online casinos for us players to start your play.
The online casino games which are most popular are blackjack, video poker, craps, baccarat, keno, pai gow, slots, and roulette. Among these games blackjack is the oldest and also most popular games in gambling. Blackjack can be played in both land-based and as well as in online casinos. It’s so easy to play and the new comers can easily understand the guidelines given in the following site. The video poker games run in both online and offline and the main features of the video poker consits of both traditional video poker and slots. You can start by playing this game in just creating a hand of five cards and by increasing the odds level you can win.
While you entering in this casinogamblingindex.com you get a clear information about the online casino games and our proper guidance will lead you to win.
About floor mats
Dear folks, Welcome back to my blog once again for getting very good information about the commercial products, politics, Hollywood, Bollywood or what ever is happening in the world. Like the same I will going to introduce some thing very interesting for you and you car or any floor. When ever you are searching about the car parts you will always miss the floor-mats. Yes that is the topic I will talk about today.
There are so many floor mats company around the world but you will never see such a good quality product in your life but for sure you will like carid’s floor mats. It will come lifelong and more worth always. Please visit their internet page on floor mats section for more information on this product.
There are many verities like acura, alfa romio, audi, BMW floor mats according to their company and it will fit for their car. Some verities of the floor mats are really fit for their situation like winter season or summer season. The floor mats are also considered according to the luxurious of the car and prices will also varies with low cast plan to medium level. Still reading the same? I did not expect as I gave the path aleady for the best floor mats. I’m going again to the same and lets meet there..
Introduction To iBatis
The iBatis framework is a lightweight data mapping framework and persistence API that can be used to quickly leverage a legacy database schema to generate a database persistence layer for your Java application. A set of XML encoded SQL Map files–one for each database table–holds SQL templates that are executed as prepared statements and map the expected results to Java domain classes. From application code, a layer of iBatis Data Access Objects (DAO) acts as the API that executes the SQL Map templates and assigns the results to the corresponding Java domain classes. Therefore, the architectural stack looks like this:
This tutorial will show how to automatically generate the code for these three layers from an existing database. To enable communication among these layers, an XML configuration file describes each DAO interface and implementation class, as well as the location of a second XML configuration file that in turn points to each SQL Map file and contains the database connection information.
This tutorial will focus on using iBatis in a Java application and a legacy MySQL database. Abator, a code generation tool for creating the files mentioned above, will also be introduced, but otherwise, only basic familiarity with Java, XML, and SQL are assumed along with a few common Java tools and libraries including Eclipse, Ant and Log4J.
prerequisites
This introduction assumes a fairly standard project directory structure, including these directories and files directly under the project root:
• src/
• lib/
• dist/
• doc/
• etc/
• build.xml
Other XML files and Java *.properties files not automatically generated by Abator are assumed to be directly under src/ . This introduction shows iBatis configured for a database running on localhost, so obviously a locally running MySQL server is needed.
Spring MVC: How it works
If you are interested in the Spring Framework’s MVC packages, this could be helpful. It’s a unified description of the life cycle of a web application or portlet request as handled by Spring Web MVC and Spring Portlet MVC. I created this for two reasons: I wanted a quick reference to the way Spring finds handlers for each stage of the request; and I wanted a unified view so I could see the similarities and differences between Web MVC and Portlet MVC.
Spring Web MVC, part of the Spring Framework, has long been a highly-regarded web application framework. With the recent release of Spring 2.0, Spring now supports portlet development with the Spring Portlet MVC package. Portlet MVC builds on Web MVC; even their documentation is similar. My focus right now is on portlet development, and I found it cumbersome to have to read the Web MVC and Portlet MVC documentation simultaneously. So I have re-edited the two together into one unified document. I have also included related information from elsewhere in the documentation, so it’s all in one place.
My idea here is to make it easy to go through your Spring configuration files and ensure that all beans are declared and named as they should be, whether you are using Spring Web MVC or Spring Portlet MVC.
Dispatcher
Spring’s Web and Portlet MVC are request-driven web MVC frameworks, designed around a servlet or portlet that dispatches requests to controllers. Spring’s dispatchers (DispatcherServlet and DispatcherPortlet) are also completely integrated with the Spring ApplicationContext and allow you to use every other feature Spring has.
The DispatcherServlet is a standard servlet (extending HttpServlet), and as such is declared in the web.xml of your web application. Requests that you want the DispatcherServlet to handle should be mapped using a URL mapping in the same web.xml file. Similarly, the DispatcherPortlet is a standard portlet (extending GenericPortlet), and as usual is declared in the portlet.xml of your web application. This is all standard J2EE configuration;
In the Portlet MVC framework, each DispatcherPortlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. These inherited beans can be overridden in the portlet-specific scope, and new scope-specific beans can be defined local to a given portlet instance.
Dispatcher Workflow
When a DispatcherServlet or DispatcherPortlet is set up for use and a request comes in for that specific dispatcher, it starts processing the request. The sections below describe the complete process a request goes through when handled by such a dispatcher, from determining the application context right through to rendering the view.
Application context
For Web MVC only, the WebApplicationContext is searched for and bound in the request as an attribute in order for the controller and other elements in the process to use. It is bound by default under the key DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE.
Locale
The locale is bound to the request to let elements in the process resolve the locale to use when processing the request (rendering the view, preparing data, etc.). For Web MVC, this is the locale resolver. For Portlet MVC, this is the locale returned by PortletRequest.getLocale(). Note that locale resolution is not supported in Portlet MVC — this is in the purview of the portal/portlet container and is not appropriate at the Spring level. However, all mechanisms in Spring that depend on the locale (such as internationalisation of messages) will still function properly because DispatcherPortlet exposes the current locale in the same way as DispatcherServlet.
Theme
For Web MVC only, the theme resolver is bound to the request to let elements such as views determine which theme to use. The theme resolver does not affect anything if you don’t use it, so if you don’t need themes you can just ignore it. Theme resolution is not supported in Portlet MVC — this area is in the purview of the portal/portlet container and is not appropriate at the Spring level.
Multipart form submissions
For Web MVC and for Portlet MVC Action requests, if a multipart resolver is specified, the request is inspected for multiparts. If they are found, the request is wrapped in a MultipartHttpServletRequest or MultipartActionRequest for further processing by other elements in the process.
Handler mapping
Spring looks at all handler mappings (beans implementing the appropriate HandlerMapping interface) in the application context. Any that implement the Ordered interface are sorted (lowest order first), and others are added at the end of the list. The handler mappings are tried in order until one yields a handler. (Note: if the dispatcher’s detectAllHandlerMappings attribute is set to false, then this changes: Spring simply uses the handler mapping bean called “handlerMapping” and ignores any others.)
Handler
If a handler is found, the execution chain associated with the handler (pre-processors, controllers and post-processors) will be executed in order to prepare a model for rendering. The handler chain returns a View object or a view name, and normally also returns a model. For example, a pre-processor may block the request for security reasons and render its own view; in this case it will not return a model.
Note that the handler chain need not explicitly return a view or view name. If it does not, Spring creates a view name from the request path. For example, the path /servlet/apac/NewZealand.jsp yields the view name “apac/NewZealand”. This behaviour is implemented by an implicitly-defined DefaultRequestToViewNameTranslator bean; you can configure your own bean (which must be called “viewNameTranslator”) if you want to customise its behaviour.
Exceptions
Exceptions that are thrown during processing of the request go to the hander exception resolver chain. Spring looks at all hander exception resolvers (beans implementing the appropriate HandlerExceptionResolverinterface) in the application context. Any that implement the Ordered interface are sorted (lowest order first), and others are added at the end of the list. The resolvers are tried in order until one yields a model and view. (Note: if the dispatcher’s detectAllHandlerExceptionResolvers attribute is set to false, then this changes: Spring simply uses the hander exception resolver bean called “handlerExceptionResolver” and ignores any others.)
View resolver
If the handler chain returns a view name and a model, Spring uses the configured view resolvers to resolve the view name to a View. Spring looks at all view resolvers (beans implementing the ViewResolver interface) in the application context. Any that implement the Ordered interface are sorted (lowest order first), and others are added at the end of the list. Then the view resolvers are tried in order until one yields a view. (Note: if the dispatcher’s detectAllViewResolvers attribute is set to false, then this changes: Spring simply uses the view resolver bean called “viewResolver” and ignores any others.)
If the handler chain returns a View object, then no view resolution is necessary. Similarly, if it does not return a model, then no view will be rendered, so again no view resolution is necessary.
View
If we now have a view and a model, then Spring uses the view to render the model. This is what the user will see in the browser window or portlet.
JavaFX Mobile released
Developers can now build RIAs using a common set of APIs for both the desktop and mobile platforms, enriched with high-fidelity audio and video, rich text, vector graphics, animation and Web services. JavaFX Mobile runs on Java Platform Micro Edition (Java ME) technology, allowing desktop and Web developers to optimize their applications for the form factor of a specific device, and for particular mobile capabilities, so they are "already pretty far along in delivering [their applications] to mobile devices," said Param Singh, senior director of Java marketing with Sun Microsystems Corp.
"Our vision of providing a programming model that spans across multiple screens is one of the core fundamental changes versus development in the past," said Singh.
The company is taking a different approach to the mobile environment, said Singh, by working with OEMs and operator partners to cover the entire device stack, including mass market and smart phones. "It's really about how do we help build an ecosystem where there are hundreds and thousands of applications that meet the consumer needs" on a variety of platforms, said Singh.
While Sun will continue to focus on the high-end feature phone market, Singh said the company does recognize there is lots of growth in the lower end where those consumers, too, have demands for the same type of cross-platform access to their information.
And basing JavaFX Mobile in Java ME technology, said Singh, responds to operator and OEM partner demands for tighter integration and lowered costs by being able to build upon their investments in the existing Java ME stack. With other vendor platforms, he added, "you can build nice visual applications but then how do you tap into device capabilities? It's at best a very difficult exercise."
Rob Enderle, principal analyst with San Jose, Calif.-based research firm Enderle Group, said the difficulty for Sun in the mobile RIA space is that "they're late to the game and other parties are already in place." Reigning supreme is Adobe Systems Corp., whom even Microsoft Corp. has had trouble displacing, said Enderle.
But that said, the upside is that Java is one of those technologies that does play broadly in the mobile arena "and the idea of being able to use a Java derivative for a more graphically intense experience could be attractive to some developers," said Enderle.
"Depending on how hard it is to move to JavaFX, some developers that otherwise might not even look at it at all, might be attracted to it," said Enderle.
Advanced Configuration of the Spring MVC Framework
In this article I will present some configuration tips for the Spring MVC framework that could help you manage multiple instances of your Spring-based web application. The configuration management topic is often neglected in the literature, but as we will see, it is very important for real-life web development. It is not directly related to any particular technology, so we will start by explaining the basic concepts of the problem. Next, we will focus on the Spring MVC framework and offer a few solutions for projects developed using this technology.
Spring Configurations
It is common for a web application to be deployed on more than one host. Take, for example, a website that will have only one instance in production. Beside that instance, you (as its developer) will probably have another (development) instance on your development machine. You may also find useful to maintain another installation of your application on some local development server inside of your company (organization). The purpose of this instance would usually be to give access to web designers, for quality assurance stuff, to people that should document the application, etc.
As you can see, even in this simplest possible scenario there are three instances of the application that we should install, configure, and maintain. The situation is even worse for geographically dispersed teams that work on a project like this. For any non-trivial web application project, you will usually have more that one developer with his local installation of the project and local settings, one installation for running unit tests, and so on.
Many organizations create their products as web applications. You may find examples of such products in various e-commerce systems, content management systems (CMSes), or even blog publishing platforms. Products like these are intended for deployment on as many servers as possible. For successful acceptance of general-purpose web applications, their developers must ensure that their apps are easy to install and integrate well with other web applications. After this discussion, it should be clear that application configuration, which is the topic of this article, is one of the very important issues for developers of general-purpose web application projects.
Version control systems, such as CVS or Subversion, are one of the standard tools used by development organizations. This kind of tool represents a central source code repository of some organization and is used to keep the source code in order. Users are able to track changes of the application's source, show differences among file versions, and make project branches. Also, they make partial updates on the application deployments possible.
It is clear that version control system software is necessary for keeping track of your source code and that it can help in a great deal with the application configuration problems discussed here. Still, in this article, we will not focus on version control systems, as there are lots of great materials that cover this topic. Here, we will focus on just a small subtopic of the version control issue: how to ease the configuration of web applications (particularly those written using the Spring MVC framework).
The question is: what kind of configuration we are talking about here? Well, any web application needs resources that are usually specific to the host on which it is running, such as the database URL, the SMTP server that will send emails, folders that will contain some application-specific documents, etc. Settings like these should be centralized so that application configuration could be as easy as possible.
But this describes only the simplest version of the problem. Sometimes, you need more complex configuration differences among application deployments. This means that you will have to make different bean wirings among deployments, which complicates this issue even further.
Solutions to these application configuration issues have many benefits, ranging from easier installation and configuration of your application to easier source version control, which leads to fewer conflicts in your source repository. Now let's discuss this topic in more detail and through examples.
Problem
Let's start with demonstrating the simpler version of the problem we described above. In this scenario, all that you want to change among application deployments are simple configuration parameters, such as URLs, passwords, etc. If you have ever tried to develop a web application using the Spring MVC framework, you know that there are two configuration files that should be used:
*
/WEB-INF/applicationContext.xml allows you to configure your beans, or to indicate the context of your application. This is the place where you define your business logic beans, resources, and all other beans that are not directly related to the web tier.
*
/WEB-INF/[servlet-name]-servlet.xml is used to configure the web tier and view resolvers, controllers, validators, and all other beans that you need in the MVC framework. The [servlet-name] refers to the name of the Spring's dispatcher servlet defined in the web.xml deployment descriptor.
So what's the problem here? The problem is that your applicationContext.xml will contain some bean definitions that are host-specific. The most obvious example of this issue is a bean that holds JDBC connection information, but any non-trivial application will have a dozen such beans. Take a look at the following example:
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
The problem with this solution is in hard maintenance of the applicationContext.xml file. For starters, imagine that you have your project in the source code version control system, such as CVS. Now let's say that you want to add new functionality to your website, and for that, you need to put some extra bean definitions in the application context definition. The problem is how to reflect those changes on the production server.
Usually your local instance of the application will not use the same database as the live site, so the applicationContext.xml file will contain settings to access your local database. When you want to commit your changes in the source repository, you have to take care of synchronization of these host-specific properties. The file in the repository will probably end up with configuration from your local settings. Now, when you want to update the configuration on the production server, you will have to manually synchronize the values of the properties. This can be a very tedious task, and is also very prone to errors.
With every instance of the application, this issue becomes more important. Imagine that three developers work on the code base and that they each use their local database. When you commit your changes, each of them must be very careful when updating source code on their local hosts. Their manual synchronization of your changes, followed by committing of their work, makes the version control system useless for these configuration files. If you've ever used Spring MVC, you know that applicationContext.xml is the crucial element of your application, since it is the glue that holds things together. Therefore, it is very important to find a mechanism that helps us keep things organized in our applications.
As we said earlier, this is the easier configuration problem that you can experience. The harder version of the problem is when you need to have different bean wirings on different hosts. Examples of this kind of problem are very easy to find in everyday software development tasks. For instance, imagine that you have a custom authentication module for your product that is able to authenticate users from relational databases or LDAP servers. Naturally, the authentication module could be configured with the bean that abstracts a certain repository. If you want to change how users are authenticated among different application deployments, you will need to make different bean wirings in your applicationContext.xml file. This kind of configuration issue could be seen in all applications that have configurable features among deployments.
SPRING Framework... AN INTRODUCTION
Spring is an open-source application framework, introduced and developed in 2004. The main ideas were suggested by an experienced J2EE architect, Rod Johnson.
He had earlier, written a book titled 'J2EE Develoment without using EJB' and had introduced the concept of Light-weight container. Primarily, his argument is that while EJB has its merits, it is not always necessary and suitable in all applications.
Just as Hibernate attacks CMP as primitive ORM technology, Spring attacks EJB as unduly complicated and not susceptible to unit-testing. Instead of EJB, Spring suggests that we make use of ordinary Java beans, with some slight modifications, to get all the supposed advantages of EJB environment. Thus, Spring is posed as an alternative to EJB essentially. However, as a concession to the existing EJB investments, Spring is designed to operate with EJB if required.
Much of the philosophy and approach of Spring framework, however, predates , the latest EJB vesrion (ie) EJB-3, about to arrive shortly. It is said that EJB-3 has absorbed a number of new ideas suggested by Spring and some more, to answer the criticisms. There is a debate going on in the Java community about Spring and EJB-3. Spring is not a Persistence technolgy but a framework which allows plug in of other such technologies. But EJB-3 is primarily focussed on Persistence Technology and has now incorporated Hibernate, the best ORM todate.Talks are going on to incorpotrate another equally nice ORM Technology known as JDO, which provides for Object Database also. Moreoveer, EJB-3 's Attribute-Orientaed Meta tags, help in vastly reducing the size of XML lines. Some have complained that Spring is still too dependent on XML files. In this tutorial, any reference to EJB, is only to EJB-2.My aim in presenting this tutorial is not to advocate the choice of either Spring or EJB-3, a topic still being devbated by experts but to share my perception with our readers.
In spring, we can make use of plain Java Beans to achieve things that were previously possible with EJB only. The main aim of Spring is to simplify the J2EE development and testing.
EJB has been around since 1988 and is an established standard and specification in Enterprise world. Though there have been numerous Open-source Java technologies recently, no other technology has claimed to be superior to EJB, in its total features.
Rod Johnson, in his book, critices a number of features in EJB. Significantly, he has also spoken approvingly of some features of EJB and has recommended its use in some special circumstances.
EJB is a standard with wide Enterprise-level Industry support.It has been deployed in thousands of successful applications around the world. The EJB specification is a fixed target and so tool-developers are able to develop wizards, which can make ejb development quick and easy. There are many vendors for EJB application server like IBM (Web-Sphere), BEA (Weblogic), Oracle (JDeveloper) etc.
To quote from another book on Spring ("Spring in Action" - Craig Walls-Manning press) " EJB is complex ", as the author put it nicely, "not for just being complex'. It is complex because it attempts to provide solutions for complex problems". EJB is developed mainly for the remote transaction and distributed objects. But a number of enterprise projects do not have this level of complexity and still use EJBs and even the simple application becomes complex. In such cases Spring claims to be an alternative.
Since Spring comes with rich support to enterprise level services, it claims to be an alternative to EJB It is worthwhile to begin with a comparison of EJB-2 and Spring, in some main features.
The main advantages of EJB are :
a) Transaction Management
b) Declarative Transaction support
c) Persistence ( CMP & BMP)
d) Declarative Security
e) Distributed Computing (Container managed RPC)
Spring does not attempt to do everything by itself but supports the best of breed technologies for each of these requirements.
For example, instead of CMP & BMP, it supports several persistence technologies like JDO, Hibernate and OJB. These ORM toools are far more capable than the implementation in CMP.To simplify JDBC coding, there are tools like iBatis and Spring supports iBatis also.
Spring makes use of Acegi, an open-source Security framework and provides declarative security through spring configuration file or class metadata while in EJB declarative security is configured through deployment descriptor.
Spring provides proxying for RMI (special remoting technologies like Burlap) JAX-RPC & web-service while EJB provides container-managed remote method calls.
Spring can offer declarative transaction like EJB. But spring provides declarative rollback behavior also ,for methods and exceptions
Thus, while EJB is monolithic and attempts to do many things, some tasks fairly well and some others not so well, Spring uses ordinary Java beans only and through special techniques provides many of the functionalities of EJB, by integrating with a number of open-source technologies.
Thereby, it gives the following advantages over EJB2.
a) testing is easier. We do not need to start the EJB container , for testing.
b) As Spring is based on the standard JavaBeans naming convention, programmers find it easy to work with.
c) It makes use of AOP(Aspect-Oriented Programming) which is a very recent and useful paradigm., in addition to classic OOP and preserves the purity of OOP.
d) It is flexible.
Spring's goal is to be an entire Application Framework. Other popular framewoks like Struts, Tapestry, JSF etc., are very good web tier frameworks but when we use these framework, we have to provide additional framework to deal with enterprise tier that integrates well with these framework. Spring tries to alleviate this problem by providing a comprehensive framework, which includes
a core bean container,
an MVC framework,
an AOP integration framework,
a JDBC integration framework and
an EJB integration framework.
It also provides integration modules for O/R mapping tools like Hibernate and JDO. Thus spring framework can be thought of as a layered architecture consisting of seven well defined modules.
The function of each component is as follows:
1. Core Container:
The core container provides the fundamental functionality of Spring. It's primary component is the 'BeanFactory', an implementation of the Factory pattern. The BeanFactory applies the IOC pattern to separate an application's configuration and dependency specification from the actual application code.
2. Spring Context/Application Context:
The Spring context is a configuration file that provides context information to the Spring framework . The Spring context supplies enterprise services such as JNDI access, EJB integration, e-mail, internalization, validation, and scheduling functionality.
3. Spring AOP:(Aspect-Oriented)
The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result we can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP we can incorporate declarative transaction management into our applications without relying on EJB components.
The Spring AOP module also introduces metadata programming to Spring. Using this we can add annotation to the source code that instructs Spring on where and how to apply aspects.
4. Spring DAO:
The Spring's JDBC and DAO abstraction layer offers a meaningful exception hierarchy for managing the databaase connection, exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of code that we need to write, such as opening and closing connections. This module also provide transaction management services for objects in a spring application.
5. Spring ORM:
The Spring framework can be integrated to several ORM frameworks to provide Object Relational tool, including JDO, Hibernate, OJB and iBatis SQL Maps.
6. Spring Web module:
The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts, JSF and webworks. The Web module also eases the tasks of handling multipart requests and binding request parameters to domain objects.
7. Spring MVC Framework:
The MVC framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles and the generation of PDF and Excel Files.
--------------------------------------------
I would venture to suggest that Spring will win sure acceptance among j2ee devcelopers , very soon because of its ready-made adapters for various hot web-tier and presentation technologies.!
For example, there is a great varierty of technologies in the web-tier like MVC PATTERN, STRUTS, JSF, WEB-WORK, JSP, TAPESTRY,FREEMARKER etc. Developers are now puzzled and confused about the relative merits and demerits of all these. Once they choose a technology and start implementing and later want to change over to another technology, it is very difficult. But, as Spring offers modules for aall the above technologies, it is most often simply changing the configuraion file. With this approach, it is even possible for a development team to try and test a given task in all the above forms and see the effect and performance before deciding the choice. Spring offers its own version of MVC architecture. It also offers adapters for Struts.
In the MVC adapter, it offers the following View choices.
JSP is default view template. 'InternalResouceViewResolver' can be used for this purpose. Spring can be integrated with other template solutions like Velocity, FreeMarker, tiles etc., Also Spring can be used to produce dynamic binary Excel spreadsheet, PDF documents etc.,
To configure the velocity engine 'VelocityConfigurer' bean is declared in spring configuration. The view resolver is configured by 'VelocityViewResolver' bean.
To configure the FreeMarker engine 'FreeMarkerConfigurer' bean is declared in spring configuration. The view resolver is configured by 'FreeMarkerViewResolver' bean.
'TilesConfigurer' can used to used to load Tiles configuration file for rendering Tiles view. 'AbstractExcelView' is used to generate Excel SpreadSheet as views. 'AbstactPdfView' supports the creation of PDF as views. 'buildPdfDocument()' is used to create PDF decument. Similarly we have 'buildExcelDocument()' to create the excel document.
For delegation purpose, Spring provides 'DelegatingRequestProcessor' and to use the tiles 'DelegatingTilesRequestProcessor' is used. 'SpringTapestryEngine' is used for integrating Tapestry to Spring. 'FacesSpringVariableResolver' is used to resolve spring-managed beans in JSF.
-----------------------------------------------------------------------------
Next we shall see the main concepts of Spring, Inversion of Control (IoC) and Aspect Oriented Programming. Spring is based on dependency injection type of IoC . We don't directly connect our components and services together in code but describe which services are needed by which components in a configuration file. A container is responsible for hooking it up. This concept is similar to 'Declarative Management'. IOC is a broad concept. the two main types are
1. Dependency Lookup:
The container provides callbacks to components and a lookup context. The managed objects are responsible for their other lookups. This is the EJB Approach. The Inversion of Control is limited to the Container involved callback methods that the code can use to obtain resources. Here we need to use JNDI to look up other EJBs and resources. Because of this reason EJB is not branded as 'IOC framework'.There are some problems in this implementation. The class needs a application server environment as it is dependent on JNDI and it is hard to test as we need to provide a dummy JNDI contest for testing purpose.
2. Dependency Injection:
In this application objects is not responsible for looking up resources they depend on. Instead IoC container configures the object externalizing resource lookup from application code into the container. That is, dependencies are injected into objects. Thus lookups are completely removed from application objects and it can be used outside the container also.
----
In this method, the objects can be populated via Setter Injection (Java-Beans properties) or Constructor Injection (constructor arguments). Each method has its own advantage and disadvantage.
Normally in all the java beans, we will use setter and getter method to set and get the value of property as follows
public class namebean
{
String name;
public void setName(String a)
{
name = a;
}
public String getName()
{
return name;
}
}
We will create an instance of the bean 'namebean' (say bean1) and set property as bean1.setName("tom"); Here in setter injection, we will set the property 'name' by using the
The subelement
setName("tom"); This process is called setter injection.
For constructor injection, we use constructor with parameters as shown below,
public class namebean
{
String name;
public namebean(String a)
{
name = a;
}
}
We will set the property 'name' while creatinf an instance of the bean 'namebean' as namebean bean1 = new namebean("tom");
Here we use the
To set properties that reference other beans , subelement of
Aspect-Oriented Programming
---------------------------
Aspect Oriented programming is a new
programming technique that promotes separation of concerns within the system. System are composed of several components each responsible for a specific piece of functionality. Whatever may be the core function of the program, the system service like logging, transaction management, security etc., must be included in the program. These system services are commonly refered to as 'cross-cutting concerns' as they tend to cut across multiple components in a system. AOP makes it possible to modularize and separate these services and then apply them declaratively to the components and we can focus on our own specific concerns. In spring, aspects are wired into objects in the spring XML file in the same way as JavaBean. This process is known as 'Weaving'.
----------------------------------------
The container is at the core of Spring Container. In manages the life cycle and configuration of application objects. We can configure how each of our beans should be created either to create a single instance of bean or produce a new instance every time and how they should be associated with each other. Spring should not, however, be confused with traditionally heavyweight EJB containers, which are often large. The Spring actually comes with two distinct containers: Bean Factories-defined by "org.springframework. beans.factory.BeanFactory" are the simplest containers, providing support for dependency injection. Application contexts - defined by "org.springframework.context.Application Context" provides application framework services.
BEAN FACTORY:
Bean factory is an implementation of the factory design pattern and its function is to create and dispense beans. As the bean factory knows about many objects within an application, it is able to create association between collaborating objects as they are instantiated. This removes the burden of configuration from the bean and the client.
There are several implementation of BeanFactory. The most useful one is "org.springframework.beans.factory.xml.
XmlBeanFactory". It loads its beans based on the definition contained in an XML file. To create an XmlBeanFactory, pass a InputStream to the constructor. The resource will provide the XML to the factory.
BeanFactory factory = new XmlBeanFactory(new FileInputStream("myBean.xml"));
This line tells the bean factory to read the bean definition from the XML file. The bean definition includes the description of beans and their properties. But the bean factory doesn't instantiate the bean yet. To retrieve a bean from a 'BeanFactory', the getBean() method is called. When getBean() method is called, factory will instantiate the bean and begin setting the bean's properties using dependency injection.
myBean bean1 = (myBean)factory.getBean("myBean");
APPLICATION CONTEXT:
While Bean Factory is used for simple applications, the Application Context is spring's more advanced container. Like 'BeanFactory' it can be used to load bean definitions, wire beans together and dispense beans upon request.
It also provide
1) a means for resolving text messages, including support for internationalization.
2) a generic way to load file resources.
3) events to beans that are registered as listeners.
Because of additional functionality, 'Application Context' is preferred over a BeanFactory. Only when the resource is scarce like mobile devices, 'BeanFactory' is used. The three commonly used implementation of 'Application Context' are
1. ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath, treating context definitions as classpath resources. The application context is loaded from the application's classpath by using the code
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
2. FileSystemXmlApplicationContext : It loads context definition from an XML file in the filesystem. The application context is loaded from the file system by using the code
ApplicationContext context = new FileSystemXmlApplicationContext("bean.xml");
3. XmlWebApplicationContext : It loads context definition from an XML file contained within a web application.
Spring is lightweight in terms of both size and overhead. The entire Spring framework can be distributed in a single JAR file that weighs just over 1.7 MB. And the processing overhead required by Spring is negligible. Also Spring is nonintrusive:(ie) objects in a Spring-enabled application typically have no dependencies on Spring-specific classes.
There are other lightweight containers like HiveMind, Avalon, PicoContainer etc., Avalon was one of the first IoC containers. Avalon mainly provides interface-dependent IoC. so, we much change our code in order to use a different container. This couples your code to a particular framework which is an undesirable feature.
PicoContainer is a minimal (very small size nearly 50k) lightweight container that provides IoC in the form of constructor and setter injection. By using PicoContainer we can only assemble components programmatically through PicoContainer's API. But it allows only one instance of any particular type to be present in the registry. Also PicoContainer is only a container. It does not offer various special features as spring like integration.
HiveMind is relatively new IoC container. Like PicoContainer, it focuses on wiring with support for both constructor and setter injections. It also allows us to define our configuration in an XML file. Like PicoContainer, HiveMind is only a container. It does not offer integration with other technology. Thus Spring makes it possible to configure and compose complex applications from simpler components. In Spring, application objects are composed declaratively, typically in an XML file. Spring also provides much infrastructure functionality like transaction management, persistence framework integration, etc., leaving the development of application logic to us.
With this inroduction, we shall see a simple example in Spring in next article.