This video begins the subject of GWT design choices. The video touches on a few thing like the :
- HandlerManager class in GWT 1.6
- GwtMocking
- MVP and testing the presenter
- EventBus
This was found on this post - http://stackoverflow.com/questions/1234389/whats-your-recommendation-for-architecting-gwt-applications-mvc-mvp-or-custom
Since I am mainly just familiar with MVC , lets get into MVP…
From this Model-View-Presenter post, it illustrates their are two flavors of the MVP:
a) Dolphin Smalltalk’s MVP - http://martinfowler.com/eaaDev/SupervisingPresenter.html
b) Passive View – http://martinfowler.com/eaaDev/PassiveScreen.html
View – widgets, responds to user actions, turns to the presenter to handle these user actions
Presenter – presentation logic, tightly coupled with the view, commands the model, changes presentation according to the application rules.
Model – business objects , doesn’t know anything about View/Presenter.
“in MVC there is controller for every widget, and every widget on the screen surface is called view. In MVP on the other hand, due to the elimination of the controller, there is no sentiment for a single widget and the screen itself is called view.”
also see : Use MVP , MVP based Component Library, GWT MVP Sample, eventbus and mock tests
Some clarifications for me. Seems Ext – GWT is also known as GXT (found on this page which talks about JSON vs RPC, to spaghtetti code)
Another interesting thing is the post on difference between a toolkit vs framework
References:
August 15, 2009
Posted by
davidbloom |
Web Design, Web/Tech |
|
No Comments Yet
Its been a while since I chimed in on the topic of Exceptions:
Checked : (java.lang.Exception). This type of exception represents useful information about the operation of a legally specified request that the caller may have had no control over and that the caller needs to be informed about. With checked exceptions, Java language forces us to document all the anticipated ways in which control might exit a method:
Unchecked : (java.lang.RuntimeException). These are exceptions that occur as a result of programming errors that the program could not be expected to catch.
Now, it is time to talk about the Exception Handling capabilities with DAOs in the Spring Framework
(2.5)
SQL Exception Translator – sql exception can be translated to a DataAccessException using the translate method
- ex1, ex2, ex3 , ex4
The method HibernateDaoSupport :: convertHibernateAccessException – convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy.
SessionFactoryUtils :
public static DataAccessException convertHibernateAccessException(HibernateException ex) {
if (ex instanceof JDBCConnectionException) {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
if (ex instanceof SQLGrammarException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
if (ex instanceof DataException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
if (ex instanceof LockAcquisitionException) {
return new CannotAcquireLockException(ex.getMessage(), ex);
}
if (ex instanceof ConstraintViolationException) {
return new DataIntegrityViolationException(ex.getMessage(), ex);
}
if (ex instanceof JDBCException) {
return new HibernateJdbcException((JDBCException) ex);
}
if (ex instanceof PropertyValueException) {
return new DataIntegrityViolationException(ex.getMessage(), ex);
}
if (ex instanceof PersistentObjectException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof TransientObjectException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof ObjectDeletedException) {
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
if (ex instanceof QueryException) {
return new HibernateQueryException((QueryException) ex);
}
if (ex instanceof UnresolvableObjectException) {
return new HibernateObjectRetrievalFailureException((UnresolvableObjectException) ex);
}
if (ex instanceof WrongClassException) {
return new HibernateObjectRetrievalFailureException((WrongClassException) ex);
}
if (ex instanceof NonUniqueResultException) {
return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
}
if (ex instanceof StaleObjectStateException) {
return new HibernateOptimisticLockingFailureException((StaleObjectStateException) ex);
}
if (ex instanceof StaleStateException) {
return new HibernateOptimisticLockingFailureException((StaleStateException) ex);
}
// fallback
return new HibernateSystemException(ex);
}
Hibernate Template
September 13, 2008
Posted by
davidbloom |
Hibernate & ORM, J2EE, Open Source |
|
No Comments Yet
If you download the spring framework with dependencies, one of the modules included is the spring-test.
spring
- Convenient jar file combining all standard modules (except for the test module and the Spring MVC support)
- Also includes the AOP Alliance interfaces (as a convenience)!
- Does not include contents of spring-aspects.jar, spring-test.jar and spring-webmvc*.jar!
spring-test
- Contents: test context framework, JUnit support, JNDI mocks, Servlet API mocks, Portlet API mocks
- Dependencies: spring-core, (spring-context, spring-jdbc, spring-web, JUnit, Servlet API, Portlet API)
As the spring documentation mentions, for unit testing transactional systems you can achieve rollback of your tests pretty easily:
Typically you will extend the subclass, AbstractTransactionalDataSourceSpringContextTests. This class also requires that a DataSource bean definition – again, with any name – be present in the application context. It creates a JdbcTemplate instance variable, that is useful for convenient querying, and provides handy methods to delete the contents of selected tables (remember that the transaction will roll back by default, so this is safe to do).
This problem was identified with MySql.
Nice article here on spring test
This link tells us about the spring testing method calls
AbstractTransactionalDataSourceSpringContextTests superclass
provides the following services:
Injects test dependencies, meaning that we don't need to
perform application context lookups. Injection uses
autowiring by type.
Executes each test method in its own transaction, which is
automatically rolled back by default. This means that even
if tests insert or otherwise change database state, there
is no need for a teardown or cleanup script.
If you want a transaction to commit--unusual, but useful
if you want a particular test to populate the database,
for example--you can call the setComplete() method inherited
from AbstractTransactionalSpringContextTests. This will cause
the transaction to commit instead of roll back.
There is also convenient ability to end a transaction before
the test case ends, through calling the endTransaction() method.
This will roll back the transaction by default, and commit it
only if setComplete() had previously been called.
Provides useful inherited protected fields, such as a JdbcTemplate
that can be used to verify database state after test operations,
or verify the results of queries performed by application code.
An ApplicationContext is also inherited, and can be used for
explicit lookup if necessary.
All the Spring Test Life Cycle Methods
API
- getConfigLocations
- setDataSource
- setTransactionManager
- onSetUpBeforeTransaction
- onSetUpInTransaction
- onTearDownInTransaction
- endTransaction
- onTearDownAfterTransaction
example scenario:
Now onto the 2.5 way of testing:
org.springframework.test.context – Spring TestContext Framework which provides annotation-driven unit and integration testing support that is agnostic of the actual testing framework in use.
Spring 2.5 continues this rich and convenient testing framework, while now removing the requirement that your unit tests extend Spring framework tests. Instead of subclassing, it uses java annotations.
Related links:
August 24, 2008
Posted by
davidbloom |
IoC, J2EE |
|
No Comments Yet
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);
}
August 17, 2008
Posted by
davidbloom |
Uncategorized |
|
No Comments Yet
As a total beginner to Spring Web Flow, the main thing I have noticed in going through the material is that there is quite a difference between the 1.x and the new release 2.0.
Web Flow | Spring Web Flow Forum
There seems to be in package org.springframework.webflow.action a FlowAction and a FlowExecutor class. As well, the ExternalContext class which is credited to allowing WF to be decoupled from Servlet API .
I do not see a FlowAction or FlowExecutor in org.spring.webflow.action package like in webflow 1.
Instead, lets look at what we have from the example Spring Flow 2.0 Example application.
To use annotations for the transactions within the example, we do the following:
- Put an tag tx:annotation-driven in the spring config file
- Put @Transactional annotation in the services classes
@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.
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/>
<!– Drives transactions using local JPA APIs –>
<bean id=”transactionManager” class=”org.springframework.orm.jpa.JpaTransactionManager”/>
The LocalContainerEntityManagerFactoryBean can be configured with all Persistent Unit information like is done here.
@PersistenceUnit – annotated on EntityManagerFactory instances are thread-safe
<!– Creates a EntityManagerFactory for use with the Hibernate JPA provider and a simple in-memory data source populated with test data –>
<bean id=”entityManagerFactory” class=”org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean”>
<property name=”jpaVendorAdapter”>
<bean class=”org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter”/>
</property>
</bean>
<!– Deploys a in-memory datasource –>
<bean id=”dataSource” class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>
<property name=”driverClassName” value=”org.hsqldb.jdbcDriver”/>
<property name=”url” value=”jdbc:hsqldb:mem:tutorialSwf”/>
<property name=”username” value=”sa”/>
<property name=”password” value=”"/>
</bean>
<!– Activates annotation-based bean configuration –>
<context:annotation-config/>
Mapping URLs to Handlers – maps request URLs to handlers. A simple way to create URL mapping rules is to define one as follows:
<!– Maps request URIs to controllers –>
<bean class=”org.springframework.web.servlet.handler.SimpleUrlHandlerMapping”>
<property name=”mappings”>
<props>
<prop key=”/f/*”>flowController</prop>
</props>
</property>
<property name=”defaultHandler”>
<!– Selects view names to render based on the request URI: e.g. /main selects “main” –>
<bean class=”org.springframework.web.servlet.mvc.UrlFilenameViewController”/>
</property>
</bean>
The Flow Handler manages executions of a single flow definition. Above the handler selects view based on the URI in a default handler. To Implement one, extend AbstractFlowHandler.
Flow Controller – The FlowHandler MVC integration approach, you define one handler per flow. This is overkill in the cases where default flow handling rules are sufficient. Web controller for the Spring web MVC framework that routes incoming requests to one or more managed web flows. Requests into the web flow system are managed using a configurable ServletFlowExecutionManager.
<!– Handles requests mapped to the Spring Web Flow system –>
<bean id=”flowController” class=”org.springframework.webflow.mvc.servlet.FlowController“/>
The flow executor is the core Web Flow configuration element. Flow execution listeners are also defined in the flow executor.
<!– Executes flows: the central entry point into the Spring Web Flow system –>
<webflow:flow-executor id=”flowExecutor”>
<webflow:flow-execution-listeners>
<webflow:listener ref=”jpaFlowExecutionListener”/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
FlowRegistry – placed where you register your flows
flow-builder-services attribute – customize the services used to build the flows in a registry…When the tag is defined, you only need to reference the services you want to customize.
<!– The registry of executable flow definitions –>
<webflow:flow-registry id=”flowRegistry” flow-builder-services=”facesFlowBuilderServices”>
<webflow:flow-location-pattern value=”/WEB-INF/flows/**/*.xml”/>
</webflow:flow-registry>
flow scoped persistence context – provides isolation of intermediate edits by only committing changes to the database at the end of flow execution. This pattern is often used in conjunction with an optimistic locking strategy to protect the integrity of data modified in parallel by multiple users.
@PersistenceContext – annotated on EntityManager instances are not thread safe
<flow xmlns=”http://www.springframework.org/schema/webflow” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd”>
<persistence-context/>
…
configure the correct FlowExecutionListener in this case for JPA
<!– Installs a listener that manages JPA persistence contexts for flows that require them –>
<bean id=”jpaFlowExecutionListener” class=”org.springframework.webflow.persistence.JpaFlowExecutionListener”>
<constructor-arg ref=”entityManagerFactory”/>
<constructor-arg ref=”transactionManager”/>
</bean>
…
Here is how they handle the view:
<!– Maps logical view names to Facelet templates (e.g. ’search’ to ‘/WEB-INF/search.xhtml’ –>
<bean id=”faceletsViewResolver” class=”org.springframework.web.servlet.view.UrlBasedViewResolver”>
<property name=”viewClass” value=”org.springframework.faces.mvc.JsfView”/>
<property name=”prefix” value=”/WEB-INF/”/>
<property name=”suffix” value=”.xhtml”/>
</bean>
Or a simple ViewResolver
July 19, 2008
Posted by
davidbloom |
J2EE |
|
No Comments Yet
I have been an Eclipse user most of my Java career. Though, I do have limited experience with Visual Age, Forte, JBuilder, and Netbeans. In the Eclipse space, it has been WSAD, MyEclipse, Eclipse WTP (2.x,3.2, Europa 3.3), and RAD 6/7.
Part of NFJS exposed me to IntelliJ. Here is one take on this IDE.
July 17, 2008
Posted by
davidbloom |
SW Tools |
|
No Comments Yet
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
July 16, 2008
Posted by
davidbloom |
Uncategorized |
|
No Comments Yet
As part my learnings of what is new with the Spring Framework, I found a nice Spring Flow 2.0 Example (with JSF and JPA).
The Spring Web Flow 2.0.2 release ( by Erwin Vervaet and Keith Donald ) comes as a separate download from the basic Spring functionality in 2.5.5.
On the Spring Web Flow (SWF) vision from 1.x to 2.x :
“[in 1.0] the SWF controller engine cared for one half of the web request lifecycle; the half related to request processing, often called the action phase. The other half, the render phase, was pushed off on the caller: either Spring MVC, Struts, or JSF front controllers
…..
The downside of this approach is it makes it difficult to apply application control logic during the view rendering phase
…..
Beginning with Web Flow 2.0 M2, the entire web request lifecycle is now under the control of Spring Web Flow, including the view rendering phase.
….
the ability for the SWF engine to communicate with external systems and conversational contexts over HTTP (embedding the proper flow execution callback URL in the redirect that is sent to the external system)”
Reference Guide 2.x
Also, note that getting these Spring Flow 2.x reference sample projects are easy to get a hold of. In the download of Web Flow is a projects/build-spring-webflow directory where you can run ant. It will build Web Flow along with the .war files for the sample projects (ant 1.7 and Java 5 are required to build).
There is a Struts2 plugin for Spring Web Flow called struts2webflow
As far as further examples than the ones above, I found some web flow 2.x examples at this site spring by example.
Spring flow 1.0 showed that it could easily integrate with struts. These sample (1.x) applications can also be found on Java Passion Site. A good 1.x reference is the Practical ntroduction . All the samples projects are Spring IDE projects that importable into Eclipse (see springide or plugin central for spring ide).
Here in the 1.x struts example:
Our first action in the jsp is as follows:
<A href=”flowAction.do?_flowId=birthdate”>Birth Date</A>
This action in the struts config says:
<action path=”/flowAction” name=”actionForm” scope=”request” type=”org.springframework.webflow.executor.struts.FlowAction”/>
We also bind to the Action Form:
<form-bean name=”actionForm” type=”org.springframework.web.struts.SpringBindingActionForm”/>
In the webflow-config.xml we define the flow registry:
<flow:executor id=”flowExecutor” registry-ref=”flowRegistry”/>
<!– Creates the registry of flow definitions for this application –>
<flow:registry id=”flowRegistry”>
<flow:location path=”/WEB-INF/birthdate.xml”/>
<flow:location path=”/WEB-INF/birthdate-alternate.xml”/>
</flow:registry>
Start State : the first state in the flow
<start-state idref=”enterBirthdate” />
View State: selects a view to render
<view-state id=”enterBirthdate” view=”birthdateForm”>
When the execution of the flow starts, enter the enterBirthdate state. Then select the birthdateForm view for display to the user, and pause the flow of execution until a user event happens.
Render Action: initializes the form object.
<render-actions>
<action bean=”formAction” method=”setupForm” />
</render-actions>
For view state, above Initializes the backing “form object” by invoking the setupForm method for formAction.
Note that the action was defined in the webflow-config.xml (instance of spring-webflow-config-1.0.xsd)
<bean id=”formAction” class=”org.springframework.webflow.samples.birthdate.BirthDateFormAction” />
Transition: Each View state must define a transition that leads to another state
<transition on=”submit” to=”processBirthdateFormSubmit” />
Action state: logic that needs to be executed in context of the request, once executed the result flow is returned which the flow may respond to.
<action-state id=”processBirthdateFormSubmit”>
<action bean=”formAction” method=”bindAndValidate”>
<attribute name=”validatorMethod” value=”validateBirthdateForm” />
</action>
transition on=”success” to=”enterCardInformation” />
<transition on=”error” to=”enterBirthdate” />
</action-state>
Related Links for Basic info on JSF:
July 13, 2008
Posted by
davidbloom |
J2EE |
|
1 Comment
I have used derby a while back. Several years later, I wanted to get it installed again on my machine.
In short, Derby is the Java Database that IBM contributed to the open source community. It was known then as cloudscape.
I start off by getting the bin download from the derby database
create DERBY_HOME environment variable : C:\JAVA\derby10\db-derby-10.2.2.0-bin\
Make sure I have my JAVA_HOME environment variable properly set
add to the PATH: C:\JAVA\derby10\db-derby-10.2.2.0-bin\bin\
from the command line:
>sysinfo
>ij
ij is the derby sql client command line
ij>connect ‘jdbc:derby://localhost:1527/mydb;
create=true;traceFile=trace.out;user=user1;password=secret4me’;
C:\JAVA\derby10\db-derby-10.2.2.0-bin\bin>
setNetworkClientCP.bat
C:\JAVA\derby10\db-derby-10.2.2.0-bin\demo\programs\simple>set CLASSPATH=.;%DERB
Y_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbynet.jar;%DERBY_HOME%\lib\derbyclient
.jar;%DERBY_INSTALL%\lib\derbytools.jar
C:\JAVA\derby10\db-derby-10.2.2.0-bin\frameworks>startNetworkserver.bat
C:\JAVA\derby10\db-derby-10.2.2.0-bin\demo\programs\simple>java org.apache.derby
.tools.sysinfo -cp embedded SimpleApp.class
FOUND IN CLASS PATH:
Derby embedded engine library (derby.jar)
C:\JAVA\derby10\db-derby-10.2.2.0-bin\lib\derby.jar
user-specified class (SimpleApp)
C:\JAVA\derby10\db-derby-10.2.2.0-bin\demo\programs\simple
SUCCESS: All Derby related classes found in class path.
get ibm jars for derby
C:\JAVA\derby10\db-derby-10.2.2.0-bin\demo\programs\simple>set CLASSPATH=.;%DERB
Y_HOME%\lib\db2jcc.jar;%DERBY_HOME%\lib\db2jcc_license_c.jar
C:\JAVA\derby10\db-derby-10.2.2.0-bin\frameworks>startNetworkserver.bat
C:\JAVA\derby10\db-derby-10.2.2.0-bin\demo\programs\simple>java SimpleApp jccjdb
cclient
SimpleApp starting in jccjdbc mode.
Loaded the appropriate driver.
Connected to and created database derbyDB
Created table derbyDB
Inserted 1956 Webster
Inserted 1910 Union
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Verified the rows
Dropped table derbyDB
Closed result set and statement
Committed transaction and closed connection
SimpleApp finished
/* the default framework is embedded*/
public String framework = “embedded”;
public String driver = “org.apache.derby.jdbc.EmbeddedDriver”;
public String protocol = “jdbc:derby:”;
public static void main(String[] args)
{
new SimpleApp().go(args);
}
void go(String[] args)
{
/* parse the arguments to determine which framework is desired*/
parseArguments(args);
System.out.println(“SimpleApp starting in ” + framework + ” mode.”);
try
{
/*
The driver is installed by loading its class.
In an embedded environment, this will start up Derby, since it is not already running.
*/
Class.forName(driver).newInstance();
System.out.println(“Loaded the appropriate driver.”);
Connection conn = null;
Properties props = new Properties();
props.put(“user”, “user1″);
props.put(“password”, “user1″);
/*
The connection specifies create=true to cause
the database to be created. To remove the database,
remove the directory derbyDB and its contents.
The directory derbyDB will be created under
the directory that the system property
derby.system.home points to, or the current
directory if derby.system.home is not set.
*/
conn = DriverManager.getConnection(protocol +
“derbyDB;create=true”, props);
System.out.println(“Connected to and created database derbyDB”);
conn.setAutoCommit(false);
/*
Creating a statement lets us issue commands against
the connection.
*/
Statement s = conn.createStatement();
/*
We create a table, add a few rows, and update one.
*/
private void parseArguments(String[] args)
{
int length = args.length;
for (int index = 0; index < length; index++)
{
if (args[index].equalsIgnoreCase(“jccjdbcclient”))
{
framework = “jccjdbc”;
driver = “com.ibm.db2.jcc.DB2Driver”;
protocol = “jdbc:derby:net://localhost:1527/”;
}
if (args[index].equalsIgnoreCase(“derbyclient”))
{
framework = “derbyclient”;
driver = “org.apache.derby.jdbc.ClientDriver”;
protocol = “jdbc:derby://localhost:1527/”;
}
}
}
July 5, 2008
Posted by
davidbloom |
SW Tools |
|
No Comments Yet
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.
June 20, 2008
Posted by
davidbloom |
Uncategorized |
|
No Comments Yet
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 Yet
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))
## 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 Yet
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.
- ActionContextCleanUp filter: The ActionContextCleanUp filter is optional. It is useful when integrating other technologies such as SiteMesh Plugin.
- 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.
- 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.
- 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.
- Then the Interceptors are executed again in reverse order. Finally the response returns through the filters configured in web.xml file.
- 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 |
|
1 Comment
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.

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

References :
November 25, 2007
Posted by
davidbloom |
Blogging, SW Tools, Struts |
|
No Comments Yet
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

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 Yet
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 Yet
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.4 –API — reference documentation — Dojo jot wiki — dojo 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:
- 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.
- 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:
url: The URL to make the request to.
mimetype: The response type expected.
load: Code to execute upon success.
error: Code to execute upon error.
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 Yet
“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 Yet
http://drdobbs.com/dept/architect/198000264: “”
June 25, 2007
Posted by
davidbloom |
Uncategorized |
|
No Comments Yet
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 Yet
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 Yet
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 Yet
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 Yet
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 Yet
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 Yet
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 Yet
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 Yet
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>
- 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.
- 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.
- <%@ taglib prefix="ww" uri="/webwork" %> : access to the tag library.
November 18, 2006
Posted by
davidbloom |
Struts |
|
No Comments Yet
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 Yet
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 Yet
in google i put: pserver:guest@cvs.dev.java.net: /cvs dwr
which gave me this url
November 11, 2006
Posted by
davidbloom |
Open Source |
|
No Comments Yet
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 Yet
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");
if ("yes".equals(enable))
_enable=true
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
if (! _enable)
{ // proceed with request
chain.doFilter(request, response);
return;
}
doIt();
chain.doFilter(request, response);
//After
FilterChain.doFilter() returns, the filter can do more processing if it
chooses;
doINextt();
}
public void destroy()
{
}
}
November 5, 2006
Posted by
davidbloom |
Web Design |
|
No Comments Yet
"Basic approach is that pages push themselves onto a trail-stack, and
a normalized version is maintained for showing on a page. ie)
In addition to the normalized user version, a full trail is also
maintained, which could be emailed or stored instead of access logs on
session expiry.
Normalization occurs whenever an element is repeated in a trail, its
http-referer is repeated in a trail [ie sneaky users used the back button]
or possibly when the trail:pop tag is used, though I’ve not had a need to
use that yet."
November 4, 2006
Posted by
davidbloom |
Web Design |
|
No Comments Yet
After the release of WebWork 2.2.2, the WebWork and Struts communities began a merge that will eventually produce Struts 2. This merger combines these two "action based" frameworks as it is told .
Compared to SpringMVC,
you sacrifice some cleanliness but there is a lot more work done in
certain areas, for example client-side validation, a strong Interceptor
framework and a nice graphical flow
designer – this latter is also a strong area, with WebWork being one of
the pioneer adopters of the freshly unbundled RIFE Continuations package.
Read more »
November 2, 2006
Posted by
davidbloom |
Struts |
|
No Comments Yet
2 User:
3 User_talk:
4 Project:
5 Project_talk:
6 Image:
7 Image_talk:
8 MediaWiki:
9 MediaWiki_talk:
10 Template:
11 Template_talk:
12 Help:
13 Help_talk:
14 Category:
15 Category_talk:
October 27, 2006
Posted by
davidbloom |
Web/Tech |
|
No Comments Yet
RACF is now
called "Security Server" [1]
Putting Latest Security Features to work [redbook]
RACF schema
What is RACF:
RACF stands for Resource Access Control Facility. RACF is a software security product that protects information
by controlling access to it. RACF also controls what the user can do and protects all of the operating system’s
resources. RACF provides this security by identifying and verifying users, authorizing users to access protected
resources and recording and reporting access attempts.
RACF helps meet the needs for security by providing the ability to:
- Identify and verify users
- Authorize users to access the protected resources
- Control the means of access to resources
- Log and report various attempts of unauthorized access to protected resources
- Administer security to meet the goals of security
RACF mag
LDAP integrate
example operation
[1]
[2]
October 10, 2006
Posted by
davidbloom |
SW Tools |
|
No Comments Yet
In Reggie Bush’s first game:
58 yards of revieving, 61 yards rushing
Kellen Winslow playing in first game since injury
1TD, 63 yards receiving
Saints and Falcons lead NFC South as Bucs and Panthers begin season in loss column.
It seemed that Bucs OL being banged up resulted in Simms bad play with 3 picks.
Caddilac Williams had only 22 yards eof rushing mainly due to Ravens strong D.
McNair had a decent first game and seemed like he will has found a favorite target in Mason.
The Panthers just could not solve Vick and Dunn combination. Panthers lacked big play
they usually can count on in Steve Smith. Laverneus Coles hooked up with passes from Pennington quite well today
September 10, 2006
Posted by
davidbloom |
Sports |
|
No Comments Yet
link : "Motricity, a
leading global provider of mobile marketplace management solutions, has
acquired GoldPocket Wireless, a leader in mobile interactivity and
marketing solutions for media and entertainment companies. The
acquisition gives Motricity an unmatched customer footprint and
positions the company as the most complete supplier of on-deck and
off-deck solutions for mobile operators and media and entertainment
companies."
July 17, 2006
Posted by
davidbloom |
Mobile |
|
No Comments Yet