Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification f...
Upcoming SlideShare
Loading in...5
×

As novidades do Java EE 7: do HTML5 ao JMS 2.0

886

Published on

As novidades do Java EE 7: do HTML5 ao JMS 2.0

Published in: Technology

Transcript of "As novidades do Java EE 7: do HTML5 ao JMS 2.0"

  1. 1. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132As novidades do Java EE 7:do HTML5 ao JMS 2.0Bruno BorgesOracle Product ManagerJava EvangelistInsert Picture Here
  2. 2. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133Bruno Borges● Oracle Product Manager / Evangelist● Desenvolvedor, Gamer● Entusiasta em Java Embedded e JavaFX● Twitter: @brunoborges
  3. 3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 134Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16Agenda  Java EE 7: quais as novidades? Construindo aplicações HTML5– WebSockets 1.0– JAX-RS 2.0– JavaServer Faces 2.2– JSON API 1.0 Mensageria com JMS 2.0 Códigos de exemplo de Java EE 7 O que vem por aí
  4. 4. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135Java EE 7: quais as novidades? Servlet 3.1 Java API for JSON Processing 1.0 Bean Validation 1.1 Batch Applications API 1.0 Java Persistence API 2.1 Concurrency Utilities for Java EE 1.0 E muito mais... :-)
  5. 5. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136Java EE 7: quais as novidades? Web Profile updated to include– JAX-RS– WebSocket– JSON-P– EJB 3.2 Lite Outras APIs
  6. 6. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137Construindo aplicações HTML5 WebSocket 1.0 JAX-RS 2.0 JavaServer Faces 2.2 JSON-P API
  7. 7. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138WebSockets 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
  8. 8. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139WebSockets 1.0import javax.websocket.*;import javax.websocket.server.*;@ServerEndpoint(“/hello”)public class HelloBean {    @OnMessage    public String sayHello(String name) {        return “Hello “ + name;    }}
  9. 9. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310WebSockets 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));    }}
  10. 10. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311DEMOWebSockets
  11. 11. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1312Maven Archetype para o Java EE 7 Maven Archetypes para Java EE 7– http://mojo.codehaus.org Maven Archetype com o Embedded GlassFish configurado– http://github.com/brunoborges/javaee7-archetype Só precisa...– $ mvn package embedded-glassfish:run
  12. 12. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313DEMOMaven ArchetypeJava EE 7GlassFish Embedded
  13. 13. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314JAX-RS 2.0 Client API Message Filters & Entity Interceptors Asynchronous Processing – Server & Client Suporte Hypermedia Common Configuration– Compartilhar configuração comum entre diversos serviçosREST
  14. 14. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315JAX-RS 2.0 - Client// Get instance of ClientClient client = ClientFactory.getClient();// Get customer name for the shipped productsString name = client.target(“http://.../orders/{orderId}/customer”)                    .resolveTemplate(“orderId”, “10”)                    .queryParam(“shipped”, “true)”                    .request()                    .get(String.class);
  15. 15. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316JAX-RS 2.0 - Server@Path("/async/longRunning")public class MyResource {@GETpublic void longRunningOp(@Suspended AsyncResponse ar) {ar.setTimeoutHandler(new MyTimoutHandler());ar.setTimeout(15, SECONDS);Executors.newSingleThreadExecutor().submit(new Runnable() {public void run() {...ar.resume(result);}});}}
  16. 16. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317JavaServer Faces 2.0 Flow Faces HTML5 Friendly Markup Cross-site Request Forgery Protection Loading Facelets via ResourceHandler Componente de File Upload Multi-templating
  17. 17. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318JSON 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, ...
  18. 18. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319JSON API 1.0"phoneNumber": [{"type": "home","number": ”408-123-4567”},{"type": ”work","number": ”408-987-6543”}]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();
  19. 19. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1320JMS para Mensageria
  20. 20. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321Java 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 gerenciadopelo container, usando CDI Objetos JMS implementam AutoCloseable Envio Async de mensagens
  21. 21. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322Java 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
  22. 22. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323Java 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;
  23. 23. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324Java 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”)
  24. 24. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325Message Driven Beans para JMS 2.0@MessageDriven(mappedName = “jms/myQueue”,activationConfig = {@ActivationConfigProperty(propertyName = “destinationLookup”,propertyValue = “jms/myQueue”),@ActivationConfigProperty(propertyName = “connectionFactoryLookup”,propertyValue = “jms/myCF”)})
  25. 25. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1326Outros exemplos
  26. 26. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1327Bean Validation 1.1public void placeOrder(@NotNull String productName,@NotNull @Max(“10”) Integer quantity,@Customer String customer) {//. . .}@Futurepublic Date getAppointment() {//. . .}
  27. 27. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1328Batch 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>
  28. 28. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1329
  29. 29. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1330GlassFish 4.0, NetBeans, e Java EE 7 Java EE 7 Expert Group Project– http://javaee-spec.java.net GlassFish 4.0 - Java EE 7 Reference Implementation– http://www.glassfish.org Adopt a JSR– http://glassfish.org/adoptajsr NetBeans e Java EE 7– http://wiki.netbeans.org/JavaEE7
  30. 30. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1331GlassFish 4.0, NetBeans, e Java EE 7 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
  31. 31. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1333OBRIGADO!
  32. 32. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1334The preceding is intended to outline our general product direction. It is intendedfor information purposes only, and may not be incorporated into any contract.It is not a commitment to deliver any material, code, or functionality, and shouldnot be relied upon in making purchasing decisions. The development, release,and timing of any features or functionality described for Oracle’s productsremains at the sole discretion of Oracle.
  33. 33. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1335
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×