GAVIN KING RED HAT CEYLON SWARM

Similar documents
PROCE55 Mobile: Web API App. Web API.

Introduction to Ceylon. Stéphane Épardaud Red Hat

Cheat Sheet: Wildfly Swarm

JBoss Users & Developers Conference. Boston:2010

IntelliJ IDEA, the most intelligent Java IDE

MicroProfile - New and Noteworthy

Java Platform, Enterprise Edition 6 with Extensible GlassFish Application Server v3

JDO Tools Guide (v5.1)

Java EE 7 is ready What to do next? Peter Doschkinow Senior Java Architect

Red Hat JBoss Enterprise Application Platform 7.2

Modular Java EE in the cloud

"Web Age Speaks!" Webinar Series

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

JPA Tools Guide (v5.0)

Liberty Right Fit for MicroProfile

How To Get Database Schema In Java Using >>>CLICK HERE<<<

JVA-563. Developing RESTful Services in Java

Baking a Java EE 8 Micro Pi Mike Croft Ondrej Mihályi. Payara Support

Eight Ceylon Idioms. Gavin King - Red Hat profiles.google.com/gavin.king ceylon-lang.org

The Next Generation. Prabhat Jha Principal Engineer

Practical Java EE 7 Development on WildFly

HOW WE MOVED FROM JAVA TO SCALA

Tattletale. What is Tattletale? Enterprise archives JBoss Application Server 7 Putting it all together Roadmap

Hello Maven. TestNG, Eclipse, IntelliJ IDEA. Óbuda University, Java Enterprise Edition John von Neumann Faculty of Informatics Lab 2.

Extreme Java Productivity with Spring Roo and Spring 3.0

Hello Gradle. TestNG, Eclipse, IntelliJ IDEA. Óbuda University, Java Enterprise Edition John von Neumann Faculty of Informatics Lab 2.

Red Hat OpenShift Application Runtimes 1

Eclipse MicroProfile with Thorntail (formerly WildFly Swarm)

Migrating traditional Java EE applications to mobile

Microservices mit Java, Spring Boot & Spring Cloud. Eberhard Wolff

Developing Rules Applications with Red Hat JBoss BRMS (JB463)

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

Sunday, May 1,

Full Control and Transparency Advanced Troubleshooting and Testing. Josh West & Andrew Dinn

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Developing Applications with Java EE 6 on WebLogic Server 12c

The Evolution of Java Persistence

Content. Development Tools 2(57)

JakartaEE and the road ahead An ASF View. Mark Struberg, RISE GmbH, Apache Software Foundation, INSO TU Wien

Struts 2 Maven Archetypes

OSGi on the Server. Martin Lippert (it-agile GmbH)

Red Hat Developer Studio 12.0

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Migrating a Classic Hibernate Application to Use the WebSphere JPA 2.0 Feature Pack

High performance reactive applications with Vert.x

Breaking Apart the Monolith with Modularity and Microservices CON3127

JVM Survival Guide. Hadi Hariri

Seam 3. Pete Muir JBoss, a Division of Red Hat

INTRODUCTION TO COMPONENT DESIGN IN JAVA EE COMPONENT VS. OBJECT, JAVA EE JAVA EE DEMO. Tomas Cerny, Software Engineering, FEE, CTU in Prague,

Selenium Testing Course Content

Monolith to Microservices

Croquet. William R. Speirs, Ph.D. Founder & CEO of Metrink

1 Markus Eisele, Insurance - Strategic IT-Architecture

Lessons learned from real-world deployments of Java EE 7. Arun Gupta, Red

Schema Null Cannot Be Resolved For Table Jpa

Optimizing Enterprise Java for a Microservices Architecture Otávio

High performance reactive applications with Vert.x

Java J Course Outline

IBM WebSphere Application Server 8. Java EE 6 Feature Packs

Building Microservices with the 12 Factor App Pattern

Eclipse Lyo Overview. Michael Fiedler, Eclipse Lyo committer IBM Corporation

Red Hat JBoss Developer Studio 11.0

Java EE 6 - Update Harpreet Singh GlassFish Portfolio Product Manager

RobertaLab: Configuration, Architecture, Frameworks, Design

Extreme Java Productivity Enterprise Applications in Just Minutes

Develop Mobile Front Ends Using Mobile Application Framework A - 2

An Architecture for Self-Organizing Continuous Delivery Pipelines

Red Hat OpenShift Application Runtimes 0.1

JVA-163. Enterprise JavaBeans

ArcGIS Runtime SDK for Java: Building Apps. Mark Baird

Web Application Development Using Spring, Hibernate and JPA

apiman - Installation Guide

Demystifying Microservices for Java EE Developers

Liberate your components with OSGi services

Introduction to Ceylon. Stéphane Épardaud Red Hat

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Improving the Yocto Project Developer Experience. How New Tools Will Enable a Better Workflow October 2016 Henry Bruce

Web Application Development Using Spring, Hibernate and JPA

Red Hat Process Automation Manager 7.0 Planning a Red Hat Process Automation Manager installation

Cloud Native Java with Kubernetes

Creating Ultra-fast Realtime Apps and Microservices with Java. Markus Kett, CEO Jetstream Technologies

<Insert Picture Here> Future<JavaEE>

Developer: Chaithanya Krishna Gogineni Graduate Teaching Assistant Software Engineering Computer Science Department Northern Illinois University

Wednesday, June 23, JBoss Users & Developers Conference. Boston:2010

Building Java Persistence API Applications with Dali 1.0 Shaun Smith

AWS Lambda. 1.1 What is AWS Lambda?

MicroProfile: Optimizing Java EE For a Microservices Architecture

An Introduction to Eclipse Che Lets build a custom cloud IDE. October 2015 Tyler Jewell, Eclipse Che Project

Using Scala for building DSL s

gcp / gke / k8s microservices

Implementing the Twelve-Factor App Methodology for Developing Cloud- Native Applications

TOOLING SUPPORT FOR ENTERPRISE DEVELOPMENT RYAN CUPRAK & REZA RAHMAN

Web Application Development Using Spring, Hibernate and JPA

Oracle Corporation

Leverage Rational Application Developer v8 to develop OSGi application and test with Websphere Application Server v8

WHITE PAPER. RedHat OpenShift Container Platform. Benefits: Abstract. 1.1 Introduction

Class Dependency Analyzer CDA Developer Guide

Accelerate at DevOps Speed With Openshift v3. Alessandro Vozza & Samuel Terburg Red Hat

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Java EE Architecture, Part Two. Java EE architecture, part two 1

Transcription:

GAVIN KING RED HAT CEYLON SWARM

CEYLON PROJECT A relatively new programming language which features: a powerful and extremely elegant static type system built-in modularity support for multiple virtual machine platforms: JVM, Android, JavaScript, Dart powerful multi-language interoperation: Java, JavaScript, Dart excellent tooling: CLI, Eclipse, IntelliJ, Android Studio

TODAY S TOPIC When I was here last time, I talked a lot about the type system (probably the most exciting topic) And a little about Ceylon s module system This time I m going to talk about interoperation with Java frameworks with reference to a small demo app based on the WildFly Swarm environment This is a great test case for interop, along with Eclipse, IntelliJ, Android, and other smaller libraries and frameworks

WILDFLY SWARM Lets you package your Java EE app and server as a fat jar archive Offers Java EE APIs without the container bundle just the bits of WildFly you re using, together with your app, and its dependencies, as a single jar file run it using java -jar Service discovery, failover, integration with Red Hat cloud technologies

ADVANTAGES OF CEYLON ON SWARM True null safety, and in general, many more errors detected at compile time Union and intersection types Tuples Type inference and flow-sensitive typing Much better support for use of immutability Streamlined definition of model or data classes A typesafe metamodel (we ll see later how this is important!)

OUR DEMO APP We want to make the most of Java EE APIs including: JPA for persistence CDI for dependency injection JAX-RS for serving up JSON APIs transactional, etc And we want to write code using natural Ceylon and Java EE idioms https://github.com/diegocoronel/ceylon-jboss-swarm/

DO I REALLY NEED ALL THIS? No! Not unless you want it! There are plenty of other options: ceylon.dbc or standalone JPA for persistence ceylon.json for producing and parsing and JSON ceylon.http.server, Vert.x, many Java web frameworks Guice or Weld (or nothing!) for dependency injection If you prefer, Ceylon works with Spring, too

THE CHALLENGE JPA, CDI, and JAX-RS are annotation-driven frameworks that work via reflection In earlier versions of Ceylon, the mapping to Java wasn t optimized for annotation-driven Java frameworks need JPA converters / JAX-RS adaptors need to explicitly annotate methods default (non-final) problems with generatedvalue and late Can make it work, but not great for a demo app

THE CHALLENGE JPA APIs aren t optimized for usage from Ceylon setparameter() methods accept Object, and so conversion to Java primitive wrapper types is not automatic operations of EntityManager all accept null, but don t know what to do with it These issues aren t showstoppers, and you can certainly use JPA APIs directly from Ceylon without difficulty, but it s not quite as comfortable as we would like

THE SOLUTION The -ee compiler mode adjusts the mapping to Java so that annotation-driven Java frameworks work more smoothly with Ceylon objects Use direct field access in JPA and JAX-RS ee mode doesn t affect binary compatibility at all, as the public API of the class isn t affected nor does it affect reflection using Ceylon s metamodel the only thing it affects is Java reflection

THE SOLUTION The SDK module ceylon.interop.persistence is a wrapper for JPA that offers much enhanced type safety for a Ceylon client In particular, it has a more typesafe criteria query API that is much less verbose, and doesn t depend on the use of an annotation processor to generate a model available in git or in 1.3.3! It also solves the little setparameter() discomfort

MODULARITY IN CEYLON Language level constructs for defining modules, expressing their dependencies, and controlling visibility between modules Versioning Module archives and module repositories and automatic fetching of dependencies at compilation time and runtime Module isolation at runtime Interoperation with Maven and npm Assembler tools for: Ceylon assembly archives, fat JARs, WARs, WildFly Swarm, Jigsaw mlib, Maven repos, Dart assemblies

SETTING UP A SWARM PROJECT Import the Java EE APIs, and SDK module Override the compile-time JPA API with the Java EE APIs Provide persistence.xml to configure JPA

SETTING UP A SWARM PROJECT That s everything! no maven, no build scripts, no additional configuration As a shortcut I added ee=true to my Ceylon config to avoid having to specify -ee on the command line Assemble and run it!

ASSEMBLY WITH SWARM The swarm plugin for the ceylon command assembles a WildFly Swarm fat jar for a given Ceylon module ceylon plugin install swarm ceylon compile ceylon swarm --provided-module=javax.javaeeapi jaxrs.example java -jar jaxrs.example-1.0.0-swarm.jar The IntelliJ + Eclipse IDEs can do all this for us in one step

ASSEMBLY FOR APPLICATION SERVER Alternatively, the war plugin for the ceylon command assembles a standard Java war for the Ceylon module ceylon compile ceylon war --static-metamodel --providedmodule=javax.javaeeapi jaxrs.example Deploy it to WildFly (or other server) No code or project metadata changes required!

MODEL CLASSES A model (data) class is declared using JPA annotations That s significantly less noisy than the same code in Java!

REST ENDPOINTS A REST endpoint is defined using JAX-RS annotations The Java EE services do all the work of mapping our model to the database and to JSON

CRITERIA QUERIES IN JPA Java doesn t have a typesafe model of elements belonging to the Java program JPA defines a metamodel for use with criteria queries, but it must be generated using an annotation processor The criteria query API is overall highly verbose, quite clumsy to use, and lacking in typesafety, due mainly to limitations of the Java language (no tuples!)

CRITERIA QUERIES IN CEYLON Ceylon features a typesafe metamodel built in it s a bit like Java reflection, but with: typed model objects representing program elements typesafe references to program elements I ve written a criteria query API that follows the basic design of JPA s API, but is much more typesafe, and is based on Ceylon s metamodel it s much more pleasant to use

CRITERIA QUERIES IN CEYLON You can t tell from a screenshot, but this code fragment is much more typesafe than what can be achieved in Java For more complex JPA queries, the additional typesafety helps even more

CONCLUSION The resulting code is extremely clean and elegant The assembly process (ceylon swarm command) is a little slower than I would like, but tolerable The ee mode is not just for Java EE it works with other reflection-based Java frameworks The new criteria query API is way better This is a really simple demo app, but the technologies it s using offer a mountain of really robust functionality

CONCLUSION It s a great platform for building microservices You should be able to get productive really quickly The Ceylon language offers so much more that you can grow into Next stop: dockerize and deploy to cloud