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
Friday
Oct122012

Eclipse Juno

Eclipse Juno (now updated to SR1) is the simultaneous release of Eclipse 4.2 and a large collection of related Eclipse projects. With the release of SR1 some of the main performance issues of the original release have been resolved.

This post updates my previous quick configuration howtos covering Ganymede, Galileo, Helios and Indigo by documenting the steps to get stock Eclipse up and running with essential Eclipse plugins. The recipe is for Windows - extrapolate as required.

1. Download Eclipse IDE for Java Developers (eclipse-jee-juno-SR1-win32.zip for 32-bit Windows, eclipse-jee-juno-SR1-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.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
-clean
-vm
C:/Java/JSE6/jre/bin/server/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Dhelp.lucene.tokenizer=standard
-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 Juno 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), General Purpose Tools (Local Terminal, Memory Analyzer, Memory Analyzer (Charts), RPM, Swing Designer, SWT Designer, and Window Builder packages), Modeling (UML2 Extender SDK), Programming Languages (JavaScript Development Tools), SOA Development, Testing, Web XML Java EE and OSGi Development (excluding PHP Development Tools (PDT) SDK Feature).

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/42/update (Not AspectJ Development Tools Source)
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

Also, from the Mylyn for Eclipse Juno update site select all updates except Mylyn Builds SDK, Mylyn Commons SDK, Mylyn Context SDK, Mylyn Docs SDK, Mylyn EPUB SDK, Mylyn Reviews SDK, Mylyn Tasks SDK, Mylyn Tasks Tests SDK, Mylyn Versions SDK and Mylyn WikiText SDK).

7. After restarting again, install the following extensions from the Eclipse Marketplace: Maven Integration for Eclipse, QWickie, Atlassian Connector for Eclipse, JavaCC Eclipse Plugin, Apache Directory Studio, TestNG for Eclipse, EGit, GitHub Mylyn Connector, Mylyn WikiText, Bndtools, Checkstyle, PMD, Vex)

8. Install Groovy Eclipse from http://dist.springsource.org/release/GRECLIPSE/e4.2/ and SpringSource Tool Suite for Eclipse Juno from http://dist.springsource.com/release/TOOLS/update/e4.2

9. Install JBoss Tools (Indigo) from http://download.jboss.org/jbosstools/updates/nightly/core/trunk/ (except sources)

10. Go to "Window / Preferences / Maven / Discovery" and "Open Catalog". Select antlr, Axis Tools m2e, buildhelper, CheckStyle M2E, m2e-apt, m2e-jdt-compiler, PMD M2E, Tycho Configurator, m2e-egit, m2e-subclipse

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

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/

12. 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
Jan192012

Release: Jadira Usertype 3.0.0.CR1 with support for Joda Money 0.6

The first candidate build of Jadira Usertype 3.0.0 is now being synchronised to Maven Central. This is quite a big release and represents a large number of significant enhancements for the library.

Change of Naming for Maven Archives

The most immediately visible change is in the names of the Maven archives. Users of 'usertype.jodatime' should now change their dependency to:

        <dependency>
            <groupId>org.jadira.usertype</groupId>
            <artifactId>usertype.core</artifactId>
            <version>3.0.0.CR1</version>
        </dependency>

Similarly the name of the 'jsr310' archive has changed to 'usertype.extended'. Usertype core contains most usertype functionaliy, whilst extended only contains library code that has dependencies that do not exist in Maven Central. Most users will want to use 'usertype.core'. Today you only need to use 'usertype.extended' if you want to use the JSR 310 usertype mappings. The reason for these changes is to accommodate new features within the usertype library.

Support for Joda Money

The most significant new feature is the inclusion of mappings for Joda Money. This library is a precursor for the eventual implementation of JSR 354, so Joda Money users will benefit from a future migration path as they adopt the JSR, just as Joda Time users can fairly readily switch usertype implementations as they adopt JSR 310. The mappings include mappings for both Money and BigMoney types, and support mapping to decimal or integer columns (for integer columns either the major amount (e.g. Dollars) or minor amount (e.g. cents) can be mapped. Single-column mappings allow a currency to be set either for the particular column (using the 'currencyCode' parameter on the column mapping) or SessionFactory wide (using the JPA or Hibernate property 'jadira.usertype.currencyCode'), whilst multicolumn mappings map the amount and currency each to their own columns.

Updates to Joda Time Support

Joda Time support has been upgraded to 2.0 release of the library. With the upgrade support for two new Joda Time datatypes - MonthDay and YearMonth has been added.

Globalised Configuration Options

The Joda Time and JSR 310 mapping have seen the introduction of system wide configuration options. This is particularly useful because you can set the database timezone and JVM default timezone once using a hibernate or JPA property. The two properties that can be used are 'jadira.usertype.javaZone' and 'jadira.usertype.databaseZone'.

A fourth supported property is 'jadira.usertype.seed'. This can be used to indicate which default implementation of Seed will be used for that SessionFactory.

Autoregistration of User Types in Hibernate 4

A final key new feature is the autoregistration of type mappings in Hibernate 4. This feature (which is not enabled by default) coupled with the use of globalised configuration, will allow you to avoid explicitly including type mappings for many of the commonly supported types.

The types that are autoregistered are:

  • PersistentBigMoneyAmount
  • PersistentMoneyAmount
  • PersistentCurrency
  • PersistentCurrencyUnit
  • PersistentDateTime
  • PersistentDurationAsString
  • PersistentInstantAsTimestamp
  • PersistentLocalDate
  • PersistentLocalTime
  • PersistentMonthDayAsString
  • PersistentPeriodAsString
  • PersistentTimeOfDay
  • PersistentYearMonthDay
  • PersistentYears

 To enable this feature, you need to set the JPA or Hibernate property 'jadira.usertype.autoRegisterUserTypes' to 'true'.

Upgrades

Upgrading from Usertype 2.0 should be relatively straightforward - as most new features are not enabled until the relevant property is set. Remember that Usertype 2.0 and later only support Hibernate 4 and onwards.

Upcoming Features

I am looking at a number of future areas for new functionality in Jadira Usertype. These include the previously mentioned addition of support for JAXB Bindings for the existing mapped types. Further planned changes include a refactor of the support for the JDK Date and Calendar classes and the development of some new domain types - and associated mappings - for types for which no standardised types currently exists. At the top of the list of these types just now are PhoneNumber (which will probably make use of Google's excellent libphonenumber) and Address.

You can find more information on the Usertype project at the project website.

Friday
Jan132012

Approach for Adding Joda Money Support to Jadira Usertype

For the next release of Jadira Usertype I am planning to add support for Joda Money.

The changes proposed are shown in this article. The existing column mapper framework used in Jadira Usertype will be augmented to provide new base mappers for Integer and Decimal types, and concrete mappers provided to map CurrencyUnit, Currency and BigMoneyProviders to single columns. For BigMoneyProvider types, Major (e.g. dollars), Minor (e.g. cents) and Decimal (i.e. dollars and cents) mappings will be provided:

 

These mappers will be used to implement single and multi-column types that support a variety of ways of storing money both with, and without a separate column for holding the currency:

Please share any feedback or suggestions for the proposed design.

Thursday
Jan122012

New Answers for New Questions: (More Than) A Decade On

Back in 2000, as part of my dissertation, the subject I wrote on was the concept of how electronic publishing was changing media and literature. Well, I didn't coin the term blogging or social network, but reading it now is fascinating. The question I posed was:

"One of the key social and philosophical issues confronting society in the beginning of
the 21st century is the sharing of all kinds of information. How we react to this issue will
change the very nature of the creation and distribution of literature, which is just one form
of information, albeit information with very special properties. Textual media and our
notion of it are changing. Old methods of sustainability and funding in publishing (literally
sales of printed material) are no longer so assured. As literature adapts to the new medium,
the nature of the material being published will be altered forever, as will the mechanisms
and organisations that support publication. The purpose of this paper is to examine the
likely nature of the impact of new media on literary publishing."

I concluded:

"It is clear that the major impact that electronic publishing is having on literature derives from its immediacy, its flexibility and its interoperability. The activities of the underground art scene with their emphasis on anonymity, and implicit and advanced understanding of practical methods of exploiting intellectual property in the digital medium means that the relations between privacy, speech, academic freedom and accountability must be an intrinsic part of any system of quality assessment and validation online. Indeed, experience shows that where a publication or public (broadcast) communication environment does not make such features an intrinsic aspect of the communication, the noise will invariably rapidly begin to outweigh the useful content.

The issues surrounding copyright, academic freedom, the right to privacy, and freedom of speech are provocative, and practical conclusions seem to challenge accepted normalities. These issues can only be effectively addressed in the context of a thorough understanding of the digital environment itself.

The electronic environment will force us to reassess our notion of intellectual property, and publishers, academics and critics will have to reassess their roles of they want to continue to provide value in the electronic environment. If the Internet and Electronic Publishing are to fulfil their promise of an interoperable, searchable canvas –the world’s biggest library, in which all creators can play their deserved part, such review should be the product of an open-minded and informed public debate; one that interested contributing members of literary communities should not only witness but also be at the centre of..."

The University gave dispensation allowing me to publish this paper on my personal website. It is available to download from here.

Sunday
Jan082012

Where Next for Jadira Usertype?

Its getting close to two years since I first put together the Usertype library. The project - quite a small piece of open source - began when I wanted to put together some classes for integrating the ThreeTen library (the reference implementation for JSR310) and Hibernate. The library expanded to support Joda Time almost by accident. I was using Joda Time Hibernate to verify that the JSR 310 mappings worked - writing to the database using one library and reading back to the other - when I found inconsistencies between the two libraries. Digging into the causes revealed problems with mapping of types such as LocalTime that had their roots in the way JDBC handles temporal types.

Today Usertype not only addresses these issues but also has support for arbitrary configuration of the database and jvm timezone; a wide variety of single and multiple column types and the JPA @Version annotation. The pending release will allow for global configuration using Hibernate properties and autoregisters the most common type mappings - avoiding the need to register them in Hibernate configuration or via annotations. Usertype supports both Joda Time and JSR 310 giving a convenient migration route from one library to the other. The library is proving remarkably stable, with very few defects and I encourage any users of the original contributed Hibernate library to consider using it.

I am now wondering where future development for the project should lie. The likely next step will be for the project to incorporate support for other fundamental types. Like date and time types, money types share many of the same properties - strong typing, single and multiple column mappings and other needs. The recent announcement of JSR 354 - Money and Currency API has me considering adding support for this API as it becomes established, and as with Joda Time, I plan to create a forward looking bridge by including support for Joda Money. The second direction I am considering taking the project is in supporting JAXB bindings for the various supported types. This will again help provide a forward direction for each supported datatype and help to put in place a canonical representation for the important Money and Currency types. The exact form these data-bindings will take needs more consideration, and should reference the general structure used in standard financial formats such as ISO 20022. Feedback on the planned directions is very much appreciated.

Closely related to Usertype is the Jadira Bindings project. This project provides a set of data binding APIs that support implicit conversions from one data type to another. The project is now becoming increasingly mature and is being enhanced to support registration of any kind of function - not only for conversions. During the next few months I expect to deliver a 1.0 release. There are also some other projects I am preparing code for - also planned to be open source - but I want to save discussion of these for another post.