Č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.
Feeds
[RSS 1.0 Feed] [RSS 2.0 Feed]
[FOAF Subscriptions] [OPML Subscriptions]
Do you blog about NetBeans ? Add your blog to PlanetNetBeans.
Feed Subscriptions
APIDesign - Blogs (feed)
David R. Heffelfinger (feed)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
NetBeans – NetBeans Ruminations (feed)
Anchialas' Java Blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Adam Bien (feed)
Inspiration and Expression » Netbeans (feed)
NetBeans – Enrico Scantamburlo (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
netbeans – markiewb's blog (feed)
Netbeans – Gualtiero Testa (feed)
netbeans – James Selvakumar’s Blog (feed)
NetBeans – nB gUru (feed)
netbeans – Newsintegrator Blog (feed)
NetBeans – Praxis LIVE (feed)
NetBeans – TechAshram (feed)
Netbeans – There's no place like 127.0.0.1 (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Neil's Dev Stuff (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
NetBeans – John O'Conner (feed)
NetBeans – JEE.gr (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Wade Chandler's Programming Blog (feed)
Devlin's Lab (feed)
Big Al's Blog (feed)
Code Snakes (feed)
In perfect (spherical) shape (feed)
Van Couvering Is Not a Verb (feed)
Diego Torres Milano's blog (feed)
Vroom Framework (feed)
Messages from mrhaki (feed)
Jeff's Blog (feed)
Manikantan's Netbeans (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Welcome to my live... (feed)
Devel Blog (feed)
diamond-powder (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
May 22, 2017 04:05 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - May 19, 2017 09:33 AM
Java EE (and Docker) Quickstart

  1. Create a Thin WAR Java EE project. Name it "micro".
  2. Create a Dockerfile in project folder with the following content:
                
                FROM airhacks/wildfly
                COPY ./target/micro.war ${DEPLOYMENT_DIR}                
                
            

    Also airhacks/payara, airhacks/tomee images are available from https://hub.docker.com/u/airhacks/. The docker files are maintained in https://github.com/AdamBien/docklands.

  3. Perform build from project folder: mvn package && docker build -t airhacks/micro .
  4. Run the project: docker run -d -p 8080:8080 --name micro airhacks/micro

See it in action: https://www.youtube.com/watch?v=P6Bk3Eiz3kE.

Behind the scenes:

  1. CentOS 7, JDK 1.8, the choosen application server (WildFly, Payara, TomEE) is going to be downloaded the first time (~560 MB, see https://youtu.be/hoqJdH87e7g) from https://hub.docker.com/u/airhacks/.
  2. All subsequent builds will only rebuild the Thin WAR -- it will take milliseconds. The smaller the WAR, the higher the productivity: https://youtu.be/5N4EUDhrkec
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 - May 15, 2017 12:44 PM
Gartner and Java EE, BCE, Modular JSF, Monitoring, JAX-RS Refactoring or 39th airhacks.tv

55 mins, 125 live attendees, ~20 topics ranging from Gartner and Java EE, BCE architecture, modular JSF, monitoring, REST refactoring, how to learn Java EE (see all topics), or the 38th airhacks.tv episode is available:

Any questions left? A fresh question queue is setup. Ask now: https://gist.github.com/AdamBien/b1a66dafdae21c0c40d647f05f44e57c and see you at June, 5th, 2017, 6 pm CET.

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]>

NetBeans – Michael's blog - May 13, 2017 10:10 PM
Impressions from Tenerife II

I took a snapshot down into a Aloa Vera or similar plant. The camera automatically focused onto the ground and the picture shows very clear a leaf at the bottom of this plant. Then I manually focused on that little animal I discovered there. Two photos taken from the same position, showing very different details. […]

Adam Bien - May 11, 2017 11:37 AM
Java EE (and Microservice) Quickstart

  1. Create Thin WAR project with: mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype. (see: Setting Up Java EE 7 Projects With Maven 3)

    Result: 24 lines of pom.xml. The pom.xml only conatins a single dependency to Java EE 7 API. In real world projects you will only need to add test dependencies like JUnit or Mockito. The file beans.xml (one tag), was created to enable Depenency Injection (DI) everywhere and the annotated class JAXRSConfiguration activates JAX-RS under the resources uri. The generated Thin WAR project is a production ready template for Java EE / Microservices / Thin WARs.
  2. Create a JAX-RS resource, like .e.g.
            
        import javax.ws.rs.GET;
        import javax.ws.rs.Path;
        
        @Path("message")
        public class HelloResource {
    
            @GET
            public String message() {
                return "works!";
            }       
        }
    
    
  3. Perform mvn package and copy the Thin WAR ./target/[NAME].war (~4 kB) into the autodeploy / deploy folder of Java EE 6 / 7 / 8 application server of your choice.
  4. ...or download NetBeans "Java EE Edition", open the project, and click "run".
  5. Open the browser with: http://localhost:8080/[NAME]/resources/message

Use a full profile Java EE application servers (Payara, WildFly, TomEE, WebLogic, Websphere Liberty Profile). The download size varies between 55 MB and 200 MB. The runtime overhead is around 50 MB RAM (see live memory profiling: "The (RAM) Overhead Of Java EE Application Servers").

For mainstream (microservices) projects there is no further tuning, configuration or optimization required.

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 - May 08, 2017 04:33 AM
Gartner, BCE, Modular JSF, Firehose, Translations, Favorite Application Server, GET Refactoring or Questions for 38th airhacks.tv

Questions (gist) for the 38th airhacks.tv, May, 8th, 7pm (exceptionally one hour later):

  1. Java EE 8 and Oracle Code Conference News
  2. Gartner and obsolete Java EE
  3. BCE and loggers, custom validators and "helpers"
  4. Wider topic: what are helper classes?
  5. Modular JSF?
  6. Firehose: performance and scalability considerations
  7. Storing / caching translations
  8. Refactoring GET endpoints with query params
  9. Dealing with Jackson "Unknown Properties"
  10. My favorite application servers
  11. Cross cutting libs (e.g. JCache) and docker
  12. CDI Events and generic types
  13. IBM, RedHat and Project Jigsaw
  14. How to approach effectively Java EE
  15. Application servers, connection pools and clustering

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]>

DukeScript - May 07, 2017 04:51 PM
Can DukeScript Ecosystem Benefit from Java9?

Today we’ve got engaged into particularly interesting discussion: Can DukeScript benefit from Java9? Java9 is feature freezed and it’s release date seem to be unstoppable: thus it is really the right time to look at its features and analyze how an independent and extremely portable project like DukeScript could benefit from the new major Java release. Here are few things that crossed our minds.

Modularity - Meaning Small

DukeScript systems are designed to be heavily portable. They fit into your phone, iPad or even a browser. As such it seams fine that Java9 defines so called java.base module - e.g. the smallest independent deployment unit one can use when bundling a Java9 application. That is indeed good.

On the other hand the smallest unit still has more than three thousand of classes. E.g. it is not as small as it could be: for example when running DukeScript in a browser, it is possible to reduce the application to less than 1000 of classes - so there is still a room for improvement. But at least the Java maintainers are heading in the right direction.

JShell

It is common in the world of browsers that developers have an interactive console: a place to evaluate its queries while the program is running. JShell brings the same possibilities into Java9 and thus also into DukeScript based applications.

In theory we could give you the same console as JavaScript programmers have, but let you code in Java. Let you talk directly to your application: use for example typed JQuery to manipulate with DOM elements.

One question remains: is such feature what you want and need?

Something Else

There is said to be 55 new features in the up-coming release of Java9. We don’t see all of them to directly fit into the charter of DukeScript, but we may be missing something: What is your favorite feature and how it could enhance DukeScript?

Question for You!

How would you like us enhance DukeScript to benefit from Java9 features? Let us know: either by twitter or by participating in the discussion below.

Thanks for helping to make DukeScript better.

APIDesign - Blogs - May 05, 2017 04:08 PM
Midlife Crisis of an API Designer

I have to admit I am currently at a midlife crisis. I dedicated my last twenty years to promotion of a proper API design. I wrote TheAPIBook, I tried to propagate the principles of good APIDesign and modularity wherever I could. However I am tired...

Because it is always the same. Why do I have ask: where is your Usecase? What this method is good for? What do you actually want to achieve with this method/class/type? Have you considered the difference between APIvsSPI aspects of your design? Do you have a unit test? Is your proposed change BackwardCompatible? Do you have an evolution story for your design? Is your solution optimized for your comfort or comfort of users of your API? And so on and so on... People should read TheAPIBook before attempting to design an API, but they don't and they make the same mistakes again and again.

I got so disgust that I feel sick, physically sick, when I have to think about API design. Last weekend Toni asked me to review an API he is creating and showed me what he has. I starred at him, then at the code and at him, etc. for three minutes before I could say a word. Then I had to apologize and describe my current MidlifeCrisis.

When I look at an API these days, all I see is the wasted potential the API could have, but it doesn't and never will, because the amount of investment I would have to do to educate the API stakeholder is so huge, that I just don't want to make it.

Anyway, if you have an API that you'd like me to improve, let me know. If I see real interest in proper API design my disgust and MidlifeCrisis may go away...

--JaroslavTulach 16:08, 5 May 2017 (UTC)

NetBeans – JEE.gr - May 02, 2017 02:53 PM
Netbeans Day Athens 2017 - Springboot made easy with Netbeans

Alexius Diakogiannis Lead Architect at UniSystems talks about SpringBoot made Easy with Netbeans hosted at Unisystems on Friday 21 April.

Unfortunately the video is of poor quality. Source code can be found here https://github.com/NetBeansDay/042117-Athens

Adam Bien - April 24, 2017 10:06 AM
GlassFish v5 (Java EE 8 RI)--Docker Image Is Available

GlassFish v5 ea (Java EE 8) builds available for download: http://download.oracle.com/glassfish/5.0/index.html

The nightly build is also available from docklands as glassfish5 and glassfish5-ping Dockerfiles.

Binary images are directly available from the public docker registry: https://hub.docker.com/u/airhacks/.

To start glassfishv5 perform docker run -d -p 8080:8080 --name glassfishv5 airhacks/glassfish-ping

The ping should be availabe after ~3 secs under: http://localhost:8080/ping.

See you at Java EE Microservices. Is Munich's airport too far? Learn from home: javaeemicro.services.
Real World Java EE Workshops [Airport Munich]>

netbeans – markiewb's blog - April 23, 2017 12:34 PM
NetBeans: How to simplify copy/paste Java code from online tutorials

Some months ago I created a small useful NetBeans plugin, which allows to you to save time when pasting code samples from online tutorials. Today I used it again and I still find it very useful in this specific context. And it saves you time. That is why I want to report about it.

What is the feature? You can copy the Java source code of whole classes from a tutorial and paste it via Menu|Edit|Paste to new file. Either the package declaration of the Java class is taken in account or the Java class is placed in the correct package. This depends on the selected node and it is documented included screencasts at https://github.com/markiewb/nb-paste-to-new-file.

That sounds familiar? Yes, this feature already exists natively in Eclipse JDT and Intellij IDEA.

Give it a try, when using NetBeans! Happy coding.

BTW: I am still looking for maintainers for my plugins! Because of time issues, I will not bugfix nor implement features anymore. Support your favorite IDE and by contribution to your favorite plugin!

PasteToNewJavaFile


Adam Bien - April 22, 2017 05:35 AM
Serverless Microservices On Java EE Servers -- Oracle Code Keynote In London

The "Live For The Code" Keynote in London, 20th April 2018 is available:

The sample code from the slideless keynote was pushed to: https://github.com/AdamBien/live4code -- expect commits during upcoming keynotes.

See you in Berlin. I decided to continue with the implementation of the serverless microservice :-).

I also participated in "Ask Me Anything" Q&A reddit session after the keynote. The conversation is available at: https://www.reddit.com/r/IAmA/comments/66k9rv/hey_redditors_its_adam_bien_author_of_real_world/

Interested in more details? Then 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 21, 2017 03:14 PM
Accessing The Current Build User In Jenkinsfile Pipeline

To access the current user in the Jenkinsfile install the Build User Vars Plugin first. After the installation the current user becomes available within the wrap block:


 wrap([$class: 'BuildUser']) {
    echo "userId=${BUILD_USER_ID},fullName=${BUILD_USER},email=${BUILD_USER_EMAIL}"
}

See you at Java EE Workshops at MUC Airport, particularly at the Java EE Testing, Pipelines as Code, CI / CD, Testing and Quality workshop


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 20, 2017 11:59 AM
Java EE, Microservices and HTML 5 -- Bucharest Voxxed Days Keynote

During the Bucharest Voxxed Days Keynote I discussed the impact of using "standards" from Java EE backend to the HTML 5 frontend:

Any questions left? See you at airhacks.tv.

Interested in Thin WARs and WebStandards? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Building HTML 5 Applications With WebStandards Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

NetBeans – Enrico Scantamburlo - April 17, 2017 11:36 PM
Automatic increase module version in a NetBeans Platform Based Application

Some time ago on the NetBeans-dev mailing list, a user asked how to automatically increment the version of a module when it is built. I remember doing something similar for work but in my case, the update was not automatic but was made when the suite was built.

The github link for the sample application is here.

The first attempt was to write the version as 1.0.20170417223643, the module compiled fine, but it won’t install because 20170417223643 does not fit an integer.

The second attempt was to write the version as 2017.0417.223643, which worked, however, this was not very good looking and I decided to just read the previous version and increase it.

I create an Ant Task that increased the version number; I also made certain that if the version of the module is not written in the manifest file but in the module properties, it would be updated as well.  This could happen when you declare implementation dependencies.

I gave a look at the README file inside the netbeans-8.2/harness to refresh my memory on how to customize the module build system.

IMHO the best place to increase the version number was the “nbm” target. This is the target that is called when the NBM file is constructed.

I overwrote the “nbm” with my own in this way:

<target name="nbm" depends="updateManifest, projectized-common.nbm">
 </target>;

“updateManifest” is the target that increases the version number, while “projectized-common.nbm” is the original that builds the nbms. The order of the dependencies makes sure that the two targets are called in the right order.

The “updateManifest”  looks like this:

<taskdef name="updatemanifest" classname="it.scantamburloenrico.dailymanifestant.UpdateManifestTask" >
 <classpath>
 <fileset dir="${basedir}/../../dailymanifest/dailymanifestAnt/target" >
 <filename name="dailymanifestAnt-1.0-SNAPSHOT.jar" />
 </fileset>
 </classpath>
 </taskdef>

 <target name="updateManifest">
 <updatemanifest />
 </target>

The taskdef at the beginning is needed to import the jar file that contains the task.

I used maven to create the ANT task, it just searches for the manifest file, if the task finds it then the version number is increased, otherwise, the task searches for the “spec.version.base” property inside the project properties and updates it.

The image comes from here

Adam Bien - April 16, 2017 07:10 AM
(Free) Oracle Code Conference and Enterprise Java.next: A Slideless Keynote

I will deliver keynotes for (free) Oracle Code conferences in London, Berlin, Prague and Brussels. The deal was: slideless content. The advantage is: the content (=code) will vary across cities and is going to be influenced by the attendees.

See you soon at 9am:

  1. April, 20th, London
  2. April, 24th, Berlin
  3. April, 28th, Prague
  4. June, 6th, Brussels

Prepare your questions!

Also 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 07, 2017 10:45 PM
CORS Auth,Mobile,Pretty Metrics,JSON Links,Thin WARs in Practice, Performance Or 37th airhacks.tv

1h, 110 live attendees, over 20 questions -- the 37th airhacks.tv Questions and Answers show is available:

Non-blocking questions queue for the 38th airhacks.tv is created and is going to be processed at May 8th, 6 pm CET, 2017. See you live!

Ask questions now, 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 - April 05, 2017 03:49 AM
Perceptor: The "Performance Metrics Gathering Interceptor For Java EE" Released

perceptor v0.0.1 released. Perceptor is "Performance Metrics Gathering Interceptor" for Java EE 7. It comes as a 9kB, zero dependencies, Thin JAR with "plug and play" installation and two flavors:

  1. perceptor (metrics available via injection only):
        
    <dependency>
        <groupId>com.airhacks</groupId>
        <artifactId>perceptor</artifactId>
        <version>0.0.1</version>
    </dependency>
        
    
  2. perceptor-spy (metrics are exposed via: /monitoring/methods endpoint):
        
    <dependency>
        <groupId>com.airhacks</groupId>
        <artifactId>perceptor-spy</artifactId>
        <version>0.0.1</version>
    </dependency>
                
    Metrics are accessbile under:  curl [YOUR_THIN_WAR]/resources/monitoring/methods/[exceptional|recent|slowest|unstable]
    

Usage:


import com.airhacks.interceptor.monitoring.boundary.PerformanceSensor;

@Interceptors(PerformanceSensor.class)
public class Invoker {
    public String slow() {}
    public String fast() {}

}

Checkout https://github.com/AdamBien/perceptor for more information. You may also like https://github.com/AdamBien/porcupine

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE Performance, Monitoring and Troubleshooting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 04, 2017 04:15 AM
Introduction to firehose -- the prometheus gateway

firehose is a standalone, Thin WAR (16 kB) gateway, which converts application metrics into prometheus.io format without any external dependencies:

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE Performance, Monitoring and Troubleshooting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

NetBeans – Enrico Scantamburlo - April 03, 2017 12:44 AM
Adding Spotbugs support to a NetBeans Platform Application

In the past week, I have been integrating FindBugs in my company NetBeans based Rich Client Application. FindBugs is a famous tool for static code analysis; it looks at your jars to find bugs, bad practices, unclosed streams … FindBugs did its job, and spotted many problems in our code, later I discovered this it was forked into a new project called SpotBugs that seems well maintained.

We wanted a complete report for all our modules, so I had to run FindBugs on them all, merge the results and convert them to HTML. All these tasks were done in ANT scripts because ANT is our build system and it was automated inside Jenkins.

I made a small sample project on GitHub to show what I did.

The first step was to create a separated ANT build.xml file called spotbugs.xml, that would be imported by every module because in this way I reduce duplicated code.

<?xml version="1.0" encoding="UTF-8"?>
<project name="changeme" default="all" basedir=".">

 <!-- where SpotBugs is located -->
 <property name="spotbugs.home" value="${basedir}/../../libs/spotbugs" />

 <path id="spotbugs.classpath">
 <fileset dir="${spotbugs.home}/lib">
 <include name="**/*.jar" />
 </fileset>
 </path>

 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
 <classpath refid="spotbugs.classpath" />
 </taskdef>

 <target name="spotbugs" depends="jar">
 <echo message="${spotbugs.home}" />

 <property name="output.folder" value="${basedir}/../../output" />

 <!-- I launch SpotBugs -->
 <spotbugs home="${spotbugs.home}"
 output="xml"
 outputFile="${output.folder}/${code.name.base}_spotbugs.xml"
 >
 <sourcePath path="${basedir}/src/java" />
 <auxClasspath path="${module.classpath}" />
 <class location="${suite.dir}/build/cluster/modules/${module.jar.basename}" />
 </spotbugs>
 </target>

</project> 

Writing the task was easy because SpotBugs/FindBugs’ ANT task is well documented, and I had just to plug the right variables that were generated by the NetBeans build system thanks to the dependence to the jar task.

The output format must be XML so I can merge the results later and it is better to pass the path used to build the module (auxClasspath). The class tag points to the generated jar file.

Inside each module’s build.xml I added this line to import the file:

<import file="${basedir}/../../spotbugs.xml" />

The next step was to launch the ANT target on each project, collect the results and convert them into HTML. I modified the module suite’s build.xml to perform this.

<property name="spotbugs.home" value="${basedir}/../libs/spotbugs" />

 <path id="spotbugs.classpath">
 <fileset dir="${spotbugs.home}/lib">
 <include name="**/*.jar" />
 </fileset>
 </path>

 <taskdef name="unionBugs" classname="edu.umd.cs.findbugs.anttask.UnionBugs">
 <classpath refid="spotbugs.classpath" />
 </taskdef>

 <taskdef name="convertXmlToText" classname="edu.umd.cs.findbugs.anttask.ConvertXmlToTextTask">
 <classpath refid="spotbugs.classpath" />
 </taskdef>


 <target name="spotbugs" depends="-init">
 <!-- I define some variable -->
 <property name="output.folder" value="${basedir}/../output" />
 <property name="xml.output" value="${output.folder}/spotbugs.xml" />
 <property name="html.output" value="${output.folder}/spotbugs.html" />

 <!-- I remove the previous files-->
 <delete failonerror="false">
 <fileset dir="${output.folder}" includes="**/*"/>
 </delete>

 <mkdir dir="${output.folder}" />

 <subant buildpath="${modules.sorted}" target="spotbugs" inheritall="false" inheritrefs="fakse" failonerror="false" />

 <unionBugs to="${xml.output}" >
 <fileset dir="${output.folder}">
 <include name="**/*_spotbugs.xml" />
 </fileset>
 </unionBugs>

 <convertXmlToText
 classpathref="spotbugs.classpath"
 input="${xml.output}"
 outputfile="${html.output}"
 format="html:fancy-hist.xsl"
 />

 </target>

In the script above, first I define some useful variables, then I delete the old output, finally, there is the most important part: the subant task that invokes SpotBugs on all modules. The modules.sorted variable has the list of all suite modules and it is very convenient in this case.

The unionBugs task merges all the .xml files generated by the previous subant task into a single XML file that is converted to HTML by the convertXmlToText task.

The convertXmlToText task lets specify how the HTML file will be generated with the format attribute; if we take a look at the documentation we can use specify 4 type of formatting (plain.xsl, default.xsl, fancy.xsl, fancy-hist.xsl) or use our own.

Running the spotbugs target in the suite will generate a spotbugs.html file inside the output folder at the same level of the suite.

if you open it will look like this:

 

A small note about SpotBugs: SpotBugs is a fork of FindBugs, so if you point to the FindBugs home instead of the SpotBugs one everything should work the same way, the class packages are also the same. However, I had some problems building SpotBugs, I could clone the git repository and launch Gradle to generate its jars, but I had to manually rename them and put them in a proper directory structure to make them work. I have included them in the GitHub repository to make your life easier.

 

 

 

 

 

NetBeans – Michael's blog - April 02, 2017 08:07 PM
JavaLand 2017

The fourth edition of JavaLand had been on March 28th + 29th 2017. JavaLand is one of the biggest Java Congresses in Europe and is hosted in my home town. Yesterday I wrote my reports for an online channel as well as for a German printed magazine. Here I’ll blog about it from three personal […]

Adam Bien - April 02, 2017 07:24 PM
Masterdata Diffs, CORS, Multi-Tenant EM, Service Discovery, HATEOAS and JAX-RS, Career Boost, ContextResolver, LB Microservices, DB Sharing or Topics For The 37th airhacks.tv

Topics (https://gist.github.com/AdamBien/beae7dd8966a6d57b7225ba310b18abe) for the 37th airhacks.tv Questions && Answers live show for Monday, 3rd April, 6pm CET:

  1. Best technology to distribute masterdata diffs
  2. CORS and Access-Control-Expose-Headers
  3. How to implement token based authentication in Java EE?
  4. Monitoring Java EE applications in production (with pretty UI)
  5. Tenant-dependent EntityManager injection
  6. Service discovery and Java EE 7
  7. How to build Hateos links with JAX-RS?
  8. Ideas to improve your career
  9. Solutions for mobile applications for Java EE services
  10. What is javax.ws.rs.ext.ContextResolver?
  11. Naming for load balanced microservices
  12. How JTA transactions are implemented under the hood?
  13. Security in Java EE 8 news
  14. Thin WARs in practice
  15. Declarative JSON validation
  16. Microservices and DB sharing
  17. Plain Java SE without Java EE -- is it viable in real world?

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]>

NetBeans – Michael's blog - March 30, 2017 08:40 PM
JShell at JavaLand – Slides

Yesterday I had my talk at JavaLand. It was all about Java 9’s great JShell, its API and a short view at its integration within NetBeans. Mathias had been so nice to take this snapshot of my talk. Although I prepared a lot of slides, I showed only a few one and demonstrated the JShell […]

Adam Bien - March 27, 2017 03:49 AM
firehose v0.0.1 released --the prometheus gateway for Java EE (micro) service monitoring

firehose v0.0.1 (ignition) the MIT-licensed, "prometheus metrics gateway" is available as docker image, Thin WAR.

firehose connects to (micro) services (Thin WARs), gathers monitoring data and provides it in prometheus-compliant format. Lacking metadata can be provided via environment variables at docker start or via HTTP / JSON at runtime. New endpoints can be re-configured on-the-fly. One firehose instance can handle multiple endpoints. Firehose is a 16 kB Java EE 7, zero dependency, Thin WAR.

Firehose and prometheus are going to be covered in Java EE Microservices / javaeemicro.services and Java EE Monitoring, Performance and Troubleshooting workshops.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - March 22, 2017 07:53 AM
polymer 2.0 with browsersync: a minimal installation / hot reloading

For a minimal polymer (2.0) with browsersync (hot reloading) installation perform the following steps:

  1. Install www.npmjs.com
  2. Install bower.io with: sudo npm install -g bower
  3. Install browsersync.io with: sudo npm install -g browser-sync

Create bower.json with minimal dependencies:


{
  "name": "(...)",
  "main": "(...).html",
  "dependencies": {
    "polymer": "Polymer/polymer#^2.0.0-rc.2"
  },
  "devDependencies": {
    "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.5"
  },
  "resolutions": {
    "polymer": "^2.0.0-rc.2"
  }
}
    

Execute: bower install

Maintain your code in src folder

Launch browsersync with with: browser-sync start --server src -f "**/*" --serveStatic ./bower_components -b "google chrome" --no-notify

Browsersync will open chrome, serve static files (polymer libs) from bower_components folder and watch src folder. Any changes are going to be automatically pushed to the browser without reloading. Skip the bower_components folder in all imports:

	
<link rel="import" href="polymer/polymer-element.html">
(...)
<script src="webcomponentsjs/webcomponents-lite.js"></script>
	
    

Also see sample project: github.com/AdamBien/polymer-essential

Interested in lean apps? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Building HTML 5 Applications with WebStandards only
Real World Java EE Workshops [Airport Munich]>

DukeScript - March 20, 2017 08:23 AM
DukeScript with Node.js backend

In one of our latest projects the customer has decided to use Node.js as a backend. So we decided to share a minimal demo how simple it is using DukeScript APIs.

You’ll need node installed and in addition the websocket module. Here’s the server, we’re using a websocket to make it a little fancier.

var ipaddress = 'localhost';
var port = 8085;

const WebSocket = require('ws');

var WebSocketServer = WebSocket.Server
  , wss = new WebSocketServer({host:ipaddress, port:port});

wss.broadcast = function(data) {
  wss.clients.forEach(function each(client) {
    if (client.readyState === WebSocket.OPEN) {
        console.log('send response');
      client.send(data);
    }
  });
};

wss.on('connection', function (ws) {
    ws.on('message', function (message) {
        console.log('received message ' + message);
        wss.broadcast("{message: 'message from server'}");
        setInterval(function () {
            wss.broadcast("{message: 'message "+i+" from server'}");
            i++;
        }, 5000);
    });
});

The websocket server sends a simple JSON message every 5 seconds after we connected. Don’t worry too much about the server code. This is just for demo purposes. Now we need a Java model to read the message:

@Model(className = "Data", targetId = "", instance = true, properties = {
    @Property(name = "message", type = String.class)
})
final class DataModel {
}

DukeScript has the extremely convenient @OnReceive annotation, that takes care of serializing messages to and deserializing messages from the server. So we extend our class with:

@OnReceive(url = "ws://localhost:8085", data = Data.class, method = "WebSocket")
public static void receive(Data data, Data message) {
    if (message != null) {
        ui.setMessage(message.getMessage());
    } else { // null means: connection established
        System.out.println("conection established");
    }
}

This will generate a method in our Model class with all the boilerplate code. To establish the connection you once call the method with a null argument.

private static Data ui;
static void onPageLoad() throws Exception {
    ui = new Data("Hallo");
    ui.applyBindings();
    ui.receive(null); //connect
}

After that you can call the receive method with data to send and receive messages via the websocket. The websocket can also push back messages to you. Let’s add a @Function, so we can send a message from the UI:

@Function
public static void send(Data data) {
    data.receive(data);
}

Now we only need a UI to start the connection, so we add this to our View:

<input type="text" data-bind="textInput: message">
<button data-bind="click: send">Send Message</button>

The full code to play with is available on Github.

And if you want to code the Node based server in Java as well, have a look at this project: Node4J.

That’s it. Easy, isn’t it? Have fun coding DukeScript!

Adam Bien - March 19, 2017 04:59 AM
Voxxed Days At Cern: Java EE -- As Cool As The LHC

After watching the keynote at Voxxed Day CERN I decided to add the "almost" to the title: "Java EE -- (Almost) As Cool As The LHC":

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 - March 18, 2017 10:12 AM
Yes/NO User Input in Jenkinsfile

The method input within the Jenkinsfile suspends the build and waits infinitely for the user input with configurable options.

A Yes / No dialog waits for user input and returns true / false with the following code snippet:


def doesJavaRock = input(message: 'Do you like Java?', ok: 'Yes', 
                        parameters: [booleanParam(defaultValue: true, 
                        description: 'If you like Java, just push the button',name: 'Yes?')])

echo "Java rocks?:" + doesJavaRock

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]>

Adam Bien - March 17, 2017 12:14 PM
JMS Redelivery, HA Singletons, Message Ordering, Test Coverage, JSON-P vs. JSON-B, UI Strategies or 36th airhacks.tv Episode Is Available

The 36th airhacks.tv, or 3 years anniversary live question and answers show with 96 live viewers and 20+ topics is available:

Past episodes are available at: airhacks.tv playlist.

Any questions left? Ask now https://gist.github.com/AdamBien/beae7dd8966a6d57b7225ba310b18abe and see you at April, 3rd, 6pm CET.

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, 2017 05:27 AM
Advanced Injection in Jersey

I've just learned a new trick: proper way to do JerseyInjection. Maybe somebody finds it useful...

--JaroslavTulach 05:27, 15 March 2017 (UTC)

DukeScript - March 07, 2017 08:23 AM
How to display a "Loading" Indicator

When deploying a DukeScript Application to the Browser, it takes a bit until the Java libraries are loaded. During that time the HTML is already displayed.

Since the Bindings aren’t applied yet, the application will look “broken” for a few moments. Let’s take my little match 3 game as an example. Here’s what it’s supposed to look like:

And here’s how it looks before the bindings are applied:

Obviously that’s not very nice. It’s not a big issue for desktop applications where the view typically only takes a few milliseconds to load. But it’s clearly visible when you deploy it in the browser, because the Java Libraries are still loaded via the internet while the game is already displayed.

It would be much nicer if there was a splash screen while the game is loading.

Let’s fix this. Fortunately I have a nice image that I can display as a loading screen:

To show the image we add a div to the html of the page:

<div id="title" ></div>

We now make the image visible at the beginning via CSS:

#title {
    background-color: black;
    background-image: url("../assets/title.png");
    padding-top: 0;
    position: absolute;
    background-size: 100%;
    background-repeat: no-repeat;
    width: 100vh;
    height:100vh;
    margin-left: auto;
    margin-right: auto;
    left: 0;
    right: 0;
    z-index: 10;
}

Now the only thing left to do is to make the image vanish, when the page is loaded. We can do so via a boolean Property in our Model:

@Model(className = "Level", properties = {
    @Property(name="loading", type=boolean.class),
    //  other Properties omitted
}, targetId = "")
class LevelVM { 
    //...
}

The property will only take effect when the Application is loaded, so we can safely use it in our DIV:

<div id="title" data-bind="visible: loading"></div>

In our “onPageLoad”-method we set the property to “false” and the startup page vanishes. And now this is what users see while the application is loading:

Click here to see it in action.

That’s it. Simple isn’t it? Have fun coding DukeScript!