Java EE 7 - Novidades e Mudanças

50 %
50 %
Information about Java EE 7 - Novidades e Mudanças
Technology

Published on February 28, 2014

Author: brunoborges

Source: slideshare.net

Description

Apresentação feita ao SERPRO em Fevereiro de 2014, para a equipe do Framework Demoiselle.

Video com Q&A disponivel aqui: https://www.youtube.com/watch?v=c1FrV4UmKEA

Java EE 7: Novidades e Mudanças Bruno Borges Oracle Product Manager Java Evangelist @brunoborges 2Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bruno Borges Oracle Product Manager / Evangelist Desenvolvedor, Gamer Entusiasta em Java Embedded e JavaFX Twitter: @brunoborges 3Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java EE 7 - Produtividade - Suporte HTML5 - Funcionalidades Enterprise Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Concurrency 1.0 Interceptors 1.2 Bean Validation 1.1 CDI 1.1 Java EE 7 JSP 2.3 JSTL EL 3.0 Servlet 3.1 Web Socket 1.0 JAX-RS 2.0 JSON-P 1.0 Batch 1.0 JTA 1.2 EJB 3.2 JPA 2.1 Java EE 7 5Copyright © 2012, Oracle and/or its affiliates. All rights reserved. JSF 2.2 Insert Information Protection Policy Classification from Slide 13 JMS 2.0 JavaMail 1.5 JCA 1.7

Java EE 7 Web Profile  Web Profile atualizado para incluir: – JAX-RS – WebSocket – JSON-P – EJB 3.2 Lite 6Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Construindo aplicações HTML5  WebSocket 1.0  JAX-RS 2.0  JavaServer Faces 2.2  JSON-P API 7Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

HTTP vs WebSockets  Protocolo HTTP é half-duplex  Gambiarras – Polling – Long polling – Streaming  WebSocket resolve o problema de uma vez por todas – Full-duplex 8Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

WebSockets Handshake  Cliente solicita um UPGRADE  Server confirma (Servlet 3.1)  Cliente recebe o OK  Inicia a sessão WebSocket http://farata.github.io/slidedecks/state_of_websocket/slides.html#13.4 9Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java API for WebSockets 1.0  API para definir WebSockets, tanto Client como Server – Annotation-driven (@ServerEndpoint) – Interface-driven (Endpoint) – Client (@ClientEndpoint)  SPI para data frames – Negociação handshake na abertura do WebSocket  Integração com o Java EE Web container 10Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java API for WebSockets 1.0 import javax.websocket.*; import javax.websocket.server.*; @ServerEndpoint(“/hello”) public class HelloBean {     @OnMessage     public String sayHello(String name) {         return “Hello “ + name;     } } 11Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java API for WebSockets 1.0 @ServerEndpoint(“/chat”) public class ChatBean {     @OnOpen     public void onOpen(Session peer) {         peers.add(peer);     }     @OnClose     public void onClose(Session peer) {         peers.remove(peer);     }     @OnMessage     public void message(String msg, Session client) {         peers.forEach(p ­> p.getRemote().sendMessage(msg));     } } 12Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JAX-RS 2.0  Client API  Message Filters & Entity Interceptors  Asynchronous Processing – Server & Client  Suporte Hypermedia  Common Configuration – Compartilhar configuração comum entre diversos serviços REST 13Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JAX-RS 2.0 - Client // Get instance of Client Client client = ClientFactory.getClient(); // Get customer name for the shipped products String name = client.target(“http://.../orders/{orderId}/customer”)                     .resolveTemplate(“orderId”, “10”)                     .queryParam(“shipped”, “true)”                     .request()                     .get(String.class); 14Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JAX-RS 2.0 - Server @Path("/async/longRunning") public class MyResource { @GET public void longRunningOp(@Suspended AsyncResponse ar) { ar.setTimeoutHandler(new MyTimoutHandler()); ar.setTimeout(15, SECONDS); Executors.newSingleThreadExecutor().submit(new Runnable() { public void run() { ... ar.resume(result); }}); } } 15Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2  Flow Faces  HTML5 Friendly Markup  Cross-site Request Forgery Protection  Carregamento de Facelets via ResourceHandler  Componente de File Upload  Multi-templating 16Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JSON API 1.0  JsonParser – Processa JSON em modo “streaming” – Similar ao XMLStreamReader do StaX  Como criar – Json.createParser(...) – Json.createParserFactory().createParser(...)  Eventos do processador – START_ARRAY, END_ARRAY, START_OBJECT, END_OBJECT, ... 17Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JSON API 1.0 "phoneNumber": [ { "type": "home", "number": ”408-123-4567” }, { "type": ”work", "number": ”408-987-6543” } ] 18Copyright © 2012, Oracle and/or its affiliates. All rights reserved. JsonGenerator jg = Json.createGenerator(...); jg. .beginArray("phoneNumber") .beginObject() .add("type", "home") .add("number", "408-123-4567") .endObject() .beginObject() .add("type", ”work") .add("number", "408-987-6543") .endObject() .endArray(); jg.close(); Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2 19Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2 ● ● ● ● Faces Flow Resource Library Contracts Multi-templating HTML5 Friendly Markup Support – Pass through attributes and elements ● ● ● Cross Site Request Forgery Protection Loading Facelets via ResourceHandler File Upload Component 20Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2 – HTML5 Friendly Markup file:///home/bruno/project/web/myPage.xhtml <form jsf:id="form" jsf:prependId="false"> <label jsf:for="name">Name < /label> <input jsf:id="name" type="text" jsf:value="#{complex.name}" /> <label jsf:for="tel">Tel < /label> <input jsf:id="tel" type="tel" jsf:value="#{complex.tel}" /> <label jsf:for="email">Email < /label> <input jsf:id="email" type="email" jsf:value="#{complex.email}" /> <label for="progress">Progress < /label> <progress jsf:id="progress" max="3"> #{complex.progress} of 3 </progress> </form> 21Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2  Flow Faces 22Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2 – Flow Faces <j:faces-flow-definition>   <j:initializer>#{someBean.init}</j:initializer> <j:start-node>startNode</j:start-node>   <j:switch id="startNode"> <j:navigation-case> <j:if>#{someBean.someCondition}</j:if> <j:from-outcome>fooView</j:from-outcome> </j:navigation-case> </j:switch>   <j:view id="barFlow"> <j:vdl-document>barFlow.xhtml</j:vdl-document> </j:view> <j:view id="fooView"> <j:vdl-document>create-customer.xhtml</j:vdl-document> </j:view> </j:faces-flow-definition> 23Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaServer Faces 2.2  Multi-Templating – Seleção default – Seleção dinâmica <ui:composition template="#{userBean.template}"> 24Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JMS para Mensageria 25Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java Message Service API 2.0  Simplificação da JMS API 1.1 sem quebrar compatibilidade  Nova API requer menos objetos – JMSContext, JMSProducer...  No Java EE, permite que JMSContext seja injetado e gerenciado pelo container, usando CDI  Objetos JMS implementam AutoCloseable  Envio Async de mensagens 26Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java Message Service API 2.0  JMSContext  Encapsula Connection e Session  Criado a partir de um default ConnectionFactory – Permite especificar um ConnectionFactory também  Unchecked exceptions  Suporta encadeamento de métodos, para fluid style 27Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java Message Service API 2.0 @Resource(lookupName = “java:comp/defaultJMSConnectionFactory”) ConnectionFactory myJMScf; @Resource(lookupName = “jms/inboud”) private Queue inboundQueue; @Inject @JMSConnectionFactory(“jms/myCF”) private JMSContext context; 28Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java Message Service API 2.0 @JMSConnectionFactoryDefinition( name=”java:global/jms/demoCF” className = “javax.jms.ConnectionFactory”) @JMSDestinationDefinition( name = “java:global/jms/inboudQueue” className = “javax.jms.Queue” destinationName = “inboundQueue”) 29Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Message Driven Beans para JMS 2.0 @MessageDriven( mappedName = “jms/myQueue”, activationConfig = { @ActivationConfigProperty( propertyName = “destinationLookup”, propertyValue = “jms/myQueue”), @ActivationConfigProperty( propertyName = “connectionFactoryLookup”, propertyValue = “jms/myCF”) }) 30Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bean Validation Batch API Concurrency Utilities 31Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bean Validation 1.1 public void placeOrder( @NotNull String productName, @NotNull @Max(“10”) Integer quantity, @Customer String customer) { //. . . } @Future public Date getAppointment() { //. . . } 32Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Batch API 1.0 <job id=“myJob”> <step id=“init”> <chunk reader=“R” writer=W” processor=“P” /> <next on=“initialized” to=“process”/> <fail on=“initError”/> </step> <step id=“process”> <batchlet ref=“ProcessAndEmail”/> <end on=”success”/> <fail on=”*” exit-status=“FAILURE”/> </step> </job> 33Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Batch Applications 1.0 Job Specification Language – Chunked Step <step id=”sendStatements”> …implements ItemReader { <chunk reader ref=”accountReader” public Object readItem() { processor ref=”accountProcessor” // read account using JPA writer ref=”emailWriter” } chunk-size=”10” /> </step> …implements ItemProcessor { Public Object processItems(Object account) { // read Account, return Statement } …implements ItemWriter { public void writeItems(List accounts) { // use JavaMail to send email } 34Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Concurrency Utilities for Java EE 1.0 ● Provide asynchronous capabilities to Java EE application components – ● ● Without compromising container integrity Extension of Java SE Concurrency Utilities API (JSR 166) Support simple (common) and advanced concurrency patterns 35Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Concurrency Utilities for Java EE 1.0 ● Provide 4 managed objects – – ● ManagedThreadFactory – ● ManagedScheduledExecutorService – ● ManagedExecutorService ContextService Context propagation Task event notifications Transactions 36Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Concurrency Utilities for Java EE 1.0 Submit Tasks to ManagedExecutorService using JNDI public class TestServlet extends HTTPServlet { @Resource(name=“concurrent/BatchExecutor”) ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { . . . // task logic } } } 37Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

NetBeans e o suporte ao HTML5 38Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

NetBeans 7.3 39Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

HTML5 Wizard  Twitter Bootstrap  HTML5 Boilerplate  Initializr  AngularJS  Mobile Boilerplate 40Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Javascript Editor  Code Completion  Contexto de Execução  Debug com Chrome  Browser log 41Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Instalando o Chrome Extension do NetBeans  Instalação Offline 42Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Q&A 43Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

44Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Java EE nas Redes Sociais Twitter @java_ee Facebook facebook.com/javaeeplatform Google+ 45Copyright © 2012, Oracle and/or its affiliates. All rights reserved. gplus.to/JavaEE Insert Information Protection Policy Classification from Slide 13

Adopt a JSR  JUGs participando ativamente  Promovendo as JSRs – Para a comunidade Java – Revendo specs – Testando betas e códigos de exemplo – Examplos, docs, bugs – Blogging, palestrando, reuniões de JUG 46Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Adopt a JSR JUGs Participantes 47Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

E o futuro do Java EE 8? Cloud Programming Model Storage JSON-B  Arquitetura Cloud  Multi tenancy para aplicações SaaS  Entrega incremental de JSRs  Modularidade baseada no Jigsaw  glassfish.org/survey 48Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 Modularity NoSQL Multitenancy Java EE 8 Cloud PaaS Enablement Thin Server Architecture

Participe hoje mesmo!  GlassFish 4.0 Java EE 7 RI – http://www.glassfish.org  Java EE Expert Group – http://javaee-spec.java.net  Adopt a JSR – http://glassfish.org/adoptajsr  The Aquarium (GF Blog) – http://blogs.oracle.com/theaquarium  NetBeans e Java EE 7 – http://wiki.netbeans.org/JavaEE7  Java EE 7 HOL – http://www.glassfish.org/hol 49Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

OBRIGADO! @brunoborges blogs.oracle.com/brunoborges 50Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 51Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

52Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Add a comment

Related presentations

Related pages

Conheça as principais novidades no JavaEE 7 | blog.caelum ...

Conheça as principais novidades no JavaEE 7 ... além de outras pequenas mudanças. ... O que você sente falta no desenvolvimento Java EE? Compartilhe
Read more

Java EE 7: Resumo dos novos componentes e melhorias ...

... apresentou as principais novidades em especificações para o Java EE 7, ... A seguir resumimos as mudanças previstas e novidades em cada componente.
Read more

Java EE 7: Resumo dos novos componentes e melhorias ...

... apresentou as principais novidades previstas para a próxima versão do Java EE. O Java EE 7 ... as mudanças previstas e novidades em cada ...
Read more

Java EE - Downloads: GlassFish and Java EE 7 | Oracle ...

Java EE 7 SDK Bundles; Java EE 7 SDK Update 2 A free integrated development kit used to build, test, and deploy Java EE 7 applications. It includes :
Read more

Java Platform, Enterprise Edition: The Java EE Tutorial ...

1.1 Java EE 7 Platform Highlights; 1.2 Java EE Application Model; 1.3 Distributed Multitiered Applications. ... 32.5 The Contents of an Enterprise Bean;
Read more

Java EE 7 SDK Download Page - Oracle | Integrated Cloud ...

Java EE 7 SDK Download Page . Oracle. Country; Country; ... Java EE. Java ME. ... Download Java for Consumers;
Read more

Novidades na plataforma Java EE 8 - InfoQ: Software ...

O Java EE 8 virá com novas ... novidades que teremos para o Java EE 8. Dentre as áreas de melhorias da plataforma Java EE, as principais mudanças ...
Read more

java.com: Java + Sie

Info zu Java (Englische Site) Sprachauswahl | Info zu Java | Support | Entwickler Datenschutz | | Nutzungsbedingungen | Marken | Haftungsausschluss.
Read more