The IBatis Model
Been a while since I started first looking at IBatis. The Spring Framework has a sample application named JPetstore (available in the core download) that gives you an example of IBatis, Spring, and Struts 1.x .
Different Spring Ibatis SQLMaps approaches:
Use Of Annotations
Implementing DAOs based on plain iBATIS API
<bean
id=”dataSource”
class=”org.springframework.jdbc.datasource.SingleConnectionDataSource”
destroy-method=”destroy”
>
<bean id=”transactionManager”
class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”>
<property name=”dataSource” ref=”dataSource”/>
</bean>
<bean id=”sqlMapClient” class=”org.springframework.orm.ibatis.SqlMapClientFactoryBean”>
<property name=”configLocation” value=”classpath:/sqlmap-config.xml”/>
<property name=”dataSource” ref=”dataSource”/>
</bean>
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE sqlMapConfig PUBLIC
“-//ibatis.apache.org//DTD SQL Map Config 2.0//EN”
“http://ibatis.apache.org/dtd/sql-map-config-2.dtd”>
<sqlMapConfig>
<settings defaultStatementTimeout=”5″ />
<sqlMap resource=”MyType.xml” />
</sqlMapConfig>
You can actually omit the ‘transaction-manager’ attribute in the <tx:annotation-driven/> tag if the bean name of the PlatformTransactionManager that you want to wire in has the name ‘transactionManager’.
<!– Instructs Spring to perfrom declarative transaction managemenet on annotated classes –>
<tx:annotation-driven/>
@Autowired
public void setSqlMapClient(SqlMapClient sqlMapClient) {
iBatisTemplate = new SqlMapClientTemplate(sqlMapClient);
}
@@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
- The @Transactional annotation may be placed before an interface definition, a method on an interface, a class definition, or a public method on a class. However, please note that the mere presence of the @Transactional annotation is not enough to actually turn on the transactional behavior.
public MyType insertMyType(MyType myType) {
MyType myType = null;
myType= (MyType) iBatisTemplate.insert(“insertIntoMyType”, MyType;
return myType;
}
Use Of Spring’s DaoSupport Class
<bean
id=”dataSource”
class=”org.apache.commons.dbcp.BasicDataSource”
destroy-method=”close”
>
<bean id=”sqlMapClient” class=”org.springframework.orm.ibatis.SqlMapClientFactoryBean”>
<property name=”configLocation” value=”classpath:/sqlmap-config.xml”/>
<property name=”dataSource” ref=”dataSource”/>
</bean>
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE sqlMapConfig PUBLIC “-//iBATIS.com//DTD SQL Map Config 2.0//EN”
“http://www.ibatis.com/dtd/sql-map-config-2.dtd”>
<sqlMapConfig>
<settings useStatementNamespaces=”true” />
<sqlMap resource=”person.xml” />
</sqlMapConfig>
PersonDaoIbatisImpl extends SqlMapClientDaoSupport
public void addPerson(Person person) {
Long id = (Long) this.getSqlMapClientTemplate().insert(“person.insert”,
person);
person.setId(id);
}
- org.springframework.orm.ibatis.support.SqlMapClientDaoSupport – Instead of a plain SqlMapClient, you can also pass a preconfigured SqlMapClientTemplate instance in. This allows you to share your SqlMapClientTemplate configuration for all your DAOs
The Spring Stack 2008 – Part1
Spring 2.0 introduced support for various annotations for configuration purposes, such as:
- @Transactional – The @Transactional annotation may be placed before an interface definition, a method on an interface, a class definition, or a public method on a class. However, please note that the mere presence of the @Transactional annotation is not enough to actually turn on the transactional behavior.
- @Required – used to mark a property as being ‘required-to-be-set’ (i.e. an annotated (setter) method of a class must be configured to be dependency injected with a value)
- @PersistenceContext – annotated on EntityManager instances are not thread safe
- @PersistenceUnit – annotated on EntityManagerFactory instances are thread-safe
Thus, to use annotations for the transactions for my purposes, I do the following:
- Put an tag tx:annotation-driven in the config file (i.e applicationContext.xml)
- Put @Transactional annotation in the services class implementation that contains operations on the entity manager
Spring 2.5 introduces support for a complete set of configuration annotations:
- @Autowired in combination with support for the JSR-250 annotations @Resource
- @PostConstruct
- @PreDestroy
NFJS In Links
The Vietnam Of Computer Science
Jacobsen : Use Cases and Aspects
Clay Shirky : “Its Turtles All the Way Up“
Ted Neward on Rest vs Soap
REST: Get, Post, Put, Delete
Roy Fielding : Architectural Styles & the Design of Network-based Software Architectures
Bob Mcwhirter : the founder of drools (jboss rules) and codehaus
Jess is another rules platform
Habits of Effective Programmers
Darshan Arney takes on: ‘ The Top software developers are more productive than average software developers not by a factor of 10x or 100x or even 1000x but by 10,000x.’
Book – TopGrading
Raymond : The Cathedral and the Bazaar
Dijkstra: Computer Science is no more about computers than astronomy is about telescopes.
Neal Ford – Thoughtworks
Brian Goetz – Sun
Brian Sam-Bodden - Integrallis
Fluffage
Starting at about 12:00 tommorow I’ll be arriving at NoFluffJustStuff conference – also known as the Research Triangle Software Symposium. This is put on by Jay Zimmerman and his cast of notable experts from the software industry.
There are a lot of good choices on the menu.
roller 4 + planet
In this post I will cover getting started with the Roller4.0 blogging software including setting up the planet (aggregation server).
Anyway, I am using the mysql database (5.0.41 community edition) with roller 4
(best available) which i placed in Tomcat’s webapps directory naming the folder roller4_0 .
I am using tomcat 5.5 with java5.
Setup: Tomcat’s common/classes folder have placed file roller-custom.properties:
installation.type=auto
database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb
database.jdbc.username=root
database.jdbc.password=admin
mail.configurationType=properties
mail.hostname=smtp-server.nc.rr.com
mail.username=x
mail.password=x
Important: You need to put the mysql driver, and two other jars into Tomcats’s common/lib directory:
- mysql-connector-java-3.1.13-bin
- activation (obtained from my java 5 lib folder)
- mail (obtained from my java 5 lib folder)
After starting Tomcat, I go to the main screen via url http://localhost:8080/roller4_0/index.jsp
which says I have a successful connection but have no tables . So I click the button to create the tables.

Then, I get the page to create users and the blog.

Yes, you need a planet-custom properties (roller-custom.properties in common/classes) file…
I set up a blog which i called planet which I give a theme of
roller front page…
My weblog template now has
## 1) SITE-WIDE entries (the default)
##set($pager = $site.getWeblogEntriesPager($since, $maxResults))
#set($pager = $planet.getAggregationPager($since, $maxResults))
## The below pager code should work against either
I thought).enable “Enable aggregated site-wide frontpage” (this is on by default)
PlanetModel in the ‘rendering.siteModels’ list.If you want Planet aggregations to be available to all blogs you can
put the model in the ‘rendering.pageModels’ list.
individual blogs via the blog’s Preferences->Settings page.”
planet.aggregator.enabled=true
cache.dir= /mycache/planetcache
planet.aggregator.guice.module=\
org.apache.roller.weblogger.planet.business.jpa.RollerPlanetModule
# Tasks which are enabled. Only tasks listed here will be run.
tasks.enabled=ScheduledEntries
Task,ResetHitCountsTask,\
TurnoverReferersTask,PingQueueTask,RefreshRollerPlanetTask,SyncWebsitesTask
# Set of page models specifically for site-wide rendering
rendering.siteModels=\
org.apache.roller.weblogger.ui.rendering.model.SiteModel,\
org.apache.roller.weblogger.ui.rendering.model.PlanetModel
named planet.aggregator.cache.dir, but the planet.properties file
looks like it uses cache.dir
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb
database.jdbc.username=x
database.jdbc.password=y
Just Say No
“I am suggesting that there are those around us who are “serial committers” – they always say yes and rarely say no, even when they should. These individuals become so engulfed by the shear number of commitments that they have made that it becomes impossible for them to execute on any of them, at least not effectively.”
http://cjhemp.wordpress.com/2007/04/28/promise-based-management/
Practices are way to Go
http://drdobbs.com/dept/architect/198000264: “”
links for 2006-11-20
-
# Email
# Shared calendar
# Web document authoring and sharing
# “Over the air” sync to mobile devices
# VoIP integration
# Microsoft Outlook, Apple, and Linux compatibilit
Official First Day
Mobile Jump
Link: Mobile Jump.
Bonnie Beagle
Prior to 1997, I never had the good fortune of experiencing the bond
between a man and his dog. In this case the dog was a beagle named
Bonnie.
She was timid, but she would touch our life with her sweet nature,
and her everlasting devotion. When she got past the shyness, she
followed the Beagle code whereby like my vet used to say, "I never saw
a beagle who would not eat anything put down in front of him/her".
You could tell she had a tough life before entering ours, she had a
good ticker (heart), and rarely ever barked. When we had another dog we
brought into the house as a puppy, she took him under her wings and
showed him the ropes. It was almost as if she thought it was her puppy.
The unique thing she would do is when we poured her a bowl of food, she
would eat only half the food in the bowl. It was as if the younger dog
would be waiting on the on deck circle, and as soon as she finished her
portion, she let the other dog eat the rest.
The dog fought a cancer battle several years ago that was defeated
thanks to one Dr Jeff Todd, but after being with us for eight solid
years, this was just her time to go. She left us gracefully last night
after starting the morning doing her favorite thing that is taking a
walk on Litchford Road. In the time we knew here, you just brought up
the word walk and her ears would rise up and a tail wagging. Thus, it
was appropriate she got to walk and sniff on her last day here with us.
I will leave you now with this excerpt from A Dog’s Prayer by Beth Harris:
"Speak
to me often, for your voice is the world’s sweetest music, as you must
know by fierce wagging of my tail when your footseps falls upon my
waiting ear…and I will leave you knowing with the last breath I drew,
my fate was ever safest in your hands"
Microsoft Adopts Mozilla’s RSS Icon
Link: Microsoft Adopts Mozilla’s RSS Icon.
"I’m excited to announce that we’re adopting the icon used in Firefox. [They] were very enthusiastic about allowing us [and anyone in the community] to use their icon," wrote a member of Microsoft’s RSS Team.
Early responses to Microsoft’s decision, posted on the Team RSS were overwhelmingly positive, describing the shared Microsoft-Mozilla icon as "well done!" and "and a welcome change of pace from the browser wars."
Blog Awards, google api
Link: Red Reporter :: 2005 Sports Blog Awards.
Gator fans like this news.
tips
http://ajaxian.com/archives/2005/12/jon_aquino_has.html
when to use it
http://ajaxian.com/archives/2005/12/6_places_you_mu.html
http://ajaxian.com/archives/2005/12/taking_firefox.html
I recently signed up for wiki account at BeJUG. They had what looks like a nice talk/demo on openLaszlo that I should check out some time
Link Dump 7/7
Learning Java
Gosling Q&A
The Early Days : "the Green project, we decided we wanted to do a prototype. We had to focus. Largely because it was more entertaining, we picked consumer electronics."
On Microsoft : "They were actually very upstanding, lovely members of the Java community for six months or a year, then they decided that was a bad idea."
Gosling Q&A
The Early Days : "the Green project, we decided we wanted to do a prototype. We had to focus. Largely because it was more entertaining, we picked consumer electronics."
On Microsoft : "They were actually very upstanding, lovely members of the Java community for six months or a year, then they decided that was a bad idea."
AJAX DWR
AJAX: It enhances user interaction by targeting updates from the server to specific areas of the web page, known as "In-page replacement" . DWR is easy AJAX for Java
http://www.newsobserver.com/news/q/story/2342342p-8720451c.html
Listening Post
Ideas and issues under discussion in the Triangle
|
Bloggers’ vulnerability
From USA Today, a commentary by Philip Meyer, the Knight professor of journalism at UNC-Chapel Hill, considers who is a journalist. Rat on your source or go to jail. When a journalist for a print or broadcast medium faces that choice, he or she usually has the benefit of a deep-pocketed employer who will pay legal fees and keep the paychecks coming. But two species of journalists — book authors and bloggers — usually lack that comfort. If you are a blogger or are thinking about becoming one, you should worry about that.
In California, Apple Computer is going after three bloggers who it says revealed important trade secrets in their online publications. A state judge has ruled that the bloggers must cough up the names of the person or persons who gave them the information.
Journalism today operates under a kind of feudal system. Just as serfs once provided their labor to the lord of the castle in exchange for protection, reporters today rely on the corporations that hire them to give them the legal clout to take risks in digging out the truth.
Neither the freelance book author nor the lonely blogger typing away in a basement has that protection. The record for time spent in jail to protect a source is held not by a television or newspaper reporter, but by Vanessa Leggett, an unaffiliated and unpublished author who was investigating a murder case. She served 168 days behind bars in Houston. The court finally let her go with the expiration of the term of the grand jury that wanted her secret.
Hers was a federal case. The Department of Justice, which approves subpoenas of journalists, stayed out of it, deciding that Leggett wasn’t a journalist.
Now the issue of who is a journalist is back. Bloggers, with their lightning response time and great variety of viewpoints and resources, are going around the traditional gatekeepers of news. The California bloggers had hoped the courts would recognize their influence and treat them as journalists so they could be covered by California’s shield law, which gives qualified protection to reporters guarding confidential sources.
Santa Clara County Superior Court Judge James Kleinberg sidestepped the issue of defining journalists by ruling that California law does not protect even recognized journalists in cases that involve theft of trade secrets.
The judge’s ruling, now under appeal, was thus a double disappointment to members of the blogging community who crave recognition as journalists. Traditional journalists should support them. There is neither sound moral nor legal justification for claiming that those who work for major news organizations have stronger First Amendment rights than the rest of us.
Thirty-one states and the District of Columbia have qualified shield laws, and court decisions have left grounds for arguing that the First Amendment has the same effect in federal cases. A federal shield law has been proposed by Sens. Richard Lugar, an Indiana Republican, and Christopher Dodd, a Connecticut Democrat. For certain cases, "it is the very promise of secrecy by a journalist," they have argued, "that ultimately protects the public’s right to know."
But all such laws are subject to unpredictable interpretation by the courts, and none tells what to do about bloggers.
As the power to disperse information moves from castle to cottage, bloggers need to band together, find patrons to protect them, or both. That is starting to happen. The recipients of the California subpoenas are getting pro bono legal services from the Electronic Frontier Foundation, established with Silicon Valley money in 1990.
The foundation was created after the Secret Service seized the computers of a small book publisher, Steve Jackson Games, in Austin. Agents thought Steve Jackson’s company was involved in the theft and distribution of a BellSouth document that hackers could use to disrupt the 911 emergency system. It wasn’t, but Jackson had to lay off employees when he lost the use of his computers, and important electronic mail was deleted when he finally got the computers back.
None of the groups to which Jackson turned for aid understood the technology enough to appreciate the civil-liberties issue.
Three men who did understand it finally got together to form the foundation: Mitch Kapor, former president of Lotus Development; John Gilmore, an early employee of Sun Microsystems; and Perry Barlow, lyricist for the Grateful Dead. And they supported Jackson’s company in a lawsuit that established the rule that electronic mail deserves as much protection as telephone conversations.
Since then, the organization has grown to 15,000 dues-paying members. It has an international presence in its support for civil-rights issues involving high technology.
Bloggers are often compared with the lonely pamphleteers who flourished in the 15th century when printing with movable type was a new technology. Professional associations and support groups will make them less lonely.
As for Vanessa Leggett, her true-crime book is still in progress. She has a publisher and a New York agent. But book authorship, still a low-tech enterprise, is likely to remain a solitary task.
http://www.newsobserver.com/news/q/story/2342342p-8720451c.html
Listening Post
Ideas and issues under discussion in the Triangle
|
Bloggers’ vulnerability
From USA Today, a commentary by Philip Meyer, the Knight professor of journalism at UNC-Chapel Hill, considers who is a journalist. Rat on your source or go to jail. When a journalist for a print or broadcast medium faces that choice, he or she usually has the benefit of a deep-pocketed employer who will pay legal fees and keep the paychecks coming. But two species of journalists — book authors and bloggers — usually lack that comfort. If you are a blogger or are thinking about becoming one, you should worry about that.
In California, Apple Computer is going after three bloggers who it says revealed important trade secrets in their online publications. A state judge has ruled that the bloggers must cough up the names of the person or persons who gave them the information.
Journalism today operates under a kind of feudal system. Just as serfs once provided their labor to the lord of the castle in exchange for protection, reporters today rely on the corporations that hire them to give them the legal clout to take risks in digging out the truth.
Neither the freelance book author nor the lonely blogger typing away in a basement has that protection. The record for time spent in jail to protect a source is held not by a television or newspaper reporter, but by Vanessa Leggett, an unaffiliated and unpublished author who was investigating a murder case. She served 168 days behind bars in Houston. The court finally let her go with the expiration of the term of the grand jury that wanted her secret.
Hers was a federal case. The Department of Justice, which approves subpoenas of journalists, stayed out of it, deciding that Leggett wasn’t a journalist.
Now the issue of who is a journalist is back. Bloggers, with their lightning response time and great variety of viewpoints and resources, are going around the traditional gatekeepers of news. The California bloggers had hoped the courts would recognize their influence and treat them as journalists so they could be covered by California’s shield law, which gives qualified protection to reporters guarding confidential sources.
Santa Clara County Superior Court Judge James Kleinberg sidestepped the issue of defining journalists by ruling that California law does not protect even recognized journalists in cases that involve theft of trade secrets.
The judge’s ruling, now under appeal, was thus a double disappointment to members of the blogging community who crave recognition as journalists. Traditional journalists should support them. There is neither sound moral nor legal justification for claiming that those who work for major news organizations have stronger First Amendment rights than the rest of us.
Thirty-one states and the District of Columbia have qualified shield laws, and court decisions have left grounds for arguing that the First Amendment has the same effect in federal cases. A federal shield law has been proposed by Sens. Richard Lugar, an Indiana Republican, and Christopher Dodd, a Connecticut Democrat. For certain cases, "it is the very promise of secrecy by a journalist," they have argued, "that ultimately protects the public’s right to know."
But all such laws are subject to unpredictable interpretation by the courts, and none tells what to do about bloggers.
As the power to disperse information moves from castle to cottage, bloggers need to band together, find patrons to protect them, or both. That is starting to happen. The recipients of the California subpoenas are getting pro bono legal services from the Electronic Frontier Foundation, established with Silicon Valley money in 1990.
The foundation was created after the Secret Service seized the computers of a small book publisher, Steve Jackson Games, in Austin. Agents thought Steve Jackson’s company was involved in the theft and distribution of a BellSouth document that hackers could use to disrupt the 911 emergency system. It wasn’t, but Jackson had to lay off employees when he lost the use of his computers, and important electronic mail was deleted when he finally got the computers back.
None of the groups to which Jackson turned for aid understood the technology enough to appreciate the civil-liberties issue.
Three men who did understand it finally got together to form the foundation: Mitch Kapor, former president of Lotus Development; John Gilmore, an early employee of Sun Microsystems; and Perry Barlow, lyricist for the Grateful Dead. And they supported Jackson’s company in a lawsuit that established the rule that electronic mail deserves as much protection as telephone conversations.
Since then, the organization has grown to 15,000 dues-paying members. It has an international presence in its support for civil-rights issues involving high technology.
Bloggers are often compared with the lonely pamphleteers who flourished in the 15th century when printing with movable type was a new technology. Professional associations and support groups will make them less lonely.
As for Vanessa Leggett, her true-crime book is still in progress. She has a publisher and a New York agent. But book authorship, still a low-tech enterprise, is likely to remain a solitary task.
IBM Portal
Cogix Survey portlet for WebSphere 5.0.2
from WSAD to RAD
Websphere 6: “IBM WebSphere Studio Site Developer and WebSphere Studio Application Developer will be re-branded as IBM Rational Web Developer for WebSphere Software and Rational Application Developer for WebSphere Software”.
[WASV6]










