Note: if you're reading this using a feedreader, please make sure you've updated to the updated TheAquarium feed.
Recent Tips and News on Java, Java EE 6, GlassFish & more :
|
• GlassFish Enterprise Server v2.1.1 Patch 15 (GlassFish for Business)
|
Note: if you're reading this using a feedreader, please make sure you've updated to the updated TheAquarium feed.
Recent Tips and News on Java, Java EE 6, GlassFish & more :
|
• GlassFish Enterprise Server v2.1.1 Patch 15 (GlassFish for Business)
|
During the past month, Microchip has been honored with four industry awards for our MPLAB X IDE. In the U.S., we won ECN Magazine’s Readers’ Choice Tech Award in the Software category, and were named by the editors of EDN to their 2011 Hot 100 list, in the Development Tools category.
|
EclipseLink's Shaun Smith has recently been delivering a number of presentations on the status and future of the open source project. If you're curious about where innovative JPA projects are going, then you should check out this slide deck from Shaun. |
|
Here are the main themes covered:
• REST: integration with JAX-RS to access relational data through REST with HTML 5 as the primary client with possibly JPA entities and persistence units defined via metadata with dynamic provisioning (i.e. no Java coding required).
• EclipseLink NoSQL: annotations (@NoSql) and XML to identify NoSQL stored entities with initial support for MongoDB and Oracle NoSQL.
• Multitenancy: already present in the shipping version of EclipseLink using the @Multitenant annotation and supporting different topologies with dedicated or shared application and/or database.
Next stop: EclipseLink 2.4 along with the June Juno Eclipse Release.
This is an, let's call it accidental post. I was looking into
transactional CDI observers and playing around with GlassFish embedded
to run some integration tests against it. But surprisingly this did not
work too well and I am still figuring out, where exactly the problems
are while using the plain embedded GlassFish for that. In the meantime I
switched to Arquillian.
...
Another upcoming NetBeans IDE feature, already in the daily builds, is this hint, which appears when you put the cursor in a class declaration:
Similarly:
When the hint is invoked, the new class, with all its required methods, is automatically generated, as a separate class (a dialog pops up letting you specify the name of the class and the package where the class should be created).
How handy these small enhancements can be!
This particular enhancement was included for 7.2 specifically because of a remark Arun Gupta made during Devoxx last year. That small discussion in a hallway resulted in this issue being highlighted and implemented:
http://netbeans.org/bugzilla/show_bug.cgi?id=49559
Just pointing this out as yet further evidence that we're really listening to users and, between balancing the various requirements coming in from various sides, are making very sure that user requests are taken extremely seriously.
The latest JSR filed is #355 and it's not a technical one - "JCP Executive Committee Merge". As the name implies this is about merging the current ME and SE/EE executive committees into a unified one.
|
If you've been following carefully the changes planned for the JCP, the 2-step process turned into a 3-step evolution:
|
|
If you're curious about the role of the executive committee members, check out this page on JCP.org. Hint: voting on JSRs is part of it, but there's more. The JSR Review Ballot starts on February 7th.
In October 2011, I used the post Hello JavaFX 2.0: Introduction by NetBeans IDE 7.1 beta to look at using NetBeans IDE 7.1 beta to build a simple Hello, World style of JavaFX 2.0 application.
James Sugrue
Building on the successful Java One San Francisco and Latin America editions in 2011, the conference is on the road to three international destinations : Tokyo, Moscow and Hyderabad. Here are the details :
JavaOne Tokyo (Japan)
Date: April 4-5, 2012
Location: Academy Hills 49F, Roppongi Tokyo
Event Web site : Japanese | English
JavaOne Moscow (Russia)
Date: April 17-18, 2012
Location: Crocus Expo, International Exhibition Center
JavaOne Hyderabad (India)
Date: May 3-4, 2012
Location: Hyderabad International Convention Center
We're looking forward to meeting you at one of those events to chat anything Java EE and GlassFish!
By the way, the dates for JavaOne 2012 San Francisco are September 30th - October 4th and registration is open already.
During an average day working on an Ant-based NetBeans Platform application, a developer would constantly use the project actions such as “Build”, “Clean” and “Test” in the NetBeans IDE. But when the application needs to be built on a build server, a way needs to be found to perform these actions from the command line. Since the projects are already Ant-based, and the actions in the IDE are linked to Ant build scripts, this is luckily straight forward. The only question is which target(s) to call.
For more information about the Ant-based build harness and how it is structured, have a look at this article. (Note that there are multiple parts, and part 2 is especially useful in this context.) But for now the only really important part to note is that all Ant-based NetBeans Platform Applications (suites) and modules have a build.xml file.
Before listing the Ant targets that are generally useful, I would like to explain how to find them yourself. The first and most difficult way is to find the action in the IDE source code. I have done this before, but it is in almost all cases complete overkill.
The second option is to expand the Build Script under Important Files in the project, to see a complete list of all the targets that are available. While this is much easier, it is still not the most direct route.
The best option in almost all cases is to perform the action and then look at the title of the Output window. The name of the project appears there, followed by the target(s) in brackets.
Targets applicable to NetBeans module projects
Note: For standalone modules, the same targets apply. The difference is that for the netbeans target, all the artifacts are placed in the module’s build folder.
Targets applicable to NetBeans Platform application suites
Several NetBeans users have been asking, for a long time already, for multi-row tabs in the NetBeans editor.
Read the list of use cases and requests around this area in the issue:
http://netbeans.org/bugzilla/show_bug.cgi?id=172512
Today, Stan Aubrecht, the NetBeans Platform window system engineer, closed the above issue. Why? Because he fixed it. In the Options window, you'll see several new options in the Appearance tab:
Above, the "Tabs placement" and "Multi-row tabs" options did not exist before today. As you can see, not only will you be able to set multi-row tabs, but you'll also be able to set where the tabs should appear, whether they're multi-tab or not.
Here you see multi-row tabs, with "top" tab placement:
Multi-row tabs, with "bottom" tab placement:

Multi-row tabs, with "right" tab placement:

Of course, anyone creating their applications on the NetBeans Platform will automatically inherit this behavior too, if they're creating document-centric NetBeans Platform applications.
With this new level of flexibility, you're able to get even more comfortable in your development environment than before.
Thanks, Stan!
|
The team is looking for talent to help build the future of our application server. If you are interested, check out this job posting. Here's an extract : "Technical lead, design and develop features to manage the configuration of clustered, highly available deployments in elastic cloud environments that delivers massive scalability." |
|
This is a job based in the US to work on the admin infrastructure, including on PaaS features.
One of the new code hints provided by NetBeans 7.1 is the Unused Assignment hint. A simple code sample that will cause this hint to be displayed in NetBeans 7.1 is shown next.
James Sugrue
|
Java EE 7 is moving along nicely at the speed of its various JSRs and Arun has a rundown of the new features planned for JPA 2.1 as described in the recent Early Draft document. |
|
The blog entry covers Stored Procedures (similar to named queries, defined on the entities themselves), bulk operations, new FUNCTION, ON, TREAT JPQL keywords, more alignment with CDI and unsynchronized persistence context.
There are more features planned for JPA 2.1 that didn't get in the early draft (such as multi-tenancy). As a reminder, EclipseLink is the reference implementation (RI) for this specification while GlassFish 4.0 will deliver the overal Java EE 7 RI.
Project News
NetBeans at Free Virtual Developer Days!
Starting this week, several virtual developer days will be held.
NetBeans will be present too. Watch presentations and follow hands on
labs where the IDE will be used for rapid Java EE 6 development.
<p>Hi everybody! Today we would like to introduce you some of our new hints. This one is called <strong>Identical Comparisons</strong> and checks whether you use more strict <em>identical</em> comparison instead of simple <em>equal</em> comparison. If not it suggests you to change it to identical one.</p> <p>If you don't know what is the difference between identical and equal comparisons, you can read it in official <a href="http://php.net/manual/en/language.operators.comparison.php">PHP manual</a>.</p> <p>And because we know, that sometimes there is a use case when you should use just <em>equal comparison</em>, this hint is <em>row sensitive</em>. It means that well known hint bulb will appear only if you are on the row with comparison. So no yellow warning triangle will scream on you ;) This hint just wants to help you :)</p> <p>But there is just another advantage of this hint. It can change your "==" sign to "===" as you certainly expected, but it can detect the type of the right hand side variable and make a type cast for you too!</p> <img src="http://blogs.oracle.com/netbeansphp/resource/article_images/identical-comparison-1.png" alt="Identical Comparisons" /> <p>That's all for today and as usual, please <a href="http://bits.netbeans.org/download/trunk/nightly/latest/">test it</a> and if you find something strange, don't hesitate to <a href="http://netbeans.org/community/issues.html">file a new issue</a> (component <em>php</em>, subcomponent <em>Editor</em>). Thanks.</p>
NetBeans IDE 7.1 adds JavaFX 2.0 Support (see my review of that) and a lot of new features and improvements including improvements to the NetBeans Platform itself. The NetBeans Platform is an application framework that can be used as a stable basis for mostly Java desktop applications. (Dozens of screenshots of applications using this framework can be found here.)
Someone reading yesterday's blog entry might have thought: "OK. So you're not only able to create syntax coloring for some kind of trivial DSL. Yes, you're also able to do it for a real language, in this case, Ceylon. However, you caught a lucky break in that case, it's unlikely you'll be able to do it again for another real language."
Well, OK, take a look at this, my hypothetically sceptical imaginary friend:
What you see here is syntax coloring for Clojure (via the Clojure.g ANTLR file), created in about 45 minutes (Clojure turns out to have a lot less tokens than Ceylon), together with HTML embedding within Clojure comments. However, note that the embedding only supports syntax coloring, not code completion, not sure if that is possible nor how to do that.
Here's my embedding definition, i.e., this is all, no more or less than this:
@ServiceProvider(service = LanguageProvider.class)
public class HTMLEmbeddingLanguageProvider extends LanguageProvider {
private Language embeddedLanguage;
@Override
public Language<?> findLanguage(String mimeType) {
return ClojureTokenId.getLanguage();
}
@Override
public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
initLanguage();
if (11 == token.id().ordinal()) { //11 is the token ordinal in Clojure for comments
return LanguageEmbedding.create(embeddedLanguage, 0, 0);
}
return null;
}
private void initLanguage() {
embeddedLanguage = MimeLookup.getLookup("text/html").lookup(Language.class);
if (embeddedLanguage == null) {
throw new NullPointerException("Can't find language for embedding");
}
}
}
Soon I'll be working on a tutorial showing how to create syntax coloring for the Movie Query DSL I showed over the last two days.
JavaFX 2.0 SDK is available for Linux as Developer Preview Download. Enjoy FX-ing!
*NEW* Real World Java EE Night Hacks - Dissecting Best Practices ...and the bestseller Real World Java EE - Rethinking Best Practices
|
Having the Early Draft Review of JSR 346 (CDI 1.1) available for review and studying is good but having an early implementation to go along is even better. That's what JBoss' Jozef Hartinger has recently announced on his blog - an alpha release of the future Weld 2.0 reference implementation. |
|
According to Jozef, the main purpose of this release is in fact to provide a feature-complete implementation of this draft CDI specification and features such as CDI.current(), application life-cycle qualifiers, beans.xml manipulation using ProcessModule, and many others.
As a reminder CDI 1.1 is scheduled to be integrated in the upcoming Java EE 7 platform later this year.
This video demonstrates the Inspect and Transform functionality available in NetBeans 7.1. The inspect and transform refactoring function is used to migrate Apache Commons IO 2.0 from JDK 5 to JDK 7. This demonstration shows the ease of use in performing a sophisticated upgrade. A project this size would normally take weeks to upgrade is done in less than 20 minutes.
...
Yesterday's blog entry was a "smoke test" for generating syntax coloring and anyone reading it might have thought: "Big deal. Syntax coloring for a trivial query language is trivial. Call us again when you've provided syntax coloring for a real language."
And, justifiably so, since the DSL used yesterday is obviously, and appropriately, pretty simplistic:

OK, fine. So how about this. Syntax coloring for Ceylon (http://ceylon-lang.org/), which is one of the new JVM languages, (read about it here on Wikipedia):


(I literally know nothing about Ceylon, copied the code shown above from here.)
What's handy about Ceylon is that you don't even need to generate the lexer. The ANTLR-based lexer (and the parser) is already in the com.redhat.ceylon.typechecker-0.1.jar. So then it's a question of weaving the Ceylon lexer with the NetBeans APIs, which [as I pointed out yesterday] is actually a trivial task.
And it's even a trivial task for a real language, as you can see. I spent about 2 hours on this and only because Ceylon has a lot more tokens than my simple 'smoke test' of yesterday did. And a lot of those two hours was spent getting the coloring right, i.e., I wanted the colors to have exactly the right shade of purple, green, etc, which took a bit of experimentation. You don't like my colors? Also fine. Change them in the Options window:

So, since I imagine there's now even more interest in this topic than there was yesterday, I'm going to make a screencast that shows how to do this, with an accompanying tutorial, and a list of references that especially focuses on the existing implementations of these NetBeans APIs, which are extremely useful when you need to customize your implementations slightly and diverge from the standard path.
Note: if you're reading this using a feedreader, please make sure you've updated to the updated TheAquarium feed.
|
We haven't really covered this before, but there's been quite a bit of work on the admin console in the upcoming GlassFish 3.1.2 release (in addition to the other new features and theme and updated components). Specifically in this release, the team worked on the following : |
|
• Performance startup (better figures by default and conditional automated console initialization).
• Feature parity with CLI in the areas of Secure Admin config, JMS Cluster configuration, Monitoring Data consolidation, new Http Listeners page (à la GlassFish v2), listing EJB timers.
• Support for new product features such as DCOM cluster nodes.
• Ability to collect domain instance logs.
• More tests.
The best part about these improvements? There's almost all entirely driven by your feedback! So thank you to everyone that took time to help us understand how to make GlassFish a better product via bug reports, requests for enhancements and even phone calls in some cases. Let's keep doing this!
The GlassFish Web Console started off back in 2006 as the killer feature, especially compared to other open source offerings. With continued enhancements I think it still has a clear edge on them and longer-term plans shouldn't prove me wrong!
In about 15 minutes of work, without typing a single line of actual code, I created syntax coloring for the domain specific language described here.
The result in a JEditorPane (and notice the non-printable characters are displayed, optionally, too) is as follows:

The user of the application is able to customize the colors:

Again, I did not type a single line of code to create the above. It was all as simple as using a lexer generator (JavaCC in this case) and then connecting the generated files into 100% standard NetBeans Lexer API implementations. I.e., all copy and paste stuff, together with a small bit of configuration and tweaking.
If anyone is interested in step by step instructions for getting to the above, again, without doing any actual coding at all, please leave a message and, based on whether there is some demand for this, I'll write a tutorial describing the procedure for this particular domain specific language.
The NetBeans 7.1 IDE introduces a really cool new feature called shelving. This allows a developer to make changes to a project without committing them to a source control system.
I gave a talk this month at the Greenville Java Users Group (GreenJUG) on the new features, and tips & tricks in the new NetBeans 7.1 IDE.
The NetBeans 7.1 IDE has a feature that has been around for a while, but does not get as much attention as it should. NetBeans allows you to take advantage of using remote databases for doing Java development. There are a number of wizards which can take advantage of connections created in the Services → Database tab.
Note: if you're reading this using a feedreader, please make sure you've updated to the updated TheAquarium feed.
Recent Tips and News on Java, Java EE 6, GlassFish & more :
|
• Mac OS X Port Project Status (OpenJDK Wiki)
|
JAX-RS (Jersey) offers a GZIP filter to compress data for responses, and to handle GZIP compressed requests. This functionality is very easy to enable, and is configurable for both requests, and responses.
That does not get much easier.
You can prove that this works by querying your resource with Firebug, or Developer Tools (depending on browser). You can also confirm that it is working by performing a query like:
curl -HAccept-Encoding:gzip -HAccept:application/json http://localhost:8080/content-coding-gzip/webresources/widget > json.gz
gzip -v -l json.gz
method crc date time compressed uncompressed ratio uncompressed_name defla 3a79ae18 Jan 20 15:25 1370 3389 60.3% json
Here's another super hidden NetBeans feature. Because of the inherent functioning of this feature, it is completely hidden and undiscoverable from the point of view of the NetBeans user interface.
The scenario is that you've got an HTML file open and you're typing something in there. The 'something' is something that you're likely to reuse within the same HTML file or other files, such as the META tags that you see highlighted below:

Now, as you can see, I have the part of the file that I'd like to reuse highlighted.
And then... I drag my mouse into the palette, i.e., the palette that you see on the right of the image above. And then, guess what? This dialog automatically pops up:

The "Content" section above is automatically filled in, based on what I dragged. The other fields and icons are things I fill in myself. Then I click "Add to Palette", at which point the HTML snippet is added into the palette, from where it can then be dragged into an HTML file, like any other snippet in the palette.
Handy, isn't it? And really hidden. (I blogged about this before here in 2008, where you also see a Java file equivalent.)
In other news. There are two excellent new NetBeans blogs out there! The first is NetBeans Ruminations by Hermien Pellissier from South Africa and the other is the NetBeans category of Crazy Java Hacking by Martin Skurla from Slovakia. Check them out! Their blog entries are also going to be visible in the NetBeans welcome screen, because they've been included in the planetnetbeans.org aggregator. You have a NetBeans related blog too? Leave a message here. And if you don't have a NetBeans blog too, why not start one?