Feed aggregator

JavaOne 2016 Observations

Javalobby Syndicated Feed - Fri, 07-Oct-16 01:01

I recently got back from JavaOne, where there was a surprising amount of good stuff in the technical sessions, including a number of very well-prepared presentations on Java 9 modularity and the best way to migrate existing code to Java 9. We also got a hint of Oracle’s plans for Java EE. On the other hand, there was disappointingly little on what we might expect regarding the longer-term future of Java, two or more versions down the road.

Java 9 and Modules

To me, the most interesting thing discussed at JavaOne was the upcoming release of Java 9. While Java 9 contains a number of new APIs, by far the most important new feature is the addition of modules (also known as “Project Jigsaw”). Modules are a way of much more closely controlling the encapsulation of APIs so that Java code can only access APIs explicitly exported by a module. Modules also specify what other modules they require, which allows for compile-time and run-time checks to determine whether all the required components are present. Finally, modules are a much more straightforward and reliable alternative to the traditional Java classpath, and allow us to avoid “classpath hell.”

Categories: Java

Apache PDFBox. Don’t Leave Home Without It.

Javalobby Syndicated Feed - Fri, 07-Oct-16 00:01

Scenario: You have to generate a multiple page PDF report from production data. Each page must be a PDF page that will show your production data and allow users to change it through the use of text fields or text areas. Each report could have from 1 to 50 pages, each page is divided into sections, and each section can have 20 UI components (text fields and text areas). One page can contain from two sections to eight sections, depending on what specific template is it used for that page.

Please see below how the template of such page might look like:

Categories: Java

Asynchronous Communication With JAX-RS 2

Javalobby Syndicated Feed - Thu, 06-Oct-16 22:31

Asynchronous communication has become more important nowadays, especially as data become more voluminous every day. 

One of the simplest cool new features in JAX-RS 2 is asynchronous processing. What's really nice is that async processing has been added both to client and server side APIs.

Categories: Java

Exploring a Top-Down SOAP Service: Part II

Javalobby Syndicated Feed - Thu, 06-Oct-16 21:31


When we left off last time, we had succeeded in getting a bare-bones WSDL definition to generate some code, using the Apache CXF cxf-codegen-plugin (Maven).

I added only the absolutely necessary pieces to the WSDL, one step a time, so that we could observe what errors were produced, and so we could learn what we might be missing. Hopefully, this might be a helpful reference if you ever encounter some error message.

Categories: Java

A Java Developer's Guide to Migration

Javalobby Syndicated Feed - Thu, 06-Oct-16 04:01

This article is featured in the new DZone Guide to Modern Java, Volume II. Get your free copy for more insightful articles, industry statistics, and more. 

Companies with desktop applications written in Java are under increased pressure to provide their users the freedom of a responsive web experience. Ideally, you could just run a desktop-style application inside a browser, and for a long time applets have made it possible to do just that. However, applets work using a protocol called NPAPI, which has been deprecated in most recent browsers. Today, the only real option to run a web application is to get pure HTML5 into the browser — not easy for most desktop developers given the new set of styling, scripting, and markup languages they have to learn.

Categories: Java

Our Next Stop in the Software Journey: A Top-Down SOAP Service (Part I)

Javalobby Syndicated Feed - Thu, 06-Oct-16 02:31


In our continuing make-believe story, you wrote some useful code for yourself in Java a year ago because you had a regular need. Soon, you turned it into a reusable component in its own project. (Shape calculator: project shape-calc-jpa-hibernate.) You then wrapped it in a command-line application.

Others in your department saw it, wanted it. Someone later suggested you provide a web application front-end as well, which you delivered.

Categories: Java

The Rise and Fall of Scala

Javalobby Syndicated Feed - Thu, 06-Oct-16 01:01

Five years ago, Scala seemed like the next big thing in programming languages because it elegantly enabled functional programming within an object-oriented paradigm. Today, Scala’s popularity seems to be fading, with companies like LinkedIn and Yammer moving away from it. The TIOBE index (www.tiobe.com) of software language popularity ranked Scala at #13 in 2012; now it’s fallen to #32 in August 2016, being used by less than .6% of the programming community.

Here’s another ominous sign for Scala: Lightbend, its parent company, is now releasing new frameworks with a Java API before the Scala version. Anecdotally, as CTO of a leading software product engineering company, I meet many software development managers, and I know of at least two who have made the painful decision to abandon Scala after more than a year of adoption. What happened? What gave Scala its initial popularity boost, and what caused its decline? Are there any use cases for which Scala is still the best choice?

Categories: Java

Spring Data Series: Spring Data in a Nutshell

Javalobby Syndicated Feed - Thu, 06-Oct-16 00:01

In this series, we will deep dive into the Spring Data architecture. In this article, we will concentrate on the features of Spring Data and what it has to offer.

Why Spring Data?

Spring Data is an umbrella that takes care of SQL and NoSQL databases and reduces the effort to use them. The Spring community’s motto is to reduce boilerplate code, so the community invented Spring Data, which is taken one step forward than the database template. In a JPA template, although Spring hides the creation EntityManagerFactory managing Entity manager but the problem is we still have to maintain a DAO layer and provide CRUD operations for each entity. CRUD operations are similar in nature you have framed it in your mind but still, have to write or copy and paste same code over and over for different Entities.

Categories: Java

Gluon CEO Johan Vos: JavaOne on Mobile

Javalobby Syndicated Feed - Wed, 05-Oct-16 22:31

After this year's JavaOne, I spoke with Johan Vos, CEO of Gluon, a cross-platform Java API for creating mobile Java apps. They created a JavaOne app for 2015 and 2016, and won the "Duke's Choice Award" for 2015 and 2014 at the conference. 

1. How Did You Like JavaOne This Year?

Every year, JavaOne provides a great opportunity to get in touch with Oracle, other companies, and members of the Java community, and to share the latest evolutions and ideas in Java. This year was no different.

Categories: Java

3 Ways to Use Redis Hash in Java

Javalobby Syndicated Feed - Wed, 05-Oct-16 21:31

Needless to say, Map is vital and the most popular structure in Java. Redis has offered a data structure that closely resembles Java's Map structure, which has attracted a lot of interest from Java developers. There has been a growing number of Java libraries that talk to Redis, most of which have provided a way to interact with Redis Hashes. Let's compare three different ways of interacting with Redis Hahs in Java through examples of using three most popular Redis Java clients. In order to make them easy to understand and fairly comparable, each example uses the same popular binary codec, Kryo, to provide serialization/deserialization of the dummy data.

1. Jedis

Jedis only works with raw binary data so encoding/decoding logic are required each time when a Redis command is invoked. A Jedis instance also needs to be acquired each time from the instance pool before any command can be invoked.

Categories: Java

Top 5 most required JIRA workflow extensions

codecentric Blog - Wed, 05-Oct-16 14:51

JIRA is the #1 software development tool for agile teams.
Its flexible workflow engine is one of the success factors. Increasing numbers of customers use JIRA for their business workflows where some enhancements are needed. Those enhancements are offered by so-called plugins or add-ons. In this blog I would like to introduce the most requested features for JIRA workflows.

As an Atlassian Expert, our company (codecentric) comes across requirements in customer projects which exceed the JIRA standard functionality.
Fortunately the Atlassian tools provide a really professional plugin concept to extend the missing functionality. By now, the Atlassian Marketplace has evolved into a platform with more than 2.000 add-ons. You can get a plugin for nearly every use case commercial or in many cases for free.

With our plugin team, codecentric developed a lot of individual plugins for our customers. We bundled all enhancements regarding JIRA workflows and packed them into one plugin called “Workflow Essentials for JIRA“. The plugin is of course available in the Atlassian Marketplace and is continuously extended with new features.
Below we describe the Top 5 use cases and how you can tackle them with this plugin:

Use Case 1 – Default Values for Create Screen

The dialog box „Create Screen“ is used for creating a new issue in JIRA. As an admin you can configure what kind of system fields and custom fields will appear on this screen. You can also define default values for custom fields – globally for all projects or in the context of each project individually. Unfortunately there is no possibility to define default values for system fields.
Those kinds of templates are much asked for to clarify which data is expected in fields or to improve usability by creating new issues.
In Workflow Essentials for JIRA there is a simple interface to pre-fill default values in system fields and custom fields for each project and issue type individually.

Default value for create screen Screenshot

The screenshot shows an example where a new bug issue for project „Use Case Demo“ is pre-filled with above shown content in the system fields „Summary“, „Description“ and „Environment“.

Atlassian Suggestion Portal

In the Atlassian Portal you can also see that this is a highly requested feature which has more than 1.000 votes and has been open since 2004.

Use Case 2 – Mandatory fields

When configuring mandatory fields, it’s always a decision between necessity of data and usability.
In JIRA it’s possible to make systems fields and custom fields mandatory by using the field configuration. Those required fields get a red asterisk (star) in front of the field on the „Create Screen“. This asterisk shows the user that he has to insert some value into those fields before he can create the issue.
In most cases the user doesn’t have all data when creating an issue. So if all fields were mandatory, the user wouldn’t be able to create the issue.
It would make more sense to make those fields mandatory at a later stage.
JIRA users would like to complete all fields at a later point of time.

In workflow transitions you can use validators to check if the user can changeover to the next status. To make mandatory fields visible to the user in any workflow transition and eventually show an individual error message, a transition screen should be configured.

Pflichtfelder in JIRA

The field “Fix Version” is configured as mandatory. The red asterisk shows the user in a transition screen that this is a mandatory field.

The Atlassian Marketplace offers different kinds of plugins to validate fields in workflow transitions.
However, these plugins don’t show the user the red asterisk for mandatory fields.
This means that users first run into an error message before they know that a field is mandatory. Our customers gave us the feedback that this is a bug as long mandatory fields are not marked as mandatory.

Even this feature request won’t be implemented in the near future by Atlassian.The request has been existing since 2005 and has 751 votes.

In “Workflow Essentials” we implemented the requirement including the red asterisk. Additionally you can create individual hints/error messages to show the user adapted messages.

Use Case 3 – Add Watcher

Notifications in JIRA can be configured by Notification Schemes for each JIRA project individually.
Notifications can be triggered by certain kind of events (Issue creation, issue update, assigning or deleting issues, etc). Additionally you can define a role, group or respective user to notify for each event.
This notification concept is very powerful. Nevertheless a lot of companies do require more flexibility. There is, for example, no possibility to handle notifications for each issue type differently.This means that notifications are sent by issue creation regardless of a bug, story or an epic.

Thanks to the JIRA watchlist feature, a new notification individualization for each issue is possible. Each user can add herself to the watchlist to follow interesting issues. With the permission „Manage Watcher list“ you can also make other users watchers of an issue.
There is a requested feature with more than 600 votes which gives the opportunity to add users to the watch list automatically. To be more precise, it should be possible to add users (for example a team) by default during issue creation.
With „Workflow Essentials“ you can add users to a Multi-User-Picker-Field by default on the Create screen. In the next step you can put a post function in the “Create transition” which adds all the users in the Multi-User-Picker-Field to the watchlist.

Add Watcher

The configuration adds all user to the watchlist which are selected in a Multi-User-Picker-Field

In order to make the users appear on the Create screen, you have to define them with the “Default value for create screen” functionality. The post function „Add Watcher“ needs to be added in the „Create transition“ of the workflow.

Use Case 4 – Update / Set Value

In JIRA you can update system fields during workflow transitions by adding the post function “Update Value” to the transition and choosing the particular system field.
An example: You can set the resolution from your issue to a defined value as soon as someone moves the issue to the status “Resolved”.
Unfortunately there is no way in JIRA to update custom fields.
The feature request to update custom fields can be found here.
There are lots of use cases – one example is: The custom field “Responsible Manager” should be automatically updated to “John Doe” when transitioning into status „Ready for Approval“.

Feldwerte in JIRA über Post-Functions ändern

The Workflow Essentials Plugin is supporting many different custom field types like date fields, text fields or numeric fields to update them via post function in workflow transitions.

Use Case 5 – Validate Parent Issue Type for Subtasks

Issue types are helping in JIRA projects to interact differently with issues in a project. That means you can for example create bugs and requirements which use different workflows, screens and fields. For each project you can define which field types are available.
If we look one level deeper at the sub-tasks, we won’t find any possibility to define which sub-task types are available for the parent issue. In other words, all assigned sub-tasks in a project are selectable while creating a new sub-task.
There are certain use cases where the options to choose a sub-task need to be adapted.

Example: For a purchase requisition, only the sub-tasks material or service delivery should be selectable. All other sub-tasks in that project are not allowed.

Validate Parent Issue Type

The Workflow Essentials Plugin provides a validator called „Parent issue type validator“. You can put the validator in the create transition from the sub-task workflow to allow the creation only for the right parent issue.


JIRA provides a wide range of functionality to realize lots of different use cases, but especially in business workflows requirements go beyond the existing workflow functionality.
With Workflow Essentials you can configure the most required extensions without writing code.
We would be pleased if you try out the plugin (30 days for free) and send us some feedback. Tell us what kind of workflow extensions you are using and what functionality you are missing. You can leave us a comment with ideas or feature suggestions or write an e-mail.

The post Top 5 most required JIRA workflow extensions appeared first on codecentric Blog.

Categories: Agile, Java, TDD & BDD

ReentrantLock Cheat Sheet

Javalobby Syndicated Feed - Wed, 05-Oct-16 12:34

The ReentrantLock is a replacement for the easier-to-use synchronized statement when you need one of the following advanced techniques: lockInterrupibly, tryLock, lock coupling, multiple conditions, or fair locks.

In the cheat sheet below, I summarized each technique. And in the rest of this blog post, I give a detailed description of those techniques.

Categories: Java

Codapps.io Teaches Java on Mobile From Scratch

Javalobby Syndicated Feed - Tue, 04-Oct-16 23:31

We’ve discussed codapps.io before. It’s an MOOC (online course) that allows non-programmers to learn Java programming. The course uses mobile and Codename One as its vehicle to provide a learning incentive. The existing Codename One documentation and tutorials can be quite intimidating to a person who is a complete Java newbie, so this course is quite helpful in bridging that gap.

I think that learning GUI programming is probably the best way to learn programming, as it lets you "see" the results instantly and experiment. Mobile is the new GUI as it is the device that has brought computing to everyone and is deeply tied into our lives. Learning through a device that has such an emotional tie into our lives is far more effective than a "dry" server side tutorial.

Categories: Java

Migrating EJB2 Entity Beans to EJB3 and JPA

Javalobby Syndicated Feed - Tue, 04-Oct-16 23:01

Scenario: you have to migrate all of the EJB2 Entity Beans from a legacy project to EJB3 Entity Beans with JPA. Hibernate will be your JPA implementation and Spring Framework cannot be used. No other layer that the EJB2 Entity Beans layer will be migrated.

The application also contains an EJB2 Session Beans layer. This one will not be replaced, but updated to work with the new EJB3 Entity Beans. (Note: this article will not explain the J2EE architecture. If you want to find more about that, please check here. Please take the patterns presented in the link with a grain of salt. Some of them are obsolete, but some still make sense.)

Categories: Java

Tutorial: Java and Maven in Eclipse Che

Javalobby Syndicated Feed - Tue, 04-Oct-16 22:31

Eclipse Che was written in Java. Get started with the rich Intellisense and Java tools in this tutorial.

1. Start Che

Use your SaaS account for the following, or if you have installed Che, open a terminal and use the Che startup script:

Categories: Java

Scala: Work With Files and Directories

Javalobby Syndicated Feed - Tue, 04-Oct-16 22:01

How often do you need to write or read files? This is a pretty common task in any more or less non-trivial project. Image upload process, CSV or XML parsing, XLS report generation etc. All these operations imply input or output processing. So I’m going to make an overview of the most powerful library for working with files in Scala.

Here is a list of operations which I want to cover:

Categories: Java

Can Spring Security Be Auto-Generated?

Javalobby Syndicated Feed - Tue, 04-Oct-16 21:31

I’ve generally found security requirements are easy to state but hard to implement. So, I've been wondering if I can autogenerate my Spring Security configuration.

Security Requirements

Common security requirements are:

Categories: Java

An Opinionless Comparison of Spring and Guice

Javalobby Syndicated Feed - Tue, 04-Oct-16 03:31

Recently, I had to delve into the play framework for a particular microservice at work. Now it is not exactly new, nor is Guice, nor DI, but coming from Spring world it was still kind of a shift in approach. There is a lot of documentation comparing Spring with Guice, stating which is better, why, and how.

In general, these articles discuss specific points where these two frameworks differ in their approaches and which approach seems better to the author. I am not sure these articles really help someone trying to take a dip in the other framework. We know the differing opinions, as they are stated by the authors of the respective frameworks in their own documentation as well.

Categories: Java

Using Akka With Java

Javalobby Syndicated Feed - Tue, 04-Oct-16 02:01

In the past few days, I've been working on a project with Akka using Java. It was an amazing experience, so I'm going to discuss how to use Akka in Java and write a test case.

If we look at the Akka's documentation, there is a class named UntypedActor to create an actor. But here, we're going to discuss the AbstractActor, which seems pretty concise.

Categories: Java

Bowling Kata in Kotlin [Video]

Javalobby Syndicated Feed - Tue, 04-Oct-16 01:01

Sergio Rodrigo implements the Bowling Game kata in Kotlin using TDD, showing some of the features of the language, such as support for Functional Programming (Higher Order Functions, Lambdas and built-in functions), Pattern Matching, Extension Functions, Expression Bodies, and method names as free text. The kata is performed in a way that shows the expressiveness of Kotlin.

The Kotlin plugin for IntelliJ is used to show the IDE support for the language, using live templates and performing small automatic refactorings.

Categories: Java

Thread Slivers eBook at Amazon

Syndicate content