Saturday, March 29, 2008

Ringside Social Application Server: Interesting but not Java

In a not-so-recent post Matt Asay featured Social Application Server - currently the only product of a startup called Ringside Networks formed by a number of former employees of Bluestone Software and JBoss.

That sounded interesting as I expected to see a Java-based implementation. In fact I was so sure of it that I read through almost entire Ringside Networks website (there's not really much of it by the way). Imagine my level of frustration surprise when I found, in the Requirements section, that the product is PHP-based!

While it's easy to dismiss Ringside's technology choice as not appropriate for the enterprise, it might be an indication of a trend in Enterprise 2.0 arena. It could be that Web 2.0 will enter the enterprise with its technological retinue such as PHP and its brethren.

If you are an enterprise Java developer, put PHP on your watch list.

Saturday, March 22, 2008

Java as Open Source Platform

It was the announcement of Pulse 2 availability that triggered my thought flow.

What is Pulse?

A quote from the official website:
Pulse is an easy way to obtain, configure and manage your Eclipse-based products.
In other words, Pulse is a product management solution for Eclipse platform.

Pulse is another example of forward thinking by Genuitec as it manifests their understanding of the crucial role of integrated approach to the delivery of platform-based solutions.

Red Hat was the first to understand the importance and value of the integrated delivery approach in the open source arena. RHEL's tremendous success is due to its quality selection and rock solid integration of freely available components built around Linux kernel, the platform.

SourceLabs with their SASH stack (Spring, Axis, Struts, Hibernate, and later Tomcat) is a glimpse of what can be done for Java in the vein similar to what Red Hat has done for Linux. What SourceLabs lacks is the scale - common requirements of an enterprise project go way beyond SASH.

If the scale, i.e. the range and variety of available components, is not an issue, you might still be better off with such a framework as Grails - an excellent integrated solution for many practical purposes.

Java is an open source platform. As a platform it needs an integrated management solution for the products built on top of it. SourceLabs' SASH and Grails are the steps in the right direction.

Thursday, March 20, 2008

The Best Feature of ExtJS

Recently I had a chance to get up-to-date with JavaScript frameworks.

There has been a lot of changes since the last time I plunged into the subject about a year ago. The most remarkable finding of mine was the ExtJS JavaScript framework.

The version 1.0 of the framework was released in April 2007, the current version being 2.0.2. The framework was quickly picked up by a number of big players such as Adobe, Best Buy, IBM, Siemens, and Visa among the others. The extended list can be found on the ExtJS site.

The broad and fast recognition doesn't feel like a wonder as ExtJS is a crown jewel of JavaScript frameworks. Eye-candy user interface widgets and clean codebase are just a few features that will make a JavaScript developer drool. Have a look at the examples to see it for yourself.

However my favorite feature is not related to the beautiful user interface or the excellent design of the framework. It's about the quality enterprise developers appreciate: smooth integration with other frameworks.

ExtJS was originally developed as an extension of Yahoo UI library (the original name of the framework was yui-ext). While currently the framework can be used standalone, it is possible to use it on top of three other JavaScript frameworks: YUI, jQuery, and Prototype/Scriptaculous.

You guessed it right. This is the protection of your current JavaScript technology investment. This is the flexibility of your technology portfolio.

Adding ExtJS to my JavaScript toolbox.

Sunday, March 16, 2008

Enterprise Features of Grails

I've just finished reading The Definitive Guide to Grails, an excellent book by Graeme Rocher.

While there is a lot of interesting content in the book, I'd like to highlight a few Grails features that are relevant in the context of enterprise software engineering as these features usually evade basic tutorials and getting started guides.

Services

You don't have to jam your business logic into the controllers. A Grails service class feels like a natural place for it. And the service class can be easily injected into the controller via a simple naming convention.

Transactions

Transaction support in a service class can be enabled via a single line of code:

def transactional = true

The declaration above will presumably make all the methods in the class transactional with the transaction propagation semantics of required.

For a fine-grained transaction control one might want to tap into the rich transaction support provided by Spring framework.

Security

Acegi Security (now Spring Security) can be integrated into an application. Acegi Security 1.0 configuration is admittedly bulky. This changed to the better in version 2.0. Hopefully a future release of Grails will organically integrate with Spring Security 2.0.

Enterprise Application Integration

A great deal of engineering effort in the enterprise is spent for interfacing with legacy systems. Creating a brand new database is a luxury that is rarely affordable, there are gobs or Java code out there, and service-oriented architecture is beginning to yield tangible results. To tackle these issues Grails provides custom ORM, direct Spring dependency injection, and seamless Java integration.

If you are an enterprise architect, put Grails on your technology watch list.

Wednesday, March 12, 2008

Google CMS

Right, I made it up. There is no such a thing as of now. There is Google Page Creator aka Google Web Pages in the Google Apps land... Which was the source of inspiration for this post.

It must be in a deep beta as there is no mention of Web Pages on the Google Apps wecome page. Nonetheless, login to your Google Apps account and it is there at your disposal.

There is not much there at this point. You can sketch a quick page based on a handful of fairly similar templates and a couple of basic layouts. CSS is not directly supported meaning there is no (conventional) way of customizing a template or a layout and you have to resort to Javascript CSS hacks if you want to do so.

Now with all that Google Sites hype it seems like the guys are serious about carving a piece of the enterprise hosted applications pie. And the next logical step seems to be a hosted content management system. No, I'm not talking about Page Creator/Web Pages. I'm taking about a real CMS where you can compose pages out of reusable blocks, plug in modules providing extended functionality, and change your page layout and look and feel as you deem appropriate.

Ironically, such systems are a download away. The options range from Drupal to Alfresco. It's interesting that there's nothing to buy here - the options are all open source. It wouldn't be too far-fetched to imagine a Google-branded hosted version of one of the excellent open source content management systems. Which one largely depends on the synergies between Google technology and the CMS technology.

Google is known for having the infrastructure that scales. What's unclear is whether they have the talent to comfortably branch and maintain an open source product. I hope they do.

Whatever they say, Google still has a chance in the enterprise. I'm waiting for Google CMS.

Sunday, March 9, 2008

JMX Monitoring of Ehcache

<This post was migrated from my wiki site, which I decided to dispose of>

I was recently tasked with the configuration of JMX monitoring of ehcache in Hibernate-backed JPA environment glued with Spring.

As you can see there are five elements here that need to be integrated into a single whole: ehcache, JMX, Hibernate, JPA, and Spring.

Having looked around, I found a fairly close shot - a blog post by Max Poon that deals with all the sought for aspects with the exception of Spring. This, as well as the fact that in the blog the action happens in NetBeans, JSF, GlassFish world rather than in my world of Eclipse, Struts, Spring, and Tomcat, prompted me to look further.

My next stop was Struts 2 tutorial. Here the speech was about Struts (expected, right?), Hibernate, JPA, and Spring. The environment felt close to home and I decided to take it as a foundation and throw in bits and pieces from Mr. Poon's blog post to arrive to the destination. Being in the "get things done" mood, I came up to a minimalistic setup with a single cached persistent entity - quickstart.model.Person - to serve as the example.

The end result in attached.

There is an Eclipse project under src/main directory that can be imported into your Eclipse-based IDE. Before doing so make sure you ran the following Maven goal:

mvn dependency:copy-dependencies

to populate target/dependency directory with the jar files.

Below are the notes for the curious.

All the Hibernate properties go into the persistence.xml file:

<persistence-unit name="punit">
<properties>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider" />
<property name="hibernate.cache.use_minimal_puts" value="false" />
<property name="hibernate.cache.use_query_cache" value="true" />
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_structured_entries" value="true" />
<property name="hibernate.ejb.classcache.quickstart.model.Person" value="read-write" />
</properties>
</persistence-unit>

applicationContext.xml defines a jmxAgent bean and the beans it depends on:

<bean id="mbeanServer" class="java.lang.management.ManagementFactory" factory-method="getPlatformMBeanServer" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<bean id="jmxAgent" class="quickstart.util.JmxAgent" init-method="init">
<property name="mbeanServer" ref="mbeanServer" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>


JmxAgent.java contains the MBean registration code:

public void init() throws Exception {

EntityManager entityManager = null;
SessionFactory sessionFactory = null;
try {

entityManager = entityManagerFactory.createEntityManager();
Session session = (Session) entityManager.getDelegate();
sessionFactory = session.getSessionFactory();

} finally {

if (entityManager != null) {

entityManager.close();

}

}

// Enable Hibernate JMX Statistics
ObjectName on = new ObjectName("Hibernate:type=statistics,application=quickstart");
StatisticsService statsMBean = new StatisticsService();
statsMBean.setSessionFactory(sessionFactory);
statsMBean.setStatisticsEnabled(true);
mbeanServer.registerMBean(statsMBean, on);

// Enable Ehcache JMX Statistics
CacheManager cacheMgr = CacheManager.getInstance();
ManagementService.registerMBeans(cacheMgr, mbeanServer, true, true, true, true);

}


Alternative Spring Configuration (contributed by a visitor)

<!-- Spring bean for Hibernate Statistics -->
<bean id="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService">
<property name="statisticsEnabled" value="true"/>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<!-- Spring initialization of ehCache's mbeans -->
<bean id="ehCacheMBeanRegistration" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="net.sf.ehcache.management.ManagementService.registerMBeans"/>
<property name="arguments">
<list>
<ref bean="cacheManager"/>
<ref bean="mbeanServer"/>
<value>true</value>
<value>true</value>
<value>true</value>
<value>true</value>
</list>
</property>
</bean>

<!-- Spring JMX bean server and exporter -->
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true"/>
</bean>

<bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="category=statistics,name=hibernate" value-ref="hibernateStatisticsMBean"/>
</map>
</property>
<property name="server" ref="mbeanServer"/>
...
</bean>

<!-- Beans referenced by JMX MBeans -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
...
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop>
<prop key="hibernate.generate_statistics">true</prop>
</props>
</property>
</bean>

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache-hibernate.xml"/>
</bean>

Comment by a visitor:
To make the EHCache statistics work I had to set the shared property on the EHCacheManagerFactoryBean to true, like so:

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml"/>
<property name="shared" value="true"/>
</bean>

Saturday, March 8, 2008

Google Sites

There has been a lot of buzz around Google Sites recently. Naturally, I decided to feel what it is by touch.

While I respect Google’s desire to position the service as the SharePoint killer, let’s say there is a gap between them the size of Grand Canyon and move on.

Below are my thoughts on where the service is realistically positioned in terms of market segment and competition and what might be useful additions to it.

It took Google solid 16 months to turn one of the best wiki services around - JotSpot - into… a good wiki service. Google Sites’ idea of collaboration revolves around the wiki concept. The incumbents here, in the enterprise play, are Socialtext, Jive Software’s Clearspace X, and PBWiki. I can imagine Google having hard time to displace any of these based on its current offering.

How might Google better its offering then?

If you look at Sites’ page templates you’ll see list templates like Issue List and Unit Status. These are supposed to be used for bug tracking and project management, respectively. I’m not gonna laugh at it as I saw things done this way even in the enterprise on a few occasions. However, under most circumstances the project teams want to use some sort of specialized tool for either task and this is where Google Sites improvement potential lies.

SugarCRM comes to mind as the first candidate for integration into Google Apps family, be it the acquisition way or otherwise. This will cover both holes mentioned above and provide a host of enterprise-relevant features on top of that.

Basecamp provides an outstanding project management service. Integrating it, or interacting with it, will be highly beneficial.

There are other conceivable integration options ranging from Mantis bug tracking system to Drupal CMS.

The corollary… Google should create or improve, by either developing in-house or acquiring, specialized collaboration components to make Google Apps (and Google Sites, the integration hub of it) relevant in the enterprise.

Wednesday, March 5, 2008

IDE for Grails

Question: What are the options for selecting an IDE for Grails?

Answer: There’s just one - Intellij IDEA

Hey, wait a minute, you might say. What about Eclipse plugin for Grails?

It has a long way to go to get there. Currently it’s an awkward baby who wants to be the center of attention. Hopefully, it will become a real helper when it grows up.

Grails create-app command creates an Eclipse project. I feel good about it as it manifests the understanding in the Grails community of Eclipse importance as a development platform. The community should make the next logical step and come up with a competitive support for Grails development in Eclipse.

Eclipse-based IDEs are a de facto standard in the enterprise. Grails will not see a significant level of enterprise adoption before it gets along with Eclipse.