Č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)
Carsten Zerbst's Weblog (feed)
NetBeans – Java PDF Blog (feed)
Winston Prakash's Weblog (feed)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
NetBeans Ruminations » NetBeans (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Inspiration and Expression » Netbeans (feed)
Adam Bien (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
Arun Gupta, Miles to go ... (feed)
Geertjan's Blog (feed)
.JARa's Bilingual Weblog (feed)
JavaFX Composer (feed)
The Java Jungle (feed)
Jesse Glick (feed)
Martin Grebac (feed)
The NetBeans Community Podcast (feed)
NetBeans Profiler (feed)
NetBeans for PHP (feed)
NetBeans Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (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 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:
September 25, 2016 06:06 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - September 25, 2016 05:37 AM
The Ingredients and Roadmap of Rebooted Java EE 8 and 9

After one year vacations Java EE 8 was rebooted and is going to be optimised to run on hypervisors and / or container environments. Java EE 8 will focus on the following areas below -- it is a proposal and very likely to change in the JCP process:

Programming Model
  1. Extend for reactive programming
  2. Unified event model
  3. Event messaging API
  4. JAX-RS, HTTP/2, Lambda, JSON-B, (...)
Packaging
  1. Package applications, runtimes into services
  2. Standalone immutable executable binary
  3. Multi-artifact archives
Key Value/Doc Store
  1. Persistence and query interface for key value and document DB
Eventual Consistency
  1. Automatically event out changes to observed data structures
Serverless
  1. New spec - interfaces, packaging format, manifest
  2. Ephemeral instantiation
Configuration
  1. Externalize configuration
  2. Unified API for accessing configuration
Multitenancy
  1. Increased density
  2. Tenant-aware routing and deployment
State
  1. API to store externalized state
Resiliency
  1. Extension to support client-side circuit breakers
  2. Resilient commands
  3. Standardize on client-side format for reporting health
Security
  1. Secret management
  2. OAuth
  3. OpenID

The choices are pragmatic and will make Java EE an even more productive platform. I'm only missing a slightly extended and modernized "Concurrency Utilities for Java EE" (jcp.org/ja/jsr/detail?id=236). Particularly the ThreadPool configuration and Backpressure could be easily standardized just by agreeing on features from https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html. Particularly useful would be the integration of the statistics (e.g. Bulkheads) with the Health Check API.

Also a standardized management API (not proposed) would simplify the creation of application images through a unified API.

Java EE 8 and 9 will come at light speed to an application server vendor near you. Java EE 8 is expected to be delivered in 2017 and Java EE 9 in 2018.

Oracle is listening now, take the chance and participate at the survey (takes a few mins): glassfish.org/survey

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 - September 24, 2016 10:42 AM
Beware of DefaultMethods

DefaultMethods is a new feature of JDK8 that we many cried for. Yet, they carry certain drawbacks with themselves. For example one can write a valid Java program that compiles and works on JDK7, but is broken on JDK8!

--JaroslavTulach 10:42, 24 September 2016 (UTC)

Geertjan's Blog - September 23, 2016 06:15 PM
Minimal Oracle JET Composite Component

Let's say you have a suite of Cloud applications and you want them to display customers in a standardized way:

If that's your business scenario, then Oracle JET composite components are a perfect fit. Here's what an absolutely minimal Oracle JET composite component looks like: 

The above is really trivial. Here's the content of "customer.html":

<h2 data-bind="text: $props.name"></h2>
<h4 data-bind="text: $props.city"></<h4
<hr>

Here's "customer.json":

{
  "properties": {
    "name": {
      "description": "Customer name.",
      "type": "string"
    },
    "city": {
      "description": "Customer location.",
      "type": "string"
    }
  }
}

About the properties above, see the below:

http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.Composite.html#metadata

And here's "loader.js", which connects the above two together and provides "customer" as a new HTML element:

define(['ojs/ojcore', 
    'text!./customer.html', 
    'text!./customer.json', 
    'ojs/ojcomposite'],
  function(oj, view, metadata) {
    oj.Composite.register('customer', {
      view: {inline: view}, 
      metadata: {inline: JSON.parse(metadata)}
    });
  }
);

In a more complex scenario, you're also able to include CSS stylesheets and business logic defined in JavaScript, as outlined in an earlier blog entry on this topic

OK, now ZIP up that folder, send it to whoever is working on other Cloud applications that need to make use of the "customer" element, which they can use as follows (in e.g., "library.js") after unzipping that ZIP into the relevant folder in their application:

define(['ojs/ojcore', 'knockout', 'ojs/ojcomposite',
'jet-composites/customer/loader'],
   function (oj, ko) {
      function libraryContentViewModel() {
          var self = this;
          self.customers = [
              {name: 'Billy Bob Thornton', city: 'New York'},
              {name: 'Brad Pitt', city: 'Hollywood'},
              {name: 'Val Kilmer', city: 'Seattle'}
          ];
      }
      return new libraryContentViewModel();
   });

All that the above does is load the "loader.js", include "ojs/ojcomposite" so that Oracle JET composite components are supported, and define a "customer" array.

Here's the view (e.g., "library.html") of the above viewModel, using the "customer" HTML element provided by the composite component:

<!-- ko foreach: customers -->
<customer name="{{name}}" city="{{city}}"></customer>
<!-- /ko -->

That's pretty neat and, guess what, Oracle JET components conform to the Web Components specification, except for the Shadow DOM, which is not supported.

Adam Bien - September 23, 2016 08:31 AM
JavaOne: Live Coding "No Ceremony" Java EE Microservices Session and Screencast

In the screencast below I created Java EE 7 projects with maven, developed and build them, created and build docker images, created a user defined network and finally launched the WARs on payara and wildfly and let them communicate:

In the first part of the JavaOne 2016 session in San Francisco I did the same. For unknown reasons docker was unbelievably slow during the presentation (I guess caused by network timeouts), so I re-recorded the first part. Now you can fast-forward over "boring" parts in the JavaOne presentation:

Any questions left? The next http://airhacks.tv is around the corner. Ask now: https://gist.github.com/AdamBien/e6e20c129e673ad558be495dd4f3afc4 or wait a month. See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices. Is MUC too far? Checkout: javaeemicro.services.


Real World Java EE Workshops [Airport Munich]>

NetBeans – Java PDF Blog - September 20, 2016 03:03 PM
Creating plugins in the NetBeans IDE

Today at JavaOne we learned about making plugins in the NetBeans IDE. Making your own plugin is a good idea because if your technology is available in the IDE, people are more likely to start using it.

netbeans-logo

Some general words of advice:

  • Before diving straight in, create levels of requirements for your plugin. For example design a prototype, then decide on the minimal, medium and full requirements you would like to include
  • Look at similar existing plugins and try and make yours as similar to those as possible. For example if you are creating a database plugin, look at how other database plugins work

Making a simple plugin is relatively straightforward. A tutorial is available here.

When you are done, right clicking on your new module will give you the option to Install/Reload. Now the software you have just been writing will be available to use in the very IDE you have just been using to create it.

When you are happy with your plugin you can go to NetBeans Plugin Portal and upload it. A community of verifiers will make sure the core functionality works and that it doesn’t break NetBeans. After that your plugin will be available in the plugin manager in NetBeans for anyone to use (just go to Tools > Plugins and search in available plugins).

Another tip: Once people are using it, be prepared for the fact that you will now need to ensure it keeps working and be prepared to respond to feedback.

The best way is to try it – have a go at creating your own plugin in NetBeans.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the  Blog RSS.

 

Related Posts:

The post Creating plugins in the NetBeans IDE appeared first on Java PDF Blog and was written by Bethan Palmer.

Geertjan's Blog - September 20, 2016 12:27 PM
Cab Drivers in San Francisco Love NetBeans

On the way to NetBeans Day 2016, I had a nice conversation...

Here's where it is on YouTube:

https://www.youtube.com/watch?v=M2F9cik4hXs

Geertjan's Blog - September 19, 2016 01:36 PM
James Gosling on NetBeans and Apache

To a packed room at NetBeans Day 2016, at the start of JavaOne 2016, James Gosling participated in a discussion panel, where he reflected on the history of NetBeans and shared his thoughts on the plans to move to Apache.

Below, watch the final minutes, where he focuses specifically on the NetBeans plans in relation to Apache:

&amp;amp;lt;span id=&amp;amp;quot;XinhaEditingPostion&amp;amp;quot;&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;

Here's the view on the room from his perspective, in a photo taken by Michael Nacimento (sitting next to James):

Thanks to Victor Duran, who made the video of James's words above. 

There was a funny moment earlier in the session, where I had explained the move of NetBeans towards Apache, which I ended by saying: "We are carefully optimistic that everything will work out and our move to Apache will succeed." At that point James threw up his hands in exasperation, turned to me, and said: "Oh, have a little faith! We'll work through the Apache process!" :-)

NetBeans – Java PDF Blog - September 18, 2016 07:08 PM
NetBeans Day 2016 – First 2 sessions

JavaOne always starts with a big Community event and NetBeans day this year had an extra buzz with the big news about the license changes and impending NetBeans 8.2 release. Here are first 2 sessions and pictures from NetBeans Day 2016….

Picture Gallery from NetBeans Day 2016

 

nbday-1 nbday-2 nbday-3 nbday-4 nbday-5 nbday-6 nbday-7 nbday-8 nbday-9 nbday-10 nbday-11 nbday-12 nbday-13 nbday-14 nbday-15 nbday-16 nbday-17

 

9.15 What’s Going On in the NetBeans Ecosystem? 

Geertjan Wielenga gave a summary of the last year. There are lots of new features in NetBeans (especially in JavaScript support) and how NetBeans was being used by multiple companies and the number of new features which will appear soon (including R and better Groovy support). He showed the cool new editing features (only 50 individual curators possible) and easy use with Oracle’s free Jet JavaScript library. The Dark theme for NetBeans is currently the most popular plugin to download. He explained how Oracle would continue to put resources into NetBeans development, while the new Apache licensing model makes it much easier for others to make use of NetBeans and contribute code. Lastly there was a 30 second youtube video of Geertjan talking code and NetBeans with his taxi driver (this is San Francisco).

Mark Stephens talked about the NetCat test program, the latest NetBeans tee-shirts (which were thrown into the audience in James Gosling’s talk) and the NetBeans day. He ran through what happened at the NetBeans Day UK at Greenwich and how the NetBeans days are evolving.

Zoran Several gave a quick sneak preview of his work on image recognition. All of this this built on top of the NetBeans platform.

10.30 James Gosling and the Newest, Latest, and Cutting-Edgiest Technologies in the NetBeans IDE

Geertjan Wielenga gave a quick summary of his 9.15 news and updates.

Arun Gupta showed how easy it was to use docker in NetBeans and how you can avoid the command line totally. He also showed the CouchBase plugin which he has written with Geertjan. There is a whole series of articles on how this was built so you can build your own plugin. His favourite Netbeans feature is the out of the box experience. It all just works.

Michael Nascimento did a jackpot demo using the find and transform to refactor some code using Joda time to new java time. He showed how it integrated into NetBeans so you can review all the changes and easily refactor huge amounts of code.

James Gosling did a history recap. Visual studio killed off most tools. Sun bought Forte (anyone remember that?) and NetBeans. Sun made NetBeans free and open source. He is really excited about Apache and signed up. His key advice was ‘Buy anyone you know in Apache a beer so they vote in favour of NetBeans project‘.

Tee-shirts were thrown into the audience!

Toni Apple did a demo using Dukescript – Java and HTML. Inspired by @internetofshit, he found that his toothbrush had an API and added a GUI (complete with minions).

Sean Phillips showed 3 demos on how NetBeans has gone beyond the cloud and into space. It is being actively used in NASA for space projects and a big attraction of NetBeans is that they can write fast display and processing applications beyond what they could create in HTML5/JavaScript.

Full details of the other sessions are available here. Still plenty to see later today…

Related Posts:

The post NetBeans Day 2016 – First 2 sessions appeared first on Java PDF Blog and was written by Mark Stephens.

Geertjan's Blog - September 18, 2016 11:53 AM
Getting Started with Oracle JET Composite Components

I worked with JB Brock yesterday on setting up and using Oracle JET's new Composite Component Architecture.

The aim of it all is to have reusable components that enable you to define your own HTML elements, like this, for example:

<!-- ko foreach: employees -->
<demo-card class="oj-flex-item" 
           name="{{name}}" 
           avatar="{{avatar}}" 
           work-title="{{title}}" 
           work-number="{{work}}" 
           email="{{email}}" 
           background-image="{{backgroundImage}}">
</demo-card>
<!-- /ko -->

Above you see a Knockout for-each loop which iterates through 'employees' and creates a new DOM element named "demo-card" for each of them.

The above is in the view, e.g., in "home.html", while "home.js", i.e., the viewModel, defines "employees" as follows:

self.employees = [
    {
        name: 'Deb Raphaely',
        avatar: 'images/composites/debraphaely.png',
        title: 'Purchasing Director',
        work: '5171278899',
        email: 'deb.raphaely@oracle.com',
        backgroundImage: 'images/composites/card-background_1.png'
    },
    {
        name: 'Adam Fripp',
        avatar: null,
        title: 'IT Manager',
        work: '6501232234',
        email: 'adam.fripp@oracle.com',
        backgroundImage: null
    }
];

In this case, the definition of "demo-card" transforms the above snippets into a view that looks like this, with a "demo-card" for each of the two employees defined above:

When the user clicks on each "demo-card", it flips around, and you see the other side of the card, which presents more information about the employee. (See the above live here.)

OK, so where does "demo-card" come from? Well, in "home.js", i.e., the same place where the 'employees' above are defined, my "define" block looks like this:

define(['ojs/ojcore', 'knockout', 'ojs/ojcomposite', 
        'jet-composites/demo-card/loader'],

Notice, first of all, that "ojs/ojcomposite" is included, which is new in Oracle JET 2.1.0. It defines composite components. Then, notice that something is loaded from a folder named 'jet-composites', which is a folder that looks like this:

Notice "demo-card" is a folder in there, which looks like this:

So, what you have is an infrastructure for creating encapsulated components, defined by JavaScript, HTML, and CSS, with properties defined in JSON. Once you have a composite component, you have created a new HTML element, in this case "demo-card", defined by "loader.js", which ties everything together:

define(['ojs/ojcore', 
    'text!./demo-card.html', 
    './demo-card', 
    'text!./demo-card.json', 
    'css!./demo-card', 
    'ojs/ojcomposite'],
  function(oj, view, viewModel, metadata) {
    oj.Composite.register('demo-card', {
      view: {inline: view}, 
      viewModel: {inline: viewModel}, 
      metadata: {inline: JSON.parse(metadata)}
    });
  }
);

You can pass the composite component in a ZIP file to whoever needs to use it, who unzips the ZIP into a folder, and loads it into their viewModel as described earlier, via the "define" block of the viewModel. You can see composite components as plugins for developers, i.e., not for the end user of the app, but for the development team, enabling features to be packaged, shared, and reused.

Here is a more complex example, which is a composite component called "demo-memory-game" which itself makes use of a composite component called "demo-memory-card":

All the details, including all the code described above, are here in the Oracle JET Cookbook:

http://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=composite&demo=basic

Note: When loading a composite component that includes a CSS file, remember to add 'css': 'libs/require-css/css' in your main.js file, i.e., in the "paths" section of your "requirejs.config", otherwise the composite component loader crashes when trying to execute the loading of the CSS, e.g., the 'css!./demo-card' piece. Thanks Janis Krasemann on Twitter for pointing this out. That is something I indeed did do but forgot to mention here. :-)

markiewb's blog - September 18, 2016 11:44 AM
Missing plugins for your NetBeans nightly builds?

Do you use a Nightly-/Dev-Build of NetBeans or even a release candidate of 8.2 within the NetCAT-program and you are missing some of your favorite plugins?

First there is no plugin center for Dev-Builds. Also most plugins from the 8.1 plugin center are not verified for the new 8.2 build yet – including my plugins.

Nevertheless in the meantime you can still use the plugins and give the plugin authors feedback of the compatiblity to 8.2. Some plugins won’t work, because of using non-public API, but that is the point to find out!

How to do that?

At Tools|Plugins|Settings add the plugin center URL for 8.1 [1] and then at Tools|Plugins|Available Plugins click at “Check for Newest

Additional

If you are interested in testing non-verified plugins see the article [2]

[1] http://plugins.netbeans.org/nbpluginportal/updates/8.1/catalog.xml.gz
[2] https://benkiew.wordpress.com/2013/02/03/netbeans-ide-verification-of-plugins-and-update-center-urls-for-non-verified-plugins/


Adam Bien - September 17, 2016 02:40 PM
My One And Only Microservices Live Hacking JavaOne Session

This year I was more cautious and only proposed a single session:

Live-Coding No-Ceremony Microservices [CON3436]

Java EE is productive and easy to learn and runs smoothly on containers such as Docker and rkt. It has become the perfect microservices platform. Unfortunately, no one in the enterprise is interested in managing thousands of nanoservices “just for fun.” In this session, the presenter hacks on stage a couple of Java EE 7/8 “rightsized” services, links them together, runs them on Docker, and explains the architectural decisions and best practices in real time.

This session is already available for: streaming.

Tuesday, Sep 20, 2:30 p.m. - 3:30 p.m. | Parc 55 - Embarcadero

Is San Francisco too far? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - September 15, 2016 06:30 AM
Java EE: Accessing Resources In Docker In Stage Environment

"How to change a e.g. JDBC URI in the configuration of a Java EE application server running in docker and staged environment?"
...is one of the recurring airhacks.com, airhacks.io and airhacks.tv questions.

The answer is: don't change it:

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices Is MUC too far? Checkout: javaeemicro.services.


Real World Java EE Workshops [Airport Munich]>

Wade Chandler's Programming Blog - September 14, 2016 03:25 AM
"Run Focused Test Method" and "Debug Focused Test Method" for NetBeans Groovy Support Now in main-golden and Nightly Builds

If you use NetBeans nightly builds you will now have this functionality. Try it out, and let me know if you experience any issues.

NetBeans – Michael's blog - September 13, 2016 05:30 PM
NetBeans goes Apache

Today NetBeans was proposed to become an Apache project. Here you’ll read the proposal: wiki.apache.org/incubator/NetBeansProposal

DukeScript - September 13, 2016 09:46 AM
SnapSVG for Java

SnapSVG is a very decent JavaScript library for rendering and animations. With great delight the DukeScript project announces immediate availability of the library for all Java users!

Check the javadoc for detailed description. Use following code to add the SnapSVG into your DukeScript application:

Paper s = Exports.Snap("#demo");
Element bigCircle = s.circle(150, 150, 100);
bigCircle.attr(values(
    "fill", "#bada55",
    "stroke", "#000",
    "strokeWidth", 5
));

Element smallCircle = s.circle(100, 150, 70);
Element discs = Element.$as(s.group(smallCircle, s.circle(200, 150, 70)));
discs.attr(values(
    "fill", "#fff"
));

bigCircle.attr(values(
    "mask", discs
));

smallCircle.animate(values("r", 50), 1000);

See the example in our Definitely Typed Java libraries project. Enjoy SVG!

markiewb's blog - September 12, 2016 07:51 PM
NB: How do I create an action which can be invoked by a macro?

Use @EditorActionRegistration!

@NbBundle.Messages({ "CTL_MyAction=Let's go", "macro-name=Let's go" })
@EditorActionRegistration(
	name = "macro-name", 
	mimeType = "text/x-java", 
	menuPath = "Source", menuPosition = 0, menuText = "#CTL_MyAction")
public class MyAction extends org.netbeans.editor.BaseAction {
 //...
}

Now your action can be invoked by a macro using its macroname (the name attribute in the @EditorActionRegistration-Annotation) and even recorded by the macro recorder.

[1] http://wiki.netbeans.org/DevFaqAddMacroableAction


APIDesign - Blogs - September 12, 2016 08:55 AM
Distribute Non-distributable

AutoUpdate is a fine NetBeans technology that can help you distribute things may see non-distributable. Here is a small demo that shows how one can fix broken NetBeans 8.1 installation.

--JaroslavTulach 08:55, 12 September 2016 (UTC)

Wade Chandler's Programming Blog - September 11, 2016 11:28 PM
"Run Focused Test Method" and "Debug Focused Test Method" for NetBeans Groovy Support in main and main-silver Hg Repositories

The ability to run or debug a single Groovy test from the IDE has now been merged into the main and main-silver Hg repositories for the NetBeans IDE. I assume this will work into main-golden and thus the nightly dev builds soon. I will post another update once that happens.

NetBeans – Michael's blog - September 11, 2016 09:04 PM
NetBeans Evening Cologne 2016

On Sept. 9th we joined for the first NetBeans Evening Cologne. Due to the fine weather some people preferred to have a party or something else and thus few seats (apx. 5) had been empty. Nevertheless, it became an interesting evening. New and Noteworthy First Geertjan Wielenga talked about NetBeans at a glance and the … Continue reading "NetBeans Evening Cologne 2016"

Geertjan's Blog - September 07, 2016 09:18 AM
Finegrained JShell Integration in NetBeans IDE

In addition to the generic JShell integration in NetBeans, discussed yesterday, there's more finegrained support enabling project-specific JShell snippets to be run. That means, depending on how you organize your life, no "build" will be needed anymore when you try out your code. Just hack a snippet together, run it in JShell, when/if it works, move it to your project.

Each project, whether Maven-based or Ant-based, will have an "Execute Java Shell" menu item, which is shown below. When that menu item is clicked, a new VM is created, which has access to the project's path, including project-specific JShell snippets, as discussed below.

Below you see a folder "nbproject/private/jshell-snippets", which contains JShell snippets that I know will be handy for experimenting with in the context of my project:

Also, note that there's a folder called "startup", within "jshell-snippets", above. Anything in there will be executed automatically when the project-specific JShell starts up. In the case of Maven, you'll set a property in your POM, "org.netbeans.jshell.snippetsRoot", which points to a folder in which your snippets, including the optional "startup" folder, are found:

<org.netbeans.jshell.snippetsRoot>src/jshell-snippets</org.netbeans.jshell.snippetsRoot>

Once the project-specific JShell has started either via a Maven project or an Ant project, there's a small drop-down that shows an item for each of the JShell snippets, which can be run by clicking on them:

Alternatively, you can do a Run/Debug project and then Run | Open Java Shell for Main Project, which connects to the VM where the project is run/debugged. The difference is the startup procedure. "Execute Java Shell" only starts the machine and waits for interaction from JShell, while "Open Java Shell" works with an existing process which starts as a regular application.

Adam Bien - September 07, 2016 07:20 AM
Building Integrated Messaging Solutions For Banks With Java EE Microservices

Grzegorz, please introduce yourself

My name is Grzegorz Huber and I'm a software developer at www.consdata.com. There are other titles that change depending on my current role in different projects, but I prefer the down-to-earth description instead.

What are you currently building?

We're building a mailbox application for one of the banks here in Poland. The idea is to give clients a better tooling for their needs to contact the bank whether it's a support question or a complaint. Obviously this also means integrating with internal bank mechanisms and now clients are receiving their bank statements in a much more convenient way. It probably sounds boring because we've all been using emails for years. However, designing your own messaging application turns out to be quite a challenge especially when everyone just keeps on saying just do it like Google does ;-). The domain is simple, yes, but the scale of the system make things much more challenging. Plus it's not only for messaging. We're currently integrating our mailbox application with some of our other products that add more functionalities like internet forms and automated workflow. Most of the features have already been implemented and I'm still in awe that our whole backend is under 20k lines of code. And people say Java makes your systems big.

After the Java EE Microservices workshop at MUC Airport in January you decided to refactor your current application towards pure Java EE Microservices. What is the progress?

Actually, It was a brand new application and we started in late February so the timing was perfect for us. The current progress is 10 microservices. I guess that's one way to describe our "advancement". Using other metrics we're currently in performance testing and getting closer to the production stage. That's for my current project. The side effect is a very small change within our organization that's about to take it's ripple effect to a whole new level.

How many microservices comprise your application / system?

Currently ten, but it was our first time and there were some disbelievers, who were skeptical at first, plus the learning curve so we definitely see there could be more closer to 15.

Which application servers, tools or IDEs are you using?

The most interesting is probably the Java EE part of the whole architecture where we decided to use Payara, Payara Micro, Embedded Payara for testing. Obviously is many ways inspired by the training in Munich. On top of that we developed our own installation platform based on Docker, which help us manage different parts of our application.

How big is your WAR?

It's between 3 and 8 MB. We're not super light, but we're very happy with the final result. Some compromises had to be made. For example we decided to use lombok, which adds almost 2MB to each war. Logback and its dependencies add another 700KB. Plus our db backends use mybatis, which adds almost 2MB as well. We like this strategy anyway... we try to keep these values in check and we consciously select what should be provided by the Jave EE container and what should be included with our application. I would like to be able to go with the javaee-api alone, but that's not possible ;-).

Here's the full report ;-)

3,7M lip 18 15:15 statics.war
7,0M lip 18 15:15 messages.war
8,0M lip 18 15:15 integration.war
7,0M lip 18 15:15 messages-sendmass.war
5,7M lip 18 15:15 users.war
3,4M lip 18 15:15 facade.war
5,5M lip 18 15:15 templates.war
3,8M lip 18 15:15 ecm.war
3,9M lip 18 15:15 crypto.war
3,6M lip 18 15:15 accounts.war

How fast is the build?

The whole microservice backend without tests is like 20-30 seconds. I normally don't divide build time with and without tests, but we did something here that should be mentioned. We write basic JUnit test cases in 3 layers... sort of. Layer one are basic junit tests based on mockito for simple business logic tests. Layer two includes real bean tests using CDI injection and everything that's possible within one microservice and using specialization beans that serve as mocks to other microservices. Layer three is the most expensive, but I think the pros are much more important than the disadvantage of extra added time. Our layer 3 test use the embedded Payara Micro, which takes the target wars and tests the real application stuff and including communication between microservices. We have Junit tests that use up to 6 microservice modules depending on the user story. I think that's one of the bigger challenges awaiting those who adopt this architecture so it was really handy to have Payara ready for that. The whole build, the one we use to build upon every commit for pull requests, takes up to 5 minutes at the moment.

Does "stock" Java EE fit well with the microservices idea?

Yep! It seems that it was designed this way and it's asking to be used this way. I really don't know why this approach wasn't picked up faster by developers around the world :).

You are using the porcupine as Bulkhead. Which problem does it solve?

Well, even though Glassfish (and Payara) have built-in monitoring it wasn't what we wanted it to be. Instead with a proper application design and splitting code across different microservices and different executors we were able to get our own dedicated monitoring service via REST plus other small things like named threads for each module. Additionally there's this feeling that you're in complete control over how different modules have different configurations for their own executor services. The added benefit of using Porcupine right away is that when you think about stuff like thread pools at the beginning of your application it's much easier to scale your system in the future.

Are you still happy with Boundary Control Entity?

I don't think we use that in the direct way. We definitely don't use technical names for organizing the core within our microservices and our approach is still based on the business responsibilities of the classes.

Any major challenges so far?

Apart from different approach to testing, which I think we tackled head on, the biggest challenge is probably some sort of microservice registry that's we're still missing in our project. Using Docker helps here a little bit, but when you get 10+ microservices and you really want to use them independently it's good to have something this figured out. One of the main reason why I came across your training was an idea to replace OSGi with something lighter. Microservices are indeed lighter, but you still have to manage them on your own. There are many solution that help with that, but I feel we need to be careful here, cause adding a registry is a good idea, but it can't become a single point of failure for us.

Any closing thoughts on Java EE and microservices?

It's nice to be able to design modules in such way that the main application operation is designed to work 24hrs per day and other heavy operation, which may bring instability to the system are in separate modules on different servers with different boundaries.

That's nearly impossible with a monolith and usually it's too late. In our case we had 9 microservices at one point and the 10th was brought to life when we realized that our core business logic is so fast and small that it runs smoothly on 1GB of RAM and the other module is doing this big batch operations and needs additional 6-8GB of RAM. It would be ill-advised to run them both together on a 8GB RAM system.

Business-wise both modules send messages. The microservice way of thinking let's you split code not only using domains but ever further when there are other benefits like performance and stability.

Is you company hiring Java (EE) developers?

Yes, checkout: kariera.consdata.pl/

Can you share any resources with us?

Here you can learn more about our software www.consdata.com. Feel free to contact me at ghuber@consdata.pl if you have any questions.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - September 07, 2016 03:42 AM
Learning Java with JShell in NetBeans IDE

Let's use JShell to learn about Paths and Files and Streams... here we go... this seems to work, since the Output window prints out the content of my file, which has two lines "hello" and "world":

Sweet documentation explains everything:


Next, let's put that useful code snippet to some use... i.e., we'll move it into a new Java source file in my application:

And there it is, all the verbosity/expressiveness of Java wrapped around our little snippet:

Hmmm. This will be pretty useful for anyone teaching and/or learning Java.

Wade Chandler's Programming Blog - September 07, 2016 03:41 AM
Adding "Run Focused Test Method" and "Debug Focused Test Method" to NetBeans Groovy Support

If you are a NetBeans and Groovy fan, then you have probably noticed over the years you can not execute nor debug an individual test method if using Groovy for testing. I have contributed to other parts of the IDE at various times, but hadn't looked into the Groovy support until recently. I finally had enough executing all tests in a file.

The code isn't necessarily difficult. For what I am adding it is slightly complicated due to NetBeans Groovy support module dependencies, and some things needing to be broken out a little differently. For now I am using reflection to access what I need, and that will work fine enough in the near term. Long term I plan to work with other community contributors to clean things up.

Another thing which makes coding this interesting is a mismatch between NetBeans notion of an offset into a source file and the Groovy ASTs notion of it. NetBeans uses a cursor or single integer value offset, and Groovy uses the notion of a line and column. So, some translation and AST traversal is needed to pinpoint the selected method. Standard editor things, but of note for this fix.

Too, the previous code halfway attempted to do this, but it seems some copy and paste happened between the Java and Groovy support as that code was using Java specific features which will not exactly work as Java is a subset of Groovy. The Groovy AST classes along with a little translation fixed it right up.

The changes should make their way into the code base soon. I have things working locally. I am now cleaning things up. I figure I will tackle other items which bother me about NetBeans Groovy support now that I am getting into it.

I will update once merged in, so check back.

Adam Bien - September 06, 2016 06:28 AM
React, Angular 2, Microservices, High Performance Java EE, Q & A -- Early Autumn Events, Conferences and JUGs

  • Mission Impossible: From HTML 5 to Native Applications, Workshop for Java EE developers, Rapperswil, Tuesday, 13th September. My goal is a (code) walk through the current JavaScript / HTML 5 / CSS eco system. This course is targeted to Java EE developers -- at least I will provide as many as possible relevant samples from the Java EE ecosystem to explain HTML 5 && Co.
  • Live Q&A streaming: October, 3rd, 6 pm CET: www.ustream.tv/channel/adambien Any questions left? Ask now: https://gist.github.com/AdamBien/e6e20c129e673ad558be495dd4f3afc4
  • Live Coding "No-Ceremony" Microservices, CON3436, September, 20th, 14:30, 15:30, JavaOne Conference, San Francisco. Last year I got too many questions and there was no time left for coding. This year I plan to code, build and deploy as many cycles as only possible. Docker, Java EE, Networking, Configuration & Co. topics included. I will answer the questions from the audience concurrently -- without any breakpoints.
  • Live streaming session, Internet Mobile World, "Building Backend Services -- Fast and Straight" imworld.ro
  • Live streaming session, High Load Conf, October, 15th, "Lightning Java EE -- What Is Possible With Stock Servers", hdconf.by
  • October, 19th, JUG Poznan session: "Microservices in 2016 — What Worked Well (this time completely without slides)". This session is about lessons learned and the most frequently asked questions about Microservices and Java EE. This time I plan to spend 99,99% of the time in the IDE. The more questions -- the better.
  • airhacks.com workshop: MUC airport, October, 24th Building React Apps. From setup, over build, to "hot deployment" with the JavaScript "Framework" react. After several React project I would like to present some "working practices".
  • airhacks.com workshop: MUC airport, October, 25th Building Angular 2 Apps. In this workshop I will focus on Angular 2 and will cover the typical project lifecycle - from setup over deployment. This workshop is similar to the "Building React Apps", but only covers Angular 2.

Coming this winter: 5 days Java EE Airhacks: from Bootstrap, over best practices, architectures, testing to microservices: http://workshops.adam-bien.com

Also checkout workshops on-demand: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - September 05, 2016 09:55 AM
Tip for JavaOne Speakers with NetBeans IDE

Quite a few speakers at JavaOne 2016 will be using NetBeans IDE for demos during their sessions. Excellent. Less excellent is the yelling that will befall you when your audience wants your font to be bigger.

So. BEFORE your session, make sure you're comfortable with the "Zoom Text" keyboard shortcuts, which are set as following by default:

Under pressure, I'm not so great with the mousewheel on my keyboard and so I have remapped the "Zoom Text" keyboard shortcuts as follows, i.e., to Ctrl+PAGE_UP and Ctrl+PAGE_DOWN. (These do override existing keyboard shortcuts, which I never use anyway, i.e., tabbing left and right, I think.)

That's much better and now I have full control over the font size in all the editors in NetBeans IDE via two handy keyboard shortcuts.

Geertjan's Blog - September 05, 2016 07:00 AM
"grunt clean" for Oracle JET

In your Oracle JET application, when you look in Gruntfile.js, you'll see "build" and "serve" are Grunt tasks that have been registered for you.

Let's add a new one, so that we can do "grunt clean":

grunt.registerTask("clean", (buildType) => {
  grunt.task.run([`oraclejet-clean:${buildType}`]);
});

Of course, "oraclejet-clean" does not exist, yet.

In "node_modules", go to "grunt-oraclejet". In "tasks", copy "build.js" and name it "clean.js".

Rename most references to "build" to be "clean" instead, which gives you this. The only changes I made are in bold:

'use strict';
const ojet = require('oraclejet-tooling');
const utils = require('./utils');

module.exports = function (grunt) {
  grunt.registerTask('oraclejet-clean', 'clean oraclejet application', (target) => {
    utils.logModuleName();    
    utils.validateFlags(grunt, grunt.option.flags());

    const done = grunt.task.current.async();
    const platform = utils.validatePlatform(grunt.option('platform'), grunt);
    const options = utils.validateBuildOptions(grunt.config('oraclejet-clean'), platform);
    const buildType = target || 'dev';
    options.buildType = buildType;
    options.buildConfig = grunt.option('build-config');
    options.theme = grunt.option('theme');
    options.sassCompile = grunt.option('sass');
    options.destination = _getDestination(grunt);
    ojet.clean(platform, options)
    .then(() => {
      done();
    })
    .catch((error) => grunt.log.error(error));
  });
};

function _getDestination(grunt) {
  let destination;
  if (grunt.option('emulator')) {
    destination = 'emulator';   
  } else if (grunt.option('device')) {
    destination = 'device';
  } else {
    destination = grunt.option('destination');
  }
  return destination;
}

The above could probably be a lot less, yes, cleaned up, quite a bit, most of those options not being needed in this context.

Also note in the above, take careful note of this:

ojet.clean

The above is the "clean" task, which exists though it hasn't been hooked up yet.

Again in "node_modules", go to "oraclejet-tooling". In the "lib" folder, notice that "clean.js" already exists. Now go one folder up into the root of "oraclejet-tooling", where you'll find "oraclejet-tooling.js". In there, include "clean" to the for each loop, as shown in bold below:

['config', 'build', 'serve', 'clean'].forEach(function(name)
{
  ojet[name] = require('./lib/' + name);
});

Now run "grunt clean" and, if the folder into which your app has been built, e.g., "web", exists, it will be emptied. The folder itself will remain, though its content will be deleted.

Adam Bien - September 05, 2016 05:33 AM
Java EE 8 Is Coming, Docker Hub, Configuration, AMQP, DTO Not Dead or 30th airhacks.tv

117 live attendees, 13+ questions, or the 30th airhacks.tv is available:

Any questions left? Ask now: https://gist.github.com/AdamBien/e6e20c129e673ad558be495dd4f3afc4.

The questions above are going to be answered during the next "Airhacks Q & A" http://airhacks.tv live. You can subscribe to the channel and / or for the next event: http://www.ustream.tv/channel/adambien (both is optional, no registration required to watch this event live).

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

Geertjan's Blog - September 04, 2016 12:10 PM
My JavaOne 2016

Here's where I'm speaking (in bold) some with others and some alone and what (I'm hoping) I'll definitely be attending (not in bold):

  • Sunday: NetBeans Day

  • Monday:
    • 8:30 a.m. - 10:30 a.m. | Rapid Development Tools for Java EE 8 [TUT1869] | Hilton - Continental Ballroom 6
    • 11:00 a.m. - 12:00 p.m. | Ten Essential Building Blocks of JavaScript in the Enterprise [CON6218] | Hilton - Plaza Room A
    • 1:30 p.m. - 3:30 p.m. Booth
    • 4:00 p.m. - 5:00 p.m. | How to Plug into NetBeans in 60 Minutes [CON5816] | Hilton - Continental Ballroom 7/8/9
    • 7:00 p.m. - 7:45 p.m. | Java 9 Module System Support in the NetBeans IDE [BOF4512] | Hilton—Continental Ballroom 6

  • Tuesday:
    • 11:00 p.m. - 12:00 p.m. | NetBeans RCP in Practice: An Ideal Platform for Scientific Computing [CON4439] | Hilton - Imperial Ballroom B
    • 12:30 p.m. - 1:30 p.m. | Strategies for Loose Coupling in Large Java Desktop Applications [CON6219] | Hilton - Imperial Ballroom B
    • 5:45 p.m. - 6:45 p.m. | Hands-on Lab: Learn the Basics of Oracle JavaScript Extension Toolkit [HOL5278] | Hotel Nikko - Nikko Ballroom III (3rd Floor)
    • 7:00 p.m. - 9:00 p.m. |  Enterprise JavaScript with Oracle JavaScript Extension Toolkit [HOL7764] | Hilton - Franciscan Room C/D

  • Wednesday:
    • 11:00 a.m. - 11:45 a.m. | Oracle JavaScript Extension Toolkit: Open Source and Ready for You [CON5257] | Moscone West - 2016
    • 13:00 a.m. - 14:00 a.m. | Depending on Vulnerable Libraries [CON6265] | Hilton - Golden Gate 2/3
    • 15:00 a.m. - 16:00 a.m. | Safe Architecture Migration and Enforcement with Jackpot and Annotation Processors [CON5859] | Hilton - Continental Ballroom 7/8/9
    • 16:30 a.m. - 17:30 p.m. | Ten Essential Building Blocks of JavaScript in the Enterprise [CON6218] | Hilton - Plaza Room A

Upating the above, it is not complete yet.

NetBeans – Michael's blog - September 03, 2016 11:46 AM
Update: NetBeans rocks JShell – Solution available

In my last post [1] I reported that Robert Field provided me a patch: As I suggested, JShell observes a file even if the editor had not been started from within the shell. My idea was to automatically switch into a wait mode when the editor had not been started from within the shell. Maybe … Continue reading "Update: NetBeans rocks JShell – Solution available"

DukeScript - September 02, 2016 11:46 PM
Role based UI with DukeScript

It’s a very common requirement to show or hide elements in a UI based on the users roles. Depending on the view technology this can be quite a challenge. The most convenient way to do this, is by declaratively marking the sections. With DukeScript it’s pretty simple. You can bind the visibility of an element to some property in the view model.

The problem is, that you need to introduce a lot of properties in your viewmodel. It would be much better, if you could simply add roles to a global user object and use this to control visibility:

<h2>Content</h2>
<div data-bind="authorize: 'admin'">
        <div id="vm1" >
            Totally secret stuff=<span data-bind="text: prop"></span>
        </div>
</div>
<div data-bind="authorize: 'reader'">
    <div data-bind="stopBinding: true">
        <div id="vm2" >
            Public=<span data-bind="text: prop"></span>
            <div data-bind="authorize: 'editor'">
                A bit less public=<span data-bind="text: prop2"></span>
            </div>
        </div>
    </div>
</div>

The user object can live in our root context and we can check if this user has the required roles:

@Model(className = "SecurityManager", targetId = "", properties = {
    @Property(name = "user", type = User.class)})
public final class SecurityBinding {

    @Model(className = "User",
            properties = {
                @Property(name = "name", type = String.class),
                @Property(name = "roles", type = String.class, array = true),
                @Property(name = "availableRoles", type = String.class, array = true)},
            targetId = "")
    public static class Uservmd {}
}

Now we need to create the “authorize”-binding. The tricky part is, that this needs to work in any binding context. If we bind several viewmodels to different parts of the page, each of them has their own root context. So we cannot rely on a common $root.

In this example I’m using document.getElementById(“security-manager”) to get hold of an element in the relevant root context. I get the User object from it and subscribe to changes in the users roles:

@JavaScriptBody(args = {}, body = "ko.bindingHandlers.authorize = {\n"
            + "    init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {\n"
            + "         var value = ko.unwrap(valueAccessor());\n"
            + "         var user = ko.contextFor(document.getElementById('security-manager')).$root.user();\n"
            + "         var roles = user.roles;\n"
            + "         if (roles().indexOf(value)==-1){\n"
            + "                 element.style.visibility='hidden';\n"
            + "             } else { element.style.visibility='visible'; }"
            + "         roles.subscribe(function(changes) {\n"
            + "             console.log('change in roles checking for role '+value);     "
            + "             if (roles().indexOf(value)==-1){\n"
            + "                 element.style.visibility='hidden';\n"
            + "             } else { element.style.visibility='visible'; }"
            + "         });\n"
            + "    },\n"
            + "};")
    public static native void init();

If the user has the right role, I show the element, otherwise it will be hidden. A pretty simple way to control access in a fine-grained way.

You can try it out yourself. I created a github project for you to play with:

https://github.com/dukescript/securitymanager