SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
2º Encontro
13/02/2014
Departamento de Engenharia Informática - Faculdade de Ciências e Tecnologia
Universidade de Coimbra
Objectivos
•

Promover a comunidade de Java na zona Centro
através de eventos periódicos

•

Encorajar a participação de membros

•

Aprender e divertir-se
Contactos
•

Meetup - http://www.meetup.com/Coimbra-JUG/

•

Mailing List - coimbra-jug-list@meetup.com

•

Youtube - http://www.youtube.com/user/coimbrajug
O primeiro contacto
com Java EE 7
Roberto Cortez
Freelancer

twitter:!
@radcortez!
!

mail:!
radcortez@yahoo.com!
!

blog:!
http://www.radcortez.com
Questões?
Assim que tiverem!
Novas Especificações
•

Websockets

•

Batch Applications

•

Concurrency Utilities

•

JSON Processing
Melhorias
•

Simplificação API JMS

•

Default Resources

•

JAX-RS Client API

•

Transacções externas a EJB’s

•

Mais Anotações

•

Entity Graphs
Java EE 7 JSRs
Websockets

•

Suporta cliente e servidor

•

Declarativo e Programático
Websockets Chat Server
@ServerEndpoint("/chatWebSocket")!
public class ChatWebSocket {!
private static final Set<Session> sessions =
Collections.synchronizedSet(new HashSet<Session>());!
!

@OnOpen!
public void onOpen(Session session) {sessions.add(session);}!
!

@OnMessage!
public void onMessage(String message) {!
for (Session session : sessions)
{ session.getAsyncRemote().sendText(message);}!
}!
!

@OnClose!
public void onClose(Session session) {sessions.remove(session);}!
}
Batch Applications
•

Ideal para processos massivos, longos e nãointeractivos

•

Execução sequencial ou paralela

•

Processamento orientado à tarefa ou em secções.
Batch Applications
Batch Applications - job.xml
<job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/
javaee" version="1.0">!
<step id="myStep" >!
<chunk item-count="3">!
<reader ref="myItemReader"/>!
<processor ref="myItemProcessor"/>!
<writer ref="myItemWriter"/>!
</chunk>! !
</step>!
</job>
Concurrency Utilities
•

Capacidades assíncronas para componentes Java
EE

•

Extensão da API de Java SE Concurrency

•

API segura e propaga contexto.
Concurrency Utilities
public class TestServlet extends HttpServlet {!
@Resource(name = "concurrent/MyExecutorService")!
ManagedExecutorService executor;!
!

Future future = executor.submit(new MyTask());!
!

class MyTask implements Runnable {!
public void run() {!
! ! ! // do something!
}!
}!
}
JSON Processing

•

API para ler, gerar e transformar JSON

•

Streaming API e Object Model API
JSON Processing
JsonArray jsonArray = Json.createArrayBuilder()!
.add(Json.createObjectBuilder()!
.add("name", “Jack"))!
.add("age", "30"))!
.add(Json.createObjectBuilder()!
.add("name", “Mary"))!
.add("age", "45"))!
.build();!
!

[ {“name”:”Jack”, “age”:”30”}, !
{“name”:”Mary”, “age”:”45”} ]
JMS
•

Nova interface JMSContext

•

Modernização da API utilizando DI

•

AutoCloseable dos recursos

•

Simplificação no envio de mensagens
JMS

@Resource(lookup = "java:global/jms/demoConnectionFactory")!
ConnectionFactory connectionFactory;!
@Resource(lookup = "java:global/jms/demoQueue")!
Queue demoQueue;!

!
public void sendMessage(String payload) {!
try {!
Connection connection = connectionFactory.createConnection();!
try {!
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);!
MessageProducer messageProducer = session.createProducer(demoQueue);!
TextMessage textMessage = session.createTextMessage(payload);!
messageProducer.send(textMessage);!
} finally {!
connection.close();!
}!
} catch (JMSException ex) {!
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);!
}!
}
JMS
@Inject!
private JMSContext context;!
!

@Resource(mappedName = "jms/inboundQueue")!
private Queue inboundQueue;!
!

public void sendMessage (String payload) {!
context.createProducer()!
.setPriority(1)!
.setTimeToLive(1000)!
.setDeliveryMode(NON_PERSISTENT)!
.send(inboundQueue, payload);!
}
JAX-RS
•

Nova API para consumir serviços REST

•

Processamento assíncrono (cliente e servidor)

•

Filtros e Interceptors
JAX-RS
String movie = ClientBuilder.newClient()!
.target("http://www.movies.com/movie")!
.request(MediaType.TEXT_PLAIN)!
.get(String.class);
JPA
•

Geração do schema da BD

•

Stored Procedures

•

Entity Graphs

•

Unsynchronized Persistence Context
JPA
<persistence-unit name="myPU" transaction-type="JTA">!
<properties>!
<property name="javax.persistence.schemageneration.database.action" value="drop-and-create"/>!
<property name="javax.persistence.schema-generation.create-source"
value="script"/>!
<property name="javax.persistence.schema-generation.drop-source"
value="script"/>!
<property name="javax.persistence.schema-generation.create-scriptsource" value="META-INF/create.sql"/>!
<property name="javax.persistence.schema-generation.drop-scriptsource" value="META-INF/drop.sql"/>!
<property name="javax.persistence.sql-load-script-source"
value="META-INF/load.sql"/>!
</properties>!
</persistence-unit>
JPA
@Entity!
@NamedStoredProcedureQuery(name="top10MoviesProcedure",!
procedureName = "top10Movies")!
public class Movie {}!
!

StoredProcedureQuery query =
entityManager.createNamedStoredProcedureQuery(!
"top10MoviesProcedure");!
query.registerStoredProcedureParameter(1, String.class,
ParameterMode.INOUT);!
query.setParameter(1, "top10");!
query.registerStoredProcedureParameter(2, Integer.class,
ParameterMode.IN);!
query.setParameter(2, 100);!
query.execute();!
query.getOutputParameterValue(1);
JSF
•

Suporte HTML 5

•

@FlowScoped e @ViewScoped

•

Componente para File Upload

•

Navegação de flow por convenção

•

Resource Library Contracts
Outros
•

JTA: @Transactional, @TransactionScoped

•

Servlet: Non-blocking I/O, Segurança

•

CDI: Automáticos para EJB’s e beans anotados (beans.xml
opcional), @Vetoed

•

Interceptors: @Priority, @AroundConstruct

•

EJB: Passivation opcional

•

EL: Lambdas, API isolada

•

Bean Validator: Restrições nos parâmetros dos métodos e retornos
Servidores Certificados
•

Glassfish 4.0

•

Wildfly 8.0.0

•

TMAX JEUS 8
Futuro Java EE 8
•

JCache

•

Logging

•

JSON-B

•

Security

•

Testability

•

Cloud?

•

Modularity?

•

NoSQL?
Materiais
•

Tutorial Java EE 7 - http://docs.oracle.com/javaee/
7/tutorial/doc/home.htm

•

Exemplos Java EE 7 - https://github.com/javaeesamples/javaee7-samples
Obrigado!

Mais conteúdo relacionado

Destaque

Coimbra JUG - 1º Encontro - As novidades do Java 8
Coimbra JUG - 1º Encontro - As novidades do Java 8Coimbra JUG - 1º Encontro - As novidades do Java 8
Coimbra JUG - 1º Encontro - As novidades do Java 8
Roberto Cortez
 
Nueva web educa inflamatoria
Nueva web educa inflamatoriaNueva web educa inflamatoria
Nueva web educa inflamatoria
hinova200
 

Destaque (20)

Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7
 
Java EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real WorldJava EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real World
 
The 5 People in your Organization that grow Legacy Code
The 5 People in your Organization that grow Legacy CodeThe 5 People in your Organization that grow Legacy Code
The 5 People in your Organization that grow Legacy Code
 
The First Contact with Java EE 7
The First Contact with Java EE 7The First Contact with Java EE 7
The First Contact with Java EE 7
 
Java EE 7 meets Java 8
Java EE 7 meets Java 8Java EE 7 meets Java 8
Java EE 7 meets Java 8
 
Coimbra JUG - 1º Encontro - As novidades do Java 8
Coimbra JUG - 1º Encontro - As novidades do Java 8Coimbra JUG - 1º Encontro - As novidades do Java 8
Coimbra JUG - 1º Encontro - As novidades do Java 8
 
Oportunidades de internet y redes sociales para profesionales
Oportunidades de internet y redes sociales para profesionalesOportunidades de internet y redes sociales para profesionales
Oportunidades de internet y redes sociales para profesionales
 
El peru y la sostenibilidad
El peru y la sostenibilidadEl peru y la sostenibilidad
El peru y la sostenibilidad
 
Trabjo de fisio pa
Trabjo de fisio paTrabjo de fisio pa
Trabjo de fisio pa
 
Nueva web educa inflamatoria
Nueva web educa inflamatoriaNueva web educa inflamatoria
Nueva web educa inflamatoria
 
BOPV Parlamento Vasco manifiesta su solidaridad con Pavlo Ibar
BOPV Parlamento Vasco manifiesta su solidaridad con Pavlo IbarBOPV Parlamento Vasco manifiesta su solidaridad con Pavlo Ibar
BOPV Parlamento Vasco manifiesta su solidaridad con Pavlo Ibar
 
Member Services Update, by Vivek Nigam [APNIC 38]
Member Services Update, by Vivek Nigam [APNIC 38]Member Services Update, by Vivek Nigam [APNIC 38]
Member Services Update, by Vivek Nigam [APNIC 38]
 
Dios te Dice
Dios te DiceDios te Dice
Dios te Dice
 
OpenTerms Syntax Issue 02
OpenTerms Syntax Issue 02OpenTerms Syntax Issue 02
OpenTerms Syntax Issue 02
 
3
33
3
 
Christmas 2013
Christmas 2013Christmas 2013
Christmas 2013
 
Biografía de Andrés Barrero Rodríguez
Biografía de Andrés Barrero RodríguezBiografía de Andrés Barrero Rodríguez
Biografía de Andrés Barrero Rodríguez
 
Pirelli F1 Shop: from Social Community to Social Commerce
Pirelli F1 Shop: from Social Community to Social CommercePirelli F1 Shop: from Social Community to Social Commerce
Pirelli F1 Shop: from Social Community to Social Commerce
 
2010 Presentacion Adaptamos Larga Con Fotos
2010 Presentacion Adaptamos Larga Con Fotos2010 Presentacion Adaptamos Larga Con Fotos
2010 Presentacion Adaptamos Larga Con Fotos
 
Sistema de crm de codigo abierto sugarcrm
Sistema de crm de codigo abierto sugarcrm Sistema de crm de codigo abierto sugarcrm
Sistema de crm de codigo abierto sugarcrm
 

Semelhante a Coimbra JUG - 2º Encontro - O primeiro contacto com Java EE 7

AngularJS - a radically different way of building Single Page Apps
AngularJS - a radically different way of building Single Page AppsAngularJS - a radically different way of building Single Page Apps
AngularJS - a radically different way of building Single Page Apps
jivkopetiov
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014
ikanow
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 

Semelhante a Coimbra JUG - 2º Encontro - O primeiro contacto com Java EE 7 (20)

AngularJS - a radically different way of building Single Page Apps
AngularJS - a radically different way of building Single Page AppsAngularJS - a radically different way of building Single Page Apps
AngularJS - a radically different way of building Single Page Apps
 
What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Java EE 7, what's in it for me?
Java EE 7, what's in it for me?
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014
 
Pushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTCPushing the Boundaries of Sencha and HTML5′s WebRTC
Pushing the Boundaries of Sencha and HTML5′s WebRTC
 
Ria with dojo
Ria with dojoRia with dojo
Ria with dojo
 
JavaScript Frameworks for SharePoint add-ins Cambridge
JavaScript Frameworks for SharePoint add-ins CambridgeJavaScript Frameworks for SharePoint add-ins Cambridge
JavaScript Frameworks for SharePoint add-ins Cambridge
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San Francisco
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
Gwtcreatekeynote
GwtcreatekeynoteGwtcreatekeynote
Gwtcreatekeynote
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XING
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
A Beginner's Guide to Client Side Development with Javascript
A Beginner's Guide to Client Side Development with JavascriptA Beginner's Guide to Client Side Development with Javascript
A Beginner's Guide to Client Side Development with Javascript
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
 
Real time event dashboards
Real time event dashboardsReal time event dashboards
Real time event dashboards
 
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
 
Evolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.jsEvolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.js
 
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
 

Mais de Roberto Cortez

Mais de Roberto Cortez (6)

Chasing the RESTful Trinity - Client CLI and Documentation
Chasing the RESTful Trinity - Client CLI and DocumentationChasing the RESTful Trinity - Client CLI and Documentation
Chasing the RESTful Trinity - Client CLI and Documentation
 
Baking a Microservice PI(e)
Baking a Microservice PI(e)Baking a Microservice PI(e)
Baking a Microservice PI(e)
 
GraalVM and MicroProfile - A Polyglot Microservices Solution
GraalVM and MicroProfile - A Polyglot Microservices SolutionGraalVM and MicroProfile - A Polyglot Microservices Solution
GraalVM and MicroProfile - A Polyglot Microservices Solution
 
Deconstructing and Evolving REST Security
Deconstructing and Evolving REST SecurityDeconstructing and Evolving REST Security
Deconstructing and Evolving REST Security
 
Lightweight Enterprise Java With Microprofile
Lightweight Enterprise Java With MicroprofileLightweight Enterprise Java With Microprofile
Lightweight Enterprise Java With Microprofile
 
Cluster your MicroProfile Application using CDI and JCache
Cluster your MicroProfile Application using CDI and JCacheCluster your MicroProfile Application using CDI and JCache
Cluster your MicroProfile Application using CDI and JCache
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Coimbra JUG - 2º Encontro - O primeiro contacto com Java EE 7