Posts

Automate task with Jenkins and jt400 on IBMi

Image
Automation is a key component for making your life easier. There are dozens of regular, boring tasks that can be automated in order to make your life easier.  The need for task automation has been steadily growing in recent years. One of the reasons behind this is that automation can free up 30% of the time you spend working on daily tasks! What Is Task Automation? Task automation is the use of tools or software to automate repetitive, manual tasks. What Are the Benefits of Task Automation? There are way more advantages to task automation than just reducing manual effort!  There are lots of different tools on the market today that make task automation as easy as possible. But the most popular is Jenkins. For Task Automation on IBMi use Jenkins and the IBM Toolbox for Java CommandCall object to send commands to the server on IBMi.  All you need is jt400 library and a simple groovy script defined in external source control repositories and loaded into existing Pipel...

Password Encryption Decryption in Java with Java 9+ modules

Image
  Java AES Encryption and Decryption Advanced Encryption Standard is one of the most popular encryption algorithms. It is an asymmetric encryption algorithm and more secure. AES is generally used for securing sensitive information so we can say that is enough secure. Before AES most of the organizations used the DES( Data Encryption Standard) algorithm which is not secure and most of the organizations considered that highly insecure. Feature of AES AES is the replacement for DES. Some features of AES are listed below: Symmetric key symmetric block cipher 128-bit data, 128/192/256-bit keys Stronger and faster than Triple-DES Provide full specification and design details Software implementable in C and Java Below is the utility class which will be used for encryption and decryption in Java applications. Java Modules Starting with Java 9 a new concept was introduced: modules. Java modules represent a more powerful mechanism to organize and aggregate packages. A Java module is a way ...

JShell to Improve Your Java Skills

Image
  The Java Shell Tool or in short JShell is a major addition in Java 9.  JShell is quite late to the party, as scripting languages like Python and Node introduced similar utilities years ago, and JVM languages like Scala, Clojure, and Groovy followed in their footsteps. But better late than never. Before the introduction of JShell, there was no way one could do REPL (Read-Evaluate-Print-Loop) in Java. A REPL is a simple, interactive programming environment that takes user input (Read), executes the user command (Evaluate), returns the result to the user (Print) and waits for the next user input (Loop). In fact, to even print a single statement in the console it was absolutely necessary to at least have a class and the main method in it. JShell attempts to take away that pain to a certain extent and adds a full-fledged REPL feature in the Java programming language. JShell is an interactive tool that is useful to learn Java language features, APIs and allows quick prototyping, d...

Creating Efficient Docker Images with Spring Boot 2.3

Image
Spring Boot 2.3 brings with it some interesting new features that can help you package up your Spring Boot application into Docker images. The first problem with common docker techniques is that the jar file is not unpacked. There’s always a certain amount of overhead when running a fat jar, and in a containerized environment this can be noticeable. It’s generally best to unpack your jar and run in an exploded form. The second issue with the file is that it isn’t very efficient if you frequently update your application. Docker images are built in layers, and in this case your application and all its dependencies are put into a single layer. Since you probably recompile your code more often than you upgrade the version of Spring Boot you use, it’s often better to separate things a bit more. If you put jar files in the layer before your application classes, Docker often only needs to change the very bottom layer and can pick others up from its cache. Two new features are introduced in Sp...

Docker for Java development

Image
The promise to use Docker during development is to provide a consistent test environment on your development machines and the different environments you use (such as QA and manufacturing). The last thing you want to do is slow your development cycle. Even if you or your team are not involved in using Docker on development computers as part of this process, there are several use cases for modifying and debugging code running in the container. For example, a developer can use Docker to mimic the production environment to reproduce errors or other conditions. In addition, the ability to debug remotely on a docked host can enable practical troubleshooting of a running environment such as QA. Let us take as an example a simple application that emulates the console's password change utility. The program asks for the login and the current password. After verifying the credentials, it prompts you to enter your new password twice. If the passwords do not match, it asks for a new password ag...

Proxy design pattern in Java

Image
  The Proxy pattern allows us to create an intermediary that acts as an interface to another resource, while also hiding the underlying complexity of the component. Types of proxies Remote proxy: They are responsible for representing the object located remotely. Talking to the real object might involve marshalling and unmarshalling of data and talking to the remote object. All that logic is encapsulated in these proxies and the client application need not worry about them. Virtual proxy: These proxies will provide some default and instant results if the real object is supposed to take some time to produce results. These proxies initiate the operation on real objects and provide a default result to the application. Once the real object is done, these proxies push the actual data to the client where it has provided dummy data earlier. Protection proxy: If an application does not have access to some resource then such proxies will talk to the objects in applications that have access t...

Builder design pattern in Java

Image
The interesting thing about Builder is that you can find different variations of the builder . For example, there is a variation of pattern with director class that is responsible for building objects. And also there is a variation of builder pattern that called chain builder and allows to build new objects step by step. Personally, I believe that the second variation is more popular. Implementation with director. To implement builder pattern with director we have to: declare builder interface create multiple builders create director that can work with different builders in client code instantiate director and concrete implementation of builder to build new objects And this below is another version of builder pattern called chain builder. To implement builder pattern with chain method calls we have to: create inner Builder class inside type that we want to build implement method in type that returns reference to the builder object declare steers in builder that returns the re...