Spring Training: Every Second Person for Free!

30 June 2009

Today is the day, if you want to take advantage of this special, but it looks like a pretty good deal …

To celebrate the availability of the Spring Certification Training in six new locations, SpringSource launched another once in a lifetime opportunity.

For every person that registers for a Spring Certification Training in one of the six new locations before July 01, 2009 you get the second person for free!

During this course you will learn to:

  • Work with the Spring Inversion of Control (IoC) Container
  • Effectively use JDBC and Hibernate for data access
  • Use JUnit, Spring, stubs and mocking frameworks to effectively implement automated unit and integration tests
  • Take advantage of Aspect-Oriented Programming (AOP) to keep code clean and maintainable
  • Use Spring Security to secure web and standalone applications
  • Manage live applications with ease using Spring’s support for Java
  • Management Extensions (JMX)
  • Become a SpringSource Certified Spring Professional
  • And much more

This special is offered in the following cities, click on the links below to learn more!

August 11 – 14: Budapest, Hungary
August 11 – 14: São Paulo, Brazil
August 11 – 14: Tel Aviv, Israel
August 18 – 21: Athens, Greece
August 18 – 21: Hong Kong, Hong Kong
August 25 – 28: Buenos Aires, Argentina


SemREST Version 0.1 Released

22 June 2009

The Open Source Release Feed has an interesting announcement this morning:

SemREST Version 0.1 Released - Semantic Extension For Java RestFull Web Services

SemREST is a Java framework for the semantic extension of RESTful Web Services. Some features of the framework include: simplification of data transmission mainly in RDF - but also in other formats (generically requests/responses) for HTTP-operations GET, PUT, POST and DELETE. Simple bijective mapping of RDF graphs and Java instances simple mapping of RDF graphs on Java interfaces (implying automatic interface implementation). Extraction of RDFa data from HTML content (via HTTP GET Request)

Download

Release Notes

Project Website


Opera Unite: a Web server on the Web browser

17 June 2009

Stefan Constantinescu of IntoMobile has an interesting take on the new Opera Unite web browser that comes complete with a built-in web server:

Today Opera launched Opera Unite and with it came a lot of excitement, confusion and questions. Opera Unite is a web server running in an Alpha version of the Opera 10 web browser. This web server can be accessed by anyone on the internet and goes around firewalls thanks to Opera’s proxies. Services can be installed to run on Unite, and at launch Opera has made available a file sharing service, media player, chat service and a few others, to show what this technology is capable of. Opera Unite is, from my knowledge of internet history, the first web server to be bundled and tightly integrated inside a web browser.

The first question that comes to people’s minds is why? Why would I want to run a web server in my web browser?

Lawrence Eng, Product Analyst at Opera Software, talks about the internet’s “unfulfilled promise” of connecting people directly and letting them interact with each other without the need to play in someone else’s sandbox. Why should I have to sign up to Flickr to share photos with Jon, why should I have to install Google (NSDQ: GOOG) Talk to chat with Lisa, why is it that few corporations, who have vast monetary resources, build huge data centers and then expect us to play by their rules in their world?

The devices we use to access the internet today are merely dumb terminals that connect to servers that host the things we care about; but what exactly is wrong with that?

What’s wrong with that? Stefan will exlpain it to you.


JavaFX squares off against AJAX

8 June 2009

This must have been interesting to watch …

Prominent AJAX developers Ben Galbraith and Dion Almaer each take a side in a mock debate over the merits of the two technologies at the JavaOne conference

In a mock debate focused on the rich Internet application development realm, AJAX was pitted against Sun Microsystems’ JavaFX Friday, with proponents for both technologies pointing up their entrant’s high points and the low points of their rival.

A session at the JavaOne conference in San Francisco had the co-founders of the Ajaxian Web site for AJAX technologies squaring off, with Ben Galbraith playing the part of the JavaFX advocate and Dion Almaer serving as AJAX’s proponent. Both serve as co-directors of developer tools at Mozilla. While Galbraith and Almaer are obviously geared toward AJAX, Galbraith said he also has experience consulting on Java.

“JavaFX is built on top of an incredibly mature runtime that gives you amazing performance,” as well great features, and [Oracle CEO] Larry Ellison, Galbraith said, giving a humorous nod to Oracle’s plans to buy Java founder Sun Microsystems.

Almaer focused on AJAX being synonymous with the Web. “It’s all Web stuff that’s going on,” he said.

The two went back and forth, measuring factors such as graphics performance, language capabilities, and tools.


Look-up Tables: Service configuration

4 June 2009

Yesterday, I tossed out a copy of my new LookupTableService without going into much detail about the use of the service or how to go about setting it up. Today, I’d like to correct that and add a little context to the story.

Basically, I wanted to be able to get to table entries, not as they are defined on the database, but as they are configured in the system. This primarily relates to user-defined properties, which are stored on the database as property01, property02, property03, etc, but which have been given certain characteristics by their creator when the look-up table was defined. Such characteristics include things like name and type and length and source and so on, which is how I wanted to get to things, as opposed to property01, property02, and so forth. That’s why you see this little tidbit of code inside of the service:

  /**
   * <p>Returns the requested table entry.</p>
   *
   * @param tableName the name of the requested table
   * @param entryId the id of the requested entry
   * @return the requested table entry
   */
  private Map<String,Object> buildTableEntry(LookupTable lookupTable, LookupTableEntry lookupTableEntry) {
    Map<String,Object> entry = new TreeMap<String,Object>();

    entry.put("id", lookupTableEntry.getEntryId());
    entry.put("description", lookupTableEntry.getDescription());
    if (lookupTable.getProperties() != null && lookupTable.getProperties().size() > 0) {
      Iterator<LookupTableProperty> i = lookupTable.getProperties().iterator();
      while (i.hasNext()) {
        LookupTableProperty lookupTableProperty = i.next();
        int index = lookupTableProperty.getSequence();
        String name = lookupTableProperty.getName();
        if (StringUtils.isEmpty(lookupTableEntry.getProperty(index))) {
          entry.put(name, "");
        } else {
          entry.put(name, lookupTableEntry.getProperty(index));
        }
      }
    }

    return entry;
  }

The current version just drops the value string into the map at this point, but I have visions of one day using the property’s “type” value to convert the data in to an Integer or Date or whatever object might be appropriate based on the “type” … but I was just too lazy to work all of that out right at the moment.

The service is set up to be configured by Spring, so to make it work, you need to add a little something to your applicationContext.xml file:

<bean id="lookupTableService" class="org.restafarian.core.service.LookupTableService">
  <property name="lookupTableManager" ref="lookupTableManager"/>
  <property name="lookupTableEntryManager" ref="lookupTableEntryManager"/>
  <property name="context" value="${lookup.table.service.context}"/>
</bean>

The service is set up to take advantage of the recent addition of “context” to the Look-up Table framework, so you have to specify which context you want to work with. If you need to access tables from more than one context, say the global context and your application’s specific context, you can simply define an instance of the service for each context required, reusing the same data manager beans for each:

<bean id="globalLookupTableService" class="org.restafarian.core.service.LookupTableService">
  <property name="lookupTableManager" ref="lookupTableManager"/>
  <property name="lookupTableEntryManager" ref="lookupTableEntryManager"/>
  <property name="context" value="global"/>
</bean>

<bean id="applLookupTableService" class="org.restafarian.core.service.LookupTableService">
  <property name="lookupTableManager" ref="lookupTableManager"/>
  <property name="lookupTableEntryManager" ref="lookupTableEntryManager"/>
  <property name="context" value="${my.application.context}"/>
</bean>

Once Spring injects the bean with all of the dependencies and turns it over to your application, then you can just use it to grab tables and table entries as needed:

countryTable = globalLookupTableService.getTable("country");

Now that that is done, I need to get busy putting it to work!


Look-up Tables: LookupTableService

3 June 2009

Most of my usage of the Look-up Table service that we created has been on the client side of things, but ocassionally, I will have a need to reference a look-up table back on the server, or in a stand-alone batch job. To accommodate that, I could utilize the HttpClient library and access the data through the REST interface, but that’s a little overkill when I have access to the data right there via Java. Still, the manager classes in the service layer are not quite designed for the seamless access that I was looking for, so I finally broke down and created a Look-up Table service module:

package org.restafarian.core.service;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.apache.commons.lang.StringUtils;
import org.restafarian.core.beans.LookupTable;
import org.restafarian.core.beans.LookupTableEntry;
import org.restafarian.core.beans.LookupTableProperty;
import org.restafarian.core.manager.LookupTableEntryManager;
import org.restafarian.core.manager.LookupTableManager;

/**
 * <p>This is the LookupTable service.</p>
 */
public class LookupTableService {
  private String context = null;
  private LookupTableManager lookupTableManager = null;
  private LookupTableEntryManager lookupTableEntryManager = null;

  /**
   * <p>Returns a list of lookup tables in this context.</p>
   *
   * @return a list of lookup tables in this context
   */
  public List<LookupTable> getTables() {
    return lookupTableManager.findByContext(context);
  }

  /**
   * <p>Returns a list of lookup table names in this context.</p>
   *
   * @return a list of lookup table names in this context
   */
  public List<String> getTableNames() {
    List<String> tableNames = new ArrayList<String>();

    List<LookupTable> tableInfo = lookupTableManager.findByContext(context);
    if (tableInfo != null) {
      Iterator<LookupTable> i = tableInfo.iterator();
      while (i.hasNext()) {
        tableNames.add(i.next().getTableName());
      }
    }

    return tableNames;
  }

  /**
   * <p>Returns the definition of the requested lookup table.</p>
   *
   * @param tableName the name of the requested table
   * @return the definition of the requested lookup table
   */
  public LookupTable getTableDefinition(String tableName) {
    return lookupTableManager.findByContextAndTableName(context, tableName);
  }

  /**
   * <p>Returns the contents of the requested lookup table.</p>
   *
   * @param tableName the name of the requested table
   * @return the contents of the requested lookup table
   */
  public Map<String,Map<String,Object>> getTable(String tableName) {
    Map<String,Map<String,Object>> table = null;

    LookupTable lookupTable = lookupTableManager.findByContextAndTableName(context, tableName);
    if (lookupTable != null) {
      table = new TreeMap<String,Map<String,Object>>();
      List<LookupTableEntry> lookupTableEntryList =
           lookupTableEntryManager.findByContextAndTableName(context, tableName);
      if (lookupTableEntryList != null && lookupTableEntryList.size() > 0) {
        Iterator<LookupTableEntry> i = lookupTableEntryList.iterator();
        while (i.hasNext()) {
          LookupTableEntry lookupTableEntry = i.next();
          table.put(lookupTableEntry.getEntryId(), buildTableEntry(lookupTable,
               lookupTableEntry));
        }
      }
    }

    return table;
  }

  /**
   * <p>Returns the requested table entry.</p>
   *
   * @param tableName the name of the requested table
   * @param entryId the id of the requested entry
   * @return the requested table entry
   */
  public Map<String,Object> getTableEntry(String tableName, String entryId) {
    Map<String,Object> entry = null;

    LookupTable lookupTable = lookupTableManager.findByContextAndTableName(context, tableName);
    if (lookupTable != null) {
      LookupTableEntry lookupTableEntry =
           lookupTableEntryManager.findByContextTableEntry(context, tableName, entryId);
      if (lookupTableEntry != null) {
        entry = buildTableEntry(lookupTable, lookupTableEntry);
      }
    }

    return entry;
  }

  /**
   * <p>Returns the requested table entry.</p>
   *
   * @param tableName the name of the requested table
   * @param entryId the id of the requested entry
   * @return the requested table entry
   */
  private Map<String,Object> buildTableEntry(LookupTable lookupTable, LookupTableEntry
         lookupTableEntry) {
    Map<String,Object> entry = new TreeMap<String,Object>();

    entry.put("id", lookupTableEntry.getEntryId());
    entry.put("description", lookupTableEntry.getDescription());
    if (lookupTable.getProperties() != null && lookupTable.getProperties().size() > 0) {
      Iterator<LookupTableProperty> i = lookupTable.getProperties().iterator();
      while (i.hasNext()) {
        LookupTableProperty lookupTableProperty = i.next();
        int index = lookupTableProperty.getSequence();
        String name = lookupTableProperty.getName();
        if (StringUtils.isEmpty(lookupTableEntry.getProperty(index))) {
          entry.put(name, "");
        } else {
          entry.put(name, lookupTableEntry.getProperty(index));
        }
      }
    }

    return entry;
  }

  /**
   * @param context the context to set
   */
  public void setContext(String context) {
    this.context = context;
  }

  /**
   * @param lookupTableManager the lookupTableManager to set
   */
  public void setLookupTableManager(LookupTableManager lookupTableManager) {
    this.lookupTableManager = lookupTableManager;
  }

  /**
   * @param lookupTableEntryManager the lookupTableEntryManager to set
   */
  public void setLookupTableEntryManager(LookupTableEntryManager lookupTableEntryManager) {
    this.lookupTableEntryManager = lookupTableEntryManager;
  }
}

There’s obviously more that could be done here, but for now, it serves its purpose.


Red Hat announces the JBoss Open Choice strategy

2 June 2009

Today is opening day for JavaOne, so everyone is getting their Java-related press releases in order. This one comes from Red Hat:

SAN FRANCISCO–(BUSINESS WIRE)–Red Hat (NYSE: RHT), the world’s leading provider of open source solutions, today announced the JBoss Open Choice application platform strategy which aims to provide a single environment for deploying a variety of programming models with a common platform, making it easier to develop and deploy applications. The JBoss Open Choice strategy represents Red Hat’s response to the expanding and rapidly changing landscape of Java for the enterprise, which is marked by more variety and more choice of programming and deployment models than ever before. At the heart of the JBoss Open Choice strategy is the JBoss Microcontainer, a new application platform architecture that uniquely isolates core enterprise class platform services from the variety of container and framework choices available today. The JBoss Open Choice strategy is intended to enable customers to embrace the latest innovations of the Java community today and represent an investment in the future as it will seek to accommodate the next wave of changes to Java for the enterprise.

With JBoss Open Choice, Red Hat plans to provide application developers with the ability to choose the framework, language and programming technologies that best fit the application requirements they are trying to achieve without sacrificing reliability, availability, scalability or manageability across their projects. This means JBoss Enterprise Middleware customers will have an opportunity to take advantage of popular programming models such as Spring, Seam, Struts, Google Web Toolkit and Java Enterprise Edition across their products and still enjoy uniformity of management and enterprise-class reliability in the platform. The strategy is expected to employ a number of new JBoss application platform products, built on a common architecture and designed to address customers’ unique application deployment needs without the complex dependencies of traditional Java EE application server products.

“With an uncertain future and the ever-changing world of Java, the JBoss Open Choice strategy is designed to provide customers with the confidence, to choose the programming and deployment model that works for them without sacrificing performance,” said Craig Muzilla, vice president, Middleware, Red Hat. “Despite all of the market shifts, Red Hat aims to remain a trusted source for valuable and innovative solutions in the Java market.”


I hate it when that happens …

29 May 2009

Some mornings, it just doesn’t pay to gnaw through those leather straps.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building core
[INFO]    task-segment: [site]
[INFO] ------------------------------------------------------------------------
[INFO] artifact org.codehaus.mojo:dashboard-maven-plugin: checking for updates from central
[INFO] artifact org.codehaus.mojo:dashboard-maven-plugin: checking for updates from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] java.lang.IllegalArgumentException: protocol = http host = null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.RuntimeException: java.lang.IllegalArgumentException: protocol = http host = null
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:913)
	at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:1951)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:388)
	at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
	at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
	at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
	at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
	at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:491)
	at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifactMetadata(DefaultWagonManager.java:388)
	at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolve(DefaultRepositoryMetadataManager.java:97)
	at org.apache.maven.artifact.transform.AbstractVersionTransformation.resolveVersion(AbstractVersionTransformation.java:65)
	at org.apache.maven.artifact.transform.LatestArtifactTransformation.transformForResolve(LatestArtifactTransformation.java:41)
	at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.transformForResolve(DefaultArtifactTransformationManager.java:57)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:145)
	at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
	at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
	at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:163)
	at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:299)
	at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolveMetaVersion(DefaultPluginVersionManager.java:673)
	at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:187)
	at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolveReportPluginVersion(DefaultPluginVersionManager.java:98)
	at org.apache.maven.plugin.DefaultPluginManager.verifyReportPlugin(DefaultPluginManager.java:592)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyReportPlugin(DefaultLifecycleExecutor.java:1557)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReportExecutions(DefaultLifecycleExecutor.java:912)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReportExecutions(DefaultLifecycleExecutor.java:888)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.IllegalArgumentException: protocol = http host = null
	at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:164)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:769)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:699)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:943)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
	... 40 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri May 29 06:58:38 PDT 2009
[INFO] Final Memory: 4M/10M
[INFO] ------------------------------------------------------------------------


AJAX World: Call for Papers

26 May 2009

You only have until June 30, so if you want be one the speakers at the 8th International AJAX World RIA Conference & Expo in San Francisco this September, you need to get all of your stuff together and submit your proposal on-line before the deadline:

The conference theme of the 8th International AJAXWorld RIA Conference & Expo, to be held September 22–23, 2009 in San Francisco, CA, is ‘Good User Experiences Are Good Business.‘ The Call for Papers, which is now open, welcomes submissions from exceptional speakers with high-quality use cases of investing in user experience (UX) design to provide strong return on investment (ROI). Case studies from companies that have chosen to invest in UX and UI, with measurable benefits, are especially encouraged.

Co-located with 16th International SOA World Conference & Expo, the combined event will feature 100+ breakout sessions, General Sessions, industry keynotes and discussion panels, as well as a 2-day Expo Floor.

The submissions process is 100% online:

Call for Papers Now Open - Submit Your Speaking Proposal Here !

More …


Facebook’s OpenID Goes Live

21 May 2009

This was a couple of days ago, so it’s ancient history by now, but it’s still interesting:

Later today Facebook will officially become an OpenID relying party. What does that mean? It means that if you wish to register for Facebook using another OpenID provider, you can. Initially the service will not be completely open though. As Facebook will post later today, “To start, new users can now register for Facebook with their Gmail accounts, and existing users can link their Facebook accounts with any OpenID provider to connect with friends and eliminate the need for multiple sign-ins.”

A few weeks ago Facebook officially announced that their OpenID support would go live and today it has become official. The initial concept is to be able to login using your external account and avoid the need to remember multiple passwords and account addresses. While many people simply use an existing email and the same password for practically every account, remember passwords can quickly become annoying.

That’s why Facebook has decided to launch their support of OpenID. What’s interesting about this is that once you are logged in to your OpenID account, you will automatically be logged in to Facebook as well. This also means that you’ll be logged in for all Facebook Connect sites that you’ve previously registered for making the login process much more simplified.

I had heard that it was going to happen, but I didn’t realize that it had. It all looks the same from the sign-on screen to me, but I guess you have to peek behind the curtain to see the changes.


Next Page »