Nov 162014
 

JSON is a format commonly used for the interchange of data between applications.. The easiest way to process a JSON file is by means of a parser that read the whole document in memory, as a tree of data structures.

But sometimes the volume of data in the JSON file is too big, and the available memory resources are not enough to use this procedure. In those cases, the data must be read as a stream, to process the content of the JSON file sequentially, one element at a time.

This post is an introduction to the Java “Jackson” library, that enables this type of sequential processing of a JSON file in a Java program.

Continue reading »

 Posted by at 12:50 pm
Oct 272014
 

WSDL (Web Services Description Language) is the W3C specification for the implementation of web services offered by servers to remote clients using the HTTP transport protocol.

A service is implemented starting with a WSDL document that defines the services offered by the server and how to access them.

SOAP (Simple Object Access Protocol) is the specification of the XML format that is used in the messages sent/received by clients and servers.

This post is a tutorial on the implementation of a simple example web service conformant to the SOAP/WSDL standard.

Continue reading »

 Posted by at 7:01 pm
Jun 252014
 

The home page of the solr site defines this software as an “open source enterprise search platform”. This post will review the functionality implemented by solr, and provide a step-by-step procedure to install solr on a Linux server.

Continue reading »

 Posted by at 1:47 pm
Apr 222014
 

Sometimes, the execution of a Java application may result in the following warning messages being output to the screen:

$ java  -jar application.jar
log4j:WARN No appenders could be found for logger (com.foo).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

This means that the application is using the log4j API for the generation of tracing messages, but it couldn’t find the configuration file to initialize the logging subsystem.

Continue reading »

 Posted by at 2:14 pm
Dec 062013
 

In our previous post “Introduction to Berkeley DB“, the characteristics and functionality of this type of database has already been introduced. This post presents sample code to use a Berkeley DB in a Java program.

Versions of the Berkeley DB Java library

There are two different versions of the Java library for Berkeley DB:

Berkeley DB standard

The package com.sleepycat.db implements an interface to the same system library used by other languages such as C, Perl and PHP. This ensures the compatibility, un such a way that a Berkeley database previously existing, created by a program written in other language, can be used by a Java program, and viceversa.

Berkeley DB Java Edition

The package com.sleepycat.je is a 100% Java implementation. This ensures the portability of databases created with this library among different platforms.

From the programmer’s point of view, the main difference is that in Berkeley DB Java Edition, creating and opening a database has to be done using the class com.sleepycat.je.Environment.In Berkeley DB standard, using this class is optional.

Other than that, the code used to work with berkeley databases in both libraries is almost identical. It is usually enough to just replace the references to “com.sleepycat.je.*” with “com.sleepycat.db.*” in the import clauses at the top of the source code.

The sample code in this post is written to use Berkeley DB standard.

Continue reading »

 Posted by at 10:47 am
Oct 292013
 

JSON (JavaScript Object Notation) is a data interchange format widely used in many environments.

The JSON website includes links to libraries for the processing of this format in many languages, including PHP, Perl and Java. For Java, there are more than twenty links to different implementations of the JSON format processing functionality.

This post analyses the possibilities offered by google-gson (the JSON library offered by Google) , with some code samples written in java to demonstrate how to read and write files in JSON format.

Continue reading »

 Posted by at 9:14 pm
Oct 282013
 

gzip (GNU-zip, files with extension “.gz”) compression is one of the most widely used in Linux environments, because it offers a good tradeoff between the compression ratio obtained and the processing time required to perform the compression.

This post presents code samples written in Java to generate a compressed “.gz” file, and to read a file compressed using this format.

Continue reading »

 Posted by at 8:58 pm