Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
[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)
Winston Prakash's Weblog (feed)
NetBeans – Michael's blog (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
NetBeans – NetBeans Ruminations (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)
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)
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:
January 18, 2017 03:07 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
NetBeans – Michael's blog - January 18, 2017 05:53 AM
JSF 2.3 Public Review

Since today the latest JSF spec is available for public review [1]. Take a look! [1] javaserverfaces.java.net/docs/2.3

NetBeans – Michael's blog - January 17, 2017 10:48 PM
Retrieve ViewScoped bean from session map

Since JSF 2.0 it is preferred to use CDI beans over JSF managed beans [1]. Different annotations are available to support different scopes, e.g. @RequestScope or @SessionScope. Sometimes you need to access such a bean from a piece of software where you don’t have direct access to the FacesContext. Lets assume, you run a different, […]

Adam Bien - January 17, 2017 04:56 AM
Importance of Java EE, JCP, Java EE Guardians and Microprofile--Interview With Reza Rahman

Reza, please introduce yourself

I am just a professional server-side Java developer, architect and consultant. I have been involved in the Java EE community for a long time (about 15 some years now). For folks interested, a long version of my bio is on my LinkedIn summary. For most readers here, it's probably significant that I am the former official Java EE evangelist at Oracle and a long time contributor to Java EE JSRs in the JCP. My humble blog is here. I also try to do something useful with my personal Twitter account. As a relatively frequent speaker, I try to share pragmatic Java EE code on my GitHub account.

Which application servers, tools or IDEs are you using?

Like most Java developers I use a wide variety of things including Java EE, Spring, WebSphere, WebLogic, JBoss, GlassFish/Payara, Tomcat, Spring Boot, Eclipse and NetBeans. My clear favorites these days are Java EE, WildFly, WebSphere Liberty and NetBeans. I think WildFly Swarm is a really cool project. I am a little sad to say I had been a long time fan of GlassFish and to a lesser extent I still am. I think TomEE has a lot of yet unmet potential and could be a significant player if the right things are done.

You are the chief Java EE Guardian. How big is the Java EE Guardians community? Who else is involved?

I don't think there is actually a chief Java EE Guardian (and I hope there will never be). From the very start the core folks involved have had a gentleman's agreement to remain a very egalitarian community where everyone is treated absolutely equally. We try our best to operate under open collective consensus based decisions. It is certainly fair to say I am a key Java EE Guardian responsible for bringing our community and concerns to the open. It is also equally fair to say the core Java EE Guardians started their most important work together far before I had anything to do with it.

I would say considering our age, the Java EE Guardian community is quite large. Our full list of supporters are always available on our web site. Without needlessly naming names, our support comes from fifty JUGs, about a dozen official Java Champions, forty some JUG leaders, many JCP members, bloggers, authors, speakers and educators. One name I think is fair to mention is James Gosling - the father of Java. Most importantly, many ordinary Java developers choose to support us. There are well over 3K signatures on our change.org petition to Oracle executives on Java EE. About 4K people follow us on Twitter. There are over 600 people subscribed to our Google Group account. There isn't a heavy Java EE vendor presence in our community. I think that's a good thing.

None of this means we do not still need more support. The broadest possible support will help us achieve our mission faster, more effectively and ensure that the results of our efforts last a very long time. We are a grassroots organization. Our only job is to serve the best interests of the Java EE community. The most important voice that matters for us is the ordinary Java developer, particularly people that see the need to keep vendors on the Java server-side accountable for their words and actions.

What is your opinion about the Microprofile?

I think MicroProfile is a very important and timely initiative. The issue is that it is very difficult to separate hype from reality in microservices. I already see a number of clients struggling under the weight of vendor driven microservices hype. I fear a lot of these projects are headed towards needless failure by buying into hype driven products too quickly. Java EE is facing the same issue. There is a very real danger Java EE may wind up prematurely standardizing many features that in the end will not stand the test of time in a few years. The MicroProfile is a great way for Java EE vendors to pseudo standardize microservices features and market those features into their products without risking polluting Java EE too much with a bunch of yet unproven ideas (or worse, outright bad ideas that happen to be trendy for a moment).

MicroProfile also serves as an important reminder to Oracle that it does not have a monopoly on standardization in server-side Java. If it fails to be a good steward for Java EE, an alternate standard can and will be naturally formed.

Lastly, MicroProfile is a good antidote to some of the deliberately designed Java EE bashing some vendors engage in (I think we all know who these vendors and individuals are). They know fully well that Java EE tries to do the right thing by avoiding hype-driven features. They take advantage of this principled and disciplined standardization approach by continually claiming Java EE is "not relevant" because it does not immediately jump on the hype of the day. Things like MicroProfile are great because it allows vendors that embrace Java EE to still take part in the hype bandwagon in their products without destroying one of the core value propositions of standards as a critical insulator against vendor hype.

My only current concern with MicroProfile is the potentially needless duplication of effort with what Oracle has announced for an accelerated Java EE 9. I hope the people involved with MicroProfile are keeping a cool head and properly negotiating and collaborating with Oracle, even if it is behind the scenes. Whether we like it or not, any standardization effort without a major vendor like Oracle is weaker, not stronger. It is also a Herculean and perhaps Quixotic task to try to re-create the JCP. Given an opportunity, I know Oracle has the resources to do the right thing for it's business and the community. Like anywhere else, there are plenty of idiots at Oracle. The way to make sure the idiots are not too empowered is by working with the right people still inside Oracle.

Why Java EE is important?

Java EE is so important it is very difficult to explain its full significance in the span of a single interview. As soon as time allows I plan to blog about this very topic soon. The topic is timely because it is very poorly understood by most developers and that's very dangerous, especially with certain vendors taking a deliberately anti-Java EE stance to advance their own proprietary business agendas - especially on the cloud.

The most obvious critical function for Java EE is that it is the only open standard we have for server-side Java. That's been the case for a very long time and hopefully will remain the case for many more years. Without Java EE you have two very bad possibilities - one far worse than the other. The lesser of the two evils is a bunch of competitors that don't really collaborate and have basically incompatible products. In such a scenario developers are basically locked into a given vendor. If that vendor turns out to be the wrong choice for any reason you have to pay a very high cost of porting all the APIs your application uses. By far the most terrible situation is that the entire server-side Java ecosystem is left to the mercy of a single monopoly vendor with no viable competition. All this is even worse on the cloud since you are locked in not just at the API level but also at the infrastructure level.

By contrast what Java EE enables is a set of uniform APIs that are shared across vendors and implementations. Vendors can effectively compete on implementations, quality of service, price and extensions. Developers are far freer to choose between vendors at will. This is the model that has enabled a robust server-side Java ecosystem for a long time. Developers should be genuinely frightened of what will happen to Java without an important competitive safeguard like Java EE in place.

What is your opinion about JCP?

I have worked inside the JCP for a very long time and honestly have only good things to say about it. I felt I had a real impact, people that really care collaborate openly on the expert groups and the rules that govern the JCP makes sure everything happens in an open, transparent way. This is in sharp contrast to open source projects I have seen. Such projects are open in name but in reality are completely controlled by a small set of committers (often even just a single dictatorial committer). By far the biggest problem with the JCP that I have seen is that not enough developers take the time to participate or care.

That is not by any means to say that the JCP is perfect (let's face it - nothing in real life is). Oracle definitely needs to open up more and relinquish more control of the JCP and Java. Participating in the JCP and implementing Java standards needs to be easier. The only way any of this will happen is by participating and working with Oracle. Having a more open and vendor neutral Java is in the interest of every developer. It is worth the effort and worth trying.

Oracle announced at JavaOne releases of Java EE 8 and Java EE 9 for the next two years. Did the announcement surprised you?

The fact that Oracle would be forced to recommit to Java EE does not surprise me at all. The underlying long-term fundamental financial factors really made what Oracle had been doing for a few months quite mindless. It is the result of the over-empowered idiots at Oracle that I alluded to earlier. Hopefully these people have now learned their lesson and the right people inside Oracle have been empowered to do the right thing for the community and Oracle's business.

What surprised me is the speed at which we were able to get Oracle to recommit. The problem with idiots is that it is hard to get them to admit they were wrong. It is possible these people were side-lined when decisions at Oracle were corrected once the right people with adequate authority figured out what was going on.

How Java EE 8 is doing? What is the progress?

At the moment Java EE 8 is looking quite good. Although we have not yet formally updated our public tracking data, anecdotally it looks like there is a significant up-tick in overall activity from Oracle. It may even be possible Java EE 8 will be delivered sooner than Oracle has promised. I think this is the right point to forgive Oracle's past mistakes and refocus on what they are doing right and can do right as the Java steward. That does not mean of course that we do not keep our ears and eyes open.

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

The best thing developers can do is stay tuned to the Java EE Guardian Twitter account and Google Group. Those are our main open coordination mechanisms. We need everyone's help to keep moving Java EE forward. No support is too big or too small. As we have shown already, the grassroots community working together can achieve remarkable things vendors can't even begin to imagine. Together humble server-side Java developers can ensure their interests are preserved above all.

Reza, thank you for the interview!

Real World Java EE Workshops [Airport Munich]>

Adam Bien - January 16, 2017 06:07 AM
Java 8 Base64 Encoding / Decoding

Java 8 comes with the Base64 class which supports Base64 encoding / decoding out-of-the-box:

import java.util.Base64;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;

public class Base64Test {

    public void encodeAndDecode() {
        final String rawString = "duke";
        Base64.Encoder encoder = Base64.getEncoder();
        byte[] encodedContent = encoder.encode(rawString.getBytes());

        Base64.Decoder decoder = Base64.getDecoder();
        byte[] decodedContent = decoder.decode(encodedContent);

        String decodedString = new String(decodedContent);
        assertThat(decodedString, is(rawString));

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 - January 15, 2017 09:48 PM
Publication page updated

I updated the list of my publications [1]. I’ve been astonished, how much articles I wrote beside the articles of this blog during the last few years. Most articles dealing about software development. Some of them describing NetBeans or dedicated features of this great IDE. I hope, I could provide a lot of useful information […]

Adam Bien - January 15, 2017 02:39 PM
Java 8 partitioningBy Example

A developer has a favorite programming language:

public class Developer {

    private int age;
    private String favoriteLanguage;

    public Developer(int age, String favoriteLanguage) {
        this.age = age;
        this.favoriteLanguage = favoriteLanguage;

    public int getAge() {
        return age;

    public String getFavoriteLanguage() {
        return favoriteLanguage;

    public String toString() {
        return "Developer{" + "age=" + age + ", favoriteLanguage=" + favoriteLanguage + '}';

A team has more than one developers. Now we would like to know which programming languages are used by developers younger than 30. Collectors#partitioningBy expects a Predicate (filter) which "partitions" all developers into two buckets identified by a "boolean":

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.junit.Test;

public class PartitioningByTest {

    public void partitionByAge() {

        List<Developer> team = Arrays.asList(
                new Developer(18, "java"),
                new Developer(20, "java"),
                new Developer(35, "javascript"),
                new Developer(50, "javascript"),
                new Developer(50, "logo"));

        Map<Boolean, List<Developer>> youngerThan30 = team.
                collect(Collectors.partitioningBy(d -> d.getAge() < 30));
        System.out.println("Developers younger than thirty are using: " + youngerThan30.get(true).stream().
		map(d -> d.getFavoriteLanguage()).
        //Output: Developers younger than thirty are using: [java]
        System.out.println("Developers older than thirty are using: " + youngerThan30.get(false).stream().
		map(d -> d.getFavoriteLanguage()).
        //Output: Developers older than thirty are using: [logo, javascript]

Related: Java 8 CompletableFuture Example

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 14, 2017 07:33 AM
Java 8 groupingBy Example

A developer has a favorite programming language:

public class Developer {

    private int age;
    private String favoriteLanguage;

    public Developer(int age, String favoriteLanguage) {
        this.age = age;
        this.favoriteLanguage = favoriteLanguage;

    public int getAge() {
        return age;

    public String getFavoriteLanguage() {
        return favoriteLanguage;

    public String toString() {
        return "Developer{" + "age=" + age + ", favoriteLanguage=" + favoriteLanguage + '}';

A team has more than one developers. Now we would like to group the developers by their favorite language. Collectors#groupingBy groups classes by properties out-of-the-box:

public class GroupingByTest {

    public void groupByFavoriteLanguage() {

        List<Developer> team = Arrays.asList(
                new Developer(18, "java"),
                new Developer(20, "java"),
                new Developer(35, "javascript"),
                new Developer(50, "javascript"),
                new Developer(50, "logo"));

        Map<String, List<Developer>> developersByLanguages = team.

		/* output:
            {java=[Developer{age=18, favoriteLanguage=java}, Developer{age=20, favoriteLanguage=java}], 
            logo=[Developer{age=50, favoriteLanguage=logo}], 
            javascript=[Developer{age=35, favoriteLanguage=javascript}, Developer{age=50, favoriteLanguage=javascript}]

        Map<String, Double> favoriteLanguageByAverageAge = team.
		/* output:
    		{java=19.0, logo=50.0, javascript=42.5}

Related: Java 8 CompletableFuture Example

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 12, 2017 05:32 AM
Java Is #1 In January 2017

Java is #1 (17.278%, -4.19%), C is #2 (9.349%, -6.69%) and Go jumps from #54 to #13 (2.325%, +2.16%). [Source: TIOBE Index for January]

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 11, 2017 08:56 AM
Spring Boot vs. Wordpress, SOAP Rocks, CDI CMT, Reactive vs. Blocking IO, or 34th airhacks.tv is available

The 1.2017 airhacks.tv was the most popular ever. 212 live viewers attended the 34th airhacks.tv with 20+ topics covered:

Still not everything crystal clear? Start asking now: https://gist.github.com/AdamBien/4791c4a5e8f06b0b8772ab6df6772001

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 - January 10, 2017 01:25 PM
New Year: New Opportunities, New Rewards!

In Dutch they say, "Nieuwe kansen, nieuwe prijzen", at the start of the latest installment of a game show, lottery, etc. Well, each new year offers new opportunities, with new rewards, and here we are in 2017.

I haven't blogged for a while, simply because I've been too busy to do so. Oracle JET is taking up all my time. I've traveled a lot over the past months and that will continue, the first half of the year is almost completely booked full already. At the same time, there's NetBeans IDE or, should I say, "Apache NetBeans (incubating)", which is moving along really well. By that I mean everything in every sense, in that context, from the Apache process, to its continued development by Oracle engineers focused on supporting Java 9, to my continual promotion of it via demonstrations of how to use Oracle JET, to all kinds of dependencies that multiple large organizations have both on NetBeans as a development tool, tooling platform, and application framework.

Oracle JET

I must confess I'm really excited about Oracle JET, for being an open source, free, and library-based JavaScript toolkit. And, no, I'm not excited about just about everything in the world (you could not, for example, get me to promote vacuum cleaners; then again, on the other hand, if it were to be a really effective vacuum cleaner that was simply awesome and somehow open source, ok, well, never mind, I'd promote your open source vacuum cleaner and probably even for free) or even everything that my employer wants me to be excited about, i.e., there are enough things my employer has suggested I promote that I feel really lukewarm about and that didn't excite me enough to spend time understanding and promoting, simply because of not completely connecting to my areas of interest, etc.

That's also something that's underhighlighted about Oracle as a whole—it is simply such a massive ecosystem of products that once you're connected to a part of it, you really do have a lifetime's worth of interesting work ahead of you. Oracle provides a lot of opportunity for learning and meaningfulness in that sense.

Java Desktop

So. Where does that leave my erstwhile enthusiasm for the Java desktop? Now that I'm a fullblown JavaScript enthusiast, spreading the gospel of browser-oriented development, have I simply dumped my many years of advocacy of the Java desktop?

No, not at all. What I have done over the years is very simple and easy to understand—I have advocated tools and technologies for industrial application development. As opposed to what? Well, as opposed to game development, for example, which I've always considered a bit, well, trivial. I've always found it most interesting to focus on development that means something real, that makes a difference, whatever those phrases mean, as opposed to those that simply seek to entertain or that do little more than help fill time, though I don't want to necessarily pass moral judgement here either, since a lot of really skilled and artistic work is done in those areas, of course, at the same time. In general, I definitely prefer the complexities of solving problems for applications targeted for the back office, or behind the firewall, or in secure areas, over those targeted at non-technical end users.

What does that mean, concretely, in terms of what I find meaningful, i.e., industrial application development? I have, and continue to do so, promoted the open source tools and technologies that, in my humble opinion, make sense when you're creating large enterprise solutions. Are you creating large applications in the areas of finance, human resources, logistics, and the like? Well, then, moving your data to "the Cloud" and your user interface to the browser, whether on mobile or desktop, makes perfect sense. (And the Oracle Cloud is truly comprehensive and stable, with a large ecosystem of knowledgeable experts and enthusiastic partners to help you. I know this, since I have interacted with many of them directly and personally over the past months.) Are you, on the other hand, creating large applications in the areas of bioinformatics, aerospace, and defense, where you want to make maximum use of desktop resources and graphic visualization and you have a lot of in-house Java desktop experience while the volatility of the JavaScript ecosystem is a real blocker for migration to the browser? Well, great, in that case, the Java desktop is perfect and you clearly need a lot more than Java toolkits such as JavaFX or Java Swing—you also need an application framework, module system, windowing/docking framework, and so on. In fact, you need the NetBeans Platform.

Wait, am I saying that there's a place for both JavaScript and Java, for both browser and desktop? Yes, of course there is—"the right tool for the right job" is simply the best approach to anything. Therefore, my argument is that you shouldn't be "religious" about your choices, of course...


...except for your tools. :-) Ultimately, you need a comprehensive and stable development environment to create your applications, regardless of where they are to be deployed. The best thing to do is to use open source tools and technologies, uniquely provided by NetBeans IDE, which is in the process of becoming an Apache project, which means that you can participate in its development process and roadmap far more than any other development tool in the history of development tools.

Hurray, 2017 is going to be great and is filled with opportunities that all make sense and all have a logical place in unlocking data and turning it into actionable information that makes a real difference in people's lives. 

Adam Bien - January 10, 2017 09:34 AM
2017 Predictions

My 2017 predictions:

  1. Back to insourcing: If you are pragmatic, software development is easier than ever. The only challenge is the deep understanding of the domain concepts and requirements (=the product thinking). Companies starting to realize that if they outsource their core expertise, nothing remains left. They become a "gray mass" indistinguishable from their competition. I'm also expecting increased investments in internal teams.
  2. Java is fast, productive, mature and extremely popular. Therefore the year 2017 is going to be full of "Bashing On Java" articles like e.g. "Oracle finally targets Java non-payers" Writing negative articles about Java draws lot of attention and so traffic. Publishers are under pressure -- writing blog posts, articles and content targeted against the Java programming language increases traffic and is good for business.
  3. I expect to see the first failures of microservice projects accompanied by some negative press. There are many projects out there with trivial business logic deployed on an unnecessary high amount of independent deployment units.
  4. I would expect some backlash against Fat WARs, Ueber JARs etc. I don't see any benefits, just disadvantages. Mixing a big amount of barely changing dependencies at each build, with tiny amount of frequently changing business logic sounds like Cargo Cult to me.
  5. Finally the microservice movement increased the need for monitoring. I expect the first "data overflow exceptions". I observe the tendency to gather all possible metrics without thinking about their meaning. It reminds me of past projects which generated gigabytes of logs with only a little amount of contained information.
  6. Demise of JavaScript frameworks: JavaScript and HTML 5 standards are become more and more powerful. You can achieve a lot without any external dependencies. One could say: JavaScript development becomes more and more similar to Java EE.
  7. Projects become more pragmatic with more focus on users and less on fancy, but optional frameworks. "Brick and mortar" companies are going to recognize, that they requirements and scale differ from Netfix, Twitter, Facebook and Co. What works great for Netflix, might be an overhead for a regional company.
  8. JDK 9 is scheduled to 23rd March 2017. Particularly "senior" developers and architects are going to get really excited about Jigsaw. This will lead to proliferation of unnecessary modules. On the other hand Java 9 becomes even more interesting for microservice deployments.
  9. Companies will start to recognize, that Angular 2 is more similar to React, than to Angular 1.
  10. "Inclouding" :-) Hardware becomes less and less expensive and cloud management software becomes also available on premise. I'm expecting a slow trend towards private clouds.
  11. Java EE projects become more pragmatic. Already in 2016 it was relatively easy for me to let projects delete unnecessary patterns, indirections and modules. There are no arguments left against "Thin WARs", fast deployments, no setup and focus on the actual requirements
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 09, 2017 07:51 AM
Java EE vs. Spring, State of Microprofile, Is SOAP nice? Oracle targets non-payers or the topics for the 1.2017 / 34th airhacks.tv

In the first edition in 2017 (or 34th episode, 9th January, 2017, at 6pm CET) of airhacks.tv we (=me + chat) will cover the following questions:

  1. The state of microprofile.io
  2. Motivation for StatusTest
  3. Java EE -- feedback from JUGs
  4. Micro, Swarms and co. the possible killer use case.
  5. SPA and JAX-RS. One or multiple projects?
  6. Files filtering and Java FX
  7. REST architecture in 5 mins
  8. Should we keep SOAP?
  9. Personal opinions on article: "Oracle finally targets Java non-payers"
  10. CDI with transactions
  11. When should we start to worry about performance?
  12. How we can communicate multiple microservices without share their DTO's?
  13. A lean way to inject properties with Java EE.
  14. Java EE vs. Spring
  15. Is it possible to put HTML5 application after the .war has been compiled?
  16. Future of NetBeans
  17. Non blocking IO vs. JDBC, Java EE and scalability
  18. How to connect SPAs with backend efficiently
  19. Java EE vs. Spring Cloud -- how to deal with non functional requirements
  20. Can we start threads in a @Singleton?

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 - January 08, 2017 09:45 AM
My Blog is a Personal Notepad

In the second post of this blog "Why blogging?" eleven years ago I was not sure about the whole point of blogging. After 11 years, my blog became a personal reference ( archive.adam-bien.com ) and notepad which I frequently use in my consulting / development / client work. I capture code snippets, ideas and sometimes expose my personal opinion and I'm curious about reader's feedback.

Probably caused by the popularity of Java EE, I get frequent (nearly weekly) proposals for guest articles intended to be published on this blog. I did not accepted any guest content so far -- and I don't plan to accept any guest articles work in future either.

However: if you are involved in an interesting, thin WARs (=productive, minimalistic, pragmatic) Java EE 6/7 projects or products, drop me a comment or tweet ( @AdamBien ). I would like to interview you.

Any questions left? See you at the next 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 - January 04, 2017 03:44 AM
My GeeCONPrague Keynote is Online!

My GeeCONPrague keynote is available online. Watch my metamorphosis yourself:

Once you survive it and get to 5th minute, you'll also see interesting demos showing how fast the GraalVM and Truffle can be. Thanks again GeeCON guys for giving me a chance to speak at your keynote.

--JaroslavTulach 03:44, 4 January 2017 (UTC)

NetBeans – Michael's blog - December 30, 2016 06:54 AM
JavaLand Castle

Mystery Castle is part of the theme park Phantasialand. In March, Phantasialand becomes JavaLand [1]. The photo shows the tower of this castle during sunset of December. I’ll talk about the upcoming Java Shell and show its integration within NetBeans on March, 29th. Visit my talk at high noon in room Quantum 3+4. [1] javaland.eu

Adam Bien - December 28, 2016 06:29 AM
Java 8: Converting An Array To A Stream

The Java 8 Arrays class allows a convenient conversion between an array and a Stream:

import java.util.Arrays;
import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;

public class ArraysToStreamTest {

    public void arraysToStream() {
        String languages[] = {"java", "javascript"};
        Stream<String> stream = Arrays.stream(languages);

        long count = stream.filter(l -> l.endsWith("va")).count();
        assertThat(count, is(1l));


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 - December 27, 2016 06:20 PM
Java Shell plugins for NetBeans 8.2

A few days before, I reported about the Java Shell which is integrated within the NetBeans nightly builds [1]. There is another project, called prototypes-repl9 [2] which is compiled only once or twice a month. Until today, I only downloaded some full zip versions of this project. This seemed to be less stable and less […]

NetBeans – Michael's blog - December 25, 2016 06:12 PM
Visitor II

I assume this had been a bumblebee, too. But it was a really large insect. At least 3 centimeters. Maybe a queen? Taking a macro photo, you have a restricted depth of sharpness. Beside its proboscis, I got the front legs really sharp. And I discovered hooks I can not see with the naked eye. […]

Adam Bien - December 23, 2016 08:03 AM
Scalable, Productive, Decoupled, Resilient and Hacky New 2017!

This holiday greetings could be scaled independently, implemented by two independent teams, deployed on different servers running on separate machines:

2016 was great. Thanks for following, commenting, watching airhacks.tv Q & A, attending airhacks.com and all the interactions on twitter: @AdamBien and github.com/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 - December 21, 2016 08:16 PM
NetBeans and the Java Shell – by Michael Simons

I just discovered another  article about the NetBeans Java Shell. NetBeans Dream Team member Michael Simons prepared a screencast showing the Java Shell [1]. For a series of screenshots take a look into my prior blog. [1] info.michael-simons.eu/2016/12/19/using-jshell-in-netbeans

NetBeans – Michael's blog - December 20, 2016 09:29 PM
NetBeans and the Java Shell

Some weeks ago, NetBeans 8.2 had been released. Currently a patch version is available.  Although NetBeans has moved to Apache, it is still developed by the NetBeans team and a vibrant community. So, let’s look at a great feature of the future version: The Java Shell. Today I’m not talking about the command line tool […]

Adam Bien - December 20, 2016 08:41 AM
How To Maximize Fun In Enterprise Projects

Unfortunately we reached the point of low noise, high productivity. Now you could fully focus on domain logic and start implementing client's use cases with the very first line of code. Sounds good, but is really boring.

These rules make your daily developer live more exciting:

  1. Forget for a moment the nonfunctional requirements and the users. Focus on infrastructure.
  2. Wisely assume your in-house application has similar nonfunctional requirements as Netflix, Twitter, Facebook or Google have. One day you will surely achieve their scale.
  3. Justified by 2. ignore existing Java 8 and Java EE functionality. Use third party libraries and frameworks on top of existing functionality.
  4. Start with implementing infrastructural frameworks first. Implementing logging, configuration, asynchronous communication, caching and discovery frameworks is a good place to start.
  5. Fat WARs are recognized as common microservice best practice. Don't stop adding external dependencies until the size of the WAR reaches at least 20 MB. Anything below that size does not look serious.
  6. Write reflection test utilities to maximize code coverage. Now you can easily achieve > 50% code coverage without writing a single assert.
  7. Complain about high complexity, defects, slow deployments and bloat.
  8. Suggest to start over with node.js, but follow the rules. Start with 1.
See you at Java EE Workshops at MUC Airport, particularly at the Java EE Architectures workshop
Real World Java EE Workshops [Airport Munich]>

Adam Bien - December 18, 2016 08:07 AM
URL Templates With JAX-RS

JAX-RS WebTarget comes with template mechanism to substitute placeholders in URIs:

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;

public class JAXRSTemplates {

    private Client client;
    private WebTarget tut;

    public void initClient() {
        this.client = ClientBuilder.newClient();
        this.tut = this.client.target("https://en.wikipedia.org/wiki/{keyword}");

    public void contentContainsKeyword() {
        String keyword = "Java";
        String content = this.tut.resolveTemplate("keyword", keyword).
        assertThat(content, containsString(keyword));

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 - December 16, 2016 09:39 PM
Custom Component for Zipping and Downloading Files

Here's a handy custom component (i.e., a CCA component) for zipping files and downloading them, in an Oracle JET application:


I've created it as part of a project where we want to let developers design a CCA component and then download it as a ZIP file, so that it can be distributed to those who want to make use of the component. That's the reason you can see above that two files are assumed to be provided, with 'file' being the name of the file, used for both the view and the viewModel.

In an application, the above component is rendered as follows:

What happens when "demo" is changed to "sample" in the text field above and then the "Download" button is clicked? Well, when you do that, a download process begins and you'll have a ZIP file, with this content, yes!, a CCA component:

So... what this blog entry is about is... how to create a CCA component for downloading CCA components... 

The structure of the CCA component you'll create is as follows:

Here's the JSON file, "fileDownloadForm.json":

  "properties": {
    "file": {
      "description": "file name.",
      "type": "string"
    "content1": {
      "description": "html content.",
      "type": "string"
    "content2": {
      "description": "js content.",
      "type": "string"

Here's the view, in "fileDownloadForm.html":

<div class="oj-panel">
    <label>ZIP Name:</label>
    <input  type="text"
            data-bind="ojComponent: {
                component: 'ojInputText',
                value: file}"/>
    <button class="oj-button-primary"
            style="float: right;"
                click: downloadFile,
                ojComponent: { 
                        component: 'ojButton', 
                        label: 'Download' }">

Here's the business logic in the viewModel, "fileDownloadForm.js":

define(['knockout', 'jszip', 'file-saver'],
    function (ko, JSZip) {
        function model(context) {
            var self = this;
            self.file = null;
            self.content1 = null;
            self.content2 = null;
            context.props.then(function (properties) {
                if (properties.file) {
                    self.file = properties.file;
                if (properties.content1) {
                    self.content1 = properties.content1;
                if (properties.content2) {
                    self.content2 = properties.content2;
            self.downloadFile = function (model, event) {
                if (event.type === 'click' || 
                        (event.type === 'keypress' 
                        && event.keyCode === 13)) {
                    var zip = new JSZip();
                    zip.file(self.file+".html", self.content1);
                    zip.file(self.file+".js", self.content2);
                    zip.file("loader.js", "to be done");
                    zip.file("README.txt", "to be done");
                    zip.generateAsync({type: "blob"})
                            .then(function (content) {
                                saveAs(content, self.file+".zip");
        return model;

The above assumes you've set up these two libraries in your application:

I.e., somehow, via Bower or otherwise, you've included them like this:

In 'main.js', you should have these references in the 'paths' of 'requirejs.config':

   'file-saver': 'libs/file-saver/FileSaver',
   'jszip': 'libs/jszip/dist/jszip'

And, to wrap things up, tying everything together, you have "loader.js":

  function(oj, view, viewModel, metadata) {
    oj.Composite.register('fileDownloadForm', {
      view: {inline: view},
      viewModel: {inline: viewModel},
      metadata: {inline: JSON.parse(metadata)}

As a simple example of usage of the above, include the following in the "viewModel" of the handy custom component outlined at the start of this blog entry:

self.htmlContent=ko.observable('dummy html content');
self.jsContent=ko.observable('dummy javascript content');

Now, whenever you include the handy custom component, anywhere in your application, the user can click "Download" and then they'll have a ZIP file downloaded with the specified content in the specified files.

NetBeans – Michael's blog - December 15, 2016 06:15 PM
Neither Eclipse…

…nor NetBeans. Just the moon. I took this photo during the one hour I could observe the moon yesterday. A few minutes later, it disappeared behind clouds and I started to check the Java Shell within NetBeans. I like to share some photos on an irregular basis. So, if you enjoy almost natural photos, please […]

Adam Bien - December 14, 2016 05:01 AM
GlassFish on Steroids, Micro, Full, Clouds and Commercial Support--An Interview With Dominika Tasarz

Dominika, please introduce yourself

I’m Dominika Tasarz and I’m a Community Builder and a Head of Marketing at Payara Services Ltd, the creators of Payara Server and Payara Micro. You can find me on Twitter twitter.com/Dominislawa and LinkedIn www.linkedin.com/in/dominikatasarz

What is your daily job at Payara?

I’m responsible for Payara’s marketing and communication strategy and a big part of my role is managing our involvement in the Payara users’ community. Basically, I’m behind most of the external communication from Payara. Everything you see on the website, in the emails, official announcements, on Twitter etc. - I probably had something to do with it ☺ . I also work very close with our Engineering and Development teams to deliver technical content, most of it published on the Payara Blog, in our user guides, data sheets and external publications. I organise Payara’s involvement in various conferences, online webinars, user groups etc., so those of you who know me probably met me at one of those events.

What is Payara and Payara Server?

Payara Server is an open source application server derived from GlassFish Server Open Source Edition. It is developed by Payara Services Ltd and released quarterly with bug fixes, hot fixes, enhancements and patches. In addition to the continuous development of its application server, Payara provides dedicated 24/7 production and developer support for Payara Server. Payara Server was developed in response to Oracle’s announcement to discontinue GlassFish support. Initially, we wanted to help by just offering support for GlassFish Open Source Edition, but we quickly noticed that it won’t be enough so we decided to create our own version with regular releases, bug fixes and patches – that’s how Payara Server (and later Payara Micro) came into existence. Both application servers are open source and are free to use for production, development and testing under the standard CDDL license.

To me, the best way to describe Payara Server is ‘GlassFish on steroids’ – everything you wanted to fix in or add to GlassFish – it’s probably already in Payara Server, and if it’s not – let us know on GitHub github.com/payara/Payara/issues and we’ll add/fix it!

Payara Server is not just a drop-in replacement for GlassFish though – it is much more than that! You don’t have to be a GlassFish user (past or present) to benefit from using Payara Server. Payara Server is a powerful and easy to use open source app server, perfect for running your Java EE apps both in production and development; with many enterprise-level features, frequent releases, vibrant community, easy licensing model and support options available. And we’re constantly working on developing and improving it even further - our vision is to optimise Payara Server to make it the best application server for production Java EE applications; with responsive 24/7 dedicated incident and software support delivered by the best middleware engineers in the industry.

Tell me more about Payara's commercial offerings. Why is it worth to give your money? :-)

On top of the Payara Server open source user’s benefits, such as regular quarterly releases, GitHub Issues support and unlimited deployment options, those who buy the subscription can benefit from 24/7 support services including phone, web, email & screen sharing support, as well as hot fixes, security fixes and monthly patched releases.

So, if you’re running GlassFish in your production or development environment and are worried about the lack of support from Oracle, infrequent application server releases, lack of bug fixes and patches - you must try Payara Server. Just a little warning - you will never want to go back to GlassFish after that! You can choose from three different levels of support (Basic, Professional and Enterprise) depending on how you want us to respond to your tickets, and the subscription price varies depending on the size of your environment. More info can be found on www.payara.fish/support

How Payara is doing? Can you name some of your customers?

Payara is doing very well – we’ve grown significantly in the last 12 months and the predictions for 2017 are looking good too. We’re currently expanding our technical team (see our careers page http://www.payara.fish/careers ) to deliver even more cool new features in Payara Server and Payara Micro next year. We’re also working on a couple of projects which will definitely benefit our current and future support customers – I can’t say too much right now but watch this space!

It’s very important to mention that we wouldn’t be here without our users’ community, especially Payara Support Customers, whose subscriptions fund development and engineering effort of the Payara Server open source project - we would not be able to make the continuous improvements to Payara Server without their help. Some of our biggest customers include BMW Group, Papa John’s Pizza, Siemens and UC Davis, all running Payara Server in production with our support.

What are the unique Payara features?

Payara has a lot of unique features, especially in comparison to GlassFish. We created a nice Payara Server vs Glassfish comparison table if you want to see the details: info.payara.fish/payara-server-glassfish-comparison I think the key features to highlight would be the production enhancements such as Slow SQL Logging and Healthcheck Service blog.payara.fish/new-features-for-ops-teams-in-payara-server There are also some cool developer features like Asadmin Command Recorder blog.payara.fish/asadmin-recorder-new-payara-server-feature-demo or the Request Tracing Service payara.gitbooks.io/payara-server/content/documentation/extended-documentation/request-tracing-service/request-tracing-service.html .

JCache integration is also worth mentioning, as it allows for a huge flexibility when architecting topologies for High Availability and Scalability. Utilising the embedded Hazelcast Data Grid for web session and JCache clustering brings the potential of many different topologies for scale out blog.payara.fish/flexible-ha-and-scalability-architectures-with-payara-server . There are Docker images available, both for Payara Server and Payara Micro ( blog.payara.fish/payara-docker-images-162-release-update ). And if you like playing around with Raspberry Pi, you can try to build a Piyara – check out Steve Millidge’s demo to find out how http://blog.payara.fish/piyara-payara-micro-on-raspberry-pi-demo .

On top of the many unique technical features, in comparison to other application servers, Payara Server gives you the biggest flexibility in regards to moving from development environment into production. Licensing is extremely straightforward, allowing you to stay on the same software version for testing/development and production without paying anything extra or migrating onto the ‘enterprise’ version. With Payara Server you can swiftly move into production whenever you’re ready and at any point in the process you can contact us to arrange for a support subscription. It’s much easier than using other app servers such as WildFly (which requires you to move to JBoss EAP for production use) or WebLogic (which is not open source and a lot of organisations can’t afford the license fees).

How many GlassFish bugs have you already patched?

Our number one priority for every release is bug fixing. In total, running a search on our JIRA instance, we have fixed more than 250 bugs since we started the Payara project. Many of these bugs will be in upstream GlassFish. Also, there will be many, many more bugs fixed by incorporating the latest versions of other components like CDI (Weld), JSF (Mojarra), WebSockets (Tyrus), Networking (Grizzly) and all the other externally developed components we regularly update for each release.

Payara's Repository https://github.com/payara/Payara is consistently active. Are you also receiving any contributions from the community?

At the moment, we have 16 contributors that have signed the CLA so we can directly merge their pull requests. We are very grateful to these users and each of them will have received a goody bag of Payara swag as a thank you. We also have many other contributors that help out on GitHub through raising issues and fixes which we incorporate from their suggestions github.com/payara/Payara/issues . We are very open to external contributions and can point people to issues or simple tasks if they want to get involved. Payara Server is a fully open source project so people interested in building an application server should get involved and raise a pull request.

Which tools or IDEs are you using?

All our developers are free to use whichever IDE they choose, but the majority of the team use NetBeans due to its superb Maven and Git support which copes easily with a very complex Maven project like Payara Server. Also, NetBeans integrates very well with Payara Server out of the box so debugging and profiling from within the IDE is simple. Other tools the team use are Jenkins for Continuous Delivery. In fact, at the moment we are building a large cross-platform Jenkins infrastructure, which will run our entire test suite across all platforms and JDKs for every merge.

You are visiting Java conferences around the world. What is your impression, is Java EE popular?

Java EE has always been popular throughout the time I’ve been working in this industry, that is since 2010. The tech world is extremely fluid and moves forward very quickly so of course a lot of things have changed in the last couple of years which affected the way Java EE is used. E.g. by now everybody knows that if you’re using SOA or monoliths you’re ‘supposed to’ move to microservices. The growing popularity of DevOps, deployment automation tools, containers such as Spring Boot and Docker is noticeable and the pressure to virtualise your infrastructure and move it onto the cloud is high.

All this time though, from what I’ve noticed, regularly talking to the community, customers and other vendors, Java EE is still staying strong. We tend to forget that a typical company running middleware infrastructure is often very much behind the industry hype. Don’t get me wrong, it doesn’t mean that Java EE will lose its relevance once the companies catch up with the new technologies - it just means that Java EE needs to develop and evolve to follow the latest trends, and we hope it will. There’s been a lot of announcements on what’s coming in Java EE 8 at this year’s JavaOne conference (Linda Demichiel’s presentation is probably the best place to start: youtu.be/KgLxnz0L7mo?t=6h45s ); and it looks like the next step is towards a new application development style for cloud and microservices, so things are looking promising. Although it is quite disappointing that the release date has been delayed again.

One of the many myths about Java EE, contributing to the opinion that it’s losing in popularity, is its alleged incompatibility with microservices, which is simply untrue. As creators of Payara Micro, members of the MicroProfile initiative and big supporters of Java EE, we’ve taken it upon ourselves to show developers how easy it is to use Java EE with microservices. Our ‘Microservices for Java EE Developers’ blog.payara.fish/microservices-for-java-ee-developers article by Fabio Turizo is just the beginning.

Payara is involved in the microprofile.io initiative. What is microprofile.io and how are your involved?

MicroProfile microprofile.io is a vendor and community collaboration aiming to make it easier for developers to use familiar Java EE technologies and APIs for building microservice applications. Our goal for MicroProfile is to rapidly innovate new APIs suitable for microservice architectures that integrate well with CDI and other Java EE technologies. With all the participants in MicroProfile we can experiment, innovate and see what works before these ideas are fed into JSRs at the JCP for standardisation. Having rapid implementation, open collaboration and working runtimes is our goal for MicroProfile. Payara Micro will form the foundation of our MicroProfile offering. Payara Micro is incredibly modular; however, it’s difficult to expose this modularity to outside developers, so we are currently working on a new Payara Micro jar format that will easily allow additional modules to be added to the jar while retaining the core features of the current Payara Micro. At Payara, we will be developing CDI based integrations to many of the popular microservice technologies out in the wild and releasing these as Payara Micro and Server modules.

Payara Micro's killer feature is the support of "Thin Wars" and so lightning speed builds: https://www.youtube.com/watch?v=8Da5jOMaNtk. What are the other typical use cases for Payara Micro?

Payara Micro www.payara.fish/payara_micro is designed for cloud based elastic infrastructures, whether on Docker or on traditional virtualisation technologies. Another killer feature for standard web applications is Payara Micro’s elastic clustering capabilities blog.payara.fish/payara-micro-dynamic-clustering-demo . Payara Micro embeds the industry leading open source data grid from Hazelcast as the core session replication technology, so large scale web deployments can take advantage of Hazelcast for large scale web clustering. Payara Micro is also ideal for microservice style deployments as it is small, fast and incredibly easy to use for JAX-RS or WebSocket microservices.

Your swag is legendary. Which upcoming conferences are you going to visit?

Thanks Adam! I really like this part of my job too – making sure we have the right swag for our community – maybe a little less serious responsibility, but still very important ;-) We were extremely busy attending and speaking at the conferences this year and 2017 is looking busy too - we’re hoping to be back at the key industry events. First one will be Java Land in Germany in March, then in the autumn conference season we’re hoping to visit JavaOne again, Devoxx, W-JAX, jDays, NetBeans Days, GeeCon, JDD and a lot of smaller JUG events around the world, both in-person and virtually. Just keep an eye on our Twitter and news page to see where we are, as new events and conferences are often added to our agenda during the year. And if you want someone from the Payara team to get involved in your event, just let us know and we’ll do our best to be there.

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

Well, first off, if you haven’t tried Payara Server yet - go ahead and download it from www.payara.fish/downloads If you want to stay up to date with the newest features overviews, how-to articles, demos etc. check out – or event better: subscribe to – our blog: http://blog.payara.fish/ (technical content only!). For technical documentation about both Payara Server and Payara Micro, see GitBooks: https://payara.gitbooks.io/payara-server/content/getting-started/getting-started.html

For those of you who want to find out more about Payara Support, have a look at the services page, where you will find the details of support levels, prices, SLAs, policies etc.: www.payara.fish/support

And if you want to officially join the community and contribute to the Payara code, see our community page. You can even dive straight in, sign our CLA and start developing Payara Sever with us: www.payara.fish/community ! 

Dominika, thank you for the interview!

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - December 13, 2016 11:09 AM
Page Flow, Enablement, and ojListView (Part 2)

Before going to the next page, as shown in yesterday's blog entry, we want to display a confirmation dialog.

We'll use 'ojDialog' for this:


Start by adding 'ojs/ojdialog' to the 'define' block of the viewModel of your Oracle JET module, together with a function for opening an ojDialog, yet to be defined, as well as a function for going to the next section:

self.next = function() {
self.confirm = function() {

Now, add your dialog in the view, i.e., probably, at the end of the HTML page that provides the view for the above functions:

<div id="dialogWrapper">
    <div style="display:none"
             component: 'ojDialog',
                initialVisibility: 'hide'}">
        <div class="oj-dialog-body">
            <div class="oj-panel">
                    Do you really want
                    <span data-bind="text: $data.selectedItem()"></span>?
        <div class="oj-dialog-footer">
            <button class="oj-button-primary"
                    data-bind="click: confirm,
                               ojComponent: {component: 'ojButton',
                                             label: 'Confirm'}">

Geertjan's Blog - December 12, 2016 10:12 AM
Page Flow, Enablement, and ojListView (Part 1)

Let's combine a couple of recent blog entries into a scenario. We'll combine Simple JSON and ojListView Sample with From ojNavigationList to ojButton and add some additional bits and pieces. 

Start by setting up Simple JSON and ojListView Sample. Now, we have a new requirement—we need a "Next" button, i.e., for navigating to the next section of our single page application. However, that button should only be enabled if something is selected in the list. Some small tweaks are needed to achieve this.

Take a look in particular at the bits in bold below, which are the only differences to Simple JSON and ojListView Sample:

    'ojs/ojcore', 'knockout',
    'jquery', 'appController', 
 function(file, oj, ko, $, app) {
    function DashboardViewModel() {
      var self = this;
      self.data = [];
      self.selectedItem = ko.observable(-1);
      var content = JSON.parse(file);
      var employees = content.employees;
      for (var i = 0; i < Object.keys(employees).length; i++) {
          var employee = employees[i];
              first: employee.firstName,
              last: employee.lastName
      self.optionChangeListener = function (event, ui) {
          if (ui.option === 'currentItem' && ui.value !== null) {
      self.dataSource = new oj.ArrayTableDataSource (
          {idAttribute: "first"}
      self.next = function() {
    return new DashboardViewModel();

Here's the view, notice in particular the usage of the "disabled" property of the ojButton, while also noticing the "optionChange" property of the ojListView:

<div class="oj-hybrid-padding">
    <h2>Select Customer</<h2>
    <ul data-bind="ojComponent: {
               component: 'ojListView',
                  data: dataSource,
                  optionChange: optionChangeListener,
                  item: {template: 'employee_template'},
                  rootAttributes: {style: 'width:20%;height:80%'},
                  selectionMode: 'single'}">
    <script type="text/html" id="employee_template">
            <h3 data-bind="text: first"></h3>
            <span data-bind="text: last"></span>
    <button id= "nextButton"
            style="width: 5%"
                click: next,
                ojComponent: {
                    component: 'ojButton',
                       label: 'Next',
                       disabled: selectedItem() == -1 }">

Thanks to my colleague Max Froeschl for these insights.

Geertjan's Blog - December 10, 2016 08:00 AM
json2form Generator for Oracle JET applications

There's often a need to create standard forms for different purposes in an application, such as these, an incident entry form and a customer feedback form:

Imagine if all that would be needed for creating the two forms above would be this in each view:

<json2form json="{{jsonFile}}"/>

For each view containing the above, the viewModel would load a file such as this for the form on the left above:

        "key": "incidents_form",
        "title": "Incident Entry Form",
        "description": "Enter Incident Details",
        "message": "We want incidents fixed fast!",
        "properties": [
            {"name": "Type", "options": ["Serious", "Minor"]},
            {"name": "Description"},
            {"name": "City"},
            {"name": "State"},
            {"name": "Country"}

And this for the form on the right above:

        "key": "customer_form",
        "title": "Customer Feedback Form",
        "description": "Enter Customer Feedback",
        "message": "We love our customers!",
        "properties": [
            {"name": "Name"},
            {"name": "Feedback"},
            {"name": "Rating", "options": ["Excellent","Good","Bad"]}

To achieve the above, we need to make use of the composite component architecture, described here:


I have blogged about a simple getting started scenario for composite components architecture here:


We also need to make use of the metadata-driven dynamic form functionality described here:


In this case, what we need is a structure like this:

See yesterday's blog entry if you want your applications structured like the above.

Here's the definition of loader.js:

        function (oj, view, viewModel, metadata)
            oj.Composite.register('json2form', {
                view: {inline: view},
                viewModel: {inline: viewModel},
                metadata: {inline: JSON.parse(metadata)}

Here's the definition of metadata.json:

  "properties": {
    "json": {
      "type": "Array"

Here's the definition of viewModel.js:

define(['ojs/ojcore', 'knockout',
    'ojs/ojradioset', 'ojs/ojbutton'],
function (oj, ko) {
    function CompositeModel(context) {
        var self = this;
        context.props.then(function (props) {
            self._props = props;
        function _initProperties() {
            self.descriptors = ko.computed(function () {
                var mapped = self._props.json.map(
                        function (json) {
                            var def = {
                                title: json.title,
                                description: json.description,
                                message: json.message,
                                properties: json.properties
                            return def;
                return mapped;
    return CompositeModel;

Here's the definition of view.html:

<div data-bind="foreach: descriptors" class="oj-panel-alt2 oj-margin oj-flex-item">
    <div class="oj-flex-item oj-panel-alt2 oj-margin">
        <h1 data-bind="text: title"></h1>
        <h3 data-bind="text: description"></h3>
    <div class="oj-flex-item oj-panel-alt2 oj-margin">
        <!-- ko foreach: $data.properties -->
        <div class="oj-flex-item oj-panel-alt oj-margin">
            <label data-bind="text: $data.name"></label>:
            <!-- ko if: $data.options -->
                <!-- ko foreach: $data.options -->
                <div data-bind="ojComponent: {
                        component: 'ojRadioset',
                        value: $data}" >
                    <span class="oj-choice-row">
                        <input type="radio" value="$data">
                        <label><span data-bind="text: $data"></span></label>
                <!-- /ko -->
            <!-- /ko -->
            <!-- ko ifnot: $data.options -->
            <input id="inputcontrol"
               data-bind="ojComponent: {
                   component: 'ojInputText',
                   rootAttributes: {style:'max-width:100em'}}">
            <!-- /ko -->
        <!-- /ko -->
    <div class="oj-flex-item oj-panel-alt2 oj-margin">
        <b data-bind="text: message"></b>

And, finally, here's how the files are loaded and used in all the viewModels that need to make use of it:

        function (file, oj, ko, $) {
            function CustomerViewModel() {
                var self = this;
                self.jsonFile= JSON.parse(file);
            return new CustomerViewModel();

There is more to be done to complete this scenario because right now we're only rendering the forms and not processing the input. That will be the next step of this series.

Right now, based on the above, you're able to transform a JSON file into a form, which is the first step in this scenario. Thanks to my colleague Max Starets for providing a similar scenario to this recently.

Geertjan's Blog - December 09, 2016 03:20 PM
Restructuring of Oracle JET Applications

During UKOUG 2016, this week, I learned a cool thing from my colleague Lyudmil Pelov—the response to the most frequently asked question from the Oracle JET sessions I have been doing around the world: "Isn't the 'js/views' and 'js/viewModels' structure a technical rather than a functional architecture? And wouldn't it be better to have both sides of an Oracle JET module in the same folder?"

Well, take a look at this, the "navdrawer" template restructured based on functionality, e.g., in the "app/pages/dashboard" folder, both sides of the "dashboard" module are found, rather than the viewModel being in 'js/viewModels' and the view in 'js/views':

If you prefer this structure over the default structure brought to you by the Oracle JET templates, take the following steps. I suggest you first get it working in the "navdrawer" template, before trying to apply this structure to your own application. 

  1. Set up the 'navbar' template, i.e., use the "Oracle JET QuickStart Basic" template in NetBeans IDE.

  2. Create a new folder named 'app', as shown in the structure above.

  3. Inside 'app', create a folder called 'pages', with a subfolder for each of the custom Oracle JET modules provided by the 'navbar' template, i.e., 'dashboard', 'incidents', 'customers', and 'about'. Move the 'dashboard.js' and 'dashboard.html' from 'js/viewModels' and 'js/views' into the 'app/dashboard' folder. Do the same for the other Oracle JET modules.

  4. Move the 'libs' folder into 'app' (and tweak '.bowerrc' and potentially other similar files, to download JavaScript libraries into the new location of 'libs'). In 'main.js', change all the paths to JavaScript libraries to reflect their new locations, i.e., they're no longer in 'libs'; they're in 'app/libs'.

  5. Move 'appController.js', 'main-release-paths.json', and 'main.js' into the 'app' folder. In 'index.html', correct the reference to 'main.js' to its new location in 'app' and do the same for 'require.js', which should now be in 'app/libs/require'.

  6. In the 'requirejs.config' section in 'main.js', change the 'baseUrl' to point to '.' instead of 'js'.

  7. In 'appController.js', change the router as follows and notice that you can also have a functional nested structure for your Oracle JET modules:
    function getPagePath(path) {
      return 'pages/' + path + '/' + path.substr(path.lastIndexOf('/') + 1);
    self.router = oj.Router.rootInstance;
     'dashboard': {value: getPagePath('dashboard'), label: 'Dashboard', isDefault: true},
     'incidents': {value: getPagePath('incidents'), label: 'Incidents'},
     'customers': {value: getPagePath('customers'), label: 'Customers'},
     'about': {value: getPagePath('about'), label: 'About'}
  8. In 'main.js', as the new first lines in the 'require' block, override the default locations of the viewModels and views, i.e., rather than the default 'js/viewModels' and 'js/views', you now want them to both be found within the 'app' folder (in the location specified by the router in the previous step):
    oj.ModuleBinding.defaults.modelPath = 'app/';
    oj.ModuleBinding.defaults.viewPath = 'text!app/';

At this point, you should be able to delete the 'js' folder, i.e., there should be nothing in it anymore.

Run the application and everything should work exactly as before!