Perfect reprise for the biggest Ape in computing: here. If you haven't seen the YouTube classic Developers, Developers, Developers, spin that first.
123485 items (117734 unread) in 107 feeds
Actualités
(18562 unread)
Informatique
(16079 unread)
Sport & Loisirs
(1860 unread)
Blogs
(6796 unread)
Gwadanina.net
(2076 unread)
Sciences & Techno
(11585 unread)
Antilles Martinique Guadeloupe
(29352 unread)
Open Source & Libre
(4969 unread)
Developpement
(17446 unread)
Sécurité
(4523 unread)
FAI
(1022 unread)
Cultures
(489 unread)
Cinéma & Musique
(77 unread)
Recettes
(406 unread)
Autres
(90 unread)
Referencement
(385 unread)
Photos
(1961 unread)
Entreprise
(56 unread)
Perfect reprise for the biggest Ape in computing: here. If you haven't seen the YouTube classic Developers, Developers, Developers, spin that first.
/**
|
/**
|
TopCoder says on their site that they were named to Inc. Magazines list of fastest growing companies. What seems to be growing alongside their company is their hubris. They wanted to find a UML tool to use, but couldn't so what do you think they did? They built one, Pal. Step aside. Here it is. (Another early sign of hubris here: they only implemented some of the diagram types, and in a move that defies reason, they did sequence diagrams, but did not add the ability to see the sequence as a collaboration.. but folks, omission is one of the sharpest forms of definition.)
Now, having long flown the flag that the world needed a really good UML tool, I was of course interested. I downloaded and followed the instructions, and what do you know, it doesn't work. No icon appears, and running run.sh gets nothing. Must be because I am on the mac. Announcement, ye of increasing heft: TONS of devs are on macs now. After reading a huge torrent of hyperbole that makes TC seem like the development equivalent of cold fusion (not the templating tinkertoy, the dixie cup sun), it is laughable to push through the first turnstile into an experience that is so fraught with the usual potholes. Here's a clue folks: if yer fusion has platform requirements, get one of the Herculeans to add a short list to the download page, it will make y'all seem a bit less like just another gangway attraction in the Barnumian Universe.
I didn't include code last entry on this subject. Basically, I wanted a really simple abstraction to a select statement so I can:
All of this was written for situations where I have the same basic query over and over again, with slight variations, mostly driven by different user options. It's very similar to what you can do with Hibernate's Criteria object, except I'm dealing with a very thin abstraction over a string rather than a new paradigm.
With out further ado, here's the code:
package builder;
import java.util.*;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* This class represents a select statement.
*
* @author sduskis
*/
public class SearchQuery {
private List select = new ArrayList();
private List from = new ArrayList();
private List where = new ArrayList();
private List order = new ArrayList();
private Map parameters = new HashMap();
public String toString() {
StringBuffer selectString = new StringBuffer();
addSqlString("SELECT ", this.select, ",nt", selectString);
addSqlString("FROM ", this.from, ",nt", selectString);
addSqlString("WHERE ", this.where, "ntand ", selectString);
addSqlString("ORDER BY ", this.order, ",nt", selectString);
return selectString.toString();
}
private StringBuffer addSqlString(String prefix, List list, String delimiter, StringBuffer s) {
if (CollectionUtils.isEmpty(list))
return s;
if (s.length() != 0)
s.append("n");
return s.append(prefix).append(StringUtils.collectionToDelimitedString(list, delimiter));
}
public SearchQuery select(String s) {
return add(select, s);
}
public SearchQuery from(String s) {
return add(from, s);
}
/** add joins to an existing "table */
public SearchQuery appendFrom(String appendStr, int location) {
String fromStr = from.get(location).toString();
fromStr += appendStr;
from.set(location, fromStr);
return this;
}
public SearchQuery where(String s) {
return add(where, s);
}
public SearchQuery orderBy(String s) {
return add(order, s);
}
public SearchQuery parameter(String key, Object param) {
parameters.put(key, param);
return this;
}
private SearchQuery add(List l, Object o) {
if (o != null)
l.add(o);
return this;
}
... GETTERS ...
}
I just screamed at Java again. This time my ire has been raised by the lack of self-types in the language.
Self-typesSo what is a self-type. Well, I could point you at some links, but I'll try and have a go at defining it myself...
A self-type is a special type that always refers to the current class. Its used mostly with generics, and if you've never needed it then you won't understand what a pain it is that it isn't in Java.
Here's my problem to help explain the issue. Consider two immutable classes - ZonedDate and LocalDate - both declaring effectively the same method:
public final class ZonedDate {
ZonedDate withYear(int year) { ... }
}
public final class LocalDate {
LocalDate withYear(int year) { ... }
}
The implementations only differ in the return type. This is essential for immutable classes, as you need the returned instance to be the same type as the original in order to call other methods (like withMonthOfYear).
Now consider that both methods actually contain the same code, and I want to abstract that out into a shared abstract superclass. This is where we get stuck:
public abstract class BaseDate {
BaseDate withYear(int year) { ... }
}
public final class ZonedDate extends BaseDate {
// withYear removed as now in superclass, or is it?
}
public final class LocalDate extends BaseDate {
// withYear removed as now in superclass, or is it?
}
The problem is that we've changed the effect of the method as far as ZonedDate and LocalDate are concerned, because they no longer return the correct type, but now return the type of the superclass.
One solution is to override the abstract implementation in the subclass, just to get the correct return type (via covariance):
public abstract class BaseDate {
BaseDate withYear(int year) { ... }
}
public final class ZonedDate extends BaseDate {
ZonedDate withYear(int year) {
return (ZonedDate) super.withYear(year);
}
}
public final class LocalDate extends BaseDate {
LocalDate withYear(int year) {
return (LocalDate) super.withYear(year);
}
}
What a mess. Imagine doing that for many methods on many subclasses. Its a large amount of pointless boilerplate code for no good reason. What we really want is self-types, with a syntax such as <this>:
public abstract class BaseDate {
<this> withYear(int year);
}
public final class ZonedDate extends BaseDate {
// withYear removed as now correctly in superclass
}
public final class LocalDate extends BaseDate {
// withYear removed as now correctly in superclass
}
The simple device of the self-type means that the withYear method will now appear to have the correct return type in each of the subclasses - LocalDate in LocalDate, ZonedDate in ZonedDate and so on. And without reams of dubious boilerplate.
Self-types are a necessary companion for abstract classes where the subclass is to be immutable (and there are probably other good uses too...).
Opinions welcome as always!
private static class MyObjectListCellRenderer extends DefaultListCellRenderer
{
@Override
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus )
{
JLabel label = (JLabel)super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
label.setText( ((MyObject)value).getName() );
return label;
}
}
To avoid having to write this, I create a PropertyListCellRenderer (inspired by GlazedList's TableFormat method) that avoids that you need to subclass, you can just create one like this:
ListCellRenderer renderer = new PropertyListCellRenderer( "name",
MyObject.class );
myJList.setCellRenderer( renderer );
This is the code for the PropertyListCellRenderer:
package com.jroller.fester.swing;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
*
*/
public class PropertyListCellRenderer extends DefaultListCellRenderer
{
private static final Logger logger = Logger.getLogger( PropertyListCellRenderer.class );
private final String m_propertyName;
private final Class m_clazz;
/**
* @param propertyName the name of the property you want to be shown in the list
* @param clazz the class of the objects that are in the list model
*/
public PropertyListCellRenderer( String propertyName, Class clazz )
{
m_propertyName = propertyName;
m_clazz = clazz;
}
@Override
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus )
{
JLabel label = (JLabel)super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
try
{
String methodName = "get" + m_propertyName.substring( 0, 1 ).toUpperCase() + m_propertyName.substring( 1 );
Method m = m_clazz.getMethod( methodName );
if (m == null)
{
throw new IllegalArgumentException( "Method '" + methodName + "' could not be found" );
}
if (m_clazz.isAssignableFrom( value.getClass() ))
{
String text = (String)m.invoke( value );
label.setText( text );
}
else
{
throw new IllegalArgumentException( "The value in the list is not of class " + m_clazz.getName() + ", but class " + value.getClass().getName() );
}
}
catch (NoSuchMethodException e)
{
logger.error( e.getMessage(), e );
}
catch (IllegalAccessException e)
{
logger.error( e.getMessage(), e );
}
catch (InvocationTargetException e)
{
logger.error( e.getMessage(), e );
}
return label;
}
}
It is pretty straight forward and using standard Java reflection techniques.
today i lost some time while struggling with a tiny(possibly buggy) case... my case is: put a property in a properties file and use it from an ant build file :)
in fact, it's so easy.. but a tiny issue caused to lose some time of mine... dropping it may help others...
suppose we have property file like this;
modul.properties
|
prop1=val1
|
above property file defines a property, myJarDir, to hold the directory name of may jars...
second, we have an ant build.xml file which includes a task to create a directory with "myJarDir" property's value;
build.xml
|
<project name="sampleAntProject" basedir="." default="make-jar-dir">
|
now, when you run the task you will see that; it will create a folder as "WebContent${myJarDir}" not our expected "WebContentgisjars" folder...
problem is; ant can not see the property from my property file if i load that property file after its usage in another property. To get the correct result, we should load our property file before its usage(above the "mylib-dir" property).
working build.xml should be written like below;
build.xml
|
<project name="sampleAntProject" ................>
|
it's interesting that; if i use "${webcontent-dir}/${myJarDir}" directly at mkdir task, it's working as normal.. This error occurs only if i put "${webcontent-dir}/${myJarDir}" value into another property(mylib-dir) before the loadproperties task and use that property at my mkdir task.
i've googled and looked at ant docs but can not see any information about definition order of properties.. if anyone see a doc explaining property definition order of ant, i'll be glad to read it..
Begin forwarded message:
From: James Gosling
Date: August 24, 2007 8:16:58 PM PDT
To: Jonathan Schwartz
Subject: How was Java named?
The story goes like this:
We needed a name. We had been using "oak" (which was selected
essentially randomly by me), and while the team had grown attached to
it, the trademark lawyers ruled it out. We had lots of email debates
about names, but nothing got resolved. We ended up in the awkward
position where the #1 thing stopping us from shipping was the name.
Our marketing lead knew someone who was a "naming consultant"
(I don't remember his name, but he was great). We could neither afford
the price nor the time of a conventional product naming process. He
agreed to do something rather odd, but effective and quick: he acted as
a facilitator at a meeting where about a dozen of us locked ourselves
in a room for an afternoon. He started asking us questions like "How
does this thing make you feel?" (Excited!) "What else makes you feel
that way?" (Java!) We ended up with a board covered with essentially
random words. Then he put us through a sorting process where we ended
up with a ranking of the names. We ended up with a dozen name
candidates and sent them off to the lawyers: they worked down the list
until they hit one that cleared their search. "Java" was the fourth
name on the list. The first name on the list was "Silk", which I hated
but everyone else liked. My favorite was "Lyric", the third one on the
list, but it didn't pass the lawyers test. I don't remember what the
other candidate names where.
So, who named Java? Marketing organized the meeting, the
consultant ran it, and a whole pile of us did a lot of yelling out of
random words. I'm honestly not real sure who said "Java" first, but I'm
pretty sure it was Mark Opperman.
There certainly wasn't any brilliant marketing mind who went through a coherent thought process.
URL: http://blogs.sun.com/jonathan/entry/better_is_always_different
I will be presenting at JavaZone 2007 in Oslo, Norway September 13-14. JavaZone is one the largest European Java conferences and this is a great opportunity for us to talk about GridGain project and most importantly about the technology and ideas behind it and our view on grid computing in general. I will be presenting on "Java Grid Computing with AOP – Fun, Simple and Productive". In this presentation I will show a live coding example where I will create a simple grid application in just 10-15 minutes. Should be fun!
JavaZone is a must go if you can travel (and if you are in Europe – you are just couple of hours flying away at the most).
So I finally stumbled across the problem that has been plaguing me with my spring/hibernate application. It turns out it was the database's fault. Well, OK, it's not the database's fault. But still ....
The problem was due to the fact that one of the objects was declared having an ID of type String (java.lang.String) and the database column was a CHAR(20) while the data was only of length 16. (Have you figured out what the problem was yet?). Apparently, Hibernate recognizes a difference between "ABCD" and "ABCD ". Once I created a view that wrapped the column in a TRIM(), everything started working beautifully.
So that's the short version of what happened. If your curious about the long version, read on.
I started by alternating between bag and set while moving inverse="true" to either hbm.xml file (thanks for the pointer Eric). No matter what I did, I still couldn't retrieve the List (or Set) of objects; and, to make matters worse, I wasn't getting any error messages. Then I ran across a blog entry that talked about the difference between load and get. I noticed I was using load, so I changed it to get. I also read some blogs about not using the Spring templates and wrappers, so I made my DAO extend HibernateBaseDao and changed my calls to use the HibernateTemplate. Then, wham! I started getting error messages about the ID being changed (or something like that, sorry I don't remember the exact message). Well, if you read my previous entry you'd know that an error message can be a good thing. After a little bit of googling with no luck on a solution, I ran across a forum post describing the issue and mentioning the trailing spaces. Then it occurred to me to try wrapping the column in a TRIM(); and, well, you know the rest. Everything works great now. I can retrieve a List of either object from either side.
All in all, I'd say it was a good learning experience and hopefully someone else who's having similar problems will stumble across my blog and be inspired with an answer to their problems. (If so, please let me know )
java.lang.ClassCastException: org.springframework.context.access.ContextBeanFactoryReference cannot be cast to org.springframework.context.access.ContextBeanFactoryReferenceI assume this is a classloader issue but I'm not yet sure how to solve it. The same jars (versions) are available on the classpath and the webapps are running under a single instance of Tomcat. Any ideas??
As some of you know, I haven't written a single line of Java code since I joined Google in April. I've been working mostly with C++. As usual, you won't find any Google-specific information in this post.
I have always been a fan of Test-driven development. Good unit tests make extensive use of Mock objects, so I am a fan of Dependency Injection as well. In its bare form, where we don't have a magical container that injects dependencies for us, we're talking about DI's origins, Inversion of Control: taking away the control flow of instantiation from inside the classes. Inversion of Control is a technique that helps you enforce the Single Responsibility Principle: the idea that each class should have one and only one purpose, one (small) thing that it's responsible for — and delegate all the rest. In the specific case of instantiation, it also delegates the construction of objects.
For example, if a class uses a special map that you can, say, load and save to a file, but the main responsibility of the class is to process something doing lookups on the map, you can refactor the map code to a separate class, say, SpecialMap, and leave the original class with the processing code, delegating the lookup to SpecialMap. You would then pass the SpecialMap in the constructor, fully initialized and ready for use. In Java, this is peanuts. In C++, it might be hard work, because all classes have one additional responsibility, namely memory management.
// this doesn't work:
MyObject start(const string& param) {
MyDelegate delegate(param);
MyObject obj(delegate);
obj.start();
// return-by-value, this will copy obj
// into another instance!
return obj;
// delegate gets destructed here!
}
In C++, local variables have local scope, and the default behaviour is pass-by-value. This means that object instances are copied around. In the snippet above, two things might happen:
If the former is true, then a new instance of MyObject will be stored in the variable that calls the function start(), thus copying the delegate object a third time! This is hardly ever what you want.
Side note: Java only has pass-by-value. But Java variables are either primitives or references: there are no object variables nor pointer variables. And that's a pretty good reason to provide garbage collection. In 1994, Java was slow not only in the evolutionary sense.
What people do in C++ is allocate the object from the heap using new and write the constructor to receive a pointer to an object:
class MyObject {
public:
MyObject(MyDelegate* delegate);
~MyObject();
private:
MyDelegate* m_delegate;
};
// Now this works:
MyObject* works(const string& param) {
MyDelegate* delegate = new MyDelegate(param);
MyObject* obj = new MyObject(delegate);
obj->start();
return obj;
}
But who's responsible for the deallocation of these objects? To avoid memory leaks, it must be clear to the clients. Anybody instantiating a MyObject should know right away if it's going to delete the delegate when it's gone. Suddenly everybody is busy with lifecycles, because either:
m_delegate, and thus the instance created by the client must live at least as long as MyObject; orm_delegate in its destructor and the MyDelegate instance created by the client can only be used as long as MyObject is aliveSo much for separation of concerns, right? I never thought that adding inversion of control to code would encourage the use of Evil Singletons.
A little research brought me to this post by Michael Feathers where he explains why building a decent DI framework for C++ is so difficult. Add to that that your own code using DI is nothing trivial and I wonder if we're ever going to see the end of the tunnel here.
In practice (and remember, I have only a few months practice, a little more if you count my graduation years), it's easy do choose what's going to happen: either the two lifecycles are completely intertwined, or the two objects have independent lives and it's pretty easy to know who dies first. Two examples:
Example 1: Your code parses some text and does something else with it, the parsing should be delegated to a separate class. But there's no reason for anyone else to reuse the parser, so you explicitly state (by leaving a comment) that your class deletes the parser when it's destroyed.
Example 2: Your code uses a heavyweight object like a GUI toolkit, connection pool, etc. In general, these big, heavy objects are designed to be used by many different objects and have easily recognizable traits (for example, being thread-safe). So you should explicitly state that you don't delete the object when your class is destroyed.
My conclusion is that it's a tough problem, but usually easy to feel what is the right approach. And your answer will also lead you to consider your own class: is it something that clients will want to use in many different objects, or is it more likely that people who delegate to your class will declare local variables of it and/or cascade delete it? And if you really have to do all this thinking, is a DI framework valuable at all?
P.S.: If the Java world had been forced to think about this issue for every class ever to join the API, maybe the StringBuilder would have come out much, much sooner.
I am currently working on a project involving JSF, Facelets and JPA. I had recently downloaded Eclipse Europa, specifically the JDT and WTP. Unfortunately WTP does not include Facelets support by default, but I had read somewhere that RHDS does, therefore I decided to download it and take it for a spin.
In case you have been living in a cave for the last few years, let me give a very brief introduction to Facelets. By default, JSF uses JSP as its view technology, but allows this default view technology to be replaced by an alternative view technology. Facelets is a very popular alternative view technology for JSF. Facelets are usually written using XHTML. XML name spaces are used for JSF specific components.
The standard XML editor that comes with the Eclipse Web Tools project does not offer autocompletion of JSF components when editing XHTML, but the XHTML editor in RHDS does. In my experience, the editor completion worked as expected, the only problem I found was that RHDS would occasionally freeze. Unfortunately it froze frequently enough that I found myself switching to good old Eclipse Europa when working with artifacts other than Facelets, then switching back to RHDS to get Facelets autocompletion.
By the way, even though JBoss is now a Red Hat product, RHDS does not tie you to JBoss, I am, as a matter of fact, deploying the project I'm developing with RHDS to GlassFish without any difficulty.
I received a tentative date in which my new book, Java EE 5 Development With GlassFish Application Server, will be published. Expect to see it in select online and brick and mortar bookstores on or before September 24th.
It will be available on Amazon, BookPool, Borders, and others. Additionally it is currently available for pre-order directly from Packt Publishing.
The book covers all major Java EE APIs including JSF 1.2, EJB 3, JPA, JAX-WS and more. Additionally, frameworks that build on top of Java EE are covered, including Facelets, Seam and Ajax4jsf
After three and half years, I am finally retiring JVending on sourceforge. Over the years, I have uploaded a number of interesting mobile projects under JVending: a JSR-124 implementation (with P2P content sharing), a J2ME MMS client (JDJ Article), J2ME DRM wrapper, a PPG Client and a registry framework for CDC devices.
I have a newer version of my 2001 J2ME GPS client ( JDJ Article) still sitting on my computer that I never uploaded (this newer version was originally for a client that backed out). I also have a fairly complete implementation of the MMI spec (DRM). A good portion of my life went into these projects, but I haven't done a release in over a year.
Since there is no JVending community, with my schedule I can't justify spending more time on development. Looking back, I can see why building a JVending community was so hard: not many people need to setup their own mobile provisioning server; most don't know what a PPG is (even if they had access); and they certainly aren't going to be interested in adding DRM.
My expectation back in 2004 was that a lot of enterprises would start looking for ways to directly enter the mobile content area and this would be JVending's niche. A lot of enterprises did start entering the mobile content area (I got some good consulting gigs out of it), but eventually these companies found that dealing with carriers was such a pain, they started going through aggregators that had pre-existing relationships with the carriers. It's a carrier's market and carriers aren't going to deploy anything without support of a backing company.
JVending is still the only open-source version of JSR-124 that I know of. It hasn't passed a TCK, but if you are interested in poking around the code to see how it works, download the source; feel free to contact me with any questions.
Three weeks ago I blogged about a "Groovy way" to create XML documents in Java. This article now is about a convenient way to access XML without requiring more than a single class (downloadable here) on top of the JRE's own XML library functions.
In fact I wrote this class before I even looked for an easy way to create XML myself, because at the time I just had to parse some XML and extract the values in an easy to use fashion.
I believe it is easiest to show an example of how to use the class. Consider the following very simple Java class:
import java.math.BigDecimal;
/**
* Simple value object for a contact.
*/
public class Contact {
public String firstname;
public String lastname;
public boolean withAccount;
public Integer numberOfCalls;
public BigDecimal amountDue;
}
Usually the fields would not be public of course, but for the sake of the example, just imagine the getters and setters being there ;-)
Now consider getting an XML string back from an external system that you cannot change:
<representative>
<address>
<street>Somewhere</street>
<city>Over The Rainbow</city>
<details>null</details>
</address>
<personal>
<name>Someone</name>
<firstname>Special</firstname>
<age>55</age>
<acct>true</acct>
</personal>
<supportHistory>
<phone>
<total>14</total>
<x11>5</x11>
<x12>9</x12>
</phone>
<incident>
<id>1</id>
<cost>1.50</cost>
</incident>
<incident>
<id>2</id>
<cost>2.50</cost>
</incident>
<incident>
<id>3</id>
<cost>3.50</cost>
</incident>
<incident>
<id>4</id>
<cost>4.50</cost>
</incident>
</supportHistory>
<current>
<due>44.12</due>
<total>100.88</total>
</current>
</representative>
What's the easiest way to get this into the “Contact” class above, without using persistence frameworks, mapping tools and the like? What about this:
XPathAccessor acc = new XPathAccessor(someXML);
Contact contact = new Contact();
contact.firstname = acc.xp("representative", "personal", "firstname");
contact.lastname = acc.xp("representative", "personal", "name");
contact.withAccount = acc.xpBool("representative", "personal", "acct");
contact.numberOfCalls = acc.xpInt("representative", "supportHistory", "phone", "total");
contact.amountDue = acc.xpBD("representative", "current", "due");
I find this rather straightforward. Of course the Strings should be declared as constants somewhere to prevent typos.
The example is really simple, because we just extract some plain values from the XML. However, you have the full power of XPath at your disposal. This means you could do something like this:
BigDecimal getTotalIncidentCost(String someXML) throws SAXException,
IOException, ParserConfigurationException, XPathExpressionException {
XPathAccessor acc = new XPathAccessor(someXML);
BigDecimal tResult;
Node historyNode = acc.getNode("representative", "supportHistory");
tResult = acc.xpBD(historyNode, "sum(incident/cost)");
return tResult;
}
The XPathAccessor instance could (and should) be reused, of course, depending on how often you need to access the document. As it caches XPath expressions that have already been used, it saves some cycles to re-use it for all accesses to a particular document.
Getting the “historyNode” first is of course not really necessary in this simple case, however sometimes it can come in handy to keep the expressions readable when you need to access deeper parts of the XML.
As with the XElement class, feel free to use this one, too. I would be happy to get feedback and/or improvements.
<bean id="openEntityInView"
class="org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor">
<property name="entityManagerFactory">
<ref local="cep-webEntityManagerFactory" />
</property>
</bean>
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="openEntityInView" />
</list>
</property>
</bean>
Il SimpleFormController per l‘upload di MagicBox si è abbellito con la barra di stato dell‘ upload
Ricetta :
1 SimpleFormController
1 AbstractController
1 JSP
2 Velocity Template
1 Commons Upload Listener
1 prototype script
css a piacimento
La prossima settimana articolo completo + recensione Spring in Action Second edition
Stay Tuned
Earlier this week, the OpenJPA community released OpenJPA version 1.0. The release is available for download at http://openjpa.apache.org/downloads.html. Read the release notes for more details.
I'd like to thank Marc Prud'hommeaux in particular for all his hard work getting the release built and automating a significant amount of the process.
All that happened in a span less than a minute. Just a short San Francisco minute...
This blog entry is a summary of changes I had to implement in order to migrate some EJB3+web services code to the new platform. From the other side of the webservices we have a C# .NET2.0 client. This is not an official reference, and probably few things that I did are the wrong approach. I was trying to minimize changes to the .NET code and try to stay as close to the standards.
NOTE0: I don't have much time to write this summary, so typos and omissions are possible...
NOTE1: The decision to move to JBossWS2.0.1 was almost arbitrary. I switched to the new version because I hoped that some of the stuff that didn't work right away will work in the new version.
NOTE2: When referring to JBoss4.0.4 I collectively refer to all the libraries that ship with it.
The @EJB annotationJBoss 4.0.4 was released with EJB3 support still in beta. Therefore the @EJB annotation was still in the javax.annotation package. In later releases, including JBoss 4.0.5, it has moved to its final destination in the javax.ejb package. The symptoms of missing this step (and deploying code linked with 4.0.4 on 4.2.x server) : Dependency injection simply doesn't work, and all the "injected" fields are nulls.
Missing constructors/settersJBoss 4.0.4 has allowed classes that participate in webservices (as parameters or return values) to omit the default constructor if the class was never to be constructed by the remote side. In the new version, all such classes must have a default constructors. Additionally, JBoss 4.0.4 has recognized such classes as beans even if a setter was missing (again, if the class was constructed on the Java side). Now I found that all setters must be present, or each getter must be annotated with the @XmlElement annotation.
The WebContext and the web context rootIn JBoss4.0.4, the context root of all the webservices was the file name of their common jar file. For example, if our beans were jarred in a beans.jar file, then the context root would be "/beans" and the webservices can be accessed at [localhost:8080] . This behavior has changed in JBoss4.2.1 (that ships with JBossWS1.2.1) and now each webservices class defines its own context root, which by default is the class name. So if you have 5 classes you end up with 5 different context roots. JBoss doesn't like it and will issue an error at deployment time. The solution is to manually add the JBoss-specific @WebContext annotation to each class, like @WebContext(contextRoot="/beans"). JBossws 2.0.1 uses some kind of compatibility mode, in which there is no need to use the special @WebContext annotation, but the default context root has changed to include the name of the EAR file. So if the beans.jar file is put into a demo.ear file, the context root of the webservices will be [127.0.0.1:8080]. In order to override the new default context, it is possible to use a new annotation @org.jboss.wsf.spi.annotation.WebContext(contextRoot="/beans") on just one of the services.
CapitalizationAnother incompatibility is the way in which the parameter classes are named in the WSDL and therefore in the .NET client. For example, if in 4.0.4 I had a webservice that looks like
@Stateless
@WebService
public class TestClass2 {
@WebMethod
public MyClass getMyClass() {
return new MySubClass();
}
}
The "MyClass" identified would appear in the WSDL as "MyClass". In newer versions, it is decapitalized to begin with a lowercase letter: "myClass". It breaks the existing .NET code, so I had to manually add the @XmlType(name="MyClass") annotation to the MyClass definition (and to the few dozens of classes that I used).
Passing webservice method parametersOne of the most significant changed in the new webserives implementation is the way it passes parameters and return value of primitive wrapper types (Integer, Long). Previously, such parameters would be defined in the WSDL as "nillable" and the corresponding .NET definition would represent them as .NET nullable types (e.g, "int?"). In the new webservices library, such parameters are given the maxOccurs="0" attribute in the WSDL and therefore appear in .NET as a pair of "int param" and "bool paramSpecified" fields. I could not find a way to cause the parameters to behave like in 4.0.4, so I had to modify our .NET code. Return values have the same problem - if an Integer is returned from Java, it is split into two fields "returnSpecified" which is true if null is returned and "@return" (yes, the "@" symbol escapes the "return" keyword) that contains the returned value. Last issue (the easiest to spot and fix) - the default argument names (if no @WebParam attribute is used) have change to follow the spec (now they are arg0, arg1, etc).
More JAXB issuesWhen bean classes that are used by the webservices are translated into XML, few incompatibilities arise:
Sometimes a webservice returns a class that has subclasses, as in the following example:
@Stateless
@WebService
public class TestClass2 {
@WebMethod
@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED, use=Use.ENCODED)
public MyClass getMyClass() {
return new MySubClass();
}
}
@XmlType
(name="MyClass")
public class MyClass {
// field+method definitions here
}
@XmlType
(name="MySubClass")
public class MySubClass extends MyClass {
}
In JBoss 4.0.4 there was no problem. The .NET client would correctly receive the MySubClass as a return value. JBoss4.2.1+JBossws2.0.1 send MyClass to the .NET client. The @XmlSeeAlso annotation should hit the web services implementation that a subclass could be involved in the method call. However, simply using the annotation was not enough (.NET would complain about the SOAP message format). In addition to the @XmlSeeAlso(MySubClass.class) annotation on the MyClass class, I also had to add a namespace attribute to the @XmlType annotation.
Duplicate methodsOne of the most bizzare bugs that I've encountered was a case when I had two different @WebService-s in the same package, and both had the same method signature, except the return type:
package demo;
@Stateless
@WebService
public class TestClass1 {
@WebMethod
public long getValue() {
return 5;
}
}
package demo;
@Stateless
@WebService
public class TestClass2 {
@WebMethod
public int getValue() {
return 5;
}
JBoss confuses between the two and both methods will have the same return type in WSDL (e.g, both will return int). I couldn't find a solution, so I just had to rename one of them.
Upgrading to a newer HibernateRecently I discovered what I think is an instance of the EJB-263 bug. Hibernate JPA queries that should return a single result (I used "JOIN FETCH" to fetch some lazy collections) were returning multiple results - in fact if my single element has 100 elemenets in the lazy collection, I would get 100 elements from the query - all of them are the same object instance. To resolve it I had to upgrade to a newer hibernate (I used Hibernate 3.2.5, Hibernate Annotations 3.3.0 and Hibernate EntityManager 3.3.1). Note - during upgrade, you should copy the helper libraries (lib folder) too.
We just released FEST 0.5!
New features:
JList, JTable and JTree. Many thanks to Fabien Barbero for his contribution.
GenericTypeMatcher. The following example shows how to lookup for a JButton that has the text 'OK':
GenericTypeMatcher<JButton> textMatcher = new GenericTypeMatcher<JButton>() {
protected boolean isMatching(JButton button) {
return "OK".equals(button.getText());
}
};
dialog.button(textMatcher).click();
Platform, which contains platform-specific utility methods.
ContainerFixture now recognizes JFileChooserFixture and JListFixture. Many thanks to Fabien Barbero.
You can download FEST here (file fest-swing-0.5.zip.) FEST requires Java SE 5.0 or later.
Here are some useful links:
Feedback is always appreciated
Play. Estimate. Plan...assim diz o título desta ferramenta da Mountain Goat Software (Empresa conhecida pelo pessoal de Scrum). É uma aplicação na web que tem por finalidade simular um Planning Poker para equipes que estão fisicamente distribuídas. Isso por que uma das premissas dos métodos ágeis é a forte comunicação e para equipes que estão cidades/estados/países diferentes isso vai ficando cada vez mais escasso.
Como funsiona a ferramenta:
Uma pessoa é o moderador. Após ela efetuar login ela convida outros participantes para participar do game. Então a pessoa entra com uma estória para ser estimada. O time claro, precisará está numa mesma conferência, onde eles discutirão sobre o a estória. Depois cada participante escolhe um cartão sua estimativa para implementar aquela estória e aí então o moderador escolhe a estimativa para aquela estória.
No canto direito possui um botão de timer de dois minutos que é um tempo razoável para escolher as estimativas. Após isso a decisão pode ser exportada para formatos conhecidos como CSV e PDF (Essa funcionalidade eu não usei)
Acho que esta ferramenta tem muita utilidade em “equipes ágeis” que utilizam o planning poker e não estão localizados numa mesma sala.
Link da ferramenta aqui.
_uacct = “UA-2402321–1”;
urchinTracker();
Currently I'm in the middle of automating the creation of new projects in CVS and CruiseControl. I've found the way to automate the projects in CVS repository using the NetBeans javacvs library. One thing though if we are testing the CVS server installed in our local machine we have to use the LocalConnection class instead of the PServerConnection class.
As for CruiseControl I think if there is no API or web service call then I can just add the configuration into the config.xml and automatically CruiseControl will pick it up.
While we are at it let me rephrase it yet another way - “With GridGain we've taken Saint Exupery's principle quite literally”.
Have fun and enjoy grid computing!
Download GridGain at [www.gridgain.com].
To be able to collaborate well with Turmalix, hosted on the free, open collaboration platform JavaForge, the use of an Integrated Development Environment (IDE), on the desktop site, is more than nice to have. To make it fun working with JavaForge/Codebeamer, you have a choice of free IDE's to be downloaded from the web. The most famous ones are Eclipse and Netbeans.
There are philosophies on which IDE to prefer. I am grateful for all of them. Thanks to our new free open source culture, we seem to be living in paradise. Now we all can afford great software and be part of this adventurous open source circus. It is more like living as an artist than being an engineer. The collaboration in the web is the source for our inspirations and our creativity.
Eclipse is more than a myth: according to wikipedia the term is most often used to describe either a solar eclipse, when the Moon's shadow crosses the Earth's surface, or a lunar eclipse.
Wikipedia also has a perfect introduction to the Eclipse IDE. For developers to collaborate with Turmalix on our collaboration platform, we want to download the free open source software piece at the community site www.eclipse.org.
To explain how to install and set up eclipse would kill this weblog. Voila, it is done for you already: see "The Official Eclipse FAQs".
To be able to connect the IDE to the Turmalix subversion archive on JavaForge, we use the Eclipse plugin called Subclipse. This plugin gives us a simple and well integrated connection between our Windows or Linux desktop / laptop and our collaboration area. For details see 10 Steps - Accessing the Turmalix subversion archive with a client.
InputStream.read would never return less than the full length of the data, right?InputStream is = openStream();
byte[] data = new byte[dataLength];
is.read(data);
Copying a stream of unknown length
If you don't know the length of the stream you are reading, you will need an efficient and dynamic data structure to copy it into. Here's a perfect example:
Unfortunately, the most efficient way to do this in Java is a synchronized, dynamic list structure, byte wrappers, and lots of typecasting. Exception HandlingVector byteVec = new Vector();
byte bRead;
while ( (bRead = inputStream.read()) != -1) {
byteVec.addElement(new Byte(bRead));
}
byte[] data = new byte[byteVec.size()];
for (int i = 0; i < byteVec.size(); i++) {
data[i] = ((Byte)byteVec.elementAt(i)).byteValue();
}
If you ever have trouble with null pointer exceptions, just sprinkle these liberally throughout your code (preferrably lots of times in the same method, where the same variable is likely to be null):
try {
b.doSomething();
} catch (NullPointerException e) {
// ugh, it broke again, just ignore the thing
}
Callers never really want to see that the callee failed.
SummaryYes, these are actual examples from real code. I will not mention the developer by name. You will have to work quite hard to reach these levels... of... well... of something!
A quick follow-up on yesterday's post. After running through my unit tests, it appears that I forgot a basic element of Java usage: order of execution for constructors.
By setting a property to a new object directly in the field definition:
public class MyProperties extends PropertyGroup {
public final StringProperty myString = new StringProperty("default string");
public StringProperty myString2;
public final IntProperty myInt = new IntProperty(10);
public final FooBazProperty myFooBaz = new FooBazProperty("file.txt");
public MyProperties(Properties p) {
super(p);
}
}
that code for constructing the object is executed after the constructor completes. Therefore, if you allow for the class to construct new instances dynamically if the field is null, or if methods need to be called on the fields, it needs to run after all the fields have been initialized. This means that the setup code cannot be in the constructor.
Which makes yet another argument for supplying factory methods. Instead of forcing the user of the class to create a new object then run a setup method, just have the class provide a factory method.
This document discusses the current design of the Crank Validation framework. Specifically it covers the base framework not the specific JSF and Spring MVC bindings nor for that matter does it cover the Ajax/JavaScript support.
The document starts off talking about the Spring MVC and JSF neutral parts of the framework. Later it does discuss the Spring MVC and JSF bindings just enough to understand how the base framework is used.
This document does not cover the Ajax support for calling validation rules, the low level JSF integration, the low level Spring MVC integration, or the JavaScript based rule generation. Perhaps, one day those documents will exist.
Before reading the Crank Validation design doc, it may make sense to see some example code at: [code.google.com],
The Crank Validation design document lives here: [code.google.com].
This is just a snapshot. Please provide feedback if you like, here it is:
Crank Validation Design Document IntroductionThis document discusses the current design of the Crank Validation framework. Specifically it covers the base framework not the specific JSF and Spring MVC bindings.
The document starts off talking about the Spring MVC and JSF neutral parts of the framework. Later it does discusses the Spring MVC and JSF bindings just enough to understand how the base framework is used.
This is not a getting started guide. If you are looking for a programming guide, the closest we have is here. There is also a JSF example validation app and a Spring MVC example validation app.
Overview of Crank ValidationsOne of the main design principles behind Crank Validation is to allow for a rich set of validation metadata that can be read from annotations, property files, and a database.
The data to configure a validation rule is separate from the implementation that consumes it. This allows us to swap implementations of design rules to fit a specific set of business requirements. The swapping of one implementation for another is done primarily with Spring's IoC container, but could easily be done with Guice or some custom IoC/DI container.
This is a feature that we have used extensively to customize validation rules based on client's specific requirements. It is felt by the team that this is a good way to go. We rely heavily on the flexibility that this separation of concern provides.
There is not a one-to-one mapping between Validation Metadata and its corresponding validation rule. This allows us to use composition to write validation rules.
Reading Validation MetadataValidatorMetaDataReader is an extension point for reading validation metadata. There are currently three implementations framework, (and a customer specific implementation that reads the data out of a database for a custom workflow engine) as follows:
UML Class Diagram Showing Validation Framework Readers
We used ChainValidatorMetaDataReader on a project recently to allow validation rules to be written using Annotation, but overridden on a workflow basis, based on validation metadata stored in a relational database.
Field ValidationWhen designing field validation, we first took a long hard look at other frameworks (WebWork?, Tapestry, Apache Commons Validaitions, Spring Modules Validation etc.). None quite fit what we are trying to do and none fit our exact usage. That said, the FieldValidation framework relies heavily on the architecture and design of WebWork? validation and Tapestry validations (mostly WebWork?). It was inspired the most by those two frameworks. It adds the concept of composition validations. Out of the box it comes with many, many validation rules. One reason it has so many is because it leans on the DI container (Spring but could be Guice) and the composition pattern so you can configure many validation rules without writing code for each.
The heart of the Field validation framework is the FieldValidation interface and the AbstractValidator classes. The CompositeValidator implements the composition design pattern and let's you configure many validation rules out of other validation rules. There are several rules that simplify working with regular expressions as well. Notice also the CommonBridgeValidator is a bridge to the Apache commons validation framework. You could easily write other bridges, thus allowing you favorite validation framework to use our flexible validation-metadata readers and support for Ajax and JavaScript?. Please read the comments in the UML diagram as follows:
UML Class Diagram Showing Field ValidationNotice that the validation annotations are not mapped one to one with the number of validation classes.
UML Class Diagram Showing Validation AnnotationsResolving Error Messages
The ValidatorMessage holds the detail and summary message for validation errors. A FieldValidator can produce many ValidatorMessages and returns them via the ValidatorMessageHolder (ValidatorMessageHolder? validate(Object fieldValue, String fieldLabel)). A ValidatorMessageHolder can be either a ValidatorMessages which is a group of ValidationMessages or a ValidationMessage which is a single ValidationMessage illustrated in UML as follows:
UML Class Diagram Showing Validation AnnotationsA FieldValidator produces ValidationMessage. Generally classes that implement FieldValidator produces ValidationMessage by using a MessageSpecification. To simplify configuration, an AbstractValidator is a MessageSpecification (it started off having a MessageSpecification but seemed to suffer from having too many fine grained objects which made it difficult to configure in the Spring application context so for simplification we combined the concepts). Most FieldValidator are subclasses of AbstractValidator.
The MessageSpecification contains information about how to generate a message. The MessageSpecification knows how to create a message. The MessageSpecification will look up the message in the resource bundle if it starts with a "{" (called the I18n Marker).
The MessageSpecification uses ResourceBundleLocator to locate a ResourceBundle. How a ResourceBundle gets located varies for JSF, Spring and our internal custom work flow engine. This allows us to change how a ResourceBundle gets located. On a recent project, we had to back our ResourceBundle with a database and this extention point helped us.
The MessageSpecification specifies both a detailMessage and a summaryMessage specification.
If the message starts with an I18n Marker ({), MessageSpecification generates the key for the ResourceBundle. The key is the message with the curly brackets pulled off (the '{' and '}' removed). MessageSpecification then looks up message in the ResourceBundle using subject and the key, i.e., subject.key. If the subject.key is not found in the ResourceBundle then the MessageSpecification looks up the message just using the key. If the message key is still not found, MessageSpecification just returns the key as the message.
MessageSpecification does the above for both detailMessage and summaryMessage.
In the case of FieldValidators the subject is the name of the field.
This is more clear with an example as follows: If the field is called firstName and the validator is called required. First the message key firstName.validator.required is looked up and then if the message is not found then the message key validator.required is looked up.
If the message does not start with the I18n markers then the MessageSpecification checks to see if the message has a '.' in it. If the message has a dot, MessageSpecification try to look it up using the same technique as before.
If neither the I18n marker at the start of the message is found or a dot is found in the message, then the key becomes the message.
The arguments for a MessageSpecification can be passed at runtime or configured in the application context (or the equivalent in Guice). If arguments are not passed at runtime, MessageSpecification checks to if there were arguments configured. If neither arguments are found, it generates an empty argument list. The dynamic args are used to pass for example the actual configured length for LengthValidator.
The argument list that is created is not the final argument list. If the subject is not null, a new argument list is created and the subject's label is the first argument (for FieldValidators? remember the subject is the field name), followed by the rest of the arguments in the list. The subject label is looked up in the ResourceBundle and if it not found it is converted from a field name to a human readable name, e.g., if firstName is not found in the ResourceBundle it is automatically converted to First Name. (It gets converted with MessageUtils?.getLabel(getSubject(), resourceBundleLocator.getBundle()));)) Lastly, the arguments are applied to the message to produce the I18n enabled message (MessageFormat?.format(message, argumentList.toArray())).
The following is illustrated with an activity diagram:
UML Activity Diagram Showing Resolving Error MessagesValidation Metadata: Locating validation rules, Copying rule data from validation metadata to FieldValidation rules
![]()
The heart of the JSF integration is the JSFBridgeMetaDataDrivenValidator. The heart of the Spring MVC integration is the SpringMVCBridgeMetaDataDrivenValidator.
There are some key differences JSFBridgeMetaDataDrivenValidator works primarily with parsing EL expressions to find the object (field) and its parent (typically a domain object). While the SpringMVCBridgeMetaDataDrivenValidator focuses on walking the object/property tree (given spring MVC property bindings) and figuring out the object (field) and parent (typically the commandObject in Spring speak). Once they have the information they need, they then process the information the same way. Below is a general high level flow (with some of the details of JSF and Spring MVC left out for brevity). Also some caching was enabled to reduce creation of objects (this was left out of this discussion for clarity).
UML Activity Diagram Showing Validation Rule lookup
Additional notes on the above diagram:
The CompositeValidators can be cached so it is not looked up each time. The objects looked up in the ObjectRegistry (backed by Spring or Guice) are prototype scope not singletons (thus the need for caching, and the reason there is no issues with copying the data). In step one, we use the ValidatorMetaDataReader which was described earlier so the validation metadata can be based on annotations, property files, or database entries (or combinations of the above or some other mechanism), read the Reading Validation Metadata for more background on this.
Well, it is time to announce another update to the project creator utility.
This latest project-creator jar can be found HERE.
It now supports the creation of projects for intellij as well as eclipse... Hooray!

The change for all scripts is the use of -gigaHome in place of -gigaHomeVar
The option for intellij is -intellij (in place of the still available -eclipse)
Here follows some example scripts for the creation of OpenSpaces projects :
rem ......
......
......
___________________________________________
NOTIFYCONTAINER_INTELLIJ (listener)
___________________________________________
rem Intellij Version
rem This script starts the projectCreator so as to create a PU containing a NotifyContainer – a SpringBean with a default method that gets invoked when a matching object appears or is modified in the space. Note this is good for a listener (a take is not performed as part of the NotifyContainer operation) and could be implemented with either a remote or embedded space.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -intellij -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc_notifyContainer -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
NOTIFYCONTAINER_ECLIPSE (listener)
___________________________________________
rem Eclipse Version
rem This script starts the projectCreator so as to create a PU containing a NotifyContainer – a SpringBean with a default method that gets invoked when a matching object appears or is modified in the space. Note this is good for a listener (a take is not performed as part of the NotifyContainer operation) and could be implemented with either a remote or embedded space.
rem In addition: This script specifies that the classpath in the eclipse project uses a GS_HOME variable in the same way the examples that come with the product do – this makes for a more portable project. Note that the build.xml file created as part of the project will still use an explicit path and will need to be edited if the project is used in a new environment and the ant tasks are invoked.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -eclipse -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc_notifyContainer -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
POLLINGCONTAINER_INTELLIJ (worker)
___________________________________________
rem Intellij Version
rem This script starts the projectCreator so as to create a PU containing a PollingContainer – a SpringBean with a default method that gets invoked when a matching object appears or is modified in the space. Note this is good for a worker and usually means you will elect to have an embedded space.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -intellij -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
POLLINGCONTAINER_ECLIPSE (worker)
___________________________________________
rem Eclipse Version
rem This script starts the projectCreator so as to create a PU containing a PollingContainer – a SpringBean with a default method that gets invoked when a matching object appears or is modified in the space. Note this is good for a worker and usually means you will elect to have an embedded space.
rem In addition: This script specifies that the classpath in the eclipse project uses a GS_HOME variable in the same way the examples that come with the product do – this makes for a more portable project. Note that the build.xml file created as part of the project will still use an explicit path and will need to be edited if the project is used in a new environment and the ant tasks are invoked.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -eclipse -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc -setPUTemplateName pu.xmlsrc -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
TIMERTASK_INTELLIJ (publisher)
___________________________________________
rem Intellij Version
rem This script starts the projectCreator so as to create a PU containing a TimerTask – a SpringBean that gets invoked over and over again by a Timer. Configure how often to do this in the PU.xml Note this is good for a feed or driver and usually means you will elect to have a remote space.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -intellij -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc_timerTask -setPUTemplateName pu.xmlsrc_timerTask -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
TIMERTASK_ECLIPSE (publisher)
___________________________________________
rem Eclipse Version
rem This script starts the projectCreator so as to create a PU containing a TimerTask – a SpringBean that gets invoked over and over again by a Timer. Configure how often to do this in the PU.xml Note this is good for a feed or driver and usually means you will elect to have a remote space.
rem In addition: This script specifies that the classpath in the eclipse project uses a GS_HOME variable in the same way the examples that come with the product do – this makes for a more portable project. Note that the build.xml file created as part of the project will still use an explicit path and will need to be edited if the project is used in a new environment and the ant tasks are invoked.
set JAVA_HOME=c:javajdk1.5.0_07
call %JAVA_HOME%binjava -jar project-creator.jar -eclipse -overwrite -project test -out C:tmpprojectcreator -setServiceTemplateName service.javasrc_timerTask -setPUTemplateName pu.xmlsrc_timerTask -gigaHome c:GigaSpacesXAP6.0
rem ##end of script##
___________________________________________
I have one experienced app developer position on my team to fill as soon as possible. It's a 3 month contract, with a view towards permanent employment.
The job will entail Ruby on Rails and Javascript programming. Good web design and CSS skills are a plus. I have to admit though, that we're more interested in finding the right personality fit, so aptitude and enthusiasm are more important than anything else. In fact, I will personally train and mentor the right candidate. (Hey, it's a tight job market.)
The Gig
We are well-funded by an established company, and working on cutting-edge Web 2.0 stuff. Right now our unlaunched social network (citycliq.com) is our main focus, but we also help out with teamgaia.com. We also have a bunch of fun projects in the pipeline.
The People
You will be joining a tight-knit team, consisting of me (Obie) and
Given the type of work we do, you shouldn't bother applying unless you're really into blogging and social networks.
The Location
We are based in beautiful Atlantic Beach, Florida (near Jacksonville.) You must be willing to live here or travel here during the week, at least until we get to know each other and are comfortable with alternative arrangements. Travel accommodations and expenses during that time are negotiable.
Other than that, did I mention we're across the street from the beach? We do boat outings on a regular basis and it's not unusual for us to go swimming (or even surfing) during lunchtime. Also, we have really comfortable backup accomodations in Asheville, NC if a hurricane were to come our way.
Contact
Hit me up via email at obiefernandez on gmail if you or someone you know is interested or wants more information. Thanks!
Update: Thanks to everyone who responded and sent resumes. (Actually got a lot more than expected!) We found a couple of promising candidates and are moving forward with them. At this point, you should only contact us if you know Rails and live in the Jacksonville area, mainly so we're aware of you and can give you an early heads up if we're hiring again.
Dear Reader
Here are the video presentation for the Birds-of-a-Feather sessions.
Presentation 1: BOF 27 Spring Extensions for Large, Complex and Evolving Applications with Phil ZoioPresentation 3: BOF 28 Introduction to the Wicket Framework Part 1
With Cemal Bayramoglu, Matt Dudbridge and Alastair Maw
Presentation 4: BOF 28 Introduction to the Wicket Framework Part 2With Cemal Bayramoglu, Matt Dudbridge and Alastair Maw
Presentation Slides Available (Zoomf)
Remember we have a Special BOF: Whither Java on the Web at the NFJS eXchange on Thursday 30th August at London Marriot Hotel from 8:45pm - 9:30pm. This is a free event, but obviously the conference is not free. However, attendees of the BOFs are also welcomed to the after-party!
This is Peter Pilgrim. Out
Seguem oportunidades de trabalho na Summa-Tech / São Paulo.
Envie seu currículo para a Thais:
Estágio
Curso:
Requisitos Técnicos:
Mandatório:
Desenvolvedor Junior
Experiência:
Recém-formado:
Requisitos Técnicos:
Desejável:
Diferencial:
Desenvolvedor Pleno
Experiência:
Formação:
Requisitos Técnicos:
Desejável:
Idiomas:
ESB-oriented architecture: The wrong approach to adopting SOA
Great piece, from -- wait for it -- IBM. Ba-da-dum. Almost as astonishing as if somebody from CSC had said something negative about ESB. via:davelinthicum, via:radovanjanecek
It has been said that primary function of a compiler is to expose all of the errors in your otherwise beautiful code. And the purpose of a user is to find all of the bugs in the otherwise flawless code. Likewise, there's nothing more effective in helping find errata in a book than to send it to the printers and unleash it on the masses.
Despite the fact that Spring in Action, 2E went through a rigorous editing cycle and two different tech reviewers, some things still slip through the cracks. Today I've been informed of one such problem and wanted to post the fix for it here so that everyone can see.
Listing 1.9 shows the use of an XmlBeanFactory to load the beans from the knight example. That's fine and it works for everything up until that point. That's because the example up through Listing 1.9 only shows basic dependency injection. But in section 1.4, that changes and we start applying aspects to the example. Unfortunately a bean factory isn't sufficient for AOP; an application context is needed. Even more unfortunate, I failed to make the switch to an application context before going into the AOP examples.
To remedy the situation, I've submitted to Manning the following change to the "Seeing it work" section on page 21:
Seeing it work
In a Spring application, a bean factory loads the bean definitions and wires the beans together. We've already seen an example of how to load a Spring bean factory using XmlBeanFactory in Listing 1.4. We could use the same technique to load the beans for our knight example. But coming up in section 1.4, we're going to apply aspects to the knight example and a BeanFactory just won't do for AOP. So instead, listing 1.9 loads our knightly beans using a Spring application context.
Listing 1.9 Running the knight example*package com.springinaction.chapter01.knight; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class KnightApp { public static void main(String[] args) throws Exception { ApplicationContext ctx = new ClassPathXmlApplicationContext( "com/springinaction/chapter01/knight/knight.xml"); Knight knight = (Knight) ctx.getBean("knight"); knight.embarkOnQuest(); } }An application context is the bean factory's much more powerful cousin. We'll take a closer look at how an application context compares to a bean factory in section 2.1.2. But for the the purposes of the knight example, suffice it to say that an application context is just another way to load bean definitions into Spring. In this case, I chose to use a ClasspathXmlApplicationContext to load the bean definitions from the root of the application's classpath.
Once the application has a reference to the Knight object, it simply calls the embarkOnQuest() method to kick off the knight's adventure. Notice that this class knows nothing about the quest the knight will take. Again, the only thing that knows which type of quest will be given to the knight is the knight.xml file.
It’s been a lot of fun sending knights on quests using dependency injection, but now let’s see how you can use DI in your real-world enterprise applications.
Of course, it's too late for those printed copies out there, but hopefully publishing it here and on the book's errata page will help clear up the confusion. Again, sorry for any confusion this may have caused.
At last, I submited a newest grammar to ObjectNotation(ON)project page
(on.dev.java.net).
Add a simple document about ON grammar guide, why simple? because ON is
simple
alt=title=":)" />
At this time, the parse works fine and grammar more clean than privious
version.
But there is a problem, now just only use parse result and antlr
CommonTree to iterator. there need an object tree to do thing easily.
but I have no good idea for give this now.
Hi folks
I decided to publish the simple pageflow project on my personal website. You can finde more information about setup and usage in your own project here SPF.pdf and a sample NetBeans 6.0 project with everything you need here SPF.zip. Note the code is not open source and therefore copyrighted by me. If one is interested in using the code in his own project please let me know. If there is enough feedback I will open source the whole project.
The documentation says nothing about custom extensions. Well it is possible to:
I was born in Bassano del Grappa (Italy) where my family still lives, while my studies and work brought me to live over the past years first in Padova and more recently in Milano.
Like the ancient tradition of the Venetian sailors and explorers, since young age I've always been interested in travelling, especially abroad. This lead me to start new challenge in Netherlands in April '07.
What I strive for
Basicaly my work consist in simplyfing the process, by making them automatic and easy to manage.
Sharing solutions with team and providing an appreciative inquiry in system development. It's a process of elaboration, discovery. It's really rewarding and it gives a good feeling when the team work it successful.
I'm a professional java senior software architect with a track record of delivery solutions for banking, telco, social network industry. I put emphasys on creating systems applying software patterns and proved technical designs.
You may look at Linkedin profile, and give a glance at my curriculum
Yes it does! When writing the code for the newest version of the "Eclipse on Swing" (EOS) plug-in I also planned to support OS/2 -- meaning download Eclipse 3.2.2, install EOS and you are all set. This was supposed to work in theory but not having OS/2 available I never confirmed it in practice.
Luckily with the help of Jürgen Ulbts who is running eComStation 2.0 RC1, we now know more -- EOS works out of the box on OS/2. Here are a few of the screenshots he sent me showing "Eclipse on Swing" with the Lipstik- and the Jgoodies Plastic Look and Feel.
Lipstik Look and Feel

JGoodies Plastic Look and Feel
Pretty neat, isn't it. In case you run OS/2 and got curious visit the EOS website to find out more.
Genuitec's MyEclipse 6.0, offers advanced features and integration for Spring and Java Persistence Architecture (JPA) development. According to the company this release revolutionizes developer productivity by greatly enhancing the Eclipse 3.3/Europa platform, adding components of Java 6 support and redefining AJAX productivity. Additionally, MyEclipse 6.0 now offers advanced features and integration for Spring and Java Persistence Architecture (JPA) development. This integration is aimed at allowing users to create entity managers and transaction manager beans, generate entities and DOA and much more through the cross-capabilities bridge created by MyEclipse.
The MyEclipse plugin set allows users to create entity managers and transaction manager beans, generate entities and DOA and much more through the cross-capabilities bridge created by MyEclipse. "I am extremely proud of the current MyEclipse release,” said Wayne Parrott, vice president of development for Genuitec. “MyEclipse customers will find that we are addressing many of the common ailments we see in today's environments and delivering a highly-productive, highly-customizable and user-friendly experience."
MyEclipse 6.0 includes the following enhancements over previous releases:
* Platform and Installation Support: Eclipse 3.3/Europa 1.0 compatible, Java 5 & Java 6 support, Windows (XP, Vista), Linux, Mac
* Java EE 5 & Spring Feature Improvements : EJB3 improved project flexibility, bean generation from DB schema
* JPA: (1)Project actions to generate Entities and DAOs from DB schema (2)Automatically maintains entity classes in persistence.xml (3)Improved JPA project capabilities configuration
* Spring 2.0 upgrade with enhanced configuration and management
* Advanced Spring-JPA Integration
* Hibernate upgrade
MyEclipse 6.0 is available immediately via download. The Standard Edition annual subscription is priced at USD 29.95 and the Professional Edition annual subscription is priced at USD 49.95.
| REF, SDA INDIA - ECLIPSE MAGAZINE | ![]() |
|
I recently needed to develop a maven build for RAD, which operates entirely on it's own peculiar sense of project structure. The online resources to pull this together were surprising difficult to locate, probably because I was googling things like 'maven alternate project structure' and 'maven for rad', and 'maven rad project layout' - provided no useful info. I understand now that the key, really, has to do with the fact that to accomplish this we are tapping into the maven war plug-in, and modifying its default behavior by using location specifiers in its markup. The war plug-in isn't even referenced in a 'standard' build, using the default maven project structure. It could well be the case that RAD's layout is standard in some way I am unaware of, but having used just about every IDE out there...haven't seen it before. The only somewhat 'normal' part is the WebContent folder - but I still prefer Maven's src/main/webapp. Thus this blog entry. This project has several components, the two key ones being a library of classes containing daos and services, and the other containing the webapp, which relies upon the library.
RAD project layout is it's own thing, as follows: /com.etc /com.etc /etc
Primary reference url:
[maven.apache.org] Which of course means you will need to maven compilebefore you maven package The below is from the web POM, which is nearly identical to the lib POM as regards the source/test location definitions. <build>
|
Turmalix is an open source project visible to the public. This means that the project can be viewed by anybody and be searched by the public search engines like Google, MSN, Yahoo and others. I myself like to use Google to even search my own websites.
When planning a security system for a project on JavaForge it is a good idea to start at what you want to be visible for anonymous users. Codebeamer, the underlying collaboration platform tool, offers a very elegant administration system for project security. Roles are defined and assigned to ressources and access rights. One special concept is the anonymous role. This role defines which documents, ressources and artifacts are accessible without a password and thus be accessible by the bots collecting pages for search engines.
For Turmalix the documents and wiki are visible by anonymous users.
The subversion archive and trackers are not be visible. For these you will need to get public member of the project: see Getting Member of Turmalix" target="_top" href="http://www.javaforge.com/proj/wiki/displayPage.do?doc_id=36181"> 10 Steps Getting Member of Turmalix
CodeBeamer has the function to automatically assign a role to new members of a project. Members of Turmalix automatically can view the full spectrum, download artifacts and builds aswell as contributing to the wiki.
I love the Internet, because you can always find someone out there who is feeling the same way you are about something.
It turns out I don't hate programming, I just hate programming in Java.
Russell Beattie is a voice I haven't read in a while; I think the last time I gave his blog a look-see was about the time he decided not to work for Google. (I suck at those puzzles too, by the way.) Now he's posted a long message about why the ticker symbol for Sun shouldn't be JAVA, but COBOL: Java needs an overhaul.
I have been toying with recovering an old project of mine. It was a Automated Link Verification engine called, "Java ALiVe!". I thought that it might be interesting to search for the term to see if a lot of the links were still there. They were, but what was more surprising to me was this. I'm not sure if he had heard about the previous project before coming up with that name or not. Really strange seeing that online, though. Anyway, it appears to be dead and never released.
Hopefully I'll make some progress in getting my old code back together and up fairly soon. Considering that it was my first real Java application, and that it started with Java 1.0, it really isn't in all that bad of a shape.
Here's an archive of the old project's homepage. A few of the screenshots were even still there. This was cutting edge stuff, that even worked on OS/2 Warp! 
Ok, so some of the code is garbage, and the old 1.0 AWT event model was awful, but its still not as bad as I thought it would be.
Corny, but there's some truth to this. 
Developing robust web applications has never been easy. Usually developers don't really care about page flow and in most cases it doesn't harm the system if a user bookmars a page.
Let's assume your users bookmark the preview page. When he enters this URL directly in the browser your application should behave correctly and notice the wrong order of URL calls in your workflow. If the application doesn't do such checks the application might behave strange: Maybe the users clicks the "Save" button of your form, what happens if you didn't add any checks at all? ;-)
I started working on a small pageflow engine for Java. It's really easy to use, although it's not finished yet. The basic idea is to use some kind of state machine to control the page flow.
Let's look at some sample configuration:
<page-flow>
<entry-views>
<entry-view>
/index.jsp
</entry-view>
</entry-views>
<exclusions>
<exclude-pattern>
.*.gif
</exclude-pattern>
</exclusions>
<rule>
<from-view>
/index.jsp
</from-view>
<to-rule>
<to-view>
/second.jsp
</to-view>
</to-rule>
</rule>
</page-flow>
I think the configuration is self explaning. You can define rules like in JSF, but they are checked. So in this sample configuration the user is only allowed to request any images (.*.gif) and the page index.jsp. If he tries to access second.jsp directly he will be informed by an ugly exception that he should not bypass workflow steps ;-).
But sometimes more complex rules are necessary. It might be allowed to navigate from the "search" page to the "save search" if a certain attribute is in the current user's session like the last search result. For this I extended the rules with conditions:
<rule>
<from-view>
/search.jsp
</from-view>
<to-rule>
<to-view>
/saveSearchResult.jsp
</to-view>
<attribute-condition>
<attribute>searchResult</attribute>
<scope>session</scope>
</attribute-condition>
</to-rule>
</rule>
The engine not only checks if the view is allowed by the workflow but also if none of the condition checks fail! It is possible to create your own conditions by implementing the Condition interface. My intention was that the installation is very easy and you can get started very quickly. The only thing you need to do is to register a filter and creating a simple pageflow.xml file in your WEB-INF directory.
I googled around a while but didn't find an easy solution for pageflow. Does anyone know one that does more or less the same or even more? If not I will probably create a small open source project. Is anyone interested in such a thing, let me know?
Albert Einstein observed, "The significant problems we face cannot be solved at the same level of thinking we were at when we created them."
Developing software with an open source software community is an agile software development process by nature.
The following abstract from the Manifesto for Agile Software Development holds for the Turmalix project:
This paradigms give us an idea of what job our project collaboration platform has to do for us to enable a civilized development process. Our assumption is that we cannot achieve a defined process control to keep the software development on a high level of quality. The only way we can prevent the project from falling into chaos is by means of structure. Structure defines borders along which processes flow. We need to build on self-regulating mechanisms and provide the structures and tools to allow those to function.
Turmalix has a high degree of complexity right from the start. It is build on a stack of other open source projects. Turmalix itself consists of many subprojects right from the beginning. So there is no silver bullet method on how to structure the project. The method of choice here is to start of with a model, to learn and to adapt. We start with a structure that represents our knowledge on how Turmalix should be organized best at this point in time. When we learn more and do know better at a later point in time, than we adapt the structure.
The structure of the project is visible to everybody involved. Suggestions for improvement have to find their place on the platform.
The folks at InfoQ just posted my interview about OpenJPA with Floyd Marinescu from The Spring Experience last year. As ever, they've done a great job of editing things to make me sound vaguely coherent. Thanks, guys!
First steps to get going on JavaForge.com went well. Adding the new project to the system is done by just one mouseclick. The project is up and ready to be moved in.
JavaForge is open to everybody. There is no permission required by the JavaForge system administrator. Once you have registred your project it is ready for you to get going.
I define the projects startpage by putting a description of the project to the main wiki page. On JavaForge an easy to use wiki markup system makes it easy to edit, format and categorize information and documentation pages.
JavaForge offers a choice of version management tools to be used for the source code repository. My decision to use a subversion archive for the source code of Turmalix is easy, since the source code right now sticks in a subversion archive already. Defining the repository is quick and it can be found on the source code tab.
The overwhelming number of functions that I can configure on JavaForge is impressing me. I realize that it is necessary to have a strategy first, on how to find a smart configuration, for all components. I want to customize the collaboration platform for Turmalix in such a way that it can fulfill and represent the needs of the team at its best.
JavaForge.com is powered by the collaboration platform CodeBeamer by Intland GmbH. I have to read the CodeBeamer Users Guide before I can go on designing the projects home.
I thought the Action ID was interesting...and I can't believe they finally got around to allowing you to pass multiple params to the html:link tag. (Dynamic Link Parameters).
Does this mean the end of UrlUtils?
alt=title=":)" />
I can blame Terracota folks themselves because their product offering is rather confusing and you constantly have to read between the lines. I challenge you to go to their website and within 1 minute tell me what their products do…
Based on Ari’s reply I kind of agree with him that it’s just wrong to compare Terracota with GridGain (or GigaSpaces or Coherence for that matter). Terracota is not a grid computing technology and it’s pretty far away from it. Terracota is a VM clusterization technology, basically, providing virtual heap and distributed thread synchronization done via byte-code augmentation. This is a far cry from anything close to grid computing products and it is rather a technology that can be potentially USED TO DEVELOP products like GridGain - not a functional replacement for it.
This is an important distinction because marketing messages and positioning can be sometime confusing and blur the lines, often on purpose. This is not in any means to say that Terracota is particularly bad product – but it is a low level middleware while GridGain is a higher level grid computing product.
I’ve said almost two years ago that Terracota seems like Azul’s technology implemented on software level. I still don’t get the value proposition of such trickery with Java semantics and whole-sales distribution of data... 1st rule of distributed programming is "Don’t Distribute".
Terracota guys are rigorously working through $13.5M they have gotten year or so ago and they are making every bit of effort to fix the perception about their technology which is in my opinion a “Look, Ma, no hands!” kind of product.
You can download GridGain at [www.gridgain.com]
You can download Terracota at [www.terracotta.org]
Overcoming early challenges faced when deploying simple Processing Units (PUs).
I was demoing again last night and was eager to show off the simple path to enjoyoying the cool capabilities of the GigaSpaces platform.
I whipped up a new couple of projects using the project-creator and ran them in the IDE (Eclipse) in a matter of minutes. All good.
What I soon realized, was the GigaSpaces proxy was struggling to write the Message object created because the Message object looked like this:
Message.java
package com.test.common;public class Message {
/* Your code goes here */
}
package com.test.common;public class Message {
private String content;public void setContent(String content) {
this.content = content;
}public String getContent() {
return content;
}}
package com.test;import org.openspaces.events.adapter.SpaceDataEvent;
import org.openspaces.core.GigaSpace;
import com.test.common.*;
import java.util.TimerTask;/**
* A simple bean that is run within a Spring context that acts
* as the processing unit context as well (when executed within a
* processing unit container).
*
* <p>This bean is designed to be invoked repeatedly by a TaskTimer
*
* <p>The TaskTimer and its factory are specified in the pu.xml
*/
public class MyService extends TimerTask{
GigaSpace space = null;
/**
* This method is called whenever run is called by the TaskTimer
*/
public void execute(){
if(space!=null){
Message obj = new Message();
obj.setContent("anything will do "+System.currentTimeMillis()+
" to create variant Strings - encouraging routing");
space.write(obj);
System.out.println(this.getClass().getName()+" Wrote Message "+obj);
}
}/**
* Here we have injection of the space as part of the constructor
*
* param in The GigaSpace to work with
*/
public MyService(GigaSpace in) {
System.out.println("I am being constructed with "+in);
this.space = in;
}/**
* This method will be invoked repeatedly by the TaskTimer
*/
public void run() {
//System.out.println("run called...");
execute();
}}
Owen.
JavaLobby: Sun Changes Ticker Symbol To JAVA. Good Move? Or Bad News For The JCP?
TheServerSide: No Fluff Just Stuff fees paid by your boss - why?
Acegi : "LDAP Support: Do you have an LDAP directory? Acegi Security can happily authenticate against it." and From Java EE security to Acegi : The right way to protect your Web applications
TheServerSide : Interface21 announces Spring Web Services 1.0
del.icio.us : Hibernate Mapping Cheat Sheet
del.icio.us: Extreme Hibernate Performance - Delivered
OpenLaszlo : Cool Flash for Clunky Java people
Digg: Screw Javascript - Use CSS to create a lightbox effect
Facebook at Work - Slacking or Networking? or Techdirt: Latest Bogus Report Blames Facebook For Productivity Loss
"Emotions Connect People"
No software project without a context and vision. The Turmalix project is devoted to people and their self-care. Turmalix is a collection of software components and applications that support us, as human beings, to get to know our self. Often we know more on our neighbors or on the celebrity of our beloved tv show than we do know on our selves. Turmalix supplies software components and applications that help us to increase our self-awareness. With these software components we are able to assemble applications, websites or mash-ups that serve as mirrors for our soules.
Turmalix supplies an open source software framework written in Java to cover all technical basics like member management, publishing and internationalization. On top of this framework algorithms are implemented that span themes to challenge minds and emotions. Some examples are questionaires, mindboggling, numerology and astrology. Ideas for new algorithms and themes will be continuous.
Emotions are the language of the soul. Our facial expressions are revealing our feelings. Scientists like Paul Ekman found that these are the same for all cultures. Facial expressions for emotions like fear or happiness are the same in asiatic, european and african cultures as they are in isolated cultures like New Guinea. Turmalix connects people, no matter what language they speak or which cultural background they come from. Committers from all over the world are invited to do localization into their language and use the software as part of their websites.
Amazing, new news, and the worst branding and trademark implementation ever, started. SUNW will become JAVA next week, CMIIW.
this make our island Java become part of NASDAQ, amazing. with marketing budget, i think in the future we will forgot where is Java, in NASDAQ or in Indonesia.
I just curious, will another island in the earth, or may be earth also become part of Dow Jones and NASDAQ.
let's trade the virtual island, because here, in Indonesia, to buy an island is hard, except the thousand island, in north of jakarta. No one can buy the island here.
We are migrating our Meruvian.com services that using Liferay 4.1 to 4.3, amazing, we cannot migrate it, and we have to recreate all the structure.
This is because we move to multidomain implementation for meruvian.com, blueoxygen.org, meruvian.org and our newest services merveos.com
Another thing is also because the CMS now splitted from Liferay default bundle.
we move to 4.3 because the multidomain in 4.1 is buggy
I love Wicket, and I love RSS so it's only logical that I'd find a way to serve up RSS within Wicket. There's an example RssPage posted on the Wicket wiki, and I posted a simple RSS solution a while back, but neither of these are really solid solutions. For the past few weeks I've been working heavily with serving RSS feeds, and I've finally gotten to a point where I can provide something back to the Wicket community.
Introducing, the new and improved Wicket FeedPage. It's actually the same API as my previous solution, but the inner workings are much improved. To create an RSS feed, just create a subclass of FeedPage and follow the ROME API to create a SyndFeed for your RSS (or Atom) content.
public class ItemFeedPage extends FeedPage {
protected SyndFeed getFeed() {
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("rss_2.0");
feed.setTitle("Sample Feed");
feed.setLink("http://mysite.com");
feed.setDescription("Sample Feed for how cool Wicket is");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
SyndEntry entry = new SyndEntryImpl();
entry.setTitle("Article One");
entry.setLink("http://mysite.com/article/one");
entry.setPublishedDate(new Date());
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("Article descriping how cool wicket is.");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries);
return feed;
}
}
The ROME library has really impressed me and does an excellent job of hiding the internals of creating these feeds. Want to change from RSS to Atom? Simple! Just change this line:
feed.setFeedType("rss_2.0");
to this
feed.setFeedType("atom_0.3");
As Borat would say..."Very Nice!"
I've created a new Wicket Stuff project to host this project which should make it super easy to get up and going. Just add this block to your pom.xml file:
<repositories>
<repository>
<id>wicket-stuff-repository</id>
<name>Wicket-Stuff Repository</name>
<url>http://www.wicketstuff.org/maven/repository/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-rome</artifactId>
<version>1.3-SNAPSHOT</version>
</dependency>
</dependencies>
As a side note, if you're having difficulty creating a dynamic url for use in your feed (guid, return url, etc) vote for this Wicket issue to help create a new API for that info.
)
Laurence Tratt has a new blogpost in which he attempts to demystify compiler writing. It's a great read:
"Recently I was discussing Converge with someone, and mentioned how little time the core compiler had taken to implement (no compile-time meta-programming, limited error checking, but a functioning compiler nonetheless) - only a few days. The chap I was talking to looked at me and told me that he didn't believe me. I laughed. Actually, he really didn't believe me. Initially that surprised me, and I wondered why he might think that I was pulling his leg. But then I thought back, and only a few years ago I would probably have had the same reaction. This article is my attempt to explain his reaction, and why it's no longer the case."
Laurence is the originator of the Converge language. Apparently it's like Python with Lisp style macros. I've been following his blog for some time, he has interesting and insightful things to say about programming languages.
I'd like to underline text programmatically in a JFormattedTextField without using HTML or drawLine() on JDK 1.4.2. Can anyone figure out how?
Please note that this bug prevents me from simply installing a TextAttribute.UNDERLINE value.
Finding a home for an open source project seems like looking for a family house to live in:
This is all about people and their needs to communicate. It is about their wishes to be expressed and fulfilled.
We want to facilitate interaction between the members and guests of the project by using tools supported by a public server on the internet. Tools for bug tracking, issue tracking, project management, forums, mailing-list, version control, wiki and blogs are available to us as open source software.
The options are building our home by ourself or moving into premises that are looked after by a landlord.
The sites that fulfill the landlord option for us and that are to be investigated are code.google.com, sourceforge.net and javaforge.com.
Because of its extraordinary wiki functionality the choice is JavaForge.com.
Excuse me? Sun changes it's stock ticker symbol from SUNW to JAVA
Run for the hills, folks! Sun‘s marketing department is innovating again. Oh the humanity…
You‘ll remember the Sun marketing dept. from such beloved stunts such as “Sun ONE“. Or the Java Desktop system, made up of exactly 0 % delicious Java juice. Or the hugely hyped Sun/Google press conf, one or two years back, which featured the announcement “Sun has heard of Google and vice versa. Rejoice, users!“ Or, latest marketing flock up named “JavaFX“ ... It‘s a plane, it‘s a phone, it‘s a horribyly misnamed language, ...
Oh yeah… something else caught my eye in J. Schwartz;s post: he goes on about people telling him about “having the Java experience multiple times a day“, which seems to be referring to them seeing a Java splash screen whenever they start up a Java app..
Are you sure that they say this with a fond smile on their face, or with the strained, throbbing vein expression that indicates that they get nothing done because they have to stare at a bleeding Java splash screen all day.
Let me be perfectly clear: a splash screen is a bug. Same as progress bars and all the other similar GUI components.
Whenever you see a splash screen, the software provider is basically telling you: “Sorry, we couldn‘t make it any faster”. The fact that Java 6 now ships with a splash screen feature, is just sad. Seems like the Java team has finally given up on the idea that they could create a JVM that allows to start up programs instantly, without keeping the user waiting.
Yep, it‘s possible, just pop over to the Squeak Smalltalk website, get your very own version, and try it. No matter how big the application built on top, no matter how fancy (OpenCroquet) it‘ll start up instantly, with “instantly“ meaning “less than half a second on a cold start”.
The answer can usually be very long. I prefer, when possible, to give a short one and just tell about some specific and simple real-life use case. Here’s one…
There’s a startup that’s trying to build a social community around open source projects and people that participate in them. One of the main functions of this website (its backend systems) is to constantly scan SVN/CVS repositories and build its own data warehouse off this harvesting process. Scanning SVN/CVS repositories (and building necessary data from it) is an embarrassingly parallel problem and it’s ideally solved by computational grid computing framework like GridGain.
GridGain provides the following:
One of the last adventures of our times is to be the project lead of a successful software development team. Even more exciting is the creation of an open source software community. This log documents my visions, deeds, feelings, thoughts and nightmares while getting the open source project Turmalix on the go.
Immediately questions arise on what are the most important opening moves. Things are tidy, possibilities are unlimited. The broad set of activities that must be set into motion in the very beginnings of a good open source community effort spans five domains: the organization, the committer, the user, the development process and deployment. The visionary leader will conceive of a future reality to be created by the effort of the community. The opening moves are thus multi-dimensional and must synthesize our desired outcomes in all the dimensions in which we are playing.
Finding a home
The first move in this game is finding a home. Our home has to be able to host the needs of all our spaned domains.
The Organization
An open source community has to cope with organizational issues, just like each commercial team. Roles have to be assigned to the members of the community. The community is a self-regulating system, commited to some vision, living in some virtual environment.
The Committer
Committers to the community are the fleeting ressource that makes the project real. They make up the virtual team.
What is the secret of aligning the minds of highly creative people to a cohesive team in a space of free mind and free will? People have thoughts, ideas and beliefs, regardless of whether they express them. It is worth hearing all of their ideas and evaluating all of their associated beliefs. Commiters and their sparkling brains are the most valuable ressource the open source community owns. Attracting them and unleashing their motivation on every new day to come, keeps the community alive.
The User
Without a user a piece of software is worth less than nothing. The user has to get involved into the community to give the feedback necessary that enables the committers to improve a product from build to build, from release to release. Communication roads have to be established to turn valuable feedback into realistic requirements ant into concrete sourcecode.
The Development Process
Software development is about managing comlexity. Versions of each piece of code are configured into builds and releases. In a virtual space that speads the globe like an open source project, this comlexity is manageable only by software itself.
The Deployment
Deploying software in all variants and to all platforms in an ordered fashion is a challenge by its own.
Ce matin sur The ServerSide j'ai trouvé un article de Michael Yuan sur JBoss Seam 2.0 qui reprend les nouveautés et présente le framework JBoss Seam. J'appelle à la conversion les développeurs qui ont un projet avec des EJB3 pour la partie business et JSF pour la partie Web. Vous verrez à quel point JBoss Seam vous simplifie le travail.
Voici quelques questions/réponses sur ce que l'on peut faire aujourd'hui avec JBoss Seam pour compléter l'article de Michael Yuan. J'espère vous apporter ici des nouvelles fraiches par rapport à ce que l'on trouve sur le net.
Est-ce que JBoss Seam est payant?
Non, JBoss Seam est distribué sous licence LGPL.
Est-ce que je dois absolument utiliser le serveur d'application JBoss pour profiter de Seam?
Non, JBoss Seam peut être aussi déployé dans un containeur léger de type Tomcat. Des portages sont en cours pour IBM Websphere, des utilisateurs ont aussi déployés Seam sur le serveur SUN Glassfish. Bref les développeurs de JBoss Seam ont clairement envie de fonctionner sur le plus de serveur d‘applications du marché possible. Voir aussi ce post pour Glassfish
Est-ce que JBoss Seam sait génerer des applications Web 2.0 avec Ajax ?
La réponse est oui. A la base, Seam utilise JSF (Java Server Faces) et la communauté open-source propose des API qui sont maintenant intégrées de facto dans JBoss Seam. Il devient ainsi très simple d‘ajouter des formulaires qui se mettent à jour partiellement via Ajax par exemple. D‘autre part le module Seam Remoting permet au développeur d‘implémenter une vraie application Web 2.0 facilement
Est-ce que Seam peut envoyer des emails ? faire des traitements la nuit ?
JBoss Seam peut en effet envoyer des emails. Il est possible de génerer un fichier PDF par exemple et de l‘envoyer chaque nuit. Pour l‘envoi de l‘email, l‘api est simple et facile à utiliser. Le traitement de batch avec Seam se repose sur un moteur Asynchrone. Seam peut par exemple faire une tâche chaque heure, chaque nuit et déclencher un traitement. Tout ceci soit via l‘api EJB3 d‘asynchronisme, soit via l‘api Quartz qui est plus puissante. En effet celle-ci permet de créer des tâches avec une date d‘écheance par exemple.
Concernant l‘envoi d‘email, jBPM 3.2 qui est en cours d‘intégration dans JBoss Seam 2.0 Beta 1 permet aussi d‘envoyer un email lorsqu‘une tâche est terminée.
Est-ce qu'il est possible de changer de langue, de locale à la volée ?
Oui en effet le support de l‘internationalisation (i18n) est fortement intégré dans Seam, en partie via JSF. Par ailleurs il est possible d‘ajouter un composant en 2 clics pour permettre de changer de langue et de Locale à la volée. Ce choix peut être persisté via un cookie. Il existe aussi une possibilité de changer le thème (la skin) d‘une application (je pense au module Stylizer chez Reuters…) afin de changer l‘aspect d‘un site avec un seul clic.
Est-ce qu'Eclipse peut me permettre d'écrire des pages graphiquements ? Existe-t-il un studio ?
J‘ai lu que Macromedia prépare une version de DreamWeaver qui reconnait parfaitement JSf 1.2. Cela devrait permettre de coder les pages de la vue plus rapidement. Attention cependant, avec richFaces, ajax4jsf et iceFaces de toutes les façons ces studios ne fonctionnent pas. Il vaut mieux travailler en mode “explode“. Ce mode consiste à compiler votre application, à déployer sur JBoss une arborescence explosée (EAR dans lequel on retrouve un repertoire WAR…). Cela permet alors de travailler sur les fichiers .xhtml (avec Facelets) sans devoir reconstruire tout l‘EAR à chaque fois. Vous n‘avez alors qu‘à lancer un “ant restart” de temps en temps si vous touchez à la partie Java. C‘est très pratique.
Par ailleurs sinon je vous conseille de dépenser un peu d'argent pour acheter IDEA IntelliJ. C'est mon quart d'heure sponsor ce soir. Mais entre Eclipse+MyEclipse vs IntelliJ, il n'y a pas photos. IntelliJ reconnait le format xhtml, les JSF et surtout les annotations de JBoss Seam ce qui au passage devrait convertir j‘espere quelques lecteurs ici. Ajoutez-y le support de JBoss AS en natif pour controler, débuger JBoss (comme JBoss IDE mais en mieux) et voilà, vous allez craquer.
Si vous avez d‘autres questions, n‘hésitez pas à commenter.
Tonight, we'll have a very interesting, if persuasive presentation. The topic is Spaces, and if you have never heard of Spaces, I urge you to attend.
For years, Java Spaces has lurked as a paradigm shift in software and networks, and from my point of view, existed only in theory. I read about it on the Jini page at the Sun website and in the book JavaSpaces: Principles, Patterns and Practice. It was such a different way of thinking, but it seemed that the only implementation was in the book and, once you got it to work, it was pretty transparent. Not much to meet the eye beyond the patterns and architecture in the code.
Well, tonight you'll hear about a quiet change that's made its way to many very big software implementations. Spaces is working and Owen Taylor will first describe what it is and then show you very clearly how it looks and works in Java.
I'm planning to order some as yet undecided dinner for everyone who RSVPs and there will be a few pretty cool things raffled off. So, please send me an RSVP if you plan to attend and feel free to invite a friend. Pass this invitation along to anyone you think might be interested in learning about Java Spaces from a true expert. I've already seen Owen's presentation at GatorJUG and let me tell you, it's one you should not miss.
As always, I hope to see many of you there. Details at [www.orlandojug.com]
Regards,
Michael Levin
rsvp at orlandojug dot com
Ok, you have a webservice to consume and want to send-out a dime attachment (a byte[]) with the envelope. You have the wsdl and you’ve generated the client-code with axis. Here’s the code part for accessing the stub and setting the encapsulation format for dime.
Stub st = (Stub) getServiceLocator().getPort(MyIntegrationServiceSoap.class);
MyIntegrationServiceSoapStub mySoapStub = (MyIntegrationServiceSoapStub) st;
mySoapStub._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT, Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
Below, mySoapStub gets a handler which contains a dataSource. There are other data sources like URLDataSource or FileDataSource. But if you have the dime-content at hand and do the attachment on-the-fly ByteArrayDataSource is the suitable one. Here is the other snippet to wrap it up.
ByteArrayDataSource dataSource = new ByteArrayDataSource(byteArrContent, "UTF-8");
DataHandler handler = new DataHandler(dataSource);
mySoapStub.addAttachment(handler);
~
Answer: no error message, but no data either. At least you can google an error message.
So, more hibernate woes today. I finally got the base of my app up and running. I can retrieve an object from the database using hibernate. I even figured out how to setup the mapping for a many-to-many associations when both objects come from the same table without a primary key on the table (and one object has 3 fields that comprise it's unique identifier). Now the problem is that the set is not being populated and I don't have a clue as to why. I'm not getting any error messages, the base object is being populated, but the contained set is coming up empty when I know there is data in the table.
Oh yeah, in case you were wondering, yes I can retrieve an object of the same type as the set without problems.
Maybe I'll see what AppFuse can do with this.... (Thanks again Matt)
For projects that use a layered architecture, it's usually important to control the dependencies between layers. For example, the service layer should not depend on the web layer, the domain layer should not depend on the service layer, etc.
On our project we use Maven. Reading Mergere's book Better Builds With Maven, and drinking that kool-aid reveals the ultimate solution to the problem. A Maven-based multi-module build, where each architectural layer is a different Maven subproject. Dependencies are all controlled by explicit settings in the pom. So elegant.
Until you try it. Let's say you have a domain package, a web layer package, service layer, db layer, utility package...Now you have 5 separate projects (not including the top-level master project that pulls them all together). Each project has 4 entries on the classpath (/src/main/java, /src/main/resources, etc). You load the whole thing into Eclipse to start developing and... you have 20+ separate classpath roots in your workspace. Finding a class, or deciding where to put a new one, becomes a full-time job. Well, anyway, I'm not here to gripe about Maven, Zarar Siddiqi did a much better job than I could.
Enter JDependWe ended up consolidating our project into a single Maven project. But then how to control those dependencies? JDepend is a framework aimed at generating metrics concerning the packaging of your code. It knows how to analyze coupling and cohesion. So we looked into seeing if we could leverage its capabilities.
In fact, it turned out to be really easy. First, you ask JDepend to analyze your source code:
JDepend jdepend = new JDepend();
jdepend.addDirectory("./target/classes");
Collection packages = jdepend.analyze();
So now you have a list of the JDepend JavaPackage objects. You can now write some fairly straighforward, if not especially clever, code to see if one package depends on another.
private boolean dependsUpon(String me, String other, Collection<JavaPackage> packages)
{
AntPathMatcher matcher = new AntPathMatcher();
for(JavaPackage pack : packages)
{
if(matcher.match(me, pack.getName())
{
Collection outgoingDependencies = pack.getEfferents();
for(JavaPackage otherPackaage : outgoingDependencies)
{
if(matcher.match(other, otherPackage.getName())
return true;
}
}
}
return false;
}
The AntPathMatcher is from Spring. This allow you to write your dependency rules using Ant matching patterns in JUnit assertions, such as
assertFalse(dependsUpon("com.myapp.service.*", "com.myapp.web.*", packages);
This test basically says "fail if any of the classes in com.myapp.service.* depend on any of the classes in com.myapp.web.*". Running this unit test (with the appropriate set of dependency rules for your app) will police your application for illegal dependencies. And if you are using Maven, the build will fail if this unit test fails, so you'll never be in the position of unwinding bad dependencies (unless you just wrote them and are trying to check them in).
| A very simple way to avoid this, is to disable all the links once the user clicks on a link. A simple java script function can do this. And this function should be called on each link. |
The java script may be written some think like this
<script>
function disableAllLinks()
{
allLinks=document.links;
for(i=0;i < alllinks.length;i++)
{
allLinks[i].onclick=function(){return false};
}
}
</script>
Once the JS function is written it can be used as follows. This should be use in all the hyperlinks on which you want to disable the links.
<a href="http://www.yahoo.com" onClick="disableAllLinks()"> My Link1 <A> <a href="http://www.yahoo.com" onClick="disableAllLinks()"> My Link 2<A>
A Complete example is given below.
<HTML>
<HEAD>
<TITLE>Disable Double Click Example</TITLE>
<META NAME="Author" CONTENT="Pradeep Kumar Sahu">
<script>
function disableAllLinks()
{
allLinks=document.links;
for(i=0;i < alllinks.length;i++)
{
allLinks[i].onclick=function(){return false};
}
}
</script>
</HEAD>
<BODY>
<A HREF="http://www.yahoo.com/" onClick="disableAllLinks()">Link 1 </A> <P>
<A HREF="http://www.google.com" onClick="disableAllLinks()">Link 2</A>
</BODY>
</HTML>
WicketMessage: Markup of type 'html' for component 'com.mycompany.wicket.MyPage' not found.
No projeto que estou trabalhando atualmente, existe um módulo EJB que utiliza o Spring. Até ai tudo bem, enquanto ainda não tinha testado esse modulo no cliente não passei por nenhum problema, consegui fazer o deploy e executar chamadas aos EJBs normalmente.
O problema apareceu quando tentei realizar um teste no cliente, onde existe um proxy que exige uma chave/senha para acessar a internet. Quando tentava fazer uns testes nos componentes EJB, o contexto do Spring não conseguia ser criado, devido a um problema na localização do schema spring-beans-2.0.xsd do arquivo de configuração, lançando uma exceção:
org.springframework.beans.factory.BeanDefinitionStoreException: Line 4 in XML document from class path resource [spring-Base.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
Cabeçalho do arquivo XML do applicationContext do spring:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
ou seja, não foi possível localizar o schema. Um erro muito estranho, pois mesmo offline, ele deveria ser capaz de localizar o spring-beans-2.0.xsd que está dentro do arquivo spring.jar.
Por algum motivo, que ainda não descobri, ele não consegue achar o arquivo “spring.schemas” que está dentro do diretório META-INF do spring.jar. Dentro desse arquivo existe a localização dos schemas. Para o schema mencionado acima existe essa linha:
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
Seguindo o fluxo normal, inicialmente o Spring localiza o schema que está dentro do jar e caso não consiga encontrá-lo, acessa a internet para localizá-lo. Devido a um problema no classpath do modulo EJB (talvez a forma que o NetBeans empacota o jar), ele não consegue encontrar o arquivo “spring.schemas” e consequentemente o XSD local no jar, sendo obrigado a acessar a internet, que por sua vez, não está acessível por causa do problema de autenticação no proxy da rede, causando o erro mostrado acima. Esse erro só acontece no modulo EJB do projeto, no modulo Web (WAR), que também utiliza Spring, o problema não ocorre.
Ainda não consegui descobrir qual o problema com o classpath que não permite a localização do arquivo de mapeamento de schemas. Para resolver o problema e continuar com os testes fui obrigado a fazer um “workaround” no arquivo XML de configuração. Na declaração do schema, eu informei diretamente a localização do arquivo XSD que está dentro do arquivo spring.jar, com isso, o cabeçalho do arquivo spring-Base.xml ficou assim (a alteração está em itálico):
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
classpath:org/springframework/beans/factory/xml/spring-beans-2.0.xsd">
Não é a melhor solução mas consegui realizar os
testes que precisava no cliente. Ainda estou pesquisando para descobrir o
motivo desse problema, se alguém tiver uma sugestão ou a solução definitiva
estou interessado em saber sobre o resultado.
Existe uma thread no fórum do spring com esse mesmo problema, mas em uma aplicação Java standalone. O problema também ocorria por causa do classapth da aplicação.
One of the obvious reasons is that we integrate with WebLogic, JBoss, Websphere, Coherence, Mule, etc. and shipping is all these products is impossible (and in many cases license-wise impossible).
But my view on that is that why do you need it? What was the last time you rebuilt, say, Mule or JBoss? From my point of view availability of the source code is a great documentation and debugging tool. I can hardly imagine anyone seriously modifying GridGain source base – and, of course, if you happen to have a real need to do it you can easily do it in less than 20 mins (you just need to download whatever dependencies you require). And if you are realy itching to develop grid computing middleware – join our project!
We take a great care of the source code that we ship. It’s well documented with Javadoc, it’s well structured and rigorously code-reviewed, and we inject file names and line numbers into all our exceptions so that if you get a stack trace you can easily glance into the source code to see what is happening.
Download GridGain at [www.gridgain.com]
I have been using Windows since version 3.0 and thought I had seen most of its subtleties. However today I found a new "gem" I had not encountered before.
We use two Perl scripts to do some FTP transfers regularly, scheduled by the Windows "Scheduled Tasks" to run several times a day. The scripts both use a common function to append to their respective daily log file. In case a file is older than 5 days, judging by its age in days based on the "Date Created" timestamp, it will be deleted and a new one created under the same name. This is intended to not have the files grow indefinitely.
While one of the jobs worked just fine, appending to its log files and rotating after 5 days, the other seemed to overwrite its log file on each run. Strangely enough - as said before - they both used the same log function, just with different file names.
After some poking around in the scripts source we decided to make a more low level test to see whether this had anything to do with either Perl or the "Scheduled Tasks". We created a file from the command line by just redirecting an echo command. We then deleted the file and recreated it again by the same means. This is what we got (German Windows XP, but behavior observed was equivalent to Windows Server 2003 and Windows Professional 2000):
C:quantum>time /t
22:46
C:quantum>echo "quantum" >> mechanics.txt
C:quantum>dir /T:C mechanics.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: 0CA5-E6F2
Verzeichnis von C:quantum
22.08.2007 22:46 8 mechanics.txt
1 Datei(en) 8 Bytes
0 Verzeichnis(se), 8.096.706.560 Bytes frei
C:quantum>time /t
22:47
C:quantum>del mechanics.txt
C:quantum>echo "temporal" >> mechanics.txt
C:quantum>dir /T:C mechanics.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: 0CA5-E6F2
Verzeichnis von C:quantum
22.08.2007 22:46 8 bar.txt
1 Datei(en) 8 Bytes
0 Verzeichnis(se), 8.096.706.560 Bytes frei
C:quantum>
Notice the experiment starts at 22:46. A file is created and its creation timestamp is automatically set to 22:46 (dir /T:C shows the creation time). Then, at 22:47 the file is deleted and recreated with different content. Again the file creation date is 22:46 while the "Date Modified" timestamp is 22:47.
Looking at the timestamps of the log file mentioned above we noticed that the "Date Created" attribute was back several months. Apparently every time the file had been deleted and recreated the original timestamp had been restored as well.
Looking around the net for some explanation for this (we suspected a filesystem bug) after a fair amount of searching I finally came across "The Old New Thing: The apocryphal history of file system tunnelling" and through that Microsoft Knowledge Base article 172190, titled "Windows NT Contains File System Tunneling Capabilities".
Basically what happens is that Windows caches the timestamp of the deleted file for some time. In case a new file appears under the same name, it will get the cached value. The default maximum time period between deleting and re-creating the file is 15 seconds. However we could also see it happen with more than 8 minutes! I do not yet understand how this comes about...
Once I knew the keyword was "tunnelling" it was also easy to find this 2001 post from a discussion on Bugtraq. I completely agree with Ken Brown who wrote that post (especially concerning the 2nd paragraph):
"Tunnelling" is a long way from any keywords that I'd associate with file systems - and a search for "tunnelling and ntfs" turns up a great many references to VPNs and bits of networking. It now turns out that it isn't really a property of the file system at all, which obviously makes the search even harder.
[...]
Obviously not serious, but I bet that someone, somewhere, has an application that depends on file creation dates and wonders why it goes wrong every now and again. That is a *mild* potential security problem, if only because it could cause confusion. Documentation bugs can be security problems. Unexpected or unwanted behaviour from a machine is always a potential security problem.
[...]
The accumulation of seemed-like-a-good-idea-at-the-time backwards-compatible gotchas in the Windows file systems [...] all combine to introduce uncertainty and unpredictability, which leaves gaps for security errors.
Because one of our scripts took more than 15 seconds (the default time-to-live for cache entries) between deleting and recreating the file as it was scheduled during a high load time, it literally took advantage from the lack of resources.
The other script, running during far less busy periods had always been fast enough to trigger the tunnelling "feature" and get the cached creation time over and over again. Of course the workaround for the scripts is simple: Consider the "Date Modified" attribute.
A more drastic approach would be to change the registry settings controlling this behavior. See the knowledge base article for details.
But seriously - I will never understand (and even less appreciate) - why Microsoft tends to always choose backwards compatibility over reliability. Maybe this was a sensible feature right when long filenames on FAT volumes came about, but seriously, is it necessary to carry this all the way to the 2003 server? I bet it is still present in Vista as well....
Dev2Dev published the article "Mock Objects: Shortcomings and Use Cases," written by yours truly.
This article shows how Mock Objects, a testing technique from the XP community, can help programmers write unit tests. It also considers the shortcomings of this technique and provides valuable use cases.
Many thanks to Jon Mountjoy!
JRoller community, I need an "informal" sample of your current developer workstation metrics. Please fill out the following for your development workstation. The one you primarily use at work, preferably company issued. If you have more than one feel free to fill this out n+times. Your help is much appreciated.
Brand (also indicate laptop v desktop):
OS:
Processor(s) brand/speed/bits (32..64...etc):
RAM memory size (GBs):
Monitor size (in inches and indicate if flat v. CRT):
IDE (development env):
Comments: This is free form...
What would you upgrade 1st about your current machine? What would make you more productive? Other information you would like to share? Some metric you think is important and I missed.
Thank you internetz for all your help. I love you internetz.
p.s. Jroller.com is marking all javadev comments as spam right now. probably because this is 500x(s) the number of comments we usually get. So, if you don't see it display, we'll get a notification and enable it ASAP. Thanks again for the feedback.
There is always something there to remind i was a programmer and how a bunch of books opened my mind and helped me to improve as a professional. The following list represent the most interesting I can remember:
When we hire a new developer I try to spend a week or two training them as a coach, transmiting the principles I have harvest among my reading and experience. This is also a great time in which the new people might make new suggestions as well regarding their past experience so we could also improve the way we are working.

I just released a major new version of the EOS plugin (Eclipse on Swing plug-in) -- download it from the EOS website. Feel free spreading the word and integrate the Get-EOS-teaser to your blog:
<a href="http://eos.sourceforge.net" target="_blank">
<img style="margin: 8px;" alt="GetEOS Download Button" title="GetEOS"
src="http://jroller.com/resources/d/dk/get_eos3.png"></a>
EOS requires Eclipse3.2, Java1.4+ and theoretically should run on all platforms supporting Swing:
*** these platforms are to our knowledge (which is admittedly limited) not supported by native SWT (ever or yet).
Proof that it now also runs under OSX (don't test it on OSX yet, you might be disappointed, there is some major Swing-unrelated OSX-specific bug which will soon be gone):
On Windows/Linux it already works very good with only one deadly bug left - right click on Project and open it. It doesn't crash Eclipse but most things stop working. There are many more bugs but they are simply less deadly.
Obviously I cannot test EOS for all of these platforms.
Feel free to send me some feedback or comment on this thread in JavaLobby.
Imagine several projects using:
Those projects are organize in several modules and several set of modules:
So, we have those constraints:
We have those functionalities with Eclipse:
My latest dilema was that edit and admin mode didn't work, the css styles weren't applied. Some digging on their developer forum showed a simple solution. Just copy ..utilstylessystem_template.css to ..utilstylessystem.css and it works just fine.
The original thread can be found here.
set JAVA_HOME=C:Devprogrambeajdk150_10
set PATH=%JAVA_HOME%bin;%PATH%
java -version

It's OK, we have what we want. Now we want to work with this embedded JDK without set those environment variables before to use java.exe, so we want to use it permanently.
If you set the User Environment Variable with :
Like this:

And you launch a new command shell, you will have this:

Your java.exe is the java.exe that you have installed with the Sun JDK package and not the embedded JDK...
In fact, Windows put the user environment variable after the system environment variable, so its looks like there is another java.exe in the system environment PATH variable.
The Sun JDK package installation put a java.exe in the C:Windowssystem32 directory, this java.exe launch the JDK witch was installed (here C:Devprogramjdk1.6.0_01).

So you have to put the C:Devprogrambeajdk150_10 at the beginning of the system PATH environment variable:


Now, it's ok.
Note: if you put %JAVA_HOME%bin at the beginning of the system PATH environment variable, it won't work because the %JAVA_HOME% is not already set: here it's a user environment variable.
So I've been trying to learn Spring and Hibernate for the last few weeks (I know, I know it shouldn't take that long, but if you knew what I put up with at work, you'd understand). Today, I finally got something slightly useful up and running. I think this is going to be really cool when it is done and I hope to use some of it for a side project I'm working on at home.
I think I have the basics down, now if I could just find a nice "medium level" tutorial. I've checked out AppFuse and AppFuse Light but they require JDK 5 and I'm stuck deploying this on a WebSphere 5.1 server (JDK 1.4)
Well off to search Google...
.
I have another problem in my TestNG and Seam integration. I don't know how to configure the xmls and my EJBs to get rid of Naming problems, of course I think I have followed all instructions of both frameworks :-/. My components.xml for testNG looks like:
core:init jndi-pattern="#{ejbName}/local" debug="true"
core:ejb installed="true"
while my componets.xml of the application looks like:
core:init debug="true" jndi-pattern="ib-0.0.1-SNAPSHOT/#{ejbName}/local"
core:manager conversation-timeout="120000" conversationIdParameter="cid"
core:ejb installed="false"
core:managed-persistence-context name="entityManager"
auto-create="true" persistence-unit-jndi-name="java:/ibEntityManagerFactory"
With this config, when I tried to run the tests, I get this exception:
java.lang.RuntimeException: Could not create Component: accounts
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865)
...
Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: accounts
at org.jboss.seam.Component.getJndiName(Component.java:372)
at org.jboss.seam.Component.(Component.java:219)
at org.jboss.seam.Component.(Component.java:203)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851)
... 21 more
I resolved this exception by adding @JndiName to all Session Bean EJBs!!!!!
Tests worked find and everything was ok! But when I tried to run my application after resolving this problem, having That annotations in my code, I got a bean creation exception in my EJBs!
I commented @JndiName from my Session Bens again! Now, My application works again, but I get the same exceptions again!
Any comments!!?
Hibernate Synchronizer is a free Eclipse plugin code generation tool to be used with the Hibernate persistence framework. The plugin will automatically generate java code when your hibernate mapping files are modified. Objects are created with generated code in an abstract base class and a user-modifiable extension class so user code does not get deleted when the generation is performed.
The automaticallly generated objects include:
* Value Objects
* Proxy Interfaces
* Composite Key Objects
* Enumeration Objects
* Component Objects
* Subclasses
* DAOs
Other features include:
* Editor with code assist and outline view
* Custom template generation
* New mapping file wizard that queries your database
* New configuration file wizard
* Actions for adding mapping references, synchronizing files, and manually activating code generation
This plugin makes using hibernate incredibly easy and fast. It is a "must have" plugin for anyone who has persistant data and has choosen to use Hibernate. But there are many disturbing bugs. It hasnt been updated for a long time and bugs havent been fixed yet. It is a useful plugin for specific purpose but I think it cannot be used in big projects.
| REF, Hibernate Synchronizer | ![]() |
In Joda-Time, a period represents a period of time which is defined in terms of fields, for example a period can be, 5 years 2 months 8 days 3 hours and 20 minutes.
Now let’s suppose you have an audio book which is divided into audio chapters and you want to calculate the audio length of the entire book by adding together the period for all the chapters.
Joda-Time period API does not provide any out-of-the-box way of doing it. First impression could be to use plusMillis, but this is not what we want as it is just going to add the millis for two periods and not taking care of any other field like seconds, minutes, hours etc.
For adding Periods we need use to another concept in Joda-Time called Duration as here.
public Period getDuration() {
Duration initialDuration = getDurationFromPeriod(new Period(0));
for (AudioChapter chapter : chapters) {
initialDuration = initialDuration.plus(getDurationFromPeriod(chapter.getLength()));
}
return initialDuration.toPeriod();
}
private Duration getDurationFromPeriod(Period period) {
return period.toDurationFrom(new Instant(0L));
}
Interpreter is one of the aleph patterns in the Gang of Four books. I have written about it before, and since I live in anxious fear of repeating myself, I will not again wax on about its greatness, except to say that I love the gang of four section on Interpreter, it is fantastic, and still love the way they bend around the concept to finally making you realize that a search/replace, nay even copy, are interpreters, when considered from the right perspective (I want to go on record as one who believes Interpreter's star is and will continue to rise).
Anyway, I have been thinking about fusing wiki and portal concepts recently. I am going to blog separately about how so many pieces of software start as a bump that grows into a boil when the team figures out their little pet needs to be a portal too. So I started thinking about what it would take to enhance the wiki portlet in Liferay. I did some poking around and found this post about Radeox, the engine that the Atlassian pups curbed their teeth on. Frankly, I don't want to rekick up the dander from that thread, except to say that finding myself agreeing with Alan Williamson on something was more shocking than thinking Eleanor Clift's voice sounded like the baited cooings of the angels. The Atlassian guys ran to their own defense, predictably, but then tell kind of a sad story, summarizes as: we would have contributed back, but for reasons that we don't fully explain, we ended up spitting this thing out and making the core of our project a Delphic mystery cult, but we are still a good open source company.
So I checked out the Radeox code. After having started to write a few bits myself, it was a good primer for setting out into their little kitbag. They have the concept of a macro, and therein is the HTML output for the corresponding type. As I have talked about again and again, I am just obsessed with Lean these days, and while I appreciate the effort made there to provide extensibility that was simple, it left me dreaming of something more gracefully extensible. That led me to look again at ANTLR. That was downright thrilling. I bought the PDF of the dude who sticks his hands out the sides of his head like he's 10. The book is great, and the tool looks sick. Then, it even turned out that he had his own ML that is kind of like wiki syntax, but that did not look so great, and the fear of dragging around a lot of stuff there has led me to my third thought. In the ANTLR notes to his ML, he had entertained the thought of being able to generate different output. Of course, I had thought about this from the beginning as well (made me think maybe Builder was more appropriate, but of course, that is ludicrous, this is Interpreter if anything ever was one), and even the Radeox has some feignt in that direction as well. I think Gang of Four is pretty straightforward on that account: by using Visitor, the actual outputting is separated from the token abstractions, and thus, you can have an HTML visitor, and an XML visitor that work from the same Composites and output different markup. Of course, as is always the case when you go to touch Interpreter, you have to keep in mind that it offers no solution or even prescription for the lexer or parser parts of the equation. This is one part of the extensibility model that I am still a little foggy on: for instance, if I wanted to support a new link syntax, do I have to write a parser? Some of the solutions I have seen have plugins that get called on each token. I thought of hooking families of plugins together based on a first character, e.g. [ for links. Another solution would be to let plugins be matched by regular expression. Anyway, one of those will have to be assayed. In the meantime, I think making the basic expression types, e.g. Link, Text, WrappedText, etc., and outputting the appropriate translations is going to be super simple and clean. Time will tell....