TechnoBuzz

A Techno Blog, mainly about Java

JPA Examples

jpa spec jsr 317

open jpa manual

In an applicationserver, EntityManager instances are typically injected, rendering the EntityManagerFactory unnecessary.

javax.persistence:

  • Persistence : contains static helper methods to obtain EntityManagerFactory
    instances in a vendor-neutral fashion.
  • EntityManagerFactory: is a factory for Entity-Manager
  • EntityManager: is the primary JPA interface used by applications.Each EntityManager manages a set of persistent objects, and has APIs to insert new objects and delete existing ones. EntityManagers also act as factories for Query instances.
  • Entity: persistent objects that represent datastore records.
  • Query: Query interface is implemented by each JPA vendor to find persistent objects that
    meet certain criteria. JPA standardizes support for queries using both the Java Persistence Query Language (JPQL) and the Structured Query Language (SQL). You obtain Query instances from an EntityManager.

JPA uses a version field in your entities to detect concurrent modifications to the same datastore record. When the JPA runtime detects an attempt to concurrently modify the same record, it throws an exception to the transaction attempting to commit last. This prevents overwriting the previous commit with stale data.

private int version;

JPA introduces another form of object identity, called entity identity or persistent identity. Entity identity tests whether two persistent objects represent the same state in the datastore.

May 11, 2008 Posted by davidbloom | Hibernate & ORM, J2EE | | No Comments

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.

image01.jpg

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

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))

## 2) PLANET-entries
#set($pager = $planet.getAggregationPager($since, $maxResults))
## The below pager code should work against either
the planet blog _must_ be the frontpage blog (this is not optional as
I thought).enable “Enable aggregated site-wide frontpage” (this is on by default)
“That’s true because the Installation Guide tells you to put the
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.
Or, if you are an admin user the you can add the PlanetModel to
individual blogs via the blog’s Preferences->Settings page.”
3- in roller-custom.properties
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

The installation guide says the planet cache directory property is
named planet.aggregator.cache.dir, but the planet.properties file
looks like it uses cache.dir
It should be RefreshRollerPlanetTask not RefreshPlanetRollerTask
planet-custom.properties:
database.configurationType=jdbc

database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb
database.jdbc.username=x
database.jdbc.password=y

January 6, 2008 Posted by davidbloom | Uncategorized | | No Comments

Struts2 Trainings

One of the struts 2 sample applications is the Mailreader application which has training course via Struts from Square One site .

Building Web Applications
Building Struts 2 Applications [ Welcome] [More ...]

Struts 2 components

Action Handler, Result Handler, Custom Tags

Interceptor : bring custom code into call stack

  • Timer Interceptor
  • Prepare (able) - If the Action implements Preparable, calls its prepare method.

value stack : stack of objects that expression language can pull from

  • Action instance pushed onto stack

Jumpstarting JUnit (More …)

Capturing Input(More …)

Validating Input (More …)

Request Lifecycle in Struts 2 applications

  • User Sends request: User sends a request to the server for some resource.
  • FilterDispatcher determines the appropriate action: The FilterDispatcher looks at the request and then determines the appropriate Action.
  • Interceptors are applied: Interceptors configured for applying the common functionalities such as workflow, validation, file upload etc. are automatically applied to the request.
  • Execution of Action: Then the action method is executed to perform the database related operations like storing or retrieving the data from database.
  • Output rendering: Then the Result render the output.
  • Return of Request: Then the request returns through the interceptors in the reverse order. The returning request allows us to perform the clean-up or additional processing.

Display the result to user: Finally the control is returned to the servlet container, which sends the output to the user browser.
Struts 2 Big Picture

The diagram depicts the architecture of Struts 2 Framework. It shows the the initial request goes to the Servlet container, which is then passed through a standard filer chain.

  1. ActionContextCleanUp filter: The ActionContextCleanUp filter is optional. It is useful when integrating other technologies such as SiteMesh Plugin.
  2. FilterDispatcher: the required FilterDispatcher is called, which in turn consults the ActionMapper to determine if the request should invoke an action. If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the ActionProxy.
  3. ActionProxy: The ActionProxy consults the Configuration Files manager, which is initialized via the struts.xml file. Then the ActionProxy creates an ActionInvocation, which implements the command pattern. The ActionInvocation process invokes the Interceptors (if configured) and then invokes the action.
  4. Once the Action returns, the ActionInvocation is responsible for looking up the proper result associated with the Action result code mapped in struts.xml. The result is then executed, which often (but not always, as is the case for Action Chaining) involves a template written in JSP or FreeMarker to be rendered. While rendering, the templates can use the Struts Tags provided by the framework. Some of those components will work with the ActionMapper to render proper URLs for additional requests.
  5. Then the Interceptors are executed again in reverse order. Finally the response returns through the filters configured in web.xml file.
  6. If the ActionContextCleanUp filter is configured, the FilterDispatcher does not clean the ThreadLocal ActionContext. If the ActionContextCleanUp filter is not present then the FilterDispatcher will cleanup all the ThreadLocals present.

Resources

If you install the war on an application server (like tomcat ) you can easily run the sample projtect. Here is the struts 201 slides

Th version I have of the application mentions: “For more about the MailReader, including alternate implementations and a set of formal Use Cases, please visit the Struts University MailReader site” .

The full source code for MailReader is available as svn site, binaries, nightlies

Other Struts2 Trainings include Migrating to Struts2 the and JPA .

REFERENCES:

December 2, 2007 Posted by davidbloom | AJAX, Struts | | No Comments

A Roller 4.o experience

Just last week, I learned about what’s new with Roller in 4.0

Thought it was finally time to try my own installation after being a one time user of this Roller platform on JRoller as user on http://www.jroller.com/interjavanet/ . I had forgotten my password over on that blog, and it did not seem to be stright forward on how you get your password reset.

Did I mention that Roller is now on Apache at http://roller.apache.org ?

They have their own wiki now at http://cwiki.apache.org/confluence/display/ROLLER

Anyway, I am using the mysql database (5.0.41 community edition) with roller 4
(apache-roller-src-4.0-rc9) 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.

image01.jpg

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

References :

November 25, 2007 Posted by davidbloom | Blogging, SW Tools, Struts | | No Comments

Roller n Struts2

November 18, 2007 Posted by davidbloom | Blogging, Hibernate & ORM, Struts | | 2 Comments

More web 2.0

Last week was the conference, this week comes people trying to define it. My best definition would be netvibes.com

A checkpoint on Web 2.0 in the enterprise

web2inenterprise_latest2.png

As such, the situational application would be another web 2.0 concept. this article defines it great.

“where small groups and departments developed their own applications independent of the corporate IT department. Today more and more end users who are not professional programmers are developing web applications that better fit their own needs. A simple example is a wiki, where the users can create and modify the pages and their content. No programmer has to decide ahead of time what the topics of interest will be or the structure and layout of the pages. The users evolve something over time that suites their needs within the time budget they have to invest in the site.”

REST is another buzzwodr like this slide presentation that explains it.

September 19, 2007 Posted by davidbloom | Web/Tech | | No Comments

web 2.0 conference

In Raleigh, I got a chance to attend IBM’s technical briefing on web 2.0 .

For now, will just list various bits of info that I will organize later.

QEDWiki (Quick and easy design) . Assembly : “QEDWiki is a unique Wiki framework in that it provides both Web users and developers with a single Web application framework for hosting and developing a broad range of Web 2.0 applications.”

Damia . Feeds: “provides easy-to-use tools that developers and IT users alike can use to quickly assemble data feeds from the Internet and a variety of enterprise data sources. The benefits of this service include the ability to aggregate and transform a wide variety of data or content feeds, which can be used in enterprise mashups.”

Mashup Hub. Tag : “Mashup Hub provides two broad areas of support: feed generation for enterprise data sources and a catalog of feeds and user interface (UI) widgets.”

Info 2.0

Many eyes

Baby name wizard

gather.com

second life

strike iron

gold corp

zoho

zoot

September 14, 2007 Posted by davidbloom | AJAX, Blogging, J2EE, NC, Open Source, SOA, Web/Tech | | No Comments

Speak Dojo

what is dojo?

Dojo is an Open Source JavaScript UI toolkit. It makes writing JavaScript easier, building great interfaces faster, and deploying dynamic UIs at scale much easier. The foundation of Dojo is “Dojo Base”, a single tiny library which contains Ajax, event handling, effects, blazing fast CSS queries, language utilities, and a lot more. On top of this Base, the rest of Dojo Core adds high-quality facilities for Drag and Drop, extended forms of Ajax and I/O, JSON-RPC, internationalization, and back-button handling.

You can use the div tag to define widget locations and Dojo will place the widget there either during page load or in response to events.

dojo book 0.4APIreference documentationDojo jot wikidojo toolkit home

JavaPassion PDF has 86 pages of info.

What is JSON?

(Using Dojo and JSON to Build Ajax Applications article ) - JSON is a Java library that helps convert Java objects into a string representation. This string, when eval()ed in JavaScript, produces an array that contains all of the information that the Java object contained. JSONObject class , JSONArray class “- Dojo provides an abstraction layer for invoking JSON-RPC requests”

json over xml?

IBM Paper: “JSON is built on two structures:

  1. A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  2. An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence

JSON-RPC is a lightweight remote procedure call protocol in which JSON serializes requests and responses

The request is a single object with three properties:

  • method - A string containing the name of the method to be invoked.
  • params - An array of objects to pass as arguments to the method.
  • id - The request ID. This can be of any type. It is used to match the response with the request that it is replying to.

When the method invocation completes, the service must reply with a response. The response is a single object with three properties:

  • result - The object that was returned by the invoked method. This must be null, in case there was an error invoking the method.
  • error - An error object if there was an error invoking the method. It must be null, if there was no error.
  • id - This must be the same ID as the request it is responding to.

A notification is a special request that does not have a response. It has the same properties as the request object with one exception:

id - Must be null

Using Dojo and JSON to Build Ajax Applications article: Dojo libraries are organized in packages just like Java code. For this example, we will need to import two packages.

The dojo.io package contains classes that allow us to make HTTP requests using protocols such as XMLHTTPTransport.

The dojo.event package is designed to provide a unified event system for DOM and programmatic events.

The dojo.event.connect() method allows you to associate a handler for the onclick event for myButton:

function onLoad() {

   var buttonObj = document.getElementById("myButton");

   dojo.event.connect(buttonObj, “onclick”,

          this, “onclick_myButton”);

  }  function onclick_myButton() {

   var bindArgs = {

    url: “welcome.jsp”,

    error: function(type, data, evt){

     alert(”An error occurred.”);

    },

    load: function(type, data, evt){

     alert(data);

    },

    mimetype: “text/plain”,

    formNode: document.getElementById(”myForm”)

   };

   dojo.io.bind(bindArgs);

  }

The magical dojo.io.bind() function is where the power lies. It takes as argument bindArgs, an array of name/value pairs. In this example, we specify five pairs:

  1. url: The URL to make the request to.
  2. mimetype: The response type expected.
  3. load: Code to execute upon success.
  4. error: Code to execute upon error.
  5. formNode: The ID of the form whose fields to submit as parameters to the URL.

Once the call to dojo.io.bind(bindArgs) is made,depending on whether the request encountered any errors, either the load or error code is executed. Both load and error take three arguments:
type
: The type of function; it will always be set to load for load() and error for error().
data
: The response received. If mimetype is specified as text/plain, data contains the raw response. If, however, text/json is used, data contains the value of eval('(' + responseReceived + ')'), where responseReceived is what the call returned.

evt: The event object.

July 21, 2007 Posted by davidbloom | AJAX | | No Comments

Design choices and Tools roundup

softarc - the anti- experienced Coding Architect

Using NetBeans Open Source Toolbox , and More Netbeans

You are doing more modeling than you think

July 2, 2007 Posted by davidbloom | J2EE, SW Tools | | No Comments

CM is made of what?

June 25, 2007 Posted by davidbloom | Uncategorized | | No Comments

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/

June 25, 2007 Posted by davidbloom | Uncategorized | | No Comments

Practices are way to Go

http://drdobbs.com/dept/architect/198000264: “”

June 25, 2007 Posted by davidbloom | Uncategorized | | No Comments

Agile Software Process

AMIS on Deliver valuable software: “Other posts about the AGILE Principles soon to come:
1. Our highest priority is to satisfy the customer through early and continuous delivery of valuable software. (This one).
2. Welcome changing requirements, even late in development. Agile processes harness change for the customer’s competitive advantage.
3. Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.
4. Business people and developers must work together daily throughout the project.
5. Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.
6. The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.
7. Working software is the primary measure of progress.
8. Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.
9. Continuous attention to technical excellence and good design enhances agility.
10. Simplicity–the art of maximizing the amount of work not done–is essential.
11. The best architectures, requirements, and designs emerge from self-organizing teams.
12. At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.

Forget those fancy tools, and try just enough information in requirement gathering.

June 8, 2007 Posted by davidbloom | Patterns & UML, SW Tools, Web Design | | No Comments

thats why they call it work

The Furious Purpose has a good outline on what makes an ideal software job.

  • The Team
  • The Process
  • The Company
  • The Product
  • The Technology
  • The Location (i.e. work at home)

For me, having a software quality plan in place is what you would like to see. Just saw this free (without customizations) for managing the software development process.

Also, collaboration is key for a job where people share knowledge and experiences so that you don’t have to reinvent the wheel everytime. Like this here wiki.

May 31, 2007 Posted by davidbloom | SW Tools | | No Comments

Struts Next

More info On Struts2

Tutorial

I few months back I experimented with Struts2 and WebWorks

and then some

Here is a wiki entry i created on site.

http://cwiki.apache.org/confluence/display/S2WIKI/Sample+Applications+with+Java+1.4.x

May 29, 2007 Posted by davidbloom | Struts | | No Comments

Jasper Soft Open Source News

Business Intelliegence Tool  JasperETL - “JasperETL will be available in Open Source and Professional editions, and was developed through a technology partnership with Talend. Led by a team of veteran data integration industry experts, Talend is the first open source software provider for data integration tools.”

ETL is an essential tool that guarantees consistency and fluidity of information in increasingly diverse IT systems. At the center of the decision- making process, ETL allows organizations to move, cleanse, standardize and transform data according to their business needs. JasperETL can be used for both analytic decision support system tasks such as updating data warehouses or marts, as well as for operational solutions such as data consolidation, duplication, synchronization, quality, migration, and change data capture. Performance tests indicate performance up to 50% faster than other leading commercial ETL tools.

JasperETL Open Source edition is available immediately direct from JasperSoft

January 31, 2007 Posted by davidbloom | Open Source, SW Tools | | No Comments

Brightcove

It seems the video hosting service that AOL uses has a bunch of tecnology based presentations:

Technorati Profile

January 16, 2007 Posted by davidbloom | Web/Tech | | No Comments

Happy New Year

Wow, I am glad to see 2007 here.

As always, New Years Day consists of a lot of  football.

January 1, 2007 Posted by davidbloom | Sports | | No Comments

Tech in Politics

John Edwards announces . That’s a first.

On of the first memories I have from my childhood is  when Nixon stepped down and Ford took the reigns. I did not know about the UNC connection with Gerald Ford til recently. I always heard that Ford was some sort of good athlete.

December 31, 2006 Posted by davidbloom | Current Affairs | | No Comments

Castor similar to jaxB

http://www.castor.org/ and get full download where i placed it here

C:/java/castor-1.0.5

C:\java\castor-1.0.5\src>ant jar

put castor jars from C:\java\castor-1.0.5\dist and place in C:/java/castor-1.0.5/lib

C:/java/castor-1.0.5/src/examples/SourceGenerator

test.bat

http://www.castor.org/javadoc/org/exolab/castor/builder/SourceGeneratorMain.html

%JAVA% -cp %CP% org.exolab.castor.builder.SourceGeneratorMain -i invoice.xsd -f -binding-file bindingInvoice.xml

JavaDoc

Marshalling - is the process of traversing a content tree and
writing an XML document that reflects the tree’s content.
org.exolab.castor.xml.Marshaller

Unmarshalling -  is the process of reading an XML document and constructing a content tree of Java content objects.org.exolab.castor.xml.Unmarshaller

example

It has been a while since I got a chance to look at Struts 2 . At the time I was interested in how to get jars going with JDK 1.4.2.

December 25, 2006 Posted by davidbloom | XML | | No Comments

links for 2006-12-13

December 12, 2006 Posted by davidbloom | Uncategorized | | No Comments

Spring Experience in Blogs

Looks as if I missed a great place to attend a Java conference known as the Spring Experience

The Spring Experience  schedule looks pretty good.

Related: whats-new-and-cool-in-spring-20

December 11, 2006 Posted by davidbloom | Spring | | No Comments

links for 2006-11-30

November 29, 2006 Posted by davidbloom | Uncategorized | | No Comments

EL

jstl provides use of the EL.

JSP 2.0 includes EL (Expression language) : "Personally I use the EL
extensively in all my JSP projects and I’ll never go back to custom tags or
scriptlets for showing the value of a request-scoped variable."
http://weblogs.java.net/blog/jfalkner/archive/2003/10/blarg_3_about_t.html

November 28, 2006 Posted by davidbloom | Web Design | | No Comments

links for 2006-11-27

November 26, 2006 Posted by davidbloom | Uncategorized | | No Comments

Struts2 Samples

I downloaded Struts2 (2.0.1) for first time after experimenting with webworks.

My experience at this point with struts2/webworks is limited.

I figured I would start from scratch rather than migrating some old code.

C:\java\struts2\struts-2.0.1\apps
The sample apps they have are
struts2-blank-2.0.1.war
struts2-mailreader-2.0.1.war
struts2-portlet-2.0.1.war
struts2-showcase-2.0.1.war

User List

Contents of  struts2-blank-2.0.1 war (folders in bold):

src
- example
– ExampleSupport.java:    ExampleSupport extends com.opensymphony.xwork2.ActionSupport
– HelloWorld.java: HelloWorld extends ExampleSupport
- struts.properties: struts.devMode = true
                                  struts.enable.DynamicMethodInvocation = false

- struts.xml:  <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                     "http://struts.apache.org/dtds/struts-2.0.dtd">
                   
… <include file="example.xml"/>

- example.xml: <!DOCTYPE struts PUBLIC
                     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                     "http://struts.apache.org/dtds/struts-2.0.dtd">
                   
<package name="example" namespace="/example" extends="struts-default">
                        

<action name="HelloWorld" class="example.HelloWorld">
                            <result>/example/HelloWorld.jsp</result>
                        </action>
                       <action name="Login!*" method="{1}" class="example.Login">
                            <result name="input">/example/Login.jsp</result>
                           <result type="redirect-action">Menu</result>
                      </action>
                      <action name="*" class="example.ExampleSupport">
                            <result>/example/{1}.jsp</result>
                    </action>
WebContent
- WEB-INF

--lib

— commons-collections-3.1

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— struts2-core-2.0.1

— commons-logging-1.0.4

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-api-2.0.1

— xwork-2.0-beta-1
- example

The Struts 2  home page states the Struts 2 requires  Java 5. However, an alternate set of jars for  Java 1.4.x are available.  The challenge here is for people using Java 1.4.X is that the sample apps  come with the Java 5 jars.The java 4 jars can be found here.  I extracted them to here:

C:\java\struts2\struts-2.0.1\j4\

But, the only file I needed from here was struts2-extras-j4-2.0.0.jar .

copy C:\java\struts2\struts-2.0.1\j4\struts2-extras-j4-2.0.0.jar
C:\java\eclipse\workspace\struts2-blank-2.0.1\WebContent\WEB-INF\lib

as I got the backport files from the nightlies:

http://people.apache.org/builds/jakarta-struts/nightlies/2.0.x/java-1.4/backport/

which i copied to

C:\java\eclipse\workspace\struts2-blank-2.0.1\WebContent\WEB-INF\lib

Then i modified the translate.bat as follows:

java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-core-2.0.1.jar -destjar struts2-core-j4-2.0.1.jar
java -jar retrotranslator-transformer-1.0.8.jar -srcjar struts2-api-2.0.1.jar -destjar struts2-api-j4-2.0.1.jar 
java -jar retrotranslator-transformer-1.0.8.jar -srcjar xwork-2.0-beta-1 -destjar xwork-2.0-j4.jar

The key thing is after the translate takes place to remove the following files:

  • struts2-core-2.0.1.jar
  • struts2-api-2.0.1.jar
  • xwork-2.0-beta-1

Again, a Java 5 version of struts2-extras-j4-2.0.0.jar was not in the struts2-blank-2.0.1 war.
In Summary, my lib folder contains the following jars for 1.4.x:

— commons-collections-3.1
—commons-beanutils-1.6
— commons-digester-1.6
— commons-logging-1.0.4

— freemarker-2.3.4

— spring-aop-1.2.8

— spring-context-1.2.8

— spring-web-1.2.8

— retrotranslator-runtime-1.0.8
— retrotranslator-transformer-1.0.8

— ognl-2.6.7

— spring-beans-1.2.8

— spring-core-1.2.8

— struts2-core-j4-2.0.1

— struts2-api-j4-2.0.1

— xwork-2.0-j4
—struts2-extras-j4-2.0.0
— backport-util-concurrent
— translate.bat

Refer to this issue here

November 24, 2006 Posted by davidbloom | Struts | | No Comments

links for 2006-11-23

November 22, 2006 Posted by davidbloom | Uncategorized | | No Comments

Apache

I just downloaded the Apache Server on Windows which I have done a while ago alongside IBM’s websphere where they call it Http Server.

I ran the download program that pretty much self installs it. The executable for the Server can be found  here
C:\Program Files\Apache Software Foundation\Apache2.2\bin

It appears a bunch of the configuration for server can be found here

C:\Program Files\Apache Software Foundation\Apache2.2\conf

httpd.txt: This is the main Apache HTTP server configuration file.  It contains the
configuration directives that give the server its instructions.

Documentation gives details on the meaning of the information in the config file.

November 21, 2006 Posted by davidbloom | SW Tools, Web Design | | No Comments

links for 2006-11-20

November 19, 2006 Posted by davidbloom | Uncategorized | | No Comments

Football Weekend

MITCH ALBOM on Bo: A true Blue legend

Should Mike Shula be shown the door? or what about Chuck?

The Miami Dolphins Phinsider is here.

November 18, 2006 Posted by davidbloom | Sports | | No Comments

Trying out Webworks

I have been reading up about Struts 2.

I figured checking out the webworks framework first might be a good idea.

API - http://www.opensymphony.com/webwork/api/allclasses-frame.html

Config Files - http://wiki.opensymphony.com/display/WW/Configuration+Files

C:\java\webworks\webwork-2.2.2\webapps>ant build -Dwebapp=shopping-cart
Buildfile: build.xml

build:
   [delete] Deleting directory C:\java\webworks\webwork-2.2.2\webapps\tmp
    [mkdir] Created dir: C:\java\webworks\webwork-2.2.2\webapps\tmp
     [copy] Copying 58 files to C:\java\webworks\webwork-2.2.2\webapps\tmp
    [javac] Compiling 13 source files to C:\java\webworks\webwork-2.2.2\webapps\
tmp\WEB-INF\classes
     [copy] Copying 1 file to C:\java\webworks\webwork-2.2.2\webapps\tmp\WEB-INF
\classes
      [war] Building war: C:\java\webworks\webwork-2.2.2\webapps\dist\shopping-c
art.war
      [war] Warning: selected war files include a WEB-INF/web.xml which will be
ignored (please use webxml attribute to war task)

BUILD SUCCESSFUL

copy C:\java\webworks\webwork-2.2.2\webapps\dis
t\shopping-cart.war c:\java\apache-tomcat-5.5.17\webapps\

http://localhost:8080/shopping-cart/

learntechnology.net has a basic Webworks example (WAR).

Snippet from xworks.xml:

<default-interceptor-ref name="paramsPrepareParamsStack"/>
        <action name="index" class="net.vaultnet.learn.action.EmployeeAction" method="list">
            <result name="success">/jsp/employees.jsp</result>
            <!– we don’t need the full stack here –>
            <interceptor-ref name="basicStack"/>
        </action>
        <action name="crud" class="net.vaultnet.learn.action.EmployeeAction" method="input">
            <result name="success" type="redirect-action">index</result>
            <result name="input">/jsp/employeeForm.jsp</result>
            <result name="error">/jsp/error.jsp</result>
        </action>

  1. ActionMapper - mapping between HTTP requests and action invocation requests and
    vice-versa; may return null if no action invocation request maps,
    or it may return an ActionMapping.
  2. Filter Dispatcher (com.opensymphony.webwork.dispatcher.FilterDispatcher) - filter and its mapping are located in web.xml and defines what requests will be intercepted. Before executing an Action, it loooks through stack of interceptors.

    Webworks Interceptors (defined in webwork-default.xml)can be invoked before and after your action is executed. paramsPrepareParamsStack- This is useful for when you wish to apply parameters directly to an object that you wish to load externally.

  3. <%@ taglib prefix="ww" uri="/webwork" %> : access to the tag library

November 18, 2006 Posted by davidbloom | Struts | | No Comments

links for 2006-11-18

November 17, 2006 Posted by davidbloom | Uncategorized | | No Comments

web 2.0 to 3.0

November 14, 2006 Posted by davidbloom | Uncategorized | | No Comments

Its a Tech Tuesday

After being a fan of Flickr for quite a while, and learning of the background of this product, i finally signed up for my own account . Thus, I am ready for the intro , should i be worried?

Another tool of note I enjoy is ITunes, not to be confused with M$FT ’s Zune . I have not had this experinece with it. Here is one tip that I probably wont try,  as I am more interested in setting up my playlists, as I have plenty of Podcasts on my  player I listen to these but have not had a use for any .Podcast Tools or lessons on how to podcast . Listening to podcasts  via a phone.

Update: Why Microsoft’s Zune music player has little or no chance of denting Apple’s iPod juggernaut [more]

November 14, 2006 Posted by davidbloom | Web/Tech | | No Comments

Its here: Sun’s Java Platform on Open Source

OPEN JDK:"Santa Clara-based Sun said it is making nearly all of Java’s source
code — excluding small pockets of code that aren’t owned by Sun —
available under the GNU General Public License. The same type of
license also covers the distribution of the core, or kernel, of the
popular open-source operating system Linux" [q&a]

Why its good : "Java under the GPL means that they can now much more readily cross-leverage each other"

Sutor: "The most widely used license is the GNU General Public License (GPL).
While it is hard to quantify, it appears likely that approximately 70%
of all open source projects use the GPL. Code that uses the GPL is
referred to as “free software.”By its nature, the GPL makes new code that incorporates older GPLed
code also use the GPL. That is, the GPL is somewhat self-propagating as
code that uses it is picked up and re-used elsewhere. This is exactly
as the authors intended.The GNU/Linux operating systems use the GPL. You cannot charge
others for a license to use GPLed software and you must make your
source code available.

Another commonly used license is from the Apache Software
Foundation
. This is an open source license that does allow direct use
of the source code within commercial products. Unlike the GPL, the Apache License
allows “defensive termination”: if you sue someone because you claim
that the software infringes on one of your patents, then you lose the
right to freely use the patents of others that are implemented in the
software.

In other words, you stop having the right to use the software if you
are trying to stop others from using it. Much of the open source
software that implements the standards of the World Wide Web is covered
under the Apache license."

freeopen-vs-closed-software

Details of what is available:

The first pieces of source code are available today:

   

* Java HotSpot technology (JVM)
   
* Java programming language compiler (javac)
   
* JavaHelp software
   
* Sun’s feature phone Java ME implementation
* Java ME testing and compatibility kit framework

Later in 2006, Sun will release these pieces:

   

* An advanced operating system phone implementation
   
* The framework for the Java Device Test Suite

Finally, in the first quarter of 2007 the move to free software will be completed as Sun provides these pieces under the GPL:

   

* A buildable Java SE Development Kit (JDK)
   
* Project GlassFish (in addition to CDDL)

Duke  Open Sourced.

IBM’s take is one of dissapointment  but one    opinion: "What IBM holds back for its clients only gives it an advantage over
everyone else, especially among the large accounts that can afford its
overhead.The Apache license accepts this reality. The GPL does not. Behind
IBM’s mild complaint is a scream of pain, an acknowledgement that Sun
has cleverly kicked it in the shins."

 

November 13, 2006 Posted by davidbloom | J2EE | | No Comments

web 2.0 one year later

about this time last year I started exploring the buzz word web 2.0

the Web 2.0 Summit was just held this past week [pod].

Now there is talk of the Web 3.0  : "Back to Web 3.0. There will be one, and it has been associated at this point with concepts of the semantic Web". 

Nova Spivack defined the semantic Web

The Semantic Web is a set of technologies which are
designed to enable a particular vision for the future of the Web – a
future in which all knowledge exists on the Web in a format that
software applications can understand and reason about. By making
knowledge more accessible to software, software will essentially become
able to understand knowledge, think about knowledge, and create new
knowledge. In other words, software will be able to be more intelligent
– not as intelligent as humans perhaps, but more intelligent than say,
your word processor is today.

The blog readwriteweb.com had a nice  web2.0 roundup :

web 2.0 vs 1.0

Here is a link to many of the web 2.0 tools .

I personally like netvibes.com a whole lot.


November 13, 2006 Posted by davidbloom | Web/Tech | | No Comments

google code search

in google i put: pserver:guest@cvs.dev.java.net: /cvs dwr

which gave me this url

cvs.dev.java.net/cvs/dwr - Apache - Java - More from dwr »

November 11, 2006 Posted by davidbloom | Open Source | | No Comments

AJAX Roundup

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

Introduction where I learned of Jesse James Garrett  from  web site Adaptivepath.com is the person who is behind the technology.

AJAX w Java

Google Maps mania

AJAXIAN

Relevance has Demo from Ajax presentation at Java in Action .

Sun Tip on AJAX

AJAX Talk notes

Eclipse AJAX Toolkit Framework project

Paul Graham : "Basically, what "Ajax" means is "Javascript now works." And that in turn means
that web-based applications can now be made to work much more like desktop ones.

Similarly, RMH tunes in about AJAX

 

Google Maps

Stu Halloway : "predicts Ajax will be part of nearly all web applications within the next year."

Google Web Toolkit (GWT) this API  &samples Designer  Tool

Software Development in the Real World: The Complete List of Ajax Tools
(tags: ajax)

November 11, 2006 Posted by davidbloom | AJAX | | No Comments

webtest canoo

I downloaded webtest to c:/java/webtest and started the install . Note that manual for webtest. I believe it makes use of clover the coverage tool.

webtest -buildfile installTest.xml

installTest.xml:

..

<target name="checkWebTest">

        <echo message="webtest.home is ${webtest.home}"/>
        <testSpec name="check calling and parsing a local file">
            <config
                host=""
                port="0"
                basepath="/"
                summary="false"
                saveresponse="false"
                haltonfailure="true"
                protocol="file"/>
            <steps>
                <invoke
                    description="get local file"
                    url="${basedir}/testfile.html"/>
                <verifyTitle
                    description="check the title is parsed correctly"
                    text="Test File Title"/>
            </steps>
        </testSpec>
    </target>

testfile.html:
<html><head>

<title>Test File Title</title>
</head>
<body>
empty
</body>
</html>

November 10, 2006 Posted by davidbloom | SW Tools | | No Comments

Servlet Filters

Servlet Filters [ link ] — are not Servlets and they are not responsible for
creating a response.

They are preprocessors of requests before they
reach a Servlet and postprocessors of responses after leaving a
Servlet.

Servlet filters can:

  • Intercept a Servlet’s invocation before the Servlet is called

  • Examine a request before the destination Servlet is invoked

  • Modify request headers and request/response data by subclassing the HttpServletRequest object and wrapping the original request

  • Intercept a Servlet’s invocation after the servlet is called

The designers of Servlet Filters identified the following examples for their use:
Authentication Filters, Logging and Auditing Filters,Image conversion Filters, Data compression Filters, Encryption Filters, Tokenizing Filters, Filters that trigger resource access events, XSL/T filters, Mime-type chain Filter

web.xml:

<filter>
      <filter-name>My Filter</filter-name>
      <filter-class>com.myproject.MyFilter</filter-class>
      <init-param>
         <param-name>enable</param-name>
         <param-value>yes</param-value>
      </init-param>
</filter>

<filter-mapping>
      <filter-name>My Filter</filter-name>
      <servlet-name>action</servlet-name>
</filter-mapping>

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
public class MyFilter implements Filter
{
    boolean _enable = false;

    public void init(FilterConfig fc) throws ServletException
    {
        String enable=fc.getInitParameter("enable"