Java / j2ee News

Koenig Now Offers Training on Core Java SE 7

Core Java SE 7 is designed for those programmers who want to build their fundamentals & programming skills using Java and want to study beyond the OCP-JP curriculum.

www.topix.net | 2/4/12 11:43 AM
Koenig Now Offers Training on Advanced Java

Advanced Java is designed for those Java programmers who already have strong programming skills but want to learn the advanced features of Java SE.

www.topix.net | 2/4/12 11:42 AM
Silcon Valley Presenters

I love doing presentations, I become an actor on stage, it's fun, it's exciting.

www.topix.net | 2/4/12 9:38 AM
H2 Database Engine 1.3.164

H2 is an SQL database engine written in Java that implements the JDBC API. Embedded, server, and clustering modes are available.

www.topix.net | 2/4/12 5:33 AM
DevX - Java: Using Hibernate to Implement Multi-tenant Cloud Architecture
Hibernate is an excellent Java ORM tool but it lacks the features required to implement a multi-tenant cloud architecture. Don't let that stop you. www.devx.com | 2/4/12 5:21 AM
Signed Applet

Hi guys, ive been writing a game in Java, that is single player at the moment. And I have posted it to my website.

www.topix.net | 2/4/12 1:18 AM
When Was Your Last Enterprise Architecture Maturity Assessment?
Every company should plan regular architecture capability maturity assessments using a model. These should provide a framework that represents the key components of a productive enterprise architecture process. A model provides an evolutionary way to improve the overall process that starts out in an ad hoc state, transforms into an immature process, and then finally becomes a well-defined, disciplined, managed and mature process. The goal is to enhance the overall odds for success of the enterprise architecture by identifying weak areas and providing a defined path towards improvement. As the architecture matures, it should increase the benefits it offers the organization. Architecture maturity assessments help to determine how companies can maximise competitive advantage, identify ways of cutting costs, improve quality of services and reduce time to market. These assessments are undertaken as part of the Enterprise Architecture management.

read more

java.sys-con.com | 2/3/12 11:00 PM
ArchBeat Link-o-Rama for 2012-02-03

"Everybody gets so much information all day long that they lose their common sense." -- Gertrude Stein Honglin Su shares instructions on how use the Oracle VM Server SDK to build a device driver for Oracle VM Server 3.0.3. Dr.

www.topix.net | 2/3/12 9:04 PM
Planet Eclipse: Doug Schaefer: Eclipse C/C++ IDE reaches 750,000 downloads for Indigo-SR1

Wow! The Eclipse C/C++ IDE, including the Linux variant, has passed 750,000 downloads for Indigo SR-1, in only 4 months.

— Doug Schaefer (@dougschaefer) February 3, 2012
cdtdoug.blogspot.com | 2/3/12 8:29 PM
Planet Eclipse: Max Rydahl Andersen: m2e(clipse)-wtp 0.15.0 : New & Noteworthy

Maven Integration for Eclipse WTP 0.15.0, a.k.a m2eclipse-wtp, a.k.a m2e-wtp is available.

This release contains mostly bug fixes, but a few improvements managed to slip in. The complete release notes are available here.

 

m2e-wtp 0.15.0 is compatible with the JavaEE distributions of Eclipse Helios and Indigo, requires at least m2e 1.0 (works with 1.1) and mavenarchiver plugin >= 0.14.0 (0.15.0 should be automatically installed).

As usual, m2e-wtp can be installed from :


 

So let's see what are the highlights of this new release :

 

Packaging inclusion/exclusion support improvements

For war project, previous m2e-wtp versions used to use and attributes from the maven-war-plugin config to enable (or not) the deployment of project dependencies to WTP servers. In 0.15.0, the same level of support has been added to EAR projects using maven-ear-plugin 2.7+. However, the problem with this approach is, other resources (web pages, classes ...) are not properly excluded (using the <*SourceInclude> and <*SourceExclude> attributes).

 

In order to address this problem, Rob Stryker, committer on WTP and lead of JBoss AS tooling in JBoss Tools, provided an implementation for JBoss AS servers that might be generalized to other WTP server adapters (if they decide to do so). Basically, some new metadata is added to the project's .settings/org.eclipse.wst.common.component like :

 

             ...                    

 

The patterns are separated with a comma and exclusions take precedence over inclusions : resources matching one of the exclusion patterns are not deployed, even if they match one of the inclusion patterns. That solution is not maven-bound so any other kind of project can benefit from it.

Now all m2e-wtp 0.15.0 does is map the maven patterns to their equivalent component metadata. This gives :

In the example above, a warning is displayed as both and are defined. Since both patterns could overlap, it might lead to some weird behavior where WTP would actually deploy more files than a maven CLI build. In order to minimize (we can not totally solve) that potential discrepancy we only keep the packaging patterns in the component files and recommend using only.

 

Currently, this feature only works in combination with the JBoss AS Tools from JBoss Tools 3.3.0.Beta1 (nightly builds available from http://download.jboss.org/jbosstools/updates/nightly/trunk/), but we'll try to make other WTP Server adapter vendors support it in the future (as part of WTP core API).

 

Warnings added when unsupported dependency types are detected

As of today, if a project depends on another workspace project of type ejb-client or test-jar,  that specific dependency will not be packaged properly by WTP, as Maven would do in command line. Moreover, you'll experience some class leakage on the compilation and test classpaths in Eclipse (ex: non client classes being visible). The only known workarounds to this issue are to disable workspace resolution, or close the dependent project and rely on the dependencies from the local maven repository.

Ideally, in order to make the deployment part work, we would need to introduce new WTP components, but the current WTP API doesn't support it, yet. So, until this is fixed, warning markers are added whenever a project depends on such "unsupported" types. That should hopefully give users an idea of the problem and how to circumvent it.

Better handling of dependencies in war projects

Previous m2e-wtp versions had, in some use cases, some outstanding issues with regard to dependency management of war projects. In particular,

  • when 2 dependencies of the same artifact, but having a different classifier were added to a web project, only one would show up on the classpath. This has been properly fixed.
  • in some cases, the timestamped version of a SNAPSHOT dependencies from the local repository, would be copied under the target/ folder, causing some jar locking issues in windows. The rationale behind this behavior is, maven-war-plugin packages snapshot dependencies using the timestamp identifier. Since the name of file in the maven classpath library needs to match the one deployed by WTP, a copy was performed. To fix this problem, the default file pattern matching used for dependency deployment has been changed to @{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@. This means that, by default in m2e-wtp, SNAPSHOT dependencies are now deployed using the SNAPSHOT suffix instead of the timestamp. If you need to force the use of timestamped artifacts, then you need to explicitely decalre the following in your pom.xml :

 

  org.apache.maven.plugins   maven-war-plugin   2.2       @{artifactId}@-@{version}@@{dashClassifier?}@.@{extension}@  

 

Removal of conflicting facets on packaging change

If you had a java utility project, that you wanted to upgrade to an EJB project for example, a constraint violation would be raised upon project configuration update (EJB and Utility facets can't be both installed).

This has been fixed by removing all conflicting facets when you change the packaging of a Java EE project, making that conversion completely transparent.

 

What's next?

m2e 1.1 introduces a new Eclipse to Maven project conversion API. It means that, in m2e-wtp.next, we will be able to automatically convert existing WTP project configuration to maven's. Dependencies will still need to be set/translated manually but that's a pretty good start IMHO.


Finally ...

I would like to thank the m2e-wtp community at large for their support and contributions, that's what make this project move forward and make it one of the most popular projects on the eclipse marketplace.

Contributions can take the form of :

 

Keep it up.

 

 

Fred.

https://twitter.com/#!/fbricon

community.jboss.org | 2/3/12 8:01 PM
Planet Eclipse: Markus Knauer: Eclipse Juno M5 and Indigo SR2 RC2

Two releases of the Eclipse EPP packages today:

The packages for Indigo SR2 RC2 (the second release candidate for the second service release of the Indigo release, based on Eclipse Platform 3.7.2) and the packages for this year’s Simultaneous Release Juno M5 (the 5th milestone based on Eclipse Platform 4.2) are available:

http://www.eclipse.org/downloads/index-developer.php

Please test and report any issues in Bugzilla. Especially the Eclipse 4.x team needs your help! The sooner bugs are found, the sooner they can be fixed!

One of the changes is the addition of Eclipse Code Recommenders to the Eclipse for RCP and RAP Developers package.

eclipsesource.com | 2/3/12 7:54 PM
Tiggzi: Cloud-based HTML5 And Hybrid Mobile App Builder Is Now Free!
Tiggzi is cloud-based mobile app builder. It makes it super easy and fast to build HTML5 and hybrid (with PhoneGap) mobile apps entirely in the cloud. With a new Free plan, anyone can now build a mobile app.


www.pheedcontent.com | 2/3/12 5:07 PM
Spring 3, Spring Web Services 2 & LDAP Security
Creating and securing a Spring 3 , Spring WS 2 web service using multiple XSDs and LDAP security.


www.pheedcontent.com | 2/3/12 5:06 PM
IT Technical Project Manager

IT Technical Project Manager - Greenfield Projects - A 65-100K An IT Technical Project Manager is required for a large change programme at a blue chip company based in London.

www.topix.net | 2/3/12 4:54 PM
The Aquarium: GlassFish 3.1.2 Release Candidate builds are here!

GlassFish 3.1.2 has never been so close to a GA/FCS release with promoted build b19 now available as Release Candidate (RC) 1. In fact you might as well go straight to RC2 (build 20), also now available from the promoted builds page.

If you're not sure which archive to use, try this one. Another RC build (RC3) is planned in the next few days. Hopefully it'll be the last one before the product ships.

So make sure you test your applications work properly with the latest promoted build and check out recent blog posts on 3.1.2 if you're wondering what to expect from this release. See you in a short while for a stable public release!

Now you know what to do over the week-end! :)

blogs.oracle.com | 2/3/12 3:29 PM
Cumulogic, yet another PaaS platform for GlassFish

Cumulogic is another PaaS provider offering Java as a platform and specifically GlassFish 3.1.1 as of their December 2011 release .

www.topix.net | 2/3/12 12:35 PM
Diagnosis of a JRockit Deadlock

Recently I came across an interesting JRockit JVM deadlock. I am sharing the details of that deadlock, its diagnosis, and how to workaround that deadlock, which might be useful until the fix for that is available in a future JRockit release.

www.topix.net | 2/3/12 8:26 AM
Alkitab Bible Study 2.8

Alkitab Bible Study is an open source and free desktop bible study software. Alkitab Bible Study supports single/parallel view, commentaries, lexicons, dictionaries, glossaries, daily devotions, etc.

www.topix.net | 2/3/12 4:16 AM
Apache JMeter 2.6 released
Apache JMeter, the Open Source Load Test tool reference, which recently became a Top Level Apache project has released a new version 2.6


www.pheedcontent.com | 2/3/12 12:01 AM
Java Champion Dick Wall on Genetics, the Java Posse, and Alternative Languages

In Part One of a two-part interview, titled "Java Champion Dick Wall on Genetics, the Java Posse, and Alternative Languages ," Java Champion and Java Posse member Dick Wall explores the potential of genetic analysis to enhance human health, shares observations about alternative languages for the Java Virtual Machine , and reveals inside dope on the ... (more)

www.topix.net | 2/3/12 12:01 AM
The Aquarium: Cumulogic, yet another PaaS platform for GlassFish

Cumulogic is another PaaS provider offering Java as a platform and specifically GlassFish 3.1.1 as of their December 2011 release.

CumuLogic PaaS has a dual public and private cloud strategy and support for Amazon EC2, OpenStack, Citrix-CloudStack, Eucalyptus, and VMware vSphere. It also offers RESTful APIs to manage the application lifecycle, and PaaS administration APIs to manage and monitor the platform.

For more details, you can read their data sheet, one where you'll learn that James Gosling is one of the company's advisors.

blogs.oracle.com | 2/3/12 12:00 AM
Planet Eclipse: Denis Roy: EclipseCon Poll: What do you think of the location change?
I haven't done a whacky poll in a long time, so there's no better time than now.

You all know that this year, our favourite Eclipse gathering is moving to a new location . After so many years in California, what do you think of this move?

Cast your vote by clickety-clicking the links below. I'll post up the results tomorrow.

http://eclipsecon.org/the-weather-better-be-warm-and-the-beer-cold.wbmstr

http://eclipsecon.org/yay-less-time-on-an-airplane.wbmstr

http://eclipsecon.org/oh-no-more-time-on-an-airplane.wbmstr

http://eclipsecon.org/if-its-not-in-california-im-not-going.wbmstr

http://eclipsecon.org/no-matter-where-eclipsecon-is-webmasters-will-still-buy-us-beer-right.wbmstr

http://eclipsecon.org/why-not-do-eclipsecon-in-(insert-tropical-exotic-location-here).wbmstr
eclipsewebmaster.blogspot.com | 2/2/12 11:39 PM
Java.net Weblogs: SwingX 1.6.3 Released

I am very pleased to announce the release of SwingX 1.6.3.  While the release notes contain many fixes, I wanted to take a minute to highlight some of the major changes.

First and foremost, we have more fully adopted Maven.  The project is now a collection of smaller modules. This will make it easier for clients to use only the pieces of SwingX that they need or want.  To enable us to break SwingX into smaller modules, some classes have been moved or reorganized.  Don't worry, we've left a deprecated copy in the original location in all instance but one (I'm looking at you JXBusyLabel.Direction).

Secondly for Maven, we needed to rename our groupId.  Per discussions with the maven.java.net folks, we are now using org.swinglabs.swingx as the groupId.  This is a change from org.swinglabs.  Doing so allows us to use the maven.java.net facitilities for automatically updating Maven Central with our releases.  Future releases should be a lot easier for us in that regard.

The third Maven-related change is that swingx-core no longer contains a copy or dependency on all SwingX classes.  The swingx-graphics package is not used by any of our components.  To suppliment the need to have an all-in-one jar, we have created the swingx-all module which provides all SwingX content as a single JAR file.

To highlight some non-Maven changes, we have:

  • Improved our serialization support.
  • Improved our beaninfo support.
  • Rearchitected our plaf support to allow third party L&F support in the future.
  • Fixed a ton of bugs.
  • Improved our testing style and code coverage.

If anyone is experiencing any issues with out latest release, please let us know over in the forums.  Any feedback, especially about how we divided the code into modules, is always welcomed.

Thanks and enjoy!

www.java.net | 2/2/12 9:10 PM
Planet Eclipse: Lars Vogel: Eclipse Community Awards voting open. Please vote

Just a small reminder, the Eclipse Community Awards is currently open for voting. Please vote: http://eclipse.org/org/press-release/20120130_awardsvote.php

I’m also nominated, as Eclipse Top Newcomer Evangelist

www.vogella.de | 2/2/12 3:02 PM
123 Live Help 5.4

It is implemented with Java server and Flash client: The Java server, powerful and compatible with popular OS, can be installed on your own server; The Flash based client is user-friendly, cross-platform, multiligual support without annoying java applet and any other plug-in. 123 Live Help is secure, fast, cost-effective and real-time one to one ... (more)

www.topix.net | 2/2/12 1:42 PM
Planet Eclipse: Jonas Helming: Modeling Symposium Submission Deadline

Hi,
Ed and I are organizing the Modeling Symposium for EclipseCon North America (see here). Thank you for all the interesting submissions so far. To notify people early enough about the acceptance of their submission, we need to set a final deadline to February 8th. Please make sure to send me your submission before this deadline.
Looking forward to your submissions!
Jonas

eclipsesource.com | 2/2/12 11:49 AM
Do you need to monitor your Mobile App?
Mobile applications are more and more becoming part of a company’s online services. This leads to the question whether we need to monitor like other parts of our IT infrastructure. As they are part of our shipped application services we need to ensure they are working properly. However, not every application must be monitored the same way. Additionally monitoring always comes at a certain cost. We need people to take care of the monitoring, we have to prepare our applications to be ready for monitoring and we potentially also have to buy or at least integrate new monitoring tools. So is it worth the investment?


www.pheedcontent.com | 2/2/12 10:18 AM
Planet Eclipse: Roy Ganor: How My Wife Drives the Technology World
ok, maybe a better name would be "Cloud -based Social -enabled Service -oriented Mobile -apps development", but that's a long and exhausting name especially for my "Thursday blogging day" :)

It started last week as a small-talk between my wife and me about sheattending so many shifts and medical sessions. According to my wife, she usuallytakes 4-5 shifts a month where the actual number is doubled (!). At that momentI had no tools to prove my point and here comes the requirements to build asmall mobile app for her to report shifts and sessions while being able towrite short notes about it (ok, she was asking this a longtime ago). In addition she usually posts some info on Facebook during her shifts so I had to connectthese reports somehow to her Facebook account. By the end of the month she hand a report about her shifts to the managers so this if the app could also print a summary it will be a big value for her.

Before I share some thoughts about some aspects of this app development, here is how this app looks like on Android and iOS:


Mobile App
jQueryMobile  (version 1.0) is really handy for creating cross-platform mobile interface, it provides easy to use APIs and is really covered well with lots of great examples . I had to use several other libraries like jQueryUrl , Moment.jsMustache , requireJS  and jsPDF . With so many "out-of-the-box" libraries it is super easy to build robust solution on for client side in minutes(!!!)

Social-enabled :
Facebook JavaScript SDK  helped me with giving a more "social look and feel" after creating  a  Facebook application . I also used Facebook's OAth service  authentication and Open Graph integration so users notify their friends about their activities with the "My Doctor Shifts" application.

Service-oriented (and Data-centric)
Zend Framework provides nice (lightweight) models representation and the MVC was useful to create the HTML view and services.

Cloud-based
Using  phpCloud was easy as always with plenty of slick workflows helping me to easily deploy my application and push updates to staging and testing targets. This way I always kept two versions that represent my Work in Progress and Done apps. I also got packages ready for deployed in case I want to deploy it to another Zend Application Fabric  instance.

The application is available on github .

ganoro.blogspot.com | 2/2/12 9:36 AM
Planet Eclipse: Jordi Böhme López: Accessing a very large data set with mobile devices

A few months ago my colleague, Ralf Sternberg, wrote an article on “how to access a huge dataset with the web browser“.  Now, if it’s possible to access very large datasets with a browser, wouldn’t it be really cool to access it in the same way with mobile devices?

As you may have heard, we launched RAP mobile two days ago. And, we did just that. With RAP mobile you can access exactly the same dataset with exactly the same code as in Ralf’s post. The dataset contains over 500,000 emails totalling over 2GB of space. Check out the screencast below and the source code on github.

What I find intriguing about this framework is that it is fast. There is no data on the phone. The information displayed in the UI is retrieved asynchroniously from the server while the user is scrolling through this enormous set of data. The native iOS client takes care of the proper preloading, caching and memory management.

eclipsesource.com | 2/2/12 8:58 AM
5 hot specialties for software developers
Want to escape the outsourcing axe? Today's IT trends are creating lucrative niches for ambitious developers. www.javaworld.com | 2/2/12 8:01 AM
Develop an environment-aware Maven build process
Including environment variables in your Maven build process could boost your team's efficiency at every stage of the software development lifecycle. Java developer Paul Spinelli demonstrates his custom approach to environment-aware Maven builds. www.javaworld.com | 2/2/12 7:39 AM
Java EE 6 pulled crowd at Austin JUG

I delivered a NetBeans-driven Java EE 6 session to about 80+ attendees at the Austin JUG yesterday.

www.topix.net | 2/2/12 5:18 AM
QMTools Editor 3.0

QMTools Editor is a free, small, unique application that can be used to interactively create and edit QMTools applet configuration files.

www.topix.net | 2/2/12 3:08 AM
DevX - Java: Oracle Proposes Single Committee to Oversee Java
The change would unify Java EE/SE and ME oversight. www.devx.com | 2/2/12 12:08 AM
Thermocouple Virtual Chart Recorder

Newport Electronics' iTCX transmitter allows users to monitor temperature from two independent thermocouple channels over an Ethernet network or the Internet.

www.topix.net | 2/1/12 11:09 PM
KonaKart V6.0.0.0 - Now With JQuery Library

London February 1, 2012 - DS Data Systems UK Ltd. is pleased to announce the release of KonaKart v6.0.0.0, a java-based eCommerce shopping cart application that provides an extensive set of features to enable retailers to successfully sell their products over the internet.

www.topix.net | 2/1/12 10:09 PM
Java.net Weblogs: Persist document in Cassandra


 
 
Nowadays the Enterprise applications beyond persist String and number also can save file. Persist this information is very interesting, for example, a civil process there are information about the process (name of author, date, number of protocol) and the document which represents, or a twett with an image. In Apache Cassandra, you can save file, but for large file you should use a NOSQL Document Store.
 
For demonstrated this resource will made a little program, an album of photography, The picture will show from name. If I use “Paris” will show a picture was related to that name.
 
 
 
 
The program was made with java SE 7 platform, with Swing like GUI, and Easy-Cassandra framework, for this it's necessary download of Easy-Cassandra and its dependencies.
 
The object has two field:
The name of the photo, how this field must be unique it also will the key
The file of the photo
 
The table 1 show the object made.
 
 
@ColumnFamilyValue
public class Photo {
@KeyValue
private String name;
 
@ColumnValue
private File picture;
//getter and setter
}
Table 1: The Object made
 
 
public class PhotoDao {
private Persistence persistence;
public PhotoDao() {
persistence = EasyCassandraManager.getPersistence("exemplo", "localhost", 9160);
}
public void criar(Photo bean) {
persistence.insert(bean);
}
 
@SuppressWarnings("unchecked")
public List listarTodos() {
return persistence.findAll(Photo.class,ConsistencyLevelCQL.ALL);
}
}
Table 2: The DAO
 
When the Cassandra is running the next step is create the KeyStore and Family Column, in Cassandra's Client mode execute the command in the table 3.
 
 

create keyspace exemplo; use exemplo;

create column family Photo

with comparator = UTF8Type;

Table 3; Command for run

 
 
 
 
 
This post presented the persistence of an document or file with a simple example. This resource is useful and easy of use. The Easy-Cassandra has support with java.io.File and all classes who implement java.nio.file.Path.
 
 

Reference:

Easy-Cassandra: https://github.com/otaviojava/Easy-Cassandra/
 Example program with Eclipse and Netbeans: https://github.com/otaviojava/Easy-Cassandra/downloads

 

 

www.java.net | 2/1/12 9:32 PM
Hadoop: The Definitive Guide

Ready to unleash the power of your massive dataset? With the latest edition of this comprehensive resource, you’ll learn how to use Apache Hadoop to build and maintain reliable, scalable, distributed systems. It’s ideal for programmers looking to analyze datasets of any size, and for administrators who want to set up and run Hadoop clusters. This third edition covers recent changes to Hadoop, including new material on the new MapReduce API, as well as version 2 of the MapReduce runtime (YARN) and its more flexible execution model. You’ll also find illuminating case studies that demonstrate how Hadoop is used to solve specific problems.

oreilly.com | 2/1/12 9:10 PM
Java.net Weblogs: Bundling Gems in Jars/Wars for Jruby

 

As part of Virgil's ability to deploy ruby scripts to a remote Hadoop cluster, we needed to package gems' into that Hadoop jar.  After a bit of monkeying around, we got it.

This is the key piece of information:

"Because the operation of Java's classpath and Ruby's load path are so similar, especially under JRuby, they are unified in JRuby 1.1. This results in a number of unified capabilities:...

 

  • Everything in the Java classpath is considered to be a load path entry, so .rb scripts, for example, contained in JAR files, are loadable."

First thing you need is to actually get your hands on the gem.  To do this, you can run jruby to grab the gem.

 

java -jar jruby-complete-1.6.0.jar -S gem install -i rest-client rest-client --no-rdoc --no-ri


This will fetch the gems and install them into the current directory under the directory "rest-client".  In that subdirectory you'll find: bin, cache, doc, gems and specifications.  The actual code for the gems is found in the gems directory.  In the case of rest-client, you'll find two directories that contain the code: mime-types-1.17.2 and rest-client-1.6.7.

 

This is what you need to bundle into the jar.  We copied those two directories into our java project under src/main/resources/gems/.

 

One approach would be to simply include those directories on your classpath.  Another approach is to programmatically adjust the loadpath to include those directories.   You can do this with the following lines:

 

List paths = new ArrayList(); 

paths.add("gems/rest-client-1.6.7/lib/"); 

paths.add("gems/mime-types-1.17.2/lib/"); 

this.rubyContainer = new ScriptingContainer(LocalContextScope.CONCURRENT); this.rubyContainer.setLoadPaths(paths);

 

Then, when using this.rubyContainer you'll be able to run ruby files that require the rest-client.

 

Since the ruby scripts are actually loaded via the classpath (from the loadpath), jruby is happy loading them from within a jar.  In our case, we built the jar using maven and the gems were included in the jar because we put them under src/main/resources/gems.

 

 

 

 

www.java.net | 2/1/12 6:15 PM
Java.net Weblogs: Bundling Gems in Jars/Wars for Jruby

 

As part of Virgil's ability to deploy ruby scripts to a remote Hadoop cluster, we needed to package gems' into that Hadoop jar.  After a bit of monkeying around, we got it.

This is the key piece of information:

"Because the operation of Java's classpath and Ruby's load path are so similar, especially under JRuby, they are unified in JRuby 1.1. This results in a number of unified capabilities:...

 

  • Everything in the Java classpath is considered to be a load path entry, so .rb scripts, for example, contained in JAR files, are loadable."

First thing you need is to actually get your hands on the gem.  To do this, you can run jruby to grab the gem.

 

java -jar jruby-complete-1.6.0.jar -S gem install -i rest-client rest-client --no-rdoc --no-ri


This will fetch the gems and install them into the current directory under the directory "rest-client".  In that subdirectory you'll find: bin, cache, doc, gems and specifications.  The actual code for the gems is found in the gems directory.  In the case of rest-client, you'll find two directories that contain the code: mime-types-1.17.2 and rest-client-1.6.7.

 

This is what you need to bundle into the jar.  We copied those two directories into our java project under src/main/resources/gems/.

 

One approach would be to simply include those directories on your classpath.  Another approach is to programmatically adjust the loadpath to include those directories.   You can do this with the following lines:

 

List paths = new ArrayList(); 

paths.add("gems/rest-client-1.6.7/lib/"); 

paths.add("gems/mime-types-1.17.2/lib/"); 

this.rubyContainer = new ScriptingContainer(LocalContextScope.CONCURRENT); this.rubyContainer.setLoadPaths(paths);

 

Then, when using this.rubyContainer you'll be able to run ruby files that require the rest-client.

 

Since the ruby scripts are actually loaded via the classpath (from the loadpath), jruby is happy loading them from within a jar.  In our case, we built the jar using maven and the gems were included in the jar because we put them under src/main/resources/gems.

 

 

 

www.java.net | 2/1/12 6:13 PM
The Aquarium: Java EE 6 samples delivered to your door step

Arun has a blog reminding folks about the Java EE 6 samples that ship with the SDK.

The list of code samples is pretty long and a good complement to the Java EE 6 Tutorial.

Note you can also access these samples from any GlassFish install (not just from the SDK) by adding the missing repository using :
% /bin/pkg set-authority -O http://pkg.sun.com/javaeesdk/6/release/ JavaEE6SDK
% /bin/pkg list -a | grep samples
javaee-samples-build (JavaEE6SDK)   1.0-4 known ----
javaee-samples-full (JavaEE6SDK)    1.0-4 known ----
javaee-samples-web (JavaEE6SDK)     1.0-4 known ----

blogs.oracle.com | 2/1/12 6:00 PM
ComfyJ 2.9

ComfyJ is a powerful application that allows you to use ActiveX/COM/OLE/OCX objects directly from your Java application.

www.topix.net | 2/1/12 5:54 PM
Planet Eclipse: Orion: Orion Features in Firefox 10 and 11

Firefox 10 was released yesterday, and the release announcement highlighted developer tools such as the Orion-based Scratchpad as key features in the release. At the same time, Firefox 11 moved into their Beta channel. The Mozilla developer tools team released a cool video last week showing upcoming features in Firefox 11, such as a 3D Page Inspector, and a new Orion-based Style Editor. Scratchpad and Style Editor are the result of many months of close collaboration between the Mozilla dev tools team and the Orion Editor team. Congrats to Mihai, Kevin, and the rest of the Firefox team on another great release!

planetorion.org | 2/1/12 4:58 PM
The Aquarium: Quick note - possible short outage on java.net

As we constantly improve the java.net infrastructure you might experience some downtime on Wed, Feb 1, 2012 @ 6-8pm PT. Hopefully, this one should only really be a short one.

blogs.oracle.com | 2/1/12 4:00 PM
Vowels don't cost $500: Pontificating on Java variable naming
Every variable you declare in Java must be associated with a type, and it must also be given a unique name. When naming your variables, put a little bit of thought into it and name them well. Well thought out variable names make Java programs both easier to read and easier to maintain. Good names can even make Java programming fun.


www.pheedcontent.com | 2/1/12 2:52 PM
Hibernate Query Cache in Action
One of the common problems of people that start using Hibernate is performance, if you don't have much experience in Hibernate you will find how quickly your application becomes slow. If you enable sql traces, you would see how many queries are sent to database that can be avoided with little Hibernate knowledge. In current post I am going to explain how to use Hibernate Query Cache to avoid amount of traffic between your application and database.


www.pheedcontent.com | 2/1/12 2:50 PM