Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
PlanetNetbeans
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
APIDesign - Blogs - April 23, 2018 03:20 PM
Git on Steroids: Master Multiple Repositories

Let me introduces MultiGitRepository - aka Git on steroids to you. I have seen a lot of confusion when it comes to working with multiple repositories and keeping them in orchestration, but I believe it is not that complex. Everything we learned about distributed version controls applies. However this time it has to be applied on a completely new level!

Master your MultiGitRepository in few easy lessons!

--JaroslavTulach 15:20, 23 April 2018 (UTC)

Adam Bien - April 19, 2018 08:33 AM
JSON-B, Groovy and Jenkins, CQRS, 40k with JSF, EJB TX or 48th airhacks.tv is available

36mins: with JSON-B and hierarchical mapping, Groovy and Jenkins pipelines, CQRS, 40k with (deprecated) JSF, EJB TX, JSON-B, Java EE migrations and I'm performing live a code review / refactoring.

Also checkout past episodes: airhacks.tv

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - April 19, 2018 06:49 AM
Shocking: Default Listener Methods ain't Dangerous!

Using Default Listener Methods is perfectly fine! Those who remember my recent arguments against using DefaultMethods in APIs maybe the surprised by this statement, but it has to be made. Looks like using Default Listener Methods doesn't violate any practices of good API Design.

Thanks Dušane, for pointing that out!

--JaroslavTulach 06:49, 19 April 2018 (UTC)

Adam Bien - April 11, 2018 07:26 AM
Local-Variable Type Inference Java 10 Example

Java 9 legacy code:


@Test
public void java9Legacy() {
    Map<String, String> devs = new HashMap();
    devs.put("duke", "java8");
    for (Map.Entry<String, String> dev : devs.entrySet()) {
        System.out.println(dev.getKey() + " " + dev.getValue());
    }
}

...can be streamlined with Java 10 and Local-Variable Type Inference (JEP-286):


import java.util.HashMap;
import java.util.Map;
import org.junit.Test;

public class VariableTypeInferenceTest {

    @Test
    public void inferTypeWithJava10() {
        var modernDevs = new HashMap<String, String>();
        modernDevs.put("duke", "java10");
        for (var dev : modernDevs.entrySet()) {
            System.out.println(dev.getKey() + " " + dev.getValue());
        }
    }
}

The code above runs on openJDK 10 GA JDK 10, was edited with Apache Netbeans 9 and built with Maven 3.5.0


        <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.airhacks</groupId>
        <artifactId>variable-type-inference</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>10</maven.compiler.source>
            <maven.compiler.target>10</maven.compiler.target>
        </properties>
    </project>    

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 10, 2018 09:22 AM
Simplest Possible Microprofile Liveness Check

A health check can be exposed using the org.eclipse.microprofile.health.Health qualifier exposing a HealthCheckResponse:


import javax.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.health.Health;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;    
@Health
@ApplicationScoped
public class LivenessCheck implements HealthCheck {

    @Override
    public HealthCheckResponse call() {
        return HealthCheckResponse.
                named("ping").
                up().
                withData("duke", "lives").
                build();
    }

}

The health check is available from the "root" URL (not the WAR URI):

curl http://localhost:8080/health outputs:

{"outcome":"UP","checks":[{"name":"ping","state":"UP","data":{"duke":"lives"}}]}

The API is included in the microprofile BOM:


 <project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.airhacks</groupId>
<artifactId>microprofile</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<dependencies>
   <dependency>
       <groupId>org.eclipse.microprofile</groupId>
       <artifactId>microprofile</artifactId>
       <version>1.2</version>
       <type>pom</type>
       <scope>provided</scope>
   </dependency>
</dependencies>
<build>
   <finalName>microprofile</finalName>
</build>
<properties>
   <maven.compiler.source>1.8</maven.compiler.source>
   <maven.compiler.target>1.8</maven.compiler.target>
   <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
</project>    

The above example comes with 4.2 kB WAR and runs on stock Payara Server 5. Payara 5 comes with Java EE 8 and microprofile 1.2 support.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 09, 2018 05:01 AM
Swing without WebStart, No Sessions, Performance Testing and JWT, JPA Query Result Caching, SAML, JavaScript Data Binding, Asynchronous Java EE or 49th airhacks.tv

Topics and questions (https://gist.github.com/AdamBien/d2bdc699f8f39948ff04126f3d09227d) for the 49th http://airhacks.tv.

  1. Swing without WebStart
  2. Preventing Web Sessions
  3. Performance Testing with JWT
  4. JPA query result caching
  5. SAML Java Frameworks
  6. JavaScript databinding with WebSockets
  7. Asynchronous Java EE
  8. Using embedded container testing with container resources blog comment
  9. When Numbers Are More Important Than Quality

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - April 06, 2018 10:27 AM
Where's your Frontend? On a desktop!?

What does term Frontend mean to you? Tell us!

--JaroslavTulach 10:27, 6 April 2018 (UTC)

APIDesign - Blogs - April 04, 2018 02:16 PM
Don't rely on Jenkins and co. They hurt your API design skills!

Recently I observed an incompatible API change and I received following explanation: Everything is OK, my ContinuousIntegration server is still green! In a shock I decided to write a philippic against ContinuousIntegration.

If you have to fix your tests in a significant way after making a change to your API, then you should think twice. Maybe such change isn't really compatible enough to become smoothly part of your framework. There is probably a lot of code similar to your tests out there and there is nobody to fix them as part of your refactoring. Better to learn and invest in keeping a bit of BackwardCompatibility.

In some sense: When designing APIs, relying only on ContinuousIntegration is bad!

--JaroslavTulach 14:16, 4 April 2018 (UTC)

DukeScript - April 04, 2018 11:51 AM
Welcome Info Footer in Archetypes Version 0.23

A very inspiring discussion about usability of DukeScript has happened on the development Apache NetBeans mailing list. As a result of the comments collected there, here comes an attempt to improve the first contact experience when somebody tries the archetypes or the IDE wizard out of curiosity without knowing anything about the APIs.

When the freshly created application starts, it now contains a footer with links to documentation, blogs, etc.

Removing the footer is a matter of deleting one script tag in the index.html file:

<!-- Remove this line to remove the button bar in the footer -->
<script async=true src="http://dukescript.com/presenters/welcome.js"></script>

The change can be tried out immediately as necessary updates to the archetypes are already hosted on the Apache Maven Central. Just try:

$ mvn archetype:generate \
	-DarchetypeGroupId=com.dukescript.archetype \
	-DarchetypeArtifactId=knockout4j-archetype \
	-DarchetypeVersion=0.23 \
        -DgroupId=your.company -DartifactId=test -Dversion=1.0-SNAPSHOT
$ cd test
$ mvn install
$ mvn -f client/pom.xml exec:exec

And you shall see the links! Is it now easier to get started with DukeScript?

Anchialas' Java Blog - April 02, 2018 08:09 PM
CoolEditorActions moved to GitHub

The CoolEditorActions NetBeans Plugin has a new home! I just moved the project from kenai.com to github.com, because the former has been offline for a while now.

You can find the whole codebase as well as installation instructions here:

https://github.com/anchialas/CoolEditorActions

If you already have the plugin installed, then please update the Update Center URL to:

https://github.com/anchialas/CoolEditorActions/raw/master/updates/updates.xml

Adam Bien - April 02, 2018 12:28 PM
Blackdown Java, Java in science, Telematics, OSGi, JavaFX--airhacks.fm

A conversation with Johan Vos about Sting at Java One, Blackdown Java, dream teams, Bill Joy, Java in science, telematics, OSGi, JavaFX, wild pigs, oktoberfest, kaffe.org social Java DaliCore, reactive JavaFX, Sun Grid, clouds, Java EE in science, Gluon, JavaFX on Mobile, openJDK 9 on iOS, Android and the future of JavaFX

Subscribe to airhacks.fm podcast via: iTunes or RSS

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - March 15, 2018 11:18 AM
The IDE for DevOps!

Admins! DevOps! In a recent StackOverFlow developer survey the NetBeans IDE has been rated at 10.9% for Mobile Developers and 8.4% for System Admins/DevOps. It is weird, but it supports the feeling I had for a long time: NetBeans is the IDE for DevOps!

Read more...

--JaroslavTulach 11:18, 15 March 2018 (UTC)

Adam Bien - March 15, 2018 09:37 AM
When Numbers Are More Important Than Quality

The higher the bureaucracy in an organization, the higher the chance that your QA department is more interested in metrics and statistics, than in the actual software quality (also checkout "Quality Assurance Driven Development - And The Resulting Damage..." ).

Instead of writing unit tests for trivial methods (and enums, exceptions and default constructors of course), or write JavaDoc for getters / setters, you could use reflection to invoke as many methods as possible and use interesting frameworks which help you with tests results:

(...) Volkswagen uses a defeat device to detect when it's being tested in a CI server and will automatically reduce errors to an acceptable level for the tests to pass. This will allow you to spend less time worrying about testing and more time enjoying the good life as a trustful software developer.
https://github.com/auchenberg/volkswagen Big thanks to: Dominik Schlosser @dmn1k

JAutodoc is able to create comments for all methods and classes. Unfortunately there is no general AI involved, therefore no additional information is added to the output. However: the JavaDoc coverage metric will improve significantly:

JAutodoc is an Eclipse Plugin for automatically adding Javadoc and file headers to your source code.(...)
JAutodoc - Eclipse Plugin http://jautodoc.sourceforge.net Big thanks to: Jan Schäfer @JanSchfr

In the screencast below I'm using a useful Chrome feature "local overrides" to modify the code coverage without any additional efforts:

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - March 09, 2018 08:40 AM
Turing speed: The Real Speed of a Language

Let me coin a new term: Turing speed - the real speed a programming language has. The speed of a general (e.g. Turing complete) computation. Read here why we need such classification.

--JaroslavTulach 08:40, 9 March 2018 (UTC)

Adam Bien - March 07, 2018 04:40 AM
10.000 Thin WAR deployment cycles or IoT with pure Java EE at IBM

Tobias, please introduce yourself

My name is Tobias N. Sasse, from Cologne (Germany) and I am a Software Architect and Managing Consultant with IBM Services. I support our enterprise clients, mainly from the insurance industry, to succeed with their digital transformation journeys. I have a focus on developing industry platform solutions, which enable our clients to adopt new capabilities as a service and accelerate a fast go-to-market with innovative technology-driven products. This sounds quite abstract, but I will give an example of what my team does later when we talk about my projects.

In my daily job, I am leading a team of incredibly talented software developers, quality engineers, and business consultants. My focus in the group is to provide the general direction for the products we are working on and design an architecture blueprint, which ensures that we meet the functional and non-functional requirements. Whenever possible, I enjoy writing source code and evaluate new technologies.

My technical focus lies on distributed and scalable systems. You can find me on Linked.in, and my twitter handle is @tnsasse.

What are you building with Java EE?

IBM has an initiative around aging at home with the aim of keeping seniors safe in their own homes longer. I am leading the effort of building such a platform. We offer this industry platform, to our clients as a service, and it combines Internet of Things technology, with a smart analytics engine in the cloud, and professional care services from our partners from the insurance- and healthcare sector.

Imagine a family, where granny Martha lives alone a couple of hundred miles away from her son Robert and his kids. Robert is concerned about the wellbeing of his mother, with all the risks that evolve around growing older. At the same time, he is not able to visit as often as he'd like, to check up on her. Martha enjoys her home and couldn't imagine moving to a nursing home or assisted-living facility.

Now with our product, Martha and Robert could get help from their insurance provider. Professional technicians would visit Martha's home and install a couple of minimal-intrusive sensors (from one of our partners) in her home, which monitor her daily activities. For Robert, we have a mobile app that lets him check the status of Martha's apartment and informs him whenever the system detects a dangerous situation. If something really bad happens, the platform will detect this through the analytics and will notify Robert as well as a connected care provider. The care provider will send a care specialist to Martha's home to assist. They can also send an ambulance, firefighters or the police. With a little box in her home, Martha can even talk to the call center of the care provider whenever our analytics detect an emergency.

The role of IBM in all of this is to establish and nurture the business ecosystem of partnering companies and to provide the technology and algorithms behind the platform. To do so, we offer a set of APIs, that enable our partners to integrate their services or processes with the platform, like to alert a call-center about an incident, or to dispatch a maintenance order to the sensor technician.

IBM is also bringing its cognitive analytics capabilities to the table, that help to make sense of the raw stream of sensor data and detecting hazardous situations, for each home. The IBM Cloud offers the necessary resources to handle this enormous flow of data and to operate all of the services in a real-time, secure and high-available manner.

Except for the mobile apps and a management web interface, we implemented the platform in pure JavaEE 7. We also applied a micro-service architecture to our system, which helps us to individually scale or replace parts of the system very well with minimal impact on our critical uptime.

Can you share with us some geeky numbers like, e.g. TX per seconds, heap sizes, thinnest WARs, etc -- whatever Java EE devs might find interesting.

We currently have ~10 micro-services. Our WAR sizes are a little blown up because we have to rely on a bunch of connector libraries for proprietary systems. Overall though, we are pursuing a thin-WAR approach, and none of our apps are heavier than 5 MB.

Our app servers comfortably run in a 500 MB heap configuration. We default to 1-2 GB though and prefer to scale horizontally if we need additional capacity. We are currently in our 26th (SCRUM) sprint, and overall we have deployed ~ 10,000 times on our development stage, not counting any local deployments. Deploying multiple times a day, the thin-WAR approach and fast app server boot/deployment times pay off for us. I am happy that we don't need to upload 60 MB of framework libraries to the cloud all the time.

Our design is built for scale, as the platform is supposed to handle not only Germany but most of Europe, so we are planning on a 7 figure apartment count, which is our primary measurement KPI. Each instance of our micro-services can sustain a couple of hundred transactions per second. Again this is not easy to measure, as our transactions range from trivially simple to quite complex.

Are you happy with Java EE so far? Is Java EE productive?

IBM has a rich history with Java EE, and most people will know, that we are actively contributing in the expert councils and as an application server vendor. We even have our own Java SDK (IBM Java Technology Edition) which is optimized and production-proven for a variety of architectures. Our JDK was recently open-sourced as OpenJ9, by the way.

From that perspective, Java EE is very much at home here. My team is incredibly productive with Java, and it provides the robustness we seek for in an application like ours. It's not only a rational technology choice, but also a lot of fun to work with the EE7 APIs, and all the goodies that came with Java 8. We still have to look into EE8 and Java 9 for that matter and are also looking into the Micro-Profile APIs, which we would love to integrate soon.

Which application servers, tools or IDEs are you using?

Of course, we are relying on IBM WebSphere Application Server Liberty Profile, which combines the best of both worlds: a small footprint, fast boot- and deployment times, enterprise-grade reliability and features. Additionally, our operations team can rely on 24/7 support from our global support colleagues, in case anything happens in production. WebSphere Liberty was also open-sourced recently as OpenLiberty and is free to use for everyone, and I have seen that you predicted it to be the killer app server for 2018.

We are deploying our apps on the IBM Cloud, which is an entirely automated process triggered by our DevOps pipeline. We host our source code in an IBM internal GitHub Enterprise repository, build it with Maven and deploy it via the IBM Cloud APIs. After the deployment, we automatically execute regression and system tests to ensure that we meet our quality standards.

My development team is using a well-known issue system for our agile sprint planning, and our IDE is based on Eclipse, which given the long history of IBM with the Eclipse IDE might not come as a surprise, too.

Our system has to handle a significant amount of IoT data, and we rely on the Watson IoT Platform to manage all the MQTT connections, security and data streaming. Of course, we have to make sense of the data we receive, and our data scientists are working with IBM DataScience Experience and Watson APIs to develop their machine-learning and cognitive analytics models.

Database-wise, I am a big fan of Db2 since my time at the IBM Almaden Research Lab back during my studies, where I had a chance to look under the hood and see some of the fantastic technologies it employs to optimize queries and workloads. So, we are using IBM Db2 on Cloud for most of our data, as it performs remarkably well and offers a high amount of security at the same time. We also employ IBM Cloudant for NoSQL document-based JSON data, wherever we need a high amount of throughput without transactional security.

You are using the Boundary Control Entity pattern to structure your applications. What were your experiences, challenges, and findings so far?

Yes, we do use the BCE pattern, although my team prefers a different package naming structure. We use ".api" for the boundary layer, ".service" for the control layer and ".model" for the entities. For me, the BCE pattern is not about the naming - it's more a guideline to stay within best practices: to keep the source code aligned with the business problem it tries to solve and to eradicate the use of those ".commons" or ".util" packages that the industry grew so fond of. I think that the pattern helps us to write more readable and streamlined code. The lean code helps us to produce better quality, too many bugs hide in unnecessary abstractions, and wrongly applied design-patterns.

How important are standards for you? Does your application depend on application server specific APIs?

IBM is a big supporter of open standards, and this is not only shown by our contribution to Java but even more in our cloud. If you take a closer look at the IBM Cloud you will see, that we base on OpenStack, Cloud Foundry, Kubernetes, and Linux Containers. For our specific application, standards are essential for our public APIs, so that we are on the same page with our partners in the industries. We embrace the REST paradigm, JSON, Swagger, OAuth 2 and OpenID Connect for example. As we are not planning on moving to a different application server, or database, we make full use of the features the platform offers. In practice, the majority of what we do is plain Java EE standard though.

As a team leader, a significant benefit of standards for me is, that I can quite efficiently communicate skills with HR. If I ask for a Java EE specialist, they know whom to look for, and I am quite sure that the person they identify will have the skills I need.

Which Java EE APIs are you using in your products?

We do use JAX-RS and JAXB for our boundary layer (HTTP/REST with JSON). Our control layer is implemented with EJBs plus some CDI, and we do (most of) our entity layer with JPA. Other than that we do use filters from the Servlet spec, for authentication, CORS, and alike. We have a couple of interceptors as well.

Did you have the chance to chat with other attendees during the airhacks? If yes, what was the most interesting project / problem / situation in the workshops?

Oh yes, I had a lot of interesting chats with attendees all over the world. One story stuck with me: we were talking about how crazy complex we developed software in the past when standards like we know today weren't around that much. One of the attendees told me, how he implemented his own database, with built-in versioning and home-grown encryption capabilities in Java. It sounded like a terrible idea in retrospect, and we had a good laugh together, but I guess these are the projects you can learn a lot from after all.

Can you share any resources with us?

I pointed out that some my favorite IBM products just went open-source. You can find OpenLiberty at openliberty.io which is my favorite EE app server, and the IBM JDK seems to be less known, but is a fantastic piece of engineering and is now released as Eclipse OpenJ9

Concerning the Java ecosystem, a project I grew quite fond of is the MicroProfile initiative, which released a bunch of handy APIs, that will hopefully find their way into a future EE version. The beautiful thing about OpenLiberty is that you can just add MicroProfile, with a single line in your server configuration file.

Of course, I'd encourage everyone to take a look at the IBM Cloud, which is based on open standards, so no vendor lock-in, provides Cloud Foundry, Containers, Kubernetes, Watson APIs and a lot of useful services. We also offer a free tier for many services, so you can get started without a credit card.

For your German-speaking readers, I'd also like to point towards the IBM THINK Blog DACH covering interesting articles on how technology changes companies and society in Germany, Austria, and Switzerland.

Tobias, thank you for the interview!


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - March 05, 2018 11:32 AM
Avoid usage of default methods in an API! Support Cluelessness!

Don't use default methods when designing your API. (For example when writing extensible visitor pattern) they just increase fuzziness and that is not what users of your API are searching for!

--JaroslavTulach 11:32, 5 March 2018 (UTC)

Adam Bien - March 05, 2018 10:02 AM
Jakarta EE News, JSON-B, Groovy Jenkins, CQRS, 40k with (deprecated )JSF, EJB TX, JSON-B, Migrations or 48th airhacks.tv

Topics (https://gist.github.com/AdamBien/22275b3372aabe651953c0992689c6d9) for the 48th http://airhacks.tv Questions and Answers:

  1. Jakarta EE News
  2. JSON-B serialization, deserialization
  3. Automating Jenkins CI with Groovy
  4. light4j, embedded SQL, CQRS streams and Java EE
  5. 40k rows with JSF
  6. Logging and debugging nasty libraries
  7. Monitoring EJB transactions, JMS queue monitoring
  8. REST authentication
  9. Marshal and unmarshal JAX-B objects
  10. ECB pattern in larger applications
  11. Is JSF deprecated
  12. Migrating Java EE projects
  13. DataSource within Java EE: how to close a JDBC connection?

Any questions left? Ask now: https://gist.github.com/AdamBien/22275b3372aabe651953c0992689c6d9 and get the answers at the next airhacks.tv.

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 25, 2018 09:03 AM
Displaying Tables with Vaadin Grid Web Component and Java EE 8 Backend

In this screencast I'm integrating a data grid Web Component / Custom Element https://vaadin.com/elements/vaadin-grid with plain ES 2015 code and connect it with a Java EE 8 microservice. Backend and frontend were created and connected from scratch. In 10 mins.

See you at Structuring Single Page Applications (SPA)s / Progressive Web Applications (PWA)s with WebComponents -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webcomponents.training (online).


Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 21, 2018 04:40 AM
DB authentication, JSF and microservices, Denormalization, Web Components, JAX-RS, Transactions, Sagas or: 47th airhacks.tv

43 mins with topics like: "Database Authentication, Microservices with JSF, Denormalization, DB Audits, Web Components decoupling, with or without DeltaSpike, JAX-RS Audit, transactions and sagas, the relation between developers and operations in future, DTOs in binary world", or 47th airhacks.tv is available:

Any questions left? Ask now: https://gist.github.com/AdamBien/22275b3372aabe651953c0992689c6d9 and get the answers at the next airhacks.tv.

Also checkout the airhacks.tv archives.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 20, 2018 05:57 AM
On-Demand Script Loading with JavaScript

In this screencast a script is dynamically loaded by user action (with click on a button) and without any external libraries:

Dynamic script loading is particularly useful for polyfills, which can be conditionally loaded depending on browser's capabilities.

See you at Single Page Applications (SPAs) -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webstandards.training (online).
Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 19, 2018 01:59 PM
Java EE 8: Manipulating JsonObjects with JsonPatch

JSON-P (JSR-374) from Java EE 8 comes with JSON Patch support, which can be used for manipulation (patching) of JsonObject instances (see also Java EE 8 and JSON-P Simplify System Testing with JSON Patch):


@Test
public void patch() {
    JsonObject sub = Json.createObjectBuilder().
            add("name", "EE4J").
            build();

    JsonObject initial = Json.createObjectBuilder().
            add("fact", "Java EE is nice").
            add("myth", "Java EE is heavyweight").
            add("future", sub).
            build();

    JsonPatch patch = Json.createPatchBuilder().
            add("/version", "8").
            replace("/fact", "Java EE rocks").
            replace("/future/name", "Jakarta EE").
            remove("/myth").
            build();

    JsonObject result = patch.apply(initial);
    System.out.println("result = " + result);
}

Output:

result = {"fact":"Java EE rocks","future":{"name":"Jakarta EE"},"version":"8"}

JSON-P comes as a single maven dependency:


<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.json</artifactId>
    <version>1.1.2</version>
</dependency>

See you at Java EE Workshops at MUC Airport, particularly at the Effective Java EE 8 workshop
Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 17, 2018 06:43 AM
Java EE, Thin WARs, Microservices and Continuous Delivery at Otto

Bastian, please introduce yourself (feel free to share your twitter, linkedin, github etc. accounts)

My name is Bastian Sperrhacke and I am a software developer and technical lead in a ten people team called "Verfügbarkeit" (availability) at Otto GmbH & Co. KG. There are three business analysts, six developers (including me) and one teamlead responsible for the product availability calculation and the product sell services. We are one of many teams in the backend IT of Otto. You can find me at @deratzmann and Bastian Sperrhacke.

What are you building with Java EE?

We build our latest system for additional sell services for products offered in a shop with Java EE 7. For example, if you want to add an additional warranty to your mobile phone or want to get rid of your old washing machine while receiving the new one, there is a business case called "article service" which abstracts these kind of cases. We build this system as a Java EE microservice and offer REST Services for our frontends and shops.

Can you share with us some geeky numbers like e.g. TX per seconds, heap sizes, thinnest WARs etc -- whatever Java EE devs might find interesting.

Currently our WAR file is about 300kb, the biggest file inside is our swagger documentation file (71kb). From commit to production we are live in about 7 minutes with our continuous delivery pipeline, including Unit-, Integration-, System- and Performancetests. Our software is running since begin of February 2018 and had 5280823 requests in the last week.

Are you happy with Java EE so far? Is Java EE productive?

Yes, I am very happy with Java EE. It provides me a standardized way to code, is well documented and highly used. With Java EE you can become productive in minutes, no bloated configuration or dependency hell anywhere. Just code your business requirements.

Which application servers, tools or IDEs are you using?

First of all we use the Payara full server, it is very fast and productive, well documented. It provides the stable Java EE API and the innovative, fast moving microprofile. The Payara team is very nice, I got to know them at JavaOne last year. Relating IDEs it is up to each team member to use his favorite IDE or editor. Most of us (including me) are using netbeans, very nice, fast and lean IDE. For our pipeline we use Jenkins. Our docker containers are orchestrated by docker swarm.

You are using the Boundary Control Entity pattern to structure your applications. What were your experiences, challenges and findings so far?

The first big challenge was to structure the class and the packages in a business, not a technical driven way. So no more "persistence", "valueobjects" or "service" package. For decades developers learned to structure in a technical way. But for new guys in a team it is hard, to find a business case implementation in such a structure. The ECB pattern is the easiest way to fit in that context. You start with an entity and a service called boundary. There is no easier way. And if (and only if) the boundary "gets too big", you refactor the non-standalone functions out to a so called control. In my opinion this way leads to a clearly arranged code, not overengineered, just fitted to the current required business case.

How important are standards for you? Does your application depend on application server specific APIs?

Standards are very important for me. When you are professionally developing products, you have to ask yourself: Do I technically need an early adopter software or a long lasting lean product. In real world projects the truth lies between these two approaches. And Java EE is a perfect fit for that. First you get a quite stable API, which is continuously evolving. Since Java EE was transferred from Oracle to the community, I think there will be much more drive behind it. Let's have a look at the great companies standing behind the microprofile initiative. This initiative is also responsible for a quite innovative de facto standardization. Using one of the application servers like Payara means, I get the API stability of Java EE and a fast evolving feature set of the microprofile. In our project we currently use the microprofile-config-api and plan to use the new fault-tolerance-api. Furthermore we use some Payara specific implementations like the Jackson API. We also planned to use the build-in Hazelcast for distributed job scheduling and caching.

Which Java EE APIs are you using in your products?

Generally we use EJB, JPA, CDI, Bean Validation, Jax-RS, JTA and JSF.

You attended JavaOne last year. What was your impression?

This was my first time at JavaOne and also my first time in the US. It was amazing and I hope to get a chance for a second visit in the near future. I attended as much sessions as I could get. It was exhausting but worth it. Hopefully I can introduce some ideas in our daily business.

Can you share any resources (blogs, etc feel free to promote yourself) with us?

I get my newest info from twitter. I read tweets and blogs from Vlad Mihalcea, Thorben Janssen (hellish good JPA specialists), Sebastian Daschner (Java EE evangelist), Payara (Java EE Server) and last but not least Adam Bien. :)

Bastian, thank you for the interview!


Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 16, 2018 09:38 AM
Java EE 8 and JSON-P Simplify System Testing with JSON Patch

JSON-P (JSR-374) from Java EE 8 comes with JSON Patch support, which is useful for system testing.

A JSON object returned from a HTTP endpoint can be easily compared to a local representation loaded from a file:


import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonPatch;
import javax.json.JsonReader;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class JSONPDiffTest {

    @Test
    public void subtraction() {
        //e.g. server result
        JsonObject actual = Json.createObjectBuilder().
                add("a", 21).
                add("b", 1).
                build();

        try (JsonReader reader
                = Json.createReader(this.getClass().getResourceAsStream("/expected.json"))) {
            JsonObject expected = reader.readObject();
            JsonPatch diff = Json.createDiff(expected, actual);
            assertTrue(diff.toString(), diff.toJsonArray().isEmpty());
        }
    }
}    

The code above loads the file src/test/resources/expected.json with the content:


{
    "a": 21,
    "b": 2
}    

and compares it to the actual instance.

The result is:

java.lang.AssertionError: [{"op":"replace","path":"/b","value":1}]

JSON-P comes as a single maven dependency:


<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.json</artifactId>
    <version>1.1.2</version>
</dependency>

See you at Java EE Workshops at MUC Airport, particularly at the Java EE CI/CD, Testing and Quality workshop
Real World Java EE Workshops [Airport Munich]>

NetBeans – Enrico Scantamburlo - February 11, 2018 08:42 PM
Make Ant great again with NetBeans

My company NetBeans RCA is based on Apache Ant, Ant is a build tool for Java that was very popular when I started programming and many IDE used it to build. The NetBeans platform build system was totally based on Ant and this was very good because it allowed customizing the build process. We are currently using it to generate files to be included in the NBMs (the NetBeans Module), to update version numbers, to copy files, to upload files to our server …

Unfortunately, nowadays Ant lost popularity to Maven and Gradle which allows also to automatically download the necessary libraries, however, we have some many stuff built in Ant and we became experts at using it that it is not worth moving to Maven, that is currently also supported by the NetBeans Platform.

For those like me that are still using Ant, I would like to share some tips.

Install the Important Files plugin

If you create a new Java Application project (Not Maven) in NetBeans, the project is based on Ant, but you do not see its build script file unless you press CTRL+2 and search in the Files window. But, when you create a NetBeans Module project you get an Important Files node that shows all the configuration files used to build that module.

You can have the same node if you install a plugin called ImportantFiles 4 JavaSE. It will add a node with the build script and the properties files used to configure the module.

The build file will be listed as Build Script, Buildscript or build.xml .

How to launch easily  any Ant targets

Once you got access to the build file, if you expand it you will see the list of all available targets, you can run them by right-clicking on them and selecting Run Target. From this menu, you can also debug and inspect the targets by choosing Properties. The coolest feature is Create Shortcut… This action will create an item on the toolbar, on the menu or a keyboard shortcut to launch the task, it will only be visible when the project is open. I find it very convenient when I am working with my custom Ant targets that  I have to run often.

Another way to run an Ant Target is to right click on the build script node, choose Run Target and then the target you want to run. If the target you want to run is not present you might have to expand the Other Targets submenu. At the beginning, I was lost about why some targets appear at other targets and others don’t, then  I discovered it works like the -p Ant command line option: it lists only the targets that have a description. To add a description to a target, just add a description attribute with some text in it.

 

<target name="Hello World" description="It says Hello World" >
    <echo message="Hello World" />
</target>

How to customize the build process

When you open the build file there is a huge comment that explains how to customize the build process, in particular, it explains how to launch your own targets before or after any step in the build process.For instance, there are these two examples: one to add obfuscation after the build:

 

<target name="-post-compile">
    <obfuscate>
       <fileset dir="${build.classes.dir}"/>
    </obfuscate>
</target>

another to override the execution to launch your own executable

<target name="run" depends="AntApplication-impl.jar">
     <exec dir="bin" executable="launcher.exe">
          <arg file="${dist.jar}"/>
     </exec>
</target>

Hint for NetBeans Platform developers:  how to run the same target on all modules

It happened to me that I had to run the same target on all my modules in a suite. You can do it in this way:

Create a new Target that depends from -init and use subant 

<subant buildpath="${modules.sorted}" target="spotbugs" inheritall="false" inheritrefs="fakse" failonerror="false" />
Photo by Mikhail Vasilyev on Unsplash

Adam Bien - February 07, 2018 03:46 PM
What is a Mixin?

In this screencast I implement and use a Mixin with stock JavaScript / ES2015 (ES6):

"In object-oriented programming languages, a Mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes (...)":

See you at Single Page Applications (SPAs) -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webstandards.training (online).


Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 05, 2018 05:34 AM
Database Authentication, Microservices with JSF, Denormalization, DB Audits, JAX-RS Audit, Devs and Ops -- or 47th airhacks.tv

Questions and topics for the 47th airhacks.tv -- a monthly Questions and Answers show:

  1. Database Authentication: SSH vs. username / password
  2. Microservices with JSF frontend -- architectural discussion
  3. How to modularize WARs
  4. Dealing with denormalized databases
  5. Java EE authentication (Active Directory)
  6. Identity preservation and audits in DB
  7. JAX-RS authentication and principal delegation to EJB / CDI
  8. Development in intranet environment
  9. Reducing coupling between Javascript components like e.g. in React
  10. Developers and operations -- their roles in the future
  11. DeltaSpike project review -- with or without @Repository
  12. Impact of 3rd party libraries on build performance -- with some numbers
  13. Unpredictable, long running transactions
  14. Propagating principals from JAX-RS to EJBs
  15. Why it is a bad idea to resend a password on each request?
  16. Dealing with security in projects like e.g. credit card processing

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - February 01, 2018 09:03 AM
Using Vaadin Date Picker as WebComponent

WebComponents are an interesting set of browser APIs to implement entire applications from scratch. However: WebComponents were also designed for reuse, so you can easily include 3rd-party (like e.g. Vaadin) components with your application.

In this screencast I'm integrating a Vaadin Date Picker WebComponent with plain JavaScript / ES 6. From scratch, in 6 minutes:

See you at Structuring Single Page Applications (SPA)s / Progressive Web Applications (PWA)s with WebComponents -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webcomponents.training (online).
Real World Java EE Workshops [Airport Munich]>

Adam Bien - January 31, 2018 03:05 PM
FN, Serverless and Exploded Servers -- airhacks.fm

A smalltalk :-) with Shaun Smith, @shaunmsmith, Director of Product Management for Oracle Serverless and Fn project committer.

From TopLink, EclipseLink over fnproject.io to Fn Java Functions Developer Kit (screencast), exploded application servers, Docker and serverless architectures or the 5th episode of airhacks.fm.

Subscribe to airhacks.fm podcast via: iTunes or RSS

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - January 29, 2018 02:11 PM
2018 Predictions

My 2018 predictions:

  1. Thin WARs become mainstream. Packaging the infrastructure together with the business logic although only <1% changes is not reasonable in containerized environments and slow. Fast turnaround cycles are crucial for productivity. Developers infected with "Thin WAR" mindset thrive for Micro WARs with fast deployments. It is common in green field Java EE 7 projects to have WARs smaller than 1 MB.
  2. Microservices become just another solution for a problem and not a general architecture. It is perfectly fine to deploy a single, small, WAR containing everything: a macroservice / microlith.
  3. Serverless overuse: serverless architectures claim to safe costs and to simplify operations. This is not true for all use cases -- I expect first reports of failing serverless projects due additional implementation complexity and plumbing. However: combining "traditional" Thin WARs with serverless endpoints brings the best of both worlds together. Servers for the main load and functions for (infrequent) events.
  4. OpenLiberty could become the killer Java EE 8 / Java 9 application server. Small, lightweight and with interesting production features.
  5. SQL revival: Modern relational databases like e.g PostgreSQL will regain traction.
  6. JMS revival: there is a lack of popular common messaging API in microservice context. JMS 2.0 is just an API and could be implemented by many messaging services. JMS API with a "funky" implementation could (should) gain traction.
  7. I got the first requests about Java 9 modules within microservices. There should be a buzz around additional module complexity introduced with "premature modularization" in second half of 2018 (or earlier).
  8. Fat Clients are back: Service Workers, Cache API, Progressive Web (Offline) Apps, IndexedDB, "offline first" encourage developers to put more and more logic on the client. This is exactly how Fat Client is defined.
  9. The year of "UseThePlatform": more and more "enterprise" projects will move away from JavaScript frameworks to plain WebStandards. Frequent migrations are expensive and come with no additional value.
  10. Server Side Rendering (SSR): server side rendering is a viable architecture for SPAs / PWAs. Java Server Pages have a bad name, but are a fast and capable serverside templating technology with great tool support.
  11. Raise of WebComponents (v1): Custom Elements, Shadow DOM together with ES 6 are a viable alternative to JavaScript frameworks. The longer you wait, the leaner your application becomes.
  12. Frameworks known from Java ecosystem like Vaadin Elements and Prime Elements become a popular WebComponent-compatible UI widget provider.
  13. HTTP/2 and Webstandards will dramatically simplify the JavaScript build pipeline. No build is the best build.
  14. JavaScript (ES 7+) will become more and more similar to Java. Now Java developers can become easily webapp developers with 20+ years experience :-)

My 2017 predictions were...


Real World Java EE Workshops [Airport Munich]>

DukeScript - January 29, 2018 04:17 AM
We Love Kotlin & MVVM!

We Love Kotlin!

Kotlin looks like the Java 2.0 everyone was calling for. It is simple (compared to Scala), powerful and expressive (compared to Java) programming language. With its strong company support it has the potential to offer viable and safe alternative for existing Java developers.

Kotlin offers the language we all have been waiting for!

We Love MVVM!

DukeScript project is a long time supporter of using the Model-View-ViewModel approach for coding client side applications in Java. We are obsesed by portability. We target any Java virtual machine in any incarnation. Write your application once and package it for desktop, Android, iOS or a browser. Kotlin targets JVM too and as such we explored ways to bring the whole DukeScript ecosystem to Kotlin - the result is great!

Kotlin brings the DukeScript concepts to absolutely new levels! The language keep type-safety as known from Java, yet it allows the developers to be far more expressive. Kotlin is a natural fit for writing the MVVM models!

The Result

This is the result: kt-mvvm.org. A website!? Yes, a website! We believe kt-mvvm.org can serve as a great starting point. It can help you explore the power of MVVM together with the flexibility of Kotlin. Give it a try!

Continue reading at kt-mvvm.org and contribute by forking the GitHub repositories or talking back.