About

Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Search
Tag Cloud
...
Login
Saturday
Jul162011

On Enterprise Architecture

This page marks the beginning of a new series that aims to introduce some pragmatic dimensions to enterprise architecture, aiming to address the gap between enterprise and technical architecture.

Pragmatic enterprise architecture supports a systematic view of the enterprise that reduces redundancy and serves the organisations objectives. A pragmatic architecture serves to help the business stakeholders describe their needs, understand their cost and significantly understand the capabilities they already have. Significantly it doesn't only achieve this. Whilst enterprise architects strive to assist the business in leading change, they also can only succeed if they can truly guide, lead and support development.

 Guiding Concerns

The Architecture of an enterprise is defined by three key concerns. These are

  • Views The Architecture must communicate information about the architecture in a way that is easy to understand
  • Methods Enterprise Architects analyze and interpret the architecture in a way that ensures its integrity, accuracy, correctness and relevance. They must use multiple views and complementary analytical techniques.
  •  Mentoring Enterprise Architects must support the realisation of the architecture through methods, process, notation and tools

An overriding concern of enterprise architecture is to support decision making. Consequently, it is insufficient to characterise enterprise architecture as merely defining a transition from today's problem state to tomorrow's future planned situation - enterprise architecture is concerned with creating an organisational context for continuous improvement.

Practitioners

Many large organisations are establishing dedicated Enterprise Architecture teams. Other organisations with mature governance are organised in matrix models where the ownership of the enterprise architecture is devolved to the senior technical architects and software engineering specialists in the organisation.

Regardless of the structure, the enterprise architect must exhibit the skills of the developer, the designer or solutions architect - expertise and professionalism in design and delivery. After all, the enterprise architect is a technical practitioner, skilled in the state of the art and adept at mentoring designers and developers at the tip of delivery. This alone is not enough - the enterprise architecture is skilled at interpreting the needs of the business, and experienced in upward as well as downward communication.

In an organisation with dedicated enterprise architects, a particular challenge is to instill the practice and involvement in enterprise architecture across the organisation. Conversely, many organisations lack dedicated enterprise architecture capacity. In these organisations developers and solutions owners lead this activity.

Why Architecture?

Whilst architecture has become a standard - albeit overused - term in an industry used to using titles as a badge of experience, the term detracts from the true holistic nature of the activities that architecture encompasses. In buildings architecture, the architect is the visionary of a team and relies on many specialists, most importantly structural engineers, to realise the design. Whilst it is true that the architecture of large scale software systems is a team activity, the enterprise architect, like other technical team members, must take a multi-disciplinary approach and participate in all stages of design and delivery.

I prefer the term enterprise design to describe the activity of an enterprise architect. During enterprise design, incremental improvements and strategic selection takes centre stage; the objective is not only to achieve a final state but to establish capabilities within the organisation (and particularly the IT organisation) to deliver ongoing and continual change.

Friday
Jul152011

Suppressing m2e Warnings

With the release of Eclipse Indigo, I've started migrating from using Maven's eclipse plugin to m2e for managing the integration of my projects into the Eclipse IDE.

This brings with it a host of new warnings relating to the use of plugins such as toolchains and enforcer. The resolution of these errors is the inclusion of the a section such as the following in the pom.xml of the affected project:

		
			m2e
			
				
					m2e.version
				
			
			
				
					
						
							org.eclipse.m2e
							lifecycle-mapping
							1.0.0
							
								
									
										
											
												org.apache.maven.plugins
												maven-toolchains-plugin
												[1.0,)
												
													toolchain
												
											
											
												true
											
										
										
											
												org.apache.maven.plugins
												maven-enforcer-plugin
												[1.0,)
												
													enforce
												
											
											
												true
											
										
									
								
							
						
					
				
			
		

Thursday
Jul072011

Eclipse Indigo

Eclipse Indigo is the simultaneous release of Eclipse 3.7 and a large collection of related Eclipse projects. Indigo brings a lot of previously external projects such as M2e and EGit into the Eclipse release train.

This post updates my previous quick configuration howtos covering Ganymede, Galileo, and Helios by documenting the steps to get stock Eclipse up and running with essential Eclipse plugins. The Indigo release is ready for use with many key thirdparty plugins already working, a much improved situation on the original release of Galileo. The recipe is for Windows - extrapolate as required.

1. Download Eclipse IDE for Java Developers (either eclipse-java-indigo-SR2-win32.zip for 32-bit Windows, or eclipse-java-indigo-SR2-win32-x86_64.zip for 64-bit Windows). These can be found via http://www.eclipse.org/downloads/

2. Make a folder for Eclipse somewhere called 'Eclipse', and unzip the Eclipse SDK zip file to the parent folder. I typically create c:\Java\Eclipse and unzip to c:\Java

3. Create a shortcut to Eclipse, for example:

C:\Java\Eclipse\eclipse.exe

4. Configure eclipse.ini, for example, with the following:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-clean
-vm
C:/Java/JSE6/jre/bin/server/jvm.dll
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-server
-Dcom.sun.management.jmxremote
-Declipse.p2.unsignedPolicy=allow
-Xms768m
-Xmx768m
-XX:MaxPermSize=256M
-XX:+UseParallelOldGC
-XX:+DoEscapeAnalysis
-XX:+TieredCompilation
-XX:+OptimizeStringConcat
-XX:+UseCompressedStrings

or, using the 64-bit VM:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-clean
-vm
C:/Java/JSE6/jre/bin/server/jvm.dll
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-server
-Dcom.sun.management.jmxremote
-Declipse.p2.unsignedPolicy=allow
-Xms768m
-Xmx768m
-XX:MaxPermSize=256M
-XX:+UseParallelOldGC
-XX:+DoEscapeAnalysis
-XX:+TieredCompilation
-XX:+OptimizeStringConcat
-XX:+UseCompressedStrings
-XX:+UseCompressedOops

(where the ‘vm’ argument points to your appropriate Java runtime with Eclipse - this should be at least version 6.0 and should be 32-bit or 64-bit as appropriate).

NB. Best practice is to point to a JDK rather than a JRE location.

5. Next, search for new features using the Indigo Updates (with "Show the latest version" selected).

Pick the appropriate platform features - you can safely select everything. Pick the appropriate platform features - you can safely select everything.

Typical selection could be Business Intelligence Reporting and Charting (except Eclipse BIRT Example and Eclipse BIRT Source Feature), Collaboration (except Subversive and Mylyn Context Connector - C++ Development), General Purpose Tools (Local Terminal, Memory Analyzer, Memory Analyzer (Charts), all of Remote System Explorer, RPM, SWT, and Window Builder packages), Modeling (Graphiti...), Programming Languages (JavaScript Development Tools), SOA Development (except SCA...), Testing, Web XML Java EE and OSGi Development (excluding PHP Development Tools (PDT) SDK Feature).

Also, from the Mylyn for Eclipse Indigo update site select all updates except Mylyn Context Connector: C/C++ Development, Mylyn Builds SDK, Mylyn Commons SDK, Mylyn Context SDK, Mylyn Docs SDK, Mylyn Reviews SDK, Mylyn Tasks SDK, Mylyn Tasks Tests SDK, Mylyn Versions SDK and Mylyn WikiText SDK).

6. After restarting, the following update sites can be used to add AspectJ Developer Tools, SvnKit, QuantumDB, Log4E and some other valuable plugins:

AJDT http://download.eclipse.org/tools/ajdt/37/update (Not AspectJ Development Tools Source)
AJDT M2e Configurator http://dist.springsource.org/release/AJDT/configurator/
SvnKit http://eclipse.svnkit.com/1.7.x
SubClipse http://subclipse.tigris.org/update_1.8.x
QuantumDB http://quantum.sourceforge.net/update-site
Log4E http://log4e.jayefem.de/update (note that the free version cannot be installed using the update site)
ERMaster http://ermaster.sourceforge.net/update-site/
then restart

7. After restarting again, install the following extensions from the Eclipse Marketplace: Maven Integration for Eclipse, Maven Integration for Eclipse WTP, QWickie, JBoss Tools (Indigo), Groovy-Eclipse, Atlassian Connector for Eclipse, SpringSource Tool Suite for Eclipse Indigo, JavaCC Eclipse Plugin, Apache Directory Studio, TestNG for Eclipse, EGit, GitHub Mylyn Connector, Mylyn, Bndtools)

8. Go to "Window / Preferences / Maven / Discovery" and "Open Catalog". Select Android Connector, antlr, Axis Tools m2e, buildhelper, Checkstyle m2e, Groovy-Eclipse, m2e connector for javacc-maven-plugin, m2e connector for maven-scm-plugin, m2e connector for org.codehaus.mojo:jaxb2, m2e connector for org.codehaus.mojo:xmlbeans, PMD m2e, Tyco Configurator, maven.runtime-3.0.3, m2e-cvs, m2e-egit

9. Install m2e-apt from the update site at http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt

10. Other interesting plugins you might want to consider could include:

Checkstyle http://eclipse-cs.sourceforge.net/update/
LogWatcher http://graysky.sourceforge.net/
Color Editor http://www.gstaff.org/colorEditor/download.html
Scala IDE http://download.scala-ide.org/releases-29/stable/site (Not JDT Weaving for Scala or Scala IDE for Eclipse Source)
Android Development Tools https://dl-ssl.google.com/android/eclipse/

11. A couple of plugins are best installed by hand:

Download Jar Class Finder version 2.1.0 from http://www.alphaworks.ibm.com/tech/jarclassfinder/download and copy the Jar to the Eclipse/dropins/plugins subdirectory.
Download Tarlog Plugin 1.4.2 from http://code.google.com/p/tarlog-plugins/ (I used tarlog.eclipse.plugins_1.4.2.jar) and copy the Jar to the Eclipse/dropins/plugins subdirectory.

https://dl-ssl.google.com/android/eclipse/
Thursday
Jul072011

Jadira Usertype 1.9 and 2.0

During this week I released Jadira Usertype 1.9 and today released 2.0.

These releases both feature the same capabilities, including a number that are new. They differ in the versions of Hibernate they support. Usertype 1.9 is for Hibernate 3.6.x and ealier; which Usertype 2.0 is built against Hibernate 4.0.0.beta2 and will not work with earlier versions.

The key new features in these releases are:

  • Improvements to the robustness of mappings of Time types to Timestamps;
  • Support for @Version functionality for Joda and JSR310 types (note that Joda will only give milliseconds precision);
  • Allow usertype properties to be dereferenced in queries for multi-column (composite) types;
  • Usertype classes are now serializable;

Documentation for Usertype is available from the Sourceforge project pages and you can download the releases from Maven Central.

Tuesday
Oct192010

The Worst Kind of Defect #1

One of the most dangerous categories of defect is the misuse of member variables in singletons.

For example

public class DefaultFooService implements FooService {

    private TheResult theResult;

    public TheResult handleServiceRequest(TheRequest request) {
        theResult = doStuff();
        doMoreStuff();
        return theResult;
    }
}

This code is dangerous, and needs urgent refactor. A safer form looks something like:

public class DefaultFooService implements FooService {

    public TheResult handleServiceRequest(TheRequest request) {
        TheResult theResult = doStuff();
        doMoreStuff(theResult);
        return theResult;
    }
}

In the first example, data can be bled from one thread to another. In a web application this can result in data bleeding from one user to another. In a business policy this can result in the wrong rules being applied. In a financial calculation this can result in the wrong answer.

This defect is serious, and not only because of its severity. It is also hard to find. Only concurrent tests have any opportunity of surfacing the problem. Getting good coverage of such tests is difficult and there is no guarantee you will spot the issue. Often code review, and experience are the only ways to find and prevent this issue. Findbugs, PMD and the like cannot detect these errors (although they can warn about misuse of static fields.

As application architectures move more and more to stateless service architectures, these kinds of problems are going to become more and more prevalent.

Where a singleton service must hold state, the only workable solution in Java, is the use of a ThreadLocal, for example:

public class DefaultFooService implements FooService {

    private ThreadLocal<TheResult> = new ThreadLocal<TheResult>();

    public TheResult handleServiceRequest(TheRequest request) {
        theResult.set(doStuff());
        doMoreStuff(theResult.get());
        return theResult.get();
    }
}