Articles for the ‘Development’ Category

Annotation based Kubernetes and Openshift Manifests for Java Applications with ap4k

Thursday, February 28th, 2019

Writing our manifest files for Kubernetes / Openshift often forces us to edit xml, json and yml files by hand.

A new library, ap4k allows to specify metadata for these manifest files directly in our Java code using annotations.

In the following short example I am going to demonstrate how to generate manifest files using Maven and ap4k.

(more…)

Managing Architecture Decision Records with ADR-Tools

Sunday, May 27th, 2018

Every software project includes a set of architecture decisions defining boundaries and constraints for further design and implementation.

It’s important to document those decisions somehow or else a development team might not know which decisions where made and with which assumptions.

Or they know the decision but are missing the context and the consequences and therefore decisions are blindly accepted or blindly changed.

In the following short tutorial I will show how to structure architecture decisions in so called Architecture Decision Records and how to manage them with a simple tool named ADR-Tools.

(more…)

Dependency Injection for Go with facebookgo-inject

Wednesday, November 9th, 2016

Setting up a larger application using dependency injection always requires us developers to set up our application’s object graph.

Programming in Go there is a library that eases this task for us, offering a reflect based injector to set up the graph in a few steps, named facebookgo-inject.

In the following article I’d like to demonstrate dependency injection using this library for a small sample application.

(more…)

Writing a Websocket Chat in Go

Saturday, October 29th, 2016

Learning the Go programming language,  I wanted to implement an application that I had written with other languages and frameworks before to get a grip on this language.

That’s why I tried to implement a really simple websocket chat server in Go and described my approach in the following article.

(more…)

Continuous Delivery with Bitbucket Cloud and Bitbucket Pipelines

Friday, July 1st, 2016

Atlassian has added a continuous integration service as a new feature to their Bitbucket Cloud product. It’s called Bitbucket Pipelines and it is similar to Travis CI for GitHub offering a nice integration for continuous integration/delivery pipelines for projects hosted on Bitbucket.

It’s still in the beta phase and requires a sign-up but nevertheless I’d like to demonstrate the current state of this service and how easy it is to add scripted pipelines to a project.

(more…)

Creating and Providing HipChat Integrations with Atlassian Connect, Nodejs and Express

Tuesday, August 18th, 2015

HipChat is Atlassian’s alternative to Slack and its solution to team collaboration chats. Atlassian Connect offers developer tools to bootstrap applications, connect to Atlassian’s cloud products with easy and in combination with HipChat’s REST APIs allows us to write integrations for such a chat server in no time.

In the following tutorial I’d like to show how to write an integration within a few steps using Atlassian Connect, Node.js and Express and how to connect the integration to a HipChat server.

Finally on the one hand I’m going to explain how to speed up local development with ngrok, an in-memory database and nodemon for automatic application restarts and on the other hand I’m going to demonstrate how to configure the application for production, running with a Redis key-value store on Heroku.

(more…)

Creating a hybrid mobile Application with Ionic, Cordova and AngularJS

Sunday, May 3rd, 2015

Nowadays in the realm of hybrid mobile application development there is a variety of available frameworks worth having a look at.

In the following tutorial I’d like to demonstrate the development life-cycle for a complete mobile application using Ionic, Cordova and AngularJS (and others) covering every step from the initial project setup, creating Angular Controllers, Directives, adding Cordova Plug-Ins, running and testing the application in the browser and emulator up to finally running the application on an Android device and assembling files for a release.

Finally I’d like to show some special features from the Ionic ecosystem like the Ionic Cloud and running our applications using the IonView app.

(more…)

Using Java Config-Builder to assemble your Application Configuration

Tuesday, May 20th, 2014

There’s a variety of configuration frameworks to use in our Java applications. Java Config Builder is one of them and it offers some nice features that I would like to demonstrate in the following short examples as are:

Loading values from different sources like property-files, environment variables, command-line-arguments or system properties, specifying default values, mapping arbitrary types or collections, merging configurations and using the Java Bean Validation standard aka JSR-303.

(more…)

Allocating available random Ports in a Maven Build

Wednesday, May 7th, 2014

Recently in a project I encountered the following problem: The development team used Git with a branch-per-feature-like workflow and the integration server, Bamboo in this case, was configured not only to run the integration-tests for the master-branch but also for every change in a feature branch.

As the team  developed a Java EE web application ports like 8080 occasionally were already bound and builds failed.

I knew a plug-in for Jenkins CI I to search for available ports and assign them to a build variable but I wanted to control such information directly within the Maven build life-cycle so I searched and finally found Sonatype’s Port Allocator Plug-in for Maven.

In the following short example I’m going to demonstrate how to allocate available random ports in a Maven build and assign them to an embedded servlet container.

(more…)

Running JavaScript Tests with Maven, Jasmine and PhantomJS

Sunday, May 4th, 2014

Sometimes in a project there is the need to run tests for your client-side code, written in JavaScript from a Maven build.
One reason might be that Maven manages a complex build life-cycle in your project and you need a close integration for your JavaScript tests, another one might be that you’re in an environment where it is complicated to install and manage additional software like an integration- or build-server.

(more…)

Creating Grammar Parsers in Java and Scala with Parboiled

Sunday, January 26th, 2014

Parboiled is a modern. lightweight and easy to use library to parse expression grammars in Java or Scala and in my humble opinion it is perfect for use cases where you need something between regular expressions and a complex parser generator like ANTLR.

In the following tutorial we’re going to create a simple grammar to specify a task list and write an implementation of a parser also as unit tests for each grammar rule in Java.

Additionally, we’re using the Scala variant of Parboiled to build up an Abstract Syntax Tree parser and analyze a given task list with it.

(more…)

Business Process Modeling with Activiti and BPMN 2.0

Sunday, September 15th, 2013

Having tried a bunch of workflow engines and business processing management platforms I now have given the Activiti framework a try.

I immediately liked the good test support using annotations and jUnit test rules, a straight API and the good Eclipse IDE integration as well as I liked the Activiti Explorer and the Activiti REST Application and the feeling to achieve quick results with less effort when using this framework.

In the following tutorial I’m going to an example BPMN process for an issue request process using different components like Groovy script tasks, service tasks written in Java, E-Mail service tasks and form builders.

Finally I’m showing how to write a full integration test for the process and how to run the process in a web application environment using the Activiti Explorer application.

(more…)

Filtering Source Files using the Templating Maven Plugin

Tuesday, September 3rd, 2013

The Templating Maven Plugin looks useful if one needs to copy and to filter source files in a project e.g. to add property values from the build environment to a class.

For a short demonstration I’ve added the following short snippet.

(more…)

Handling Feature Flags in a Java EE Application using Togglz

Wednesday, June 26th, 2013

Feature flags are a common technique, often combined with continuous deployment and delivery and they allow us to rollback a specific feature, to create A/B tests or to rollout a specific feature for a specific test group, a specific amount of users or dedicated systems.

In the following short examples I’d like you to demonstrate how easy it is to implement feature flags with the Togglz framework with a few steps in a Java EE environment.

(more…)

Continuous Deployment using GlassFish, Jenkins, Maven and Git

Wednesday, May 29th, 2013

Recently I needed a quick solution to deploy a Java EE 6 web application on a GlassFish instance automatically and subsequent to a successful build of the project on the integration server.

It took only a few steps using Jenkins, Maven and the Cargo plugin and I’d like to share this quick solution with you here.

(more…)

Creating Rich Clients with Apache Pivot

Sunday, May 19th, 2013

Apache Pivot is a modern framework to create rich clients as desktop applications or to run in a web browser.

It offers nice GUI elements, supports XML/WTKX templates, data bindings, JVM scripting languages and much more.

In the following short examples I’m going to create a desktop application to open a file browser, select a file and output the selected file’s name, first using a programmatic approach to create the user interface, and afterwards using XML/WTKX templates.

(more…)

Adding multiple EntityListeners to an Entity in JPA 2

Monday, February 25th, 2013

The ability to attach lifecycle events to an entity using simple annotations sometimes is a neat feature in the Java Persistence API.

The following short snippets demonstrate how to bind and trigger the different available lifecycle events using an embedded derby database and a bunch of annotations.

(more…)

Aspects of Functional Programming in Java

Monday, July 16th, 2012

Functional programming is a trending topic these days and a lot of Java programmers are hot for the features that modern functional programming languages might offer.

Waiting for Java 8 and native closure support is a nice thing but for now we’re going to take a look at several Java frameworks that are trying to implement typical structures from those functional languages where possible using the capabilities of the Java language to emulate elements like higher-order-functions, closures, options and others …

(more…)

Compiling CoffeeScript with Maven

Friday, May 18th, 2012

CoffeeScript is a neat language that is transcompiled into JavaScript but is more predictable and allows to write the same code with 1/3 fewer lines and of course with a (imho) nicer syntax.

CoffeeScript is nice but a vivid integration into our application build lifecycle with Maven is better  and that is what the following example is all about.

(more…)

Selenium WebDriver, Selenium Server and PageObjects by Example

Tuesday, March 6th, 2012

A lot has changed since Selenium RC and WebDriver has given us a new syntax to write tests for our web pages. PageObjects add an abstraction to the pages under test and finally we’re able to programatically start Selenium server instances and use them to run the tests.

In the following tutorial, we’re writing some tests using PageObjects, WebDriver, Selenium Server and finally we’re even taking some screenshots of our tested web pages..

(more…)

Creating a LDAP server for your development environment in 5 minutes

Monday, June 13th, 2011

I am currently working on a plugin that needs to receive some information from an LDAP/Active Directory using JNDI. That’s why I needed to set up a directory server in a short time and I didn’t want to waste much effort for here.

Luckily for me the Apache Directory Studio saved my day and allowed me to set up everything I needed in a few minutes.

Short and sweet: In this tutorial I’m going to show you how to configure everything you need in your Eclipse IDE and finally how to query the created LDAP server with a tiny java client using JNDI.

(more…)

A look at Google’s Protocol Buffers

Tuesday, July 6th, 2010
Protocol Buffers are a serialization format developed by Google- you might ask if another IDL is really needed here – is Google barking at the wrong tree?
But protocol buffers offer some advantages over data serialization via XML or JSON – Google says they (compared to XML)..
  • are 3 to 10 times smaller
  • are 20 to 100 times faster
  • provide generated data access classes for programmatic use
  • provide backward compatibility
So lets play around a little with protocol buffers in Java and build a small application that serializes and deserializes some data using a defined format..

Java Server Faces/JSF 2 Tutorial – Step 1: Project setup, Maven and the first Facelet

Saturday, June 5th, 2010

In this short tutorial we are going to build a Java Server Faces Web-Application using JSF2.0, Facelets, Maven and Hibernate as ORM Mapper.

The goals for this first step are: Setting up the project structure using Maven, defining a frame template/decorator and a registration facelet, creating a managed bean and mapping it’s values to the facelet, adding some basic validation, displaying validation errors and finally adding a navigation structure.

In step2 of this tutorial we are going to add persistence using Hibernate, add some security, create a custom UI component and add some AJAX.

The Mojarra JSF implementation is used for this tutorial – perhaps I’m going to post more about the MyFaces implementation in another tutorial.

(more…)

Coding Katas with Maven

Thursday, April 15th, 2010

Searching for nice coding kata sites I found this one – codingkata.org – I really liked because of the quick start and nice maven integration.

Just head over to the kata overview select the kata you wish to try out, copy the generated maven command line option and run it in the console – heres the code for the hello-world sample: (more…)

Named Queries in Grails 1.2

Tuesday, April 6th, 2010

They built a nice new feature in Grails 1.2 called “named queries“. Named queries can be defined in a domain class as static properties and support the criteria builder syntax. (more…)

Manage dependencies with the Maven Dependency Plugin

Sunday, April 4th, 2010

In a maven project there are lots of dependencies to handle – often one wants to know which version of a software comes from.

The solution to this problem is the Maven Dependency Plugin which helps you to find used/unused/declared/undeclared dependencies in your project.

In addition the plugin allows you to copy or unpack artifacts. (more…)

How to build a Confluence SOAP client in 5 minutes

Sunday, March 28th, 2010

In this tutorial we are going to build a SOAP client for the popular Confluence Wiki in about five minutes. The client is going to receive rendered HTML Markup from a specified Confluence Page.
(more…)

Confluence Developer Instance Quick Setup

Friday, March 26th, 2010

This short tutorial shows how to set-up a developer instance of the popular Confluence Wiki from Atlassian in a few minutes.

It’s a prerequisite for a few following tutorials regarding the Confluence API and plug-in development for this system.

We want a quick install so we are going to run Confluence with the embedded servlet container and HSQL database.
(more…)

How to add a local lib directory to Maven

Thursday, March 18th, 2010
Sometimes there is a dependency not available at a remote repository and one is too lazy to set up a local maven repository – that’s when one adds a directory in the project structure and wants maven to find dependencies there. (more…)
Search
Categories