PlanetJava

July 02, 2009

The Aquarium

GlassFish Adoption Report for May '09

ALT DESCR

I've posted the May 09 GlassFish Adoption Report. Some growth from April 09, but not back to the March 09 peak; probably some seasonal drop, possibly some impact from the Oracle announcement.

The full report includes the usual download data for run-time and tools bundles, a comparison with JBoss downloads, GeoMap, Registration and Update Center.

I expect to post the June report next week.

by pelegri at July 02, 2009 11:59 PM

Tim Bray

Junepix 2: Purple on Purple

The title about says it; both kinds of purple are flowers.

Medium purple blossoms against small purple blossoms

The little ones are a ground-cover recommended by a professional gardener for our front yard; since the kids play out back, we don’t want to be defending a grass lawn from moss and creeping buttercup and dandelions and all the other enemies. This stuff just spreads out and covers up and you can walk on it a bit while you’re gardening. Don’t know what it’s called.

Don’t know what the larger purple flowers are either.

July 02, 2009 11:13 PM

Tim Bray

Slow REST

We’re working on a fairly substantial revision of the Sun Cloud API, motivated by this problem: In a RESTful context, how do you handle state-changing operations (POST, PUT, DELETE) which have substantial and unpredictable latency?

What we’ve learned, from work with our own back-end based on the Q-layer technology and with some other back-ends, is that Cloud operations are by and large not very fast; and that the latencies show up in weird places. Here’s an example: in our own implementation, creating a Virtual Machine from a template or by copying another VM instance is very snappy. But weirdly, connecting a network (public or private) to a VM can sometimes be extremely slow. Go check out other implementations like EC2 and you see a similar unpredictable-latency narrative.

The idiom we’d been using so far was along these lines:

  • As with both AtomPub and Rails, when you want to create something new you POST it to a collection of some sort and the server comes back with “201 Created” and the URI of the new object.

  • When you POST to some controller (for example “boot a machine”) or do a DELETE, the server comes back with “204 No content” to signal success.

This is all very well and good; but what happens when some of these operations take a handful of milliseconds and others (e.g. “boot all the VMs in this cluster”) could easily go away for several minutes.

The current thinking is evolving in the Project Kenai forums, and was started up by Craig McLanahan in PROPOSAL: Handling Asynchronous Operation Requests. Check it out, and put your oar in if you have something better in mind.

To summarize: For any and all PUT/POST/DELETE operations, we return “202 In progress” and a new “Status” resource, which contains a 0-to-100 progress indicator, a target_uri for whatever’s being operated on, an op to identify the operation, and, when progress reaches 100, status and message fields to tell how the operation came out. The idea is that this is designed to give a hook that implementors can make cheap to poll.

We also thought about a Comet style implementation where we keep the HTTP channel open, and that can be made clean but support for it in popular libraries is less than ubiquitous. My personal favorite idea was to use “Web hooks”, i.e. the client sends a URI along with the request and the server POSTs back to it when the operation is complete. But every time I started talking about it I ran into a brick wall because it probably doesn’t work for a client behind a firewall, which is where most of them will be. Sigh.

There are a few points that are still troubling me, listed here in no particular order:

  • When an operation is finished and you want to provide a Status code, we’re re-using HTTP status codes. Which on the one hand seems a bit outside their design space, but on the other hand maybe it’s a wheel we don’t have to re-invent.

  • Instead of having the “op” field, we could have a different media-type for each imaginable kind of Status resource. That might be a bit more RESTful but seems a less convenient to use for client implementors.

  • This whole notion of the target_uri makes me wonder if we’re missing a generalization. The most obvious role is when the Status is that of a create operation, for example Create New VM; then the target_uri is the new resource’s URI, what would come back in the Location HTTP header in a synchronous world.

    And in a few cases you might want more than one target, for example when you’re attaching an IP address to a VM.

    Hmmm.

  • Speaking of generalization, I wonder if this whole “Slow REST” thingie is a pattern that’s going to pop up again often enough in the future that we should be thinking of a standardized recipe for approaching it; the kind of thing that has arisen for CRUD operations in the context of AtomPub and Rails.

What do you think?

July 02, 2009 10:58 PM

Planet Eclipse

Tom Schindl: E4 – A new area for RCP/RIA-Applications



I’m on the road to prepare my example for the E4 talk I’m delivering on the Eclipse-Developers-Day in Karlsruhe and I have to say that in my eyes E4 is going to open up a new world for Eclipse-RCP-Developers.

Though RCP-Applications written in 3.x might not look too bad no one can deny that the UI-Design is coming from an IDE background and compared to modern Web-UIs it looks boring (which is not a bad thing per se for business applications). The problem in 3.x is that it is very hard to impossible to change the L&F of your application.

E4 provides different multiple solutions to fix the L&F:

  1. Declarative-Styleing through CSS
  2. The possibility to define your own renderes to exchange Widget A through Widget B if CSS is not enough to theme your application

To demostrate what you can achieve when you combine the 1st and 2nd possibility I create a small screencast

where you see the famous E4-Photo-Application revamped

E4 Photo Demo

A second example application is our E4-Contacts-Demo created and maintained by Kai Tödter which shows advanced css-styles like radial gradients.

Contacts Demo

I use this application to show you another nice thing you can do with E4’s declarative styling support. You can adjust the styling of your application while it is running so that you can experiment with various font and color settings WITHOUT shutting down your application.

If all this would not be enough you can run the unmodified code (please take this literally) from the example application above in your browser using the RAP-Framework.

E4-Rap-Screenshot

If you are interested in E4 and what’s going on behind the scenes of the next major Eclipse-Release I hope to see you in Karlsruhe on Tuesday July 7th.







July 02, 2009 10:38 PM

The Server Side

Registration Now Open for The Ajax Experience 2009

Registration is now open for Ajaxian.com's <a href="http://ajaxexperience.techtarget.com/conference/index.html?Offer=AEtsspost701">The Ajax Experience</a>. If you're developing applications using Ajax, you don't want to miss this event taking place September 14-16 in Boston. Register before the end of this month to lock in $300 early bird savings.



by Peter (Varhol@nospam.com) at July 02, 2009 07:05 PM

Planet Eclipse

Martin Lippert: Slides from Talk at Java-Forum-Stuttgart 2009

Today I gave a talk on building dynamic applications with OSGi at the Java-Forum-Stuttgart 2009. This was mostly the talk I gave (and prepared) together with Kai Tödter and Gerd Wütherich for previous conferences. Here are the slides:

The talk were in the main hall of the conference center and it was fun standing on that huge stage... :-) And of course I got completely confused during the talk while switching between the demo application and a slide showing a screenshot of that demo app - picking up every possible embarrassment... ;-)

by Martin Lippert (noreply@blogger.com) at July 02, 2009 06:33 PM

Planet Eclipse

Bryan Hunt: Running Rational Team Concert (Jazz) on Eclipse 3.5 / Mac OS X



Rational Team Concert 2.0 has been released. With a little work, you can get the client running on Eclipse 3.5 and the server running on Mac OS X.

Server

The Jazz team does not officially support running the server on OS X, and a download that runs on OS X out-of-the-box is not available.  With a couple of minor modifications, the Linux server download will run on OS X just fine.

  1. Download the Express C Server for Linux.
  2. Unzip the download
  3. Launch the Terminal
  4. cd jazz/server
  5. rm -rf jre (the Linux JRE is obviously not needed on OS X)
  6. Edit tomcat/conf/server.xml.  You need to modify the Connector specification for port 9443.  Search for SSL_TLS and change it to TLS.  Also change the next line from IbmX509 to SunX509.  The resulting Connector specification should look like:
  7. <Connector port="9443"
                   connectionTimeout="20000"
                   maxHttpHeaderSize="8192"
                   maxThreads="150"
                   minSpareThreads="25"
                   maxSpareThreads="75"
                   enableLookups="false"
                   disableUploadTimeout="true"
                   acceptCount="100"
                   scheme="https"
                   secure="true"
                   clientAuth="false"
                   keystoreFile="ibm-team-ssl.keystore"
                   keystorePass="ibm-team"
                   sslProtocol="TLS"
    			   algorithm="SunX509"
    			   URIEncoding="UTF-8" />
    
  8. Edit server.startup and server.shutdown changing JRE_HOME from `pwd`/jre to /System/Library/Frameworks/JavaVM.framework/Home
  9. Launch the server ./server.startup

If you want to make sure the server started correctly, you can tail -f tomcat/logs/catalina.out and watch the server startup.  If you see any exceptions thrown, something went wrong.  If all goes well, the last message you see in the log should be:

INFO: Server startup in xxxxx ms

To get started right away, launch Safari and point it to https://localhost:9443/jazz login with User: ADMIN and Password: ADMIN.  You can use this admin account to create a personalized account.  Don’t forget to give yourself a Developer license.

Client

These instructions are not specific to Mac OS X – they should work for any OS.

The Jazz team does support a Mac OS X Client as an incubator project, but the client is based on Eclipse 3.4.  You can download the client and get the jazz bundles to work in an Eclipse 3.5 environment.   The Jazz client has dependencies on the following features:

With the exception of SDO, all of the features can be installed from the Galileo update site.  To get SDO, add the EMF releases update site and install the SDO runtime from the EMF 2.4.2 release.

From the downloaded client, move all of the sub-folders in jazz/client/eclipse/jazz to your Eclipse 3.5 dropins folder.  You could use P2 to install the contents of those sub-folders; however, you must manually check every bundle to be installed.  I’d rather spend 10 seconds doing a drag-and-drop rather than 15 minutes checking checkboxes.

After you launch the client, you should be able to open the Team Artifacts view and create a connection to the repository at https://localhost:9443/jazz

Next Steps

See the Jazz web site for tutorials on getting started.

July 02, 2009 06:22 PM

Java.net Weblogs

Rails on GlassFish - "most performant of all", "simpler and just works", "blazing speed"

Here are some quotes about running Rails applications on GlassFish from user@jruby mailing list: I find the glassfish gem to be the most performant of all -- and I don't need to war-up my app. I also have some mongrel cluster stuff, but...

by Arun Gupta at July 02, 2009 06:02 PM

Planet Eclipse

Dave Carver: XText for RelaxNG

So, I decided to try and create an XText Grammar for the RelaxNG Compact Syntax. Mixed results so far, mainly having to do with my lack of knowledge on the XText grammar and it's mapping to EBNF.



Here is what I have so far:







grammar org.oasisopen.relaxng with org.eclipse.xtext.common.Terminals



generate relaxng "http://www.oasis-open.org/relaxng"



terminal Letter:

ID;



terminal CHAR:

'#x9' | '#xA' | '#xD' | ('#x20'..'#xD7FF') | ('#xE000'..'#xFFFD') | ('#x10000'..'#x10FFFF');



terminal NewLine:

'#xA' | '#xD' | ('#xA' '#xD');



terminal NameStartChar:

":" |

('A'..'Z') |

"_" |

('a'..'z') |

('#xC0'..'#xD6') |

('#xD8'..'#xF6') |

('#xF8'..'#x2FF') |

('#x370'..'#x37D') |

('#x37F'..'#x1FFF') |

('#x200C'..'#x200D') |

('#x2070'..'#x218F') |

('#x2C00'..'#x2FEF') |

('#x3001'..'#xD7FF') |

('#xF900'..'#xFDCF') |

('[#xFDF0'..'-#xFFFD') |

('#x10000'..'#xEFFFF');



terminal NameChar:

NameStartChar | "-" | "." | ('0'..'9') | '#xB7' | ('#x0300'..'#x036F') | ('#x203F'..'#x2040');



Model :

(elements += TopLevel);



TopLevel:

Decl* (Pattern | GrammarContent*);



Decl:

'namespace' (IdentifierOrKeyWord '=' NamespaceURILiteral) |

'default' 'namespace' (IdentifierOrKeyWord) '=' NamespaceURILiteral |

'datatypes' IdentifierOrKeyWord '=' Literal;



Pattern:

'element' NameClass '{' Pattern '}' |

'attribute' NameClass '{' Pattern '}' |

Pattern (',' Pattern)+ |

Pattern ('&' Pattern)+ |

Pattern ('|' Pattern)+ |

Pattern '?' |

Pattern '*' |

Pattern '+' |

'list' '{' Pattern '}' |

'mixed' '{' Pattern '}' |

Identifier |

'parent' Identifier |

'empty' |

'text' |

(DataTypeName) DataTypeValue |

DataTypeName ('{' Param* '}') (ExceptPattern) |

'notAllowed' |

'external' AnyURILiteral (Inherit) |

'grammar' '{' GrammarContent* '}' |

'(' Pattern ')';



Param:

IdentifierOrKeyWord '=' Literal;



ExceptPattern:

'-' Pattern;



GrammarContent:

Start | Define |

'div' '{' GrammarContent* '}' |

'include' AnyURILiteral (Inherit) ('{' IncludeContent* '}');



IncludeContent:

Define | Start |

'div' '{' GrammarContent* '}';



Start:

'start' AssignedMethod Pattern;



Define:

Identifier AssignedMethod Pattern;



AssignMethod:

'=' |

'|=' |

'&=';



NameClass:

Name |

NsName (ExceptClassName) |

AnyName (ExceptClassName) |

NameClass '|' NameClass |

'(' NameClass ')';



Name:

IdentiferOrKeyWord | CName;



ExceptNameClass:

'-' NameClass;



DataTypeName:

CName |

'string' |

'token';



DataTypeValue:

Literal;



AnyURILiteral:

Literal;



NamespaceURILiteral:

Literal | 'inherit';



Inherit:

'inherit' '=' IdentifierOrKeyWord;



IdentifierOrKeyWord:

Identifier | KeyWord;





Identifier:

(NCName .. KeyWord) |

QuotedIdentifier;





CName:

NCName ':' NCName;



NsName:

NCName ':*';



AnyName:

'*';



Literal:

LiteralSegment ('~' LiteralSegment)+;



LiteralSegment:

'"' (CHAR .. ('"' | NewLine))* '"' |

"'" (CHAR .. ("'" | Newline))* "'" |

'"""' (('"') ('"') (CHAR .. '"'))* '"""';



KeyWord:

"attribute"

| "default"

| "datatypes"

| "div"

| "element"

| "empty"

| "external"

| "grammar"

| "include"

| "inherit"

| "list"

| "mixed"

| "namespace"

| "notAllowed"

| "parent"

| "start"

| "string"

| "text"

| "token";



NCName:

NCNameStartChar NCNameChar*; /* An XML Name, minus the ":" */



NCNameChar:

NameChar - ':';



NCNameStartChar:

Letter | '_';



Name:

NameStartChar (NameChar)*;



Names:

Name ('#x20' Name)*;



Nmtoken:

(NameChar)+;



Nmtokens:

Nmtoken ('#x20' Nmtoken)*;



QuotedIdentifier:

'\' NCName;





Some of the errors I can figure out...others are just baffling. Particular the ones where it can't find the Rule even though it's been editted. Help from the XText gurus out their would be appreciated.

by David Carver (noreply@blogger.com) at July 02, 2009 05:03 PM

Planet Eclipse

BioClipse: Bioclipse 2.0 Release Candidate 5



Today, Bioclipse 2.0 Release Candidate 5 (versioned 2.0.0.RC5) was released with primarily a fix in the atom typing done when editing chemical structures, and a less stricter handling of SDFiles. The release requires a fresh download from Sourceforge, and we kindly ask beta-testers for bug reports on the bugs.bioclipse.net.



by Ola Spjuth (noreply@blogger.com) at July 02, 2009 03:13 PM

Planet Eclipse

Sven Efftinge: Xtext scopes and EMF index in action

This is a post about scoping and how to use the EMF index for that. It is in some sense a practical follow up on another blog post about the general idea behind indexing and scoping in Xtext. The topic is somewhat advanced and bleeding edge. This post describes the needed steps to get the current index based default scoping up and running. I've prepared a small screencast demonstrating the result in action. The example language can be downloaded from here.









Today, the common way to do cross resource references in Xtext is to do it via resource URIs. That is if you want to reference a model element (EObject) from another resource, you typically put the whole resource on the scope by adding a corresponding import. Example:

import "platform:/resource/my.project/src/othermodel.dsl"



//.. refer to elements from othermodel.dsl
The corresponding default scoping is very simplistic. Every object in the current resource and in the referenced resources can be referenced by its simple name (as long as it has a 'name').



Although this is very easy to understand, it has it's limitation when it comes to more sophisticated design. If you for instance want to hide some elements or have duplicate simple names in different packages (this can be the case if you use elements, which are developed by others).



In many programming languages we have the notion of namespaces, which are much more flexible and powerful. Java, for instance, is file system agnostic. Although it forces you to put the files into folders which correspond the packages, it ultimately is just based on namespaces (packages, types).

That said Java's namespace mechanism is also a bit limited. For instance I cannot have imports in nested namespaces but only per file. And I cannot nest packages but only classes and interfaces.



Scala and C# both allow to have multiple nested packages within one file and you can put imports per namespace, so that imported names are only visible within that namespace.



In order to demonstrate how to use the index together with Xtext, I've implemented a DefaultIndexBasedScopeProvider which implements a similar semantic. There's a small example I've prepared, where you can see how it can be used. It is mainly a matter of configuring the different implementations with Guice. Programming is not needed as long as you're happy with the defaults.



Here's how it works



The index registeres a builder, which is invoked on resource changes. In order to make your model elements visible, you'll have to contribute a so called Indexer using an extension point.

<extension point="org.eclipse.emf.index.indexer">

<indexer class="org.eclipse.xtext.example.DomainmodelExecutableExtensionFactory

:org.eclipse.xtext.index.DefaultDeclarativeResourceIndexer"

fileextensions="dmodel"/>

</extension>

Please ignore the ExecutableExtensionFactory, which is declared in order to make any executable extension Guice aware, that is you can use dependency injection. This is a different topic and might be covered by another blog post.



The actual class to be instantiated is the one after the colon (':'): The DefaultDeclarativeResourceIndexer, which delegates to an instance of IQualifiedNameProvider, which itself is injected. This means that its implementation can be arbitrarily changed.

The contract of a name provider is very simple: it computes a qualified name for an element, if it returns null, the element is not indexed and hence not referable.



By default we use a DefaultDeclarativeQualifiedNameProvider, which if not otherwise specified looks up a simple name (if there's an attribute 'name') and concatenates it to the qualified name of its parent. It's named 'declarative' because you're able to change the described default behavior per type by just adding a method like this:

String qualifiedName(MyType foo) {

// compute different qualified name for MyTypes

// ...

}
It will automatically dispatch to this method as soon as it has to compute a qualified name for an instance of MyType.



With this in place we'll have our elements automatically indexed as long as they are in a project, which have the index nature enabled. Being indexed means that they are globally visible by their qualified name, which is comparable to how public Java elements are globally visible as soon as they are on the classpath.



What's next?



In order to use the index and have it injected into your components (e.g. your scope provider) you'll have to configure the singleton instance from the index bundle into your Guice module. In the example the corresponding binding goes into the UI module and looks like this:

public IndexStore bindIndexStore() {

return EmfIndexUIPlugin.getDefault().getIndexStore();

}
With that in place you can inject the index store by just adding a dependency in your code:

@Inject

private IndexStore store;
Guice will automatically put the instance into such declared dependencies.

Now that we have a binding for IndexStore we can add the index based scoping to the runtime module:

public IndexStore bindIndexStore() {

return new PersistableIndexStore();

}



@Override

public Class bindIScopeProvider() {

return DefaultIndexBasedScopeProvider.class;

}
Note the additional IndexStore binding, which is overridden by the binding we previously added to the UI module, but is needed in order to use this stuff at runtime (i.e. without running within exquinox). So it gets active as soon as you run without UI.



How the DefaultIndexBasedScopeProvider works



The DefaultIndexBasedScopeProvider

- looks up EAttributes with name 'importNamespace'

- and translates the globally unique qualified name into shorter ones using those import statements.



By default qualified names with or without a wildcard at the end are supported. For an import of a qualified name the simple name is made available as we know from e.g. Java, where

import java.util.Set;
makes it possible to refer to 'java.util.Set' by its simple name 'Set'.

Contrary to Java the import is not active for the whole file but only for the namespace it is declared in and its child namespaces. That is why you can write the following in the example DSL:

package foo {

import bar.Foo

entity Bar extends Foo {

}

}



package bar {

entity Foo {}

}
Of course the declared elements within a package are as well referable by their simple name:

package bar {

entity Bar extends Foo {}

entity Foo {}

}
Of course the following would as well be ok:

package bar {

entity Bar extends bar.Foo {}

entity Foo {}

}

Disclaimer

All this is in a very early stage. The index is not finished and its architecture is not settled down yet. Also the scope provider implementation might be changed in future (I'm sure it will).

Additionally, there are other things around this which we have to work on before considering this mature.



But as I know that there are a lot of bleeding edge users out there, I wanted to share the current state, so you might find a starting point to play with it. The index is an enabler for more advanced functionality in Xtext and in EMF based development in general. So expect it to become an important part in Eclipse Modeling.



Feedback is highly appreciated and should either go to the newsgroup for Xtext (the scoping part) or to the EMFT newsgroup (the index part), because the index project is a component under EMFT.

by Sven Efftinge (noreply@blogger.com) at July 02, 2009 02:29 PM

Planet Eclipse

Vasanth Dharmaraj: Portable Eclipse and Portable Java

I like portable software. I carry around a bunch of them in my flash drive. I just found out that both Java and Eclipse are available as portable versions at PortableApps.com. The Java version they have is Java 6 update 14 but Eclipse is stuck at 3.4.2.

Eclipse uses portable Java, so Java need not be installed in the PC to run it. Nice. The portable version has some trouble finding the workspace but once you correct the path it works fine.

I updated the Eclipse binaries in to the just released 3.5 and it work great too. Nice way to take Eclipse and your work with you.

Related posts:

  1. Eclipse Tip: Keeping plugins and workspace separate
  2. Eclipse Tip: Java Editor Breadcrumb Navigation Bar
  3. Eclipse Tip: Sharing Java project settings
  4. Eclipse Tip: Grouping Java Problems
  5. Java rides on Google App Engine

July 02, 2009 02:24 PM

InfoQ

Presentation:Bindings, Platforms, and Innovation

Bob Frankston offers a vision of the Internet that focuses on communication and connection uninhibited by artificial barriers like carrier exclusivity, arbitrary differences in protocols, and vendor constraints. He uses stories as his organizing and presentational metaphor to share a vision of what could be, if we had free reign to follow our imagination. By Bob Frankston

by Bob Frankston at July 02, 2009 02:07 PM

Planet Eclipse

Ed Merks: Talking About Connected Data Objects

My personal Berlin tour guide, Eike Stepper, and I did a Galileo Series Podcast about CDO with James Sugrue the other day.





Eike and his rapidly growing team are doing some extremely cool things with CDO, so you might be interested to find out more.

by Ed Merks (noreply@blogger.com) at July 02, 2009 01:46 PM

Java.net Weblogs

How to Start and Grow a JUG: Community Corner 2009 Podcast

Have you ever thought about starting a Java User Group? Matt Stine spoke with me at JavaOne about his experiences with starting and growing the Memphis/Mid-South Java User Group in a java.net Community Corner podcast... Also:

Java Today: The ATM Object-Oriented Design and Implementation Case Study; JUG Leadership: Lessons Learned; and Hudson Growth - Plugins, Jobs, Eclipse.

Weblogs: What is new with Pivot?; ; and Attaching Security Policies to Individual Operations.

Forums: SUNONE APP Server 8.2 and JMX MBeanServer; NEED HELP!! how to Display IMEI number on Java ME emulator device; and Invalid user or password after undeploy.

Featured Articles: Grails and Continuous Integration: An Essential Combo; Exposing Domain Models through the RESTful Service Interface, Part 1.

Featured Podcast: Java Mobility Podcast 81: JTDF.

by Kevin Farnham at July 02, 2009 01:45 PM

The Server Side

predic8 Announces Open Source SOAP Monitor

Predic8 announces an open source release of its Web Services monitoring tool <a href="http://www.predic8.com/open-source/soap-monitor/">Membrane Monitor</a>



by Thomas (Bayer@nospam.com) at July 02, 2009 12:33 PM

The Server Side

NextReports 2.3 - Java Reporting Tool

NextReports is an Ad Hoc Query and Reporting tool that promotes simple, fast and powerful report creation.



by Mihai (Dinca@nospam.com) at July 02, 2009 12:31 PM

The Server Side

Experience Model Driven Development with Taylor MDA 1.3.0

The Taylor team is pleased to announce the release of <a href="http://taylor.sourceforge.net">Taylor MDA 1.3.0</a>.<br><br>Taylor MDA is an open source, Eclipse-based UML modeling and code generation tool. It leverages a convention-based code generation approach plus stereotypes to generate the maximum amount of code from streamlined UML models.



by John (Gilbert@nospam.com) at July 02, 2009 12:29 PM

The Server Side

IntelliJ IDEA 9M1: Advanced Support for Newest Technologies

JetBrains have released IntelliJ IDEA 9 Milestone 1, a ready-to-use preview with new support for Java EE6, PHP, Google App Engine, GWT, Android, OSGi, Tapestry, JavaScript Debugger, and more.



by Ilia (Dumov@nospam.com) at July 02, 2009 12:29 PM

Planet Eclipse

Greg Wilkins: Continuations to Continue

Jetty-6 Continuations introduced the concept of asynchronous servlets to provide scalability and quality of service to web 2.0 applications such as chat, collaborative editing, price publishing, as well as powering HTTP based frameworks like cometd, apache camel, openfire XMPP and flex BlazeDS.

With the introduction of similar  asynchronous features in Servlet-3.0, some have suggested that the Continuation API would be deprecated.  Instead, the Continuation API has been updated to provide a simplified portability run asynchronously on any servlet 3.0 container as well as on Jetty (6,7 & 8).  Continuations will work synchronously (blocking) on any 2.5 servlet container. Thus programming to the Continuations API allows your application to achieve asynchronicity today without waiting for the release of stable 3.0 containers (and needing to upgrade all your associated infrastructure).

Continuation Improvements

The old continuation API threw an exception when the continuation was suspended, so that the thread to exit the service method of the servlet/filter. This caused a potential race condition as a continuation would need to be registered with the asynchronous service before the suspend, so that service could do a resume before the actual suspend, unless a common mutex was used.  

Also, the old continuation API had a waiting continuation that would work on non-jetty servers.  However the behaviour of this the waiting continuation was a little different to the normal continuation, so code had to be carefully written to work for both.

The new continuation API does not throw an exception from suspend, so the continuation can be suspended before it is registered with any services and the mutex is no longer needed. With the use of a ContinuationFilter for non asynchronous containers, the continuation will now behaive identically in all servers.

Continuations and Servlet 3.0

The servlet 3.0 asynchronous API introduced some additional asynchronous features not supported by jetty 6 continuations, including:

  • The ability to complete an asynchronous request without dispatching
  • Support for wrapped requests and responses.
  • Listeners for asynchronous events

  • Dispatching asynchronous requests to specific contexts and/or resources

While powerful, these additional features may also be very complicated and confusing. Thus the new Continuation API has cherry picked the good ideas and represents a good compromise between power and complexity.  The servlet 3.0 features adopted are:

  • The completing a continuation without resuming.
  • Support for response wrappers.
  • Optional listeners for asynchronous events.

 

Using The Continuation API

The new continuation API is available in Jetty-7 and is not expected to significantly change in future releases.  Also the continuation library is intended to be deployed in WEB-INF/lib and is portable.  Thus the jetty-7 continuation jar will work asynchronously when deployed in jetty-6, jetty-7, jetty-8 or any servlet 3.0 container.

Obtaining a Continuation

The ContinuationSupport factory class can be used to obtain a continuation instance associated with a request:
    Continuation continuation = ContinuationSupport.getContinuation(request);

Suspending a Request

The suspend a request, the suspend method is called on the continuation:
  void doGet(HttpServletRequest request, HttpServletResponse response)

{

...

continuation.suspend();

...

}

After this method has been called, the lifecycle of the request will be extended beyond the return to the container from the Servlet.service(...) method and Filter.doFilter(...) calls. After these dispatch methods return to, as suspended request will not be committed and a response will not be sent to the HTTP client.

Once a request is suspended, the continuation should be registered with an asynchronous service so that it may be used by an asynchronous callback once the waited for event happens.

The request will be suspended until either continuation.resume() or continuation.complete() is called. If neither is called then the continuation will timeout after a default period or a time set before the suspend by a call to continuation.setTimeout(long). If no timeout listeners resume or complete the continuation, then the continuation is resumed with continuation.isExpired() true. There is a variation of suspend for use with request wrappers and the complete lifecycle (see below):

    continuation.suspend(response);

Suspension is analogous to the servlet 3.0 request.startAsync() method. Unlike jetty-6 continuations, an exception is not thrown by suspend and the method should return normally. This allows the registration of the continuation to occur after suspension and avoids the need for a mutex. If an exception is desirable (to bypass code that is unaware of continuations and may try to commit the response), then continuation.undispatch() may be called to exit the current thread from the current dispatch by throwing a ContinuationThrowable.

Resuming a Request

Once an asynchronous event has occurred, the continuation can be resumed:
  void myAsyncCallback(Object results)

{

continuation.setAttribute("results",results);

continuation.resume();

}

Once a continuation is resumed, the request is redispatched to the servlet container, almost as if the request had been received again. However during the redispatch, the continuation.isInitial() method returns false and any attributes set by the asynchronous handler are available.

Continuation resume is analogous to Servlet 3.0 AsyncContext.dispatch().

Completing Request

As an alternative to completing a request, an asynchronous handler may write the response itself. After writing the response, the handler must indicate the request handling is complete by calling the complete method:
  void myAsyncCallback(Object results)

{

writeResults(continuation.getServletResponse(),results);

continuation.complete();

}

After complete is called, the container schedules the response to be committed and flushed.

Continuation resume is analogous to Servlet 3.0 AsyncContext.complete().

Continuation Listeners

An application may monitor the status of a continuation by using a ContinuationListener:
  void doGet(HttpServletRequest request, HttpServletResponse response)

{

...



Continuation continuation = ContinuationSupport.getContinuation(request);

continuation.addContinuationListener(new ContinuationListener()

{

public void onTimeout(Continuation continuation) { ... }

public void onComplete(Continuation continuation) { ... }

});



continuation.suspend();

...

}

Continuation listeners are analogous to Servlet 3.0 AsyncListeners.

 

Continuation Patterns

Suspend Resume Pattern

The suspend/resume style is used when a servlet and/or filter is used to generate the response after a asynchronous wait that is terminated by an asynchronous handler. Typically a request attribute is used to pass results and to indicate if the request has already been suspended.
  void doGet(HttpServletRequest request, HttpServletResponse response)

{

// if we need to get asynchronous results

Object results = request.getAttribute("results);

if (results==null)

{

final Continuation continuation = ContinuationSupport.getContinuation(request);



// if this is not a timeout

if (continuation.isExpired())

{

sendMyTimeoutResponse(response);

return;

}



// suspend the request

continuation.suspend(); // always suspend before registration



// register with async service. The code here will depend on the

// the service used (see Jetty HttpClient for example)

myAsyncHandler.register(new MyHandler()

{

public void onMyEvent(Object result)

{

continuation.setAttribute("results",results);

continuation.resume();

}

});

return; // or continuation.undispatch();

}



// Send the results

sendMyResultResponse(response,results);

}

This style is very good when the response needs the facilities of the servlet container (eg it uses a web framework) or if the one event may resume many requests so the containers thread pool can be used to handle each of them.

Suspend Continue Pattern

The suspend/complete style is used when an asynchronous handler is used to generate the response:
  void doGet(HttpServletRequest request, HttpServletResponse response)

{

final Continuation continuation = ContinuationSupport.getContinuation(request);



// if this is not a timeout

if (continuation.isExpired())

{

sendMyTimeoutResponse(request,response);

return;

}



// suspend the request

continuation.suspend(response); // response may be wrapped.



// register with async service. The code here will depend on the

// the service used (see Jetty HttpClient for example)

myAsyncHandler.register(new MyHandler()

{

public void onMyEvent(Object result)

{

sendMyResultResponse(continuation.getServletResponse(),results);

continuation.complete();

}

});

}

This style is very good when the response does not needs the facilities of the servlet container (eg it does not use a web framework) and if an event will resume only one continuation. If many responses are to be sent (eg a chat room), then writing one response may block and cause a DOS on the other responses.

 

Continuation Examples

Chat Servlet

The ChatServlet example shows how the suspend/resume style can be used to directly code a chat room. The same principles are applied to frameworks like cometd.org which provide an richer environment for such applications, based on Continuations.

Quality of Service Filter

The QoSFilter(javadoc), uses suspend/resume style to limit the number of requests simultaneously within the filter. This can be used to protect a JDBC connection pool or other limited resource from too many simultaneous requests.

If too many requests are received, the extra requests wait for a short time on a semaphore, before being suspended. As requests within the filter return, they use a priority queue to resume the suspended requests. This allows your authenticated or priority users to get a better share of your servers resources when the machine is under load.

Denial of Service Filter

The DosFilter(javadoc) is similar to the QoSFilter, but protects a web application from a denial of service attack (as best you can from within a web application). If too many requests are detected coming from one source, then those requests are suspended and a warning generated. This works on the assumption that the attacker may be written in simple blocking style, so by suspending you are hopefully consuming their resources. True protection from DOS can only be achieved by network devices (or eugenics :).

Proxy Servlet

The ProxyServlet uses the suspend/complete style and the jetty asynchronous client to implement a scalable Proxy server (or transparent proxy).

Gzip Filter

The jetty GzipFilter is a filter that implements dynamic compression by wrapping the response objects. This filter has been enhanced to understand continuations, so that if a request is suspended in suspend/complete style and the wrapped response is passed to the asynchronous handler, then a ContinuationListener is used to finish the wrapped response. This allows the GzipFilter to work with the asynchronous ProxyServlet and to compress the proxied responses.

 

Where do you get it?

You can read about it, or download it with jetty or include it in your maven project like this pom.xml.



July 02, 2009 11:11 AM

Cafe au Lait

Sun has released NetBeans 6.7, its open source IDE for Java.

Sun has released NetBeans 6.7, its open source IDE for Java. New features in this version include: More...

July 02, 2009 09:15 AM

Tim Bray

Junepix 1: Car-Free

I was editing some pictures (which I organize per-month) and realized that there were a ton in the June folder that I’d been meaning to run, and now it’s not June. So let’s populate the first few days of July with some of ’em. First, musical faces of Car-Free Vancouver Day.

The first is self-explanatory.

Harpists at Car-Free Vancouver Day

The second is a few blocks north; DRMHLLR, a spacey sort of jam band, was playing really loud. I was pushing my little toddlergirl and she’s usually pretty sensitive, always telling me to turn down the rock & roll in the car. But as we rolled up she seemed fascinated, so I bashed a couple of bystanders with the stroller to get a front-row spot. She just leaned back and went with the groove; I have high hopes for the girl.

DRMHLLR performs at Car-Free Vancouver Day

That Car-Free day, it’s OK by me. This is on Main and there were thousands and thousands of people there; interesting shopping, good eats, cool beats, and fun people to look at.

The glass on that parchment had broken in transit, so I’d dropped it off at a framing shop on Main for repairs. I wheeled my ice-cream-stained daughter out of the crowd into the shop, and he told me he’d done a huge amount of walk-in business and spent the rest of the day enjoying the show. What’s not to like? Can we do this every month in the summer?

July 02, 2009 08:10 AM

ONJava

Programming Scala

Scala is an exciting, modern, multi-paradigm language for the JVM. You can use it to write traditional, imperative, object-oriented code. But you can also leverage its higher level of abstraction to take full advantage of modern, multicore systems. Programming Scala will show you how to use this powerful functional programming language to create highly scalable, highly concurrent applications on the Java Platform.

by Venkat Subramaniam at July 02, 2009 08:00 AM

Erik Thauvin

Twits du Jour (July 1)

  • A friend of mine just realized that his ex installed a key logger on his computer. Damn, that's pretty hard-core. #
  • I'm fat, and apparently, so are you! bit.ly/Tn6wZ #
  • Erik's Tumbles - Outloud “We Run” bit.ly/zap38 #
  • Getting dinner. Yum. - Photo: bkite.com/098vl #
  • No contingencies for Bubbles (bit.ly/3TS4bY) in Michael Jackson's last will. So sad. bit.ly/RfvQf #
  • Just got done washing the car. Simple green car wash rules. #
  • Getting a late dinner around here is close to impossible. 24hrs McDonald's is closed for cleaning. Denny's grill is shutting down in 20mins. #


by Erik C. Thauvin (erik@thauvin.net) at July 02, 2009 07:00 AM

OSDir.com - Java

Java VM on way for the iPhone

From the JPhone dept.:

Sun Microsystems is developing a Java Virtual Machine for Apple's iPhone and plans to release the JVM some time after June, enabling Java applications to run on the popular mobile device.

July 02, 2009 04:00 AM

OSDir.com - Java

Java for Mac OS X 10.4, Release 6

From the Fresh Brew dept.:

Time to fire up the 'ole Software Update as Apple has just released a Java update for Mac OS X. This update will fix vulnerabilities in both server and client versions of 10.4. Apple explains that, 'A malicious webpage can remove or insert items in the keychain,' which sure doesn't sound good to us.

July 02, 2009 04:00 AM

OSDir.com - Java

Java 6 Available on OSX

From the Fresh Brew dept.:

Many Mac users have been upset that Apple has not made Java 6 available on the platform. Landon Fuller posts that there is a developer preview release available of Java JDK6 on Mac OSX, Tiger and Leopard. It is based on the BSD port of Sun's Java 6 and is made available under the Java Research License.

July 02, 2009 04:00 AM

OSDir.com - Java

Sun Scrapping Mobile Java, Moving Devices to Standard Java

From the Isn't that the one that works? dept.:

Sun's starting to phase out mobile Java (Java Micro Edition) that's been the standard on cellphones and other small devices in favor of their standard edition, which are made for PCs everywhere. Sun VP James Gosling's reasoning for shifting everyone over to Java Standard Edition is because "cellphones and TV set-top boxes are growing up," meaning they're getting enough processing power to handle all the demands of full-featured Java.

July 02, 2009 04:00 AM

OSDir.com - Java

Red Hat CEO Calls on Oracle to Keep Java Open

From the Recipes dept.:

With Oracle set to acquire Sun and gain stewardship over Java, there are many in the tech world with an opinion on how the database giant should handle its new relationship with the programming language.



One of those opinions is being voiced by Red Hat CEO Jim Whitehurst, who is calling on Oracle to keep Java open. During a conference call yesterday to discuss Red Hat's first-quarter fiscal 2010 results, Whitehurst also took aim at Oracle's operating system business.

July 02, 2009 04:00 AM

OSDir.com - Java

Java for Mac OS X 10.5 Update 2

From the Light Lunch dept.:

Apple has just released Java Update 2 for Mac OS X. According to Apple, this update "delivers improved reliability and compatibility for Java SE 6, J2SE 5.0 and J2SE 1.4.2 on Mac OS X 10.5.4 and later."

July 02, 2009 04:00 AM

OSDir.com - Java

Java is finally Free and Open

From the Journey of 1000 Miles... dept.:

...This week the IcedTea Project reached an important milestone - The latest OpenJDK binary included in Fedora 9 (x86 and x86_64) passes the rigorous Java Test Compatibility Kit (TCK). This means that it provides all the required Java APIs and behaves like any other Java SE 6 implementation - in keeping with the portability goal of the Java platform. As of writing, Fedora 9 is the only operating system to include a free and open Java SE 6 implementation that has passed the Java TCK. All of the code that makes this possible has been made available to the IcedTea project so everyone can benefit from the work.



The Java TCK is a complex suite of tools and documentation that verifies that Java implementations conform to the Java specification. It consists of more than 80,000 tests and over 1 million lines of code.

July 02, 2009 04:00 AM

OSDir.com - Java

How to rescue Java from the men in suits

From the Suits Still Control Java dept.:

Members of a JavaOne panel on the JCP, open source and standards have expressed their frustrations with a process they believe puts corporate interests first when it comes to Java. For once, it wasn't just Spring Framework creator and evangelist Rod Johnson calling for change.



Joining him was Sun Microsystems' own, recently recruited, "free and open source software ambassador" Dalibor Topic and representatives from one of the industry's newest Java user group - the Paris JUG - plus one of the largest - Brazil's SouJava. Brazil is a country Sun repeatedly champions when discussing uptake of Java and open source.

July 02, 2009 04:00 AM

OSDir.com - Java

Java SE 6 For Mac OS X

From the 6 dept.:

After a long delay, Apple has finally released a version of Java 6 for OS X. 64-bit Intel Macs are starting to see this pushed out via Software Update...

July 02, 2009 04:00 AM

OSDir.com - Java

Sun looks to free up the rest of Java (again)

From the Buffering.... dept.:

Sun Microsystems is stepping up efforts to boost Java usage in Linux shops by working to remove some final encumbrances in the open-source Java platform.



..."We're hoping to see some movement [with the] Linux distributions in the very near future, hopefully by JavaOne," said Rich Sands, group manager for developer marketing at Sun, in an interview on Tuesday. The JavaOne conference is to be held in San Francisco in two weeks.

July 02, 2009 04:00 AM

Java.net Weblogs

Event Based Programming in JavaFX

I decided to try my hand at some JavaFX programming to see what the language had to offer. Two of the key features of JavaFX are its ability to bind to data, and its access to all Java libraries. I used that to see how it handles for event-based programming. I built this minesweeper game, enjoyed using bind and on replace, and found myself wishing for more.

by David Walend at July 02, 2009 03:23 AM

July 01, 2009

The Server Side

Oracle unveils Oracle Fusion Middleware 11g

Oracle today announced availability of <a href="http://oracle.com/fusionmiddleware11g">Oracle® Fusion Middleware 11g</a>: Complete, integrated and hot-pluggable. This best-of-breed, market-leading middleware suite includes new, innovative capabilities in Oracle WebLogic Suite, Oracle WebCenter Suite, Oracle SOA Suite and Oracle Identity Management.



by Cameron (Purdy@nospam.com) at July 01, 2009 11:10 PM

The Aquarium

VirtualBox 3.0 is out - Multiple Virtual CPU Support (and more)

ALT DESCR

VirtualBox 3.0, is now available for download. This is a major release (PR), most notable is support for guest SMP support - up to 32 vCPUs. Also included is support for OpenGL 2.0 for Windows, Linux and Solaris guests and experimental support for Direct3D 8/9 on Windows guests.

Check the Changelog Details and then go to download page.

Andy has a nice Overview and Podcast; Jeff has an overview focused on Virtual SMP Support. Other Sun reviews come from Rudolf and Homer. Non-Sun reviews include Softpedia, Virtualization Review and an early mention in InfoWeek.

The ZDnet/CNet folks have several reviews on VirtualBox and seem increasingly positive about it - see Jason Perlow's Very Positive Review (earlier last year he had written a V12N Comparison based on VBox 1.6) and Dan Kusnetzky Review; also see their Screenshot Gallery. On the CNetTV, check Tom Merritt's story on Installing Windows 7 RC on VBox.

Finally, this is a very interesting release and I believe it will make a big difference in applicability of VirtualBox, but all major releases "push the envelope" a bit. I'm not in the VirtualBox team but, based on their Release History I'd expect follow-up maintenance releases "soon".

by pelegri at July 01, 2009 10:33 PM

Planet Eclipse

Eric Rizzo: Screencast: Creating an Eclipse download package "from scratch"

If the cave you've been living in does not have Internet service, then perhaps it will come as news to you that Galileo was successfully released last week. It's a truly impressive feat to release so reliably so many projects year after year - you'd think that corporate internal and consumer software projects would take note and figure out what it is that enables the yearly release train to succeed when so many projects deliver late, over budget, or not at all. But, I digress...



Being a recent immigrant to the Nation of Mac, I was among the glad to see the Cocoa port graduate from incubation. However, all is not 100% happy in Eclipse+Mac land. The Eclipse Packaging Project (EPP), the small group that produces those easily consumable downloads, the themed packages of plug-ins built on top of the core platform, has limited resources. And with limited people, they can not produce the packages for every hardware/OS platform on which Eclipse is known to run. Of particular interest to me is the conspicuous absence of EPP package builds for 64-bit OS X. After some discussion, it appears we the community can't make a 64-bit build happen until the first "service release" of Galileo, sometime in the Fall. I'm disappointed, but I (mostly) understand the position that EPP is in.



So, what do we do if we want to make full use of all the 64-bit goodness of our operating system and Java 6 JVM? Well, it turns out that re-constructing the EPP packages from the "base platform" SDK is not all that difficult. Ekke Gentz has already blogged some text+picture instructions; my screencast below brings the process to life.



Note: the URL of the EPP update site used in the screencast is

http://download.eclipse.org/technology/epp/packages/galileo/




by Eric Rizzo (noreply@blogger.com) at July 01, 2009 10:25 PM

Planet Eclipse

Kenn Hussey: On Falling...

It's been just under two years now since I left the mother ship for an opportunity with Embarcadero, and I've seldom looked back... until today. On this day, when most other Canadians are celebrating the birth of our great nation and the freedom it affords its citizens, I'm faced with commemorating a new found freedom of my own. I've been exiled from Cubicle Nation.


This isn't exactly the kind of change I had in mind when I wrote my last blog entry, but I'm committed to facing it with an open mind (seeing as I have no choice). I don't know what I'll be doing for income yet (if you have any suggestions, I'd love to hear them), but in the meantime I thought it would be an apt occasion to take another wordle snapshot of my blog (exactly six months after the last one).




So far, 2009 has been a challenging year. But, a friend of mine told me recently that a kick in the pants is still a step forward, and I'm inclined to agree. I really should be seeing this as more of a beginning than an end, and I'm sure that once I've landed with two feet firmly planted on my next venture, this will be obvious in hindsight. One thing is for certain, though. I'll not be looking back again.

by Kenn Hussey (noreply@blogger.com) at July 01, 2009 10:22 PM

Java.net Weblogs

2 JavaOne Hands On Labs , Sun Technology Exchange, Java Technology Day Israel, and Java Day Turkey

I had a very busy June, I gave two Hands on Labs at JavaOne, two sessions at the Sun Technology Exchange, three sessions at Java Technology Day in Tel Aviv Israel, and one session at Java Day in Istanbul Turkey.

by Carol McDonald at July 01, 2009 10:05 PM

Tim Bray

“Hello World” for Open Data

Recently, Vancouver’s City Council passed an “Open Data, Open Source” motion. I was too busy at the time to pay much attention, which I’ve regretted. Now I’ve started poking around a bit, and turned up an interesting person and an outstanding example.

Open Garbage Data

No, I’m not kidding. This idea was recently floated by David Eaves in How Open Data even makes Garbage collection sexier, easier and cheaper. Seriously; take a moment and read it. If there’s low-hanging fruit in garbage collection [Watch those metaphors. -Ed.] it’s hard not to get excited over what you could build on the raw data about housing and zoning and licensing and traffic and all the other intensely-local things a city has its hands on.

I’ve always liked opening up data resources and have spent my career building technology to support this, but for me this is a powerful abstraction-free “Hello World” example of why.

Meeting David

By an odd coincidence, I already had a date to meet David Eaves, the guy who wrote that piece. He’d come across my radar as one of the people doing work on that Open Everything resolution and then he published a blog piece saying “Who are the people that read this?” and I’d dropped him a note saying “I’m an Internet guy who likes what the city’s doing, wondering if I can help”, so we had coffee.

David Eaves

David Eaves in an appropriately urban setting at Cambie and Broadway.

He doesn’t actually work for the City, but he’s an activist with Vision Vancouver, the municipal sort-of-political-party that currently holds a majority on council. They’re not perfect, but they seem, on balance, level-headed and smart.

David has lots of ideas about other good things that could be accomplished by opening up this data source or that, and it all seems affordable. I was pleasantly surprised to discover that there’s not much in the way of organized opposition. I imagine the city’s IT department is grumbling about unasked-for extra work, which is fair, but it shouldn’t be that painful.

The thinking seems to be along these lines:

  • Publish the data in a usable form.

  • License it in a way that turns people loose to do whatever they want, but doesn’t create unreasonable liability risk for the city.

  • See what happens. Nobody’s smart enough to predict what combination of private-business and community-activist players will use it, or what they’ll use it for. If nobody does, well, it didn’t cost much to try.

Vancouver’s not alone; apparently Washington DC, of all places, is the world leader in doing this; also some West Coast cities including San Francisco are making good progress.

Going Local

Me, I’ve spent the last few decades starting businesses and trying to improve the Internet. I’ve been well-rewarded for doing it and I have few regrets. But I’m increasingly getting an urge to pitch in and give back at a local level, if I can find somewhere I’d be useful.

I’m not sure where that is. But as a first step, I’m joining Vision Vancouver; the first political party I’ve been a member of since the early Eighties.

July 01, 2009 09:46 PM

Tim Bray

Is This Spam?

I still moderate all the comments here, but the setup is idiosyncratic enough that hardly any spam gets through. Today, I’m pondering one particular comment, wondering whether to approve.

The comment is to Kindle Yourself, about how you can buy the contents of this blog for $1.99 a month on your Kindle. It says:

From: Wendy

As much as I love to read - especially blogs - I don't think it would be feasible for most people to subscribe to 5 or 6 blogs for that price. Not in this economy. But it's a great idea and I would gladly do it for some of the top daily newspapers.

Sensible enough. As I often do, since I care who reads this, I clicked on the “Wendy” link and it took me to wendycarlisle.com. While at first glance this is a vanilla blog, something about it bothered me; also, I was pretty sure I’d seen this movie before; comments from other blogs that somehow, in some intangible way I couldn’t put a finger on, felt like this one.

A bit of poking around increased my discomfort. First, there’s the blog’s “Disclosure Policy”, a graphic of some text (?!) from which I excerpt:

This blog is a personal blog written and edited by me. For questions about this blog, please contact <gmail address elided>.

This blog accepts forms of cash advertising, sponsorship, paid insertions or other forms of compensation... the owner(s) of this blog is compensated to provide opinion on products, services, websites, and various other topics. Even though the owner(s) of this blog receives compensation for or posts or advertisements, we always give our honest opinions, findings, beliefs, or experiences on those topics or products...

Hmm, well, OK, I guess.

Then I glanced at the blogroll. All linked by first name, all hosted at URLs of the form FirstnameLastname.com. All sounding like they were written by real people living in real places, but theme-free and passion-free. All with what looked like bits of product placement. All WordPress. Most but not all of the domain names registered by AC Merchandising LLC.

So, yep, I’m pretty sure this is a new (to me) form of, uh... what? Spam? I’m not sure. It seems there are some real people in the system writing these blogs? Innocent folk looking to make a few extra bucks? A small staff each emulating a bunch of these people?

Anyhow, I don’t think I’m going to approve the comment. Wendy, if you’re a real person, I apologize.

July 01, 2009 08:29 PM

Java.net Weblogs

What is new with Pivot?

Discusses some aspects of the forthcoming Apache Pivot 1.3 release.

by Greg Brown at July 01, 2009 08:21 PM

Java.net Weblogs

What is new with Apache Pivot?

Discusses some aspects of the forthcoming Apache Pivot 1.3 release.

by Greg Brown at July 01, 2009 08:21 PM

The Server Side

Oracle Fusion Middleware 11g supports SCA, JavaServer Faces

Oracle today launched the Fusion Middleware 11g suite. It represents the first major release of the Fusion middleware platform since the company closed the deal last year to buy application infrastructure vendor BEA Systems.



by Bree (Nally@nospam.com) at July 01, 2009 08:18 PM

Java.net Weblogs

My CommunityOne 2009 presentation is online

My CommunityOne 2009 presentation is now available online.

by Harold Carr at July 01, 2009 06:59 PM

Planet Eclipse

Chris Aniszczyk: Training for Eclipse Galileo and p2

As part of the Eclipse Galileo release, we updated all of our training courses to reflect the latest release:

We have also added two new courses to cover two popular topics, Equinox p2 and migrating to Galileo RCP:

We are also offering our courses online now. If you’re interested in any of these courses, please email us.

July 01, 2009 06:41 PM

Planet Eclipse

Jens von Pilgrim: User Report: Migrate from oAW Xtext to TMF Xtext

With Eclipse 3.5 comes the new version of Xtext, called TMF Xtext. Since I had to switch to Eclipse 3.5 in order to keep GEF3D running on the latest Eclipse version, I decided to migrate from the old openArchitecture Xtext (oAW Xtext) to the new TMF version.



Fortunately the Xtext documentation contains a section about migrating from oAW Xtext to TMF Xtext. Frankly, I was a little bit afraid (never change a running system). But at least I hadn't implemented any content assist or other editor extensions yet, so I hoped that it wouldn't be too hard.



Before you read on, please note that I'm only an Xtext user. I don't know any internal details about Xtext. Maybe some of my problems can be solved more efficiently, if that is the case, I would be more then happy if you leave me a comment. My first intention was to migrate my already running grammar as fast as possible, with as few modifications as possible.



The Setting



I have written a model transformation language, and it consists of an Xtext grammar (with about 90 rules), an interpreter for executing the language, and other things which I didn't expected to be involved in the migration, as a debugger component or other user-interface stuff. An Xtend-based M2M transformation exists which modifies the generated ecore model in order to set some default values, add some workarounds for existing oAW bugs, and do other things. In order to migrate my application, I had to

  1. migrate the grammar
  2. adapt the M2M-transformation
  3. adapt client code which uses the model and the Xtext API


In the following old versions are highlighted with a light red back and the new ones with a light green background.



Migrating the Grammar



As described in the Xtext documentation, I had to replace "Enum" with "enum", and add two new lines at the beginning of the grammar.



Since "with" has become a keyword. Thus I had to rename "with" in my grammar :

RuleXY: ... ( "with" with=Block)? ...


into

RuleXY: ... ( "with" _with=Block)? ...


This also caused some small changes in the model and the client code. Is there a way to use Xtext keywords as a reference names?



Backtracking



Apparently the parser generation (or some settings) has changed, too. E.g., the following rule worked with the oAW Xtext version:

ParameterReference: QualifiedParameterReference|SimpleParameterReference;

SimpleParameterReference: type=Type (name=ID)?;

QualifiedParameterReference: type=Type name=ID;


The idea of these rules is to force the definition of a name in case of qualified parameter references and to make it optional in simple ones.

Unfortunately these rules are not working with the new version. Since ANTLR is a LL-parser, there are some constraints on how to define the grammar. There is a document explaining how to remove backtracking from a grammar, unfortunately some of the described techniques cannot be used with Xtext. In some cases I was able to fix the problem by rewriting my grammar, as in this example: I simply had to reorder the first rule:

ParameterReference: SimpleParameterReference|QualifiedParameterReference;

SimpleParameterReference: type=Type (name=ID)?;

QualifiedParameterReference: type=Type name=ID;


In some cases I couldn't find a solution (maybe it is possible, but I'm not an LL/LR-expert). Actually I'm not the first one with this problem, and there is a posting in the TMF newsgroup about this. If you cannot rewrite your grammar, you need backtracking (and lookahead). Thanks to this posting, I was able to fix the problem. I had to edit the MWE-file from

<fragment class="org.eclipse.xtext.generator.AntlrDelegatingFragment" />


to

<fragment class="de.itemis.xtext.antlr.XtextAntlrGeneratorFragment">

<options k="2" backtrack="true" memoize="true"/>

</fragment>


Note that you have to install the itemis generator fragment from http://download.itemis.com/updates as described in the Xtext documentation (page 62).

Maybe I'm going to "left factor" my grammar in a future version, but for now I only wanted to get my application running.



Lexer Rules



In the oAW version, lexer rules were defined with the keyword "native", which has been changed to "terminal". Not mentioned in the migration guide yet: INT was redefined in the new version. I had rewritten the definition in the old version in order to remove the optional sign (as my language is handling this itself). This is the old INT definition:

Native INT: ('-')?('0'..'9')+ 


And here's the new one:

terminal INT: ('0'..'9')+ 


In my case I could remove my own definition since the new one matches my requirements. In other cases, this might be a trap.



According to the documentation, it should be possible to define the type of a terminal rule now. I tried this as follows:

terminal FLOAT returns ecore::EFloat: ('0'..'9')*'.'('0'..'9')+;


As a matter of fact, the code is generated as expected, but the parser still returns a String, which leads to a ClassCastException. So I removed the type definition and added a convenient method to my model, as described below. I assume this is a bug or something, I will file a report later on ;-). Since the old version always returned Strings, my code was prepared for that, anyway.



OrmPackage missing



I don't know exactly why or when, but at some point in time my grammar file contains got an error marker:

- WrappedException: java.lang.ClassNotFoundException: com.sun.java.xml.ns.persistence.orm.OrmPackage"


This bug seems to be fixed already, fortunately it is possible to generate the model and code from the grammar, even with this error.



Unassigned Actions



In the oAW Xtext version, a model element was assigned whenever a non-abstract rule was hit. My grammar contained the following rule:

NullLiteral: "null";


This rule is not working with the new TMF Xtext version. As found in the documentation "by default the object to be returned by a parser rule is created lazily on the first assignment". Although I've read that passage, I was not aware of the consequences. In the new version, an element is not automatically created when the rule is hit, but only when an assignment is to be executed. That is, a rule which contains only terminals does not create a model element, as in the example above. While this first example is obvious, the problem is sometimes hidden. Here is another more tricky example:

Block: "{" (statements+=BlockStatement)* "}";


If no "BlockStatements" are specified, that is in case of an empty block ("{}"), no block element is created at all. I posted that problem to the newsgroup, and Sebastian Zarnekow immediately