Java EE 7 Workshop

Download Report

Transcript Java EE 7 Workshop

Java EE 7
The new features of the upcoming Enterprise Edition
S
Hello, I‘m Marcus
S Diploma in Computer Science 2002
University of Tuebingen
S Freelancing Software Architect
specialized in Java EE
S worked for serveral large companies
in Germany like Daimler (Mercedes),
Commerzbank and Deutsche Bahn
Our Agenda
• Overview of the new features
• Example application
• Dig into the code
Damn it, we need a new main
theme!
S Originally: PaaS (Cloud and multi-tenancy)
S No Cloud
S No Multi-tenancy
S But Productivity and HTML5
S Due date: Q2 2013
JSF 2.2
S renders HTML5
S <h:inputText value="#{bean.value}" >
<f:passThroughAttribute name="placeholder"
value="Enter text" />
</h:inputText>
S CDI ViewScope / Managed Beans deprecated
S Faces Flow
How to use the new features: http://www.marcusschiesser.de/2013/01/how-to-usejsf-2-2-with-jboss-7-1
CDI 1.1, EJB 3.2 & JPA 2.1
S @Transactional-Annotation
S But: Still no annotations for EJB Security
S CDI: Priority ordering of Interceptors and Decorators
S JPA: Stored Procedures and DB-Functions in JPQL
Method level validation
S Part of Bean Validation 1.1
@NotNull
public MyObject createMyObject(
@Size(min=5, max=40) String name,
@DecimalMin(value="1.00") Double value,
@Pattern(regexp="\\d{8}") String code) {...
JMS 2.0
@Inject
@JMSConnectionFactory("jms/connectionFactory")
private JMSContext context;
@Resource(mappedName = "jms/inboundQueue")
private Queue inboundQueue;
public void sendMessage(String payload) {
context.send(inboundQueue, payload);
}
Some new APIs
S Java API for JSON Processing (JSR 353)
S Batch Applications (JSR 352)
Things we‘ll cover
S Java API for WebSockets (JSR 356)
S Bidirectional communication
S Directly over TCP
S No HTTP, only for Handshake via HTTP Upgrade
S JAX-RS 2.0
S finally a REST-Client
Sample app „MyAktion“
Our sample application allows organizers of nonprofit
campaigns to create online fundraising forms for their projects.
The organizer can embed these forms into their own website.
This allows the organizer to raise money for his campaign.
Each organizer can create forms for multiple campaigns.
The application takes care of the generation of the forms and
the management of the campaigns and donations.
Domain classes
class Fachklassen
Aktion
Organisator
-
-
E-Mail :String
Nachname :String
Passwort :String
Vorname :String
Spende
Name :String
Spendenbetrag :double
Spendenziel :double
gespendet wurde
betreibt
1
-
1
*
*
Betrag :double
Quittung erwünscht :boolean
Spendername :String
«enum»
- Status :Status = IN_BEARBEITUNG
1
1
sendet Geld von
empfängt Geld auf
1
1
Konto
-
BLZ :String
Konto-Nr :String
Name :String
Name der Bank :String
«enumeration»
Status
UEBERWIESEN {readOnly}
IN_BEARBEITUNG {readOnly}
Let‘s see...
But now some JEE 7 please…
Communication diagram
sd Kommunikationsarchitektur
Websocket-fähiger
Brow ser
Websocket
1: Aktion wählen()
Glassfish Jav a EE 7
my-aktion-monitor
1.2: Spenden der Aktion übertragen()
2.2: Neue Spende übertragen()
REST
SOAP
2.1: Neue Spende übertragen()
1.1: Spenden einer Aktion abfragen()
Brow ser oder
REST-Client
REST
2: Geld spenden()
JBoss Jav a EE 6
my-aktion
Questions?
Please ask and don‘t hesitate to contact me
S Name: Marcus Schiesser
S Blog: www.marcusschiesser.de
S Email: [email protected]
S Code: www.bitbucket.org/mschiesser/my-aktion