SlideShare a Scribd company logo
1 of 18
Download to read offline
TM
Enterprise JavaBeans
(EJBTM) 3.1
Kenneth Saks
Senior Staff Engineer
SUN Microsystems
EJB 3.1 Specification
• Goals
  > Continued focus on ease-of-use
  > New features
• JSR (Java Specification Request) 318
  > Part of Java EE 6
  > Java Persistence API will evolve separately ( JSR 317 )
  > Public Draft Released October 2008
• Caveat – APIs still subject to change


                                                         2
Ease of Use Improvements

•   Optional Local Business Interfaces
•   Simplified Packaging in .war
•   EJB “Lite”
•   Portable Global JNDI Names
•   Simplified Unit Testing




                                         3
Session Bean with “No-interface”
View
 @Stateless
 public class HelloBean {
     public String sayHello(String msg) {
         return “Hello “ + msg;
     }
 }


 // Client of HelloBean no-interface view
 @EJB HelloBean h;
 …
 h.sayHello(“bob”);


                                            4
Web/EJB Application in
    TM
Java EE Platform 5
           foo.ear                          foo.ear

                                    lib/foo_common.jar
  foo_web.war
  WEB-INF/web.xml                   com/acme/Foo.class
  WEB-INF/classes/
   com/acme/FooServlet.class        foo_web.war
  WEB-INF/classes
   com/acme/Foo.class          OR   WEB-INF/web.xml
                                    WEB-INF/classes/
                                     com/acme/FooServlet.class
  foo_ejb.jar
 com/acme/FooBean.class             foo_ejb.jar
 com/acme/Foo.class
                                    com/acme/FooBean.class


                                                                 5
Web/EJB Application in
    TM
Java EE Platform 6
                  foo.war

          WEB-INF/classes/
           com/acme/FooServlet.class

          WEB-INF/classes/
           com/acme/FooBean.class




                                       6
EJB “Lite” vs. Full EJB 3.1 API
EJB Lite                      Full = Lite + :
• Local Session Beans         • Message Driven Beans
• Annotations / ejb-jar.xml   • EJB Web Service
• CMT / BMT                     Endpoints
• Declarative Security        • RMI-IIOP
                                Interoperability
• Interceptors
                              • 2.x / 3.x Remote view
                              • 2.x Local view
                              • Timer Service
                              • CMP / BMP             7
Portable Global JNDI Names
 “java:global[/<app-name>]/<module-
 name>/<bean-name>”

 // Client in a Java EE container
 @EJB(mappedName=
      ”java:global/hello/HelloBean”)
 Hello hello;


 // Client in a Java SE environment
 Hello hello = (Hello) new InitialContext()
     lookup(“java:global/hello/HelloBean”);

                                         8
Enhanced Testing Support
 public class BankTester {

   public static void main(String[] args) {

       EJBContainer container =
          EJBContainer.createEJBContainer();

       // Acquire EJB component reference
       BankBean bank = (BankBean)container.getContext().
          lookup(“java:global/bank/BankBean”);

       testBank(bank);
       ...
       container.close();
   }

                                                   9
Example : Embeddable API (cont.)
 % java -classpath bankClient.jar :
                   bank.jar :
                   javaee.jar :
                   <vendor_rt>.jar

                   com.acme.BankTester




                                         10
New Features

•   Singletons
•   Application startup / shutdown callbacks
•   Calendar-based timer expressions
•   Automatic timer creation
•   Simple Asynchrony




                                               11
Simple Singleton
 @Singleton
 public class SharedBean {

     private SharedData shared;

     @PostConstruct private void init() {
       shared = ...;
     }

     public int getXYZ() {
       return shared.xyz;
     }

 }


                                            12
Singleton Client
 @Stateless
 public class FooBean {

     @EJB
     private SharedBean shared;

     public void foo() {
       int xyz = shared.getXYZ();
       ...
     }

 }




                                    13
Automatic Timer Creation
 @Stateless
 public class BankBean {

     @PersistenceContext EntityManager accountDB;
     @Resource javax.mail.Session mailSession;

     // Callback the 1st of each month at 8 a.m.

     @Schedule(hour=”8”, dayOfMonth=”1”)
     void sendMonthlyBankStatements() {
       ...
     }

 }




                                                    14
Simple Asynchrony
 @Stateless public class DocBean {

     @Resource SessionContext ctx;

     public void processDocument(Document document) {
       DocBean me = ctx.getBusinessObject(DocBean.class);
       me.doAnalysisA(document);
       me.doAnalysisB(document);
     }

     @Asynchronous public void doAnalysisA(Document d) {...}

     @Asynchronous public void doAnalysisB(Document d) {...}

 }


                                                            15
Asynchronous Operation Results --
Client
 @EJB Processor processor;

 Task task = new Task(...);

 Future<int> computeTask = processor.compute(task);

 ...

 int result = computeTask.get();




                                                 16
EJB 3.1 and Glassfish V3 Prelude
• Glassfish V3 is reference implementation for EJB 3.1
• V3 Prelude has preview implementations of these
  EJB 3.1 features :
  >   No-interface view
  >   .war packaging of stateless session beans
  >   Singletons
  >   Portable Global JNDI Names
• EJB 3.1 preview module available from Update Tool


                                                  17
For More Information
• JSR 318 Home : http://jcp.org/en/jsr/detail?id=318
  > Send comments to jsr-318-comments@jcp.org
• Blog : http://blogs.sun.com/kensaks/
• Reference Implementation : GlassFish project V3
  > http://glassfish.dev.java.net
  > ejb@glassfish.dev.java.net




                                                    18

More Related Content

What's hot

Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)Chitrank Dixit
 
Jsp interview questions by java training center
Jsp interview questions by java training centerJsp interview questions by java training center
Jsp interview questions by java training centerMaheshit Jtc
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the CloudMarkus Eisele
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)Manisha Keim
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...ddrschiw
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technologyTanmoy Barman
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSINGAaqib Hussain
 
Jsp elements
Jsp elementsJsp elements
Jsp elementsNuha Noor
 

What's hot (20)

Jsp chapter 1
Jsp chapter 1Jsp chapter 1
Jsp chapter 1
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)
 
Jsp interview questions by java training center
Jsp interview questions by java training centerJsp interview questions by java training center
Jsp interview questions by java training center
 
Jsp Slides
Jsp SlidesJsp Slides
Jsp Slides
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the Cloud
 
Wt unit 3
Wt unit 3 Wt unit 3
Wt unit 3
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Java server pages
Java server pagesJava server pages
Java server pages
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
 
JSP Directives
JSP DirectivesJSP Directives
JSP Directives
 
Jsp elements
Jsp elementsJsp elements
Jsp elements
 
Jsp presentation
Jsp presentationJsp presentation
Jsp presentation
 
Jsp element
Jsp elementJsp element
Jsp element
 
Being agile with modern Java
Being agile with modern JavaBeing agile with modern Java
Being agile with modern Java
 

Similar to EJB 3.1 and GlassFish v3 Prelude

GlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseGlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseLudovic Champenois
 
What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?Sanjeeb Sahoo
 
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010Arun Gupta
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical OverviewSvetlin Nakov
 
EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)Montreal JUG
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewEugene Bogaart
 
Session 4 Tp4
Session 4 Tp4Session 4 Tp4
Session 4 Tp4phanleson
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise Group
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionArun Gupta
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerArun Gupta
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGArun Gupta
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 

Similar to EJB 3.1 and GlassFish v3 Prelude (20)

GlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseGlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for Eclipse
 
What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?
 
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
 
J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
Seam Glassfish Perspective
Seam Glassfish PerspectiveSeam Glassfish Perspective
Seam Glassfish Perspective
 
EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
Session 4 Tp4
Session 4 Tp4Session 4 Tp4
Session 4 Tp4
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 
JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 training
 
Glass Fishv3 March2010
Glass Fishv3 March2010Glass Fishv3 March2010
Glass Fishv3 March2010
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More Power
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
EJB .
EJB .EJB .
EJB .
 
Enterprise JavaBeans(EJB)
Enterprise JavaBeans(EJB)Enterprise JavaBeans(EJB)
Enterprise JavaBeans(EJB)
 

More from Eduardo Pelegri-Llopart

Pelegri Desarrollando en una nueva era de software
Pelegri   Desarrollando en una nueva era de software Pelegri   Desarrollando en una nueva era de software
Pelegri Desarrollando en una nueva era de software Eduardo Pelegri-Llopart
 
Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Eduardo Pelegri-Llopart
 
The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015Eduardo Pelegri-Llopart
 
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...Eduardo Pelegri-Llopart
 
What is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouWhat is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouEduardo Pelegri-Llopart
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEduardo Pelegri-Llopart
 

More from Eduardo Pelegri-Llopart (20)

Juggling at freenome
Juggling   at freenomeJuggling   at freenome
Juggling at freenome
 
Csumb capstone-fall2016
Csumb capstone-fall2016Csumb capstone-fall2016
Csumb capstone-fall2016
 
Digital activitymanagement
Digital activitymanagementDigital activitymanagement
Digital activitymanagement
 
Progress next iot_pelegri
Progress next iot_pelegriProgress next iot_pelegri
Progress next iot_pelegri
 
Pelegri Desarrollando en una nueva era de software
Pelegri   Desarrollando en una nueva era de software Pelegri   Desarrollando en una nueva era de software
Pelegri Desarrollando en una nueva era de software
 
Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015
 
The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015
 
IOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ ProgressIOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ Progress
 
Node.js as an IOT Bridge
Node.js as an IOT BridgeNode.js as an IOT Bridge
Node.js as an IOT Bridge
 
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
 
What is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouWhat is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts You
 
Community Update 25 Mar2010 - English
Community Update 25 Mar2010 - EnglishCommunity Update 25 Mar2010 - English
Community Update 25 Mar2010 - English
 
GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010
 
Glass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.MiniGlass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.Mini
 
Virtual Box Aquarium May09
Virtual Box Aquarium May09Virtual Box Aquarium May09
Virtual Box Aquarium May09
 
Introduction To Web Beans
Introduction To Web BeansIntroduction To Web Beans
Introduction To Web Beans
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage Patterns
 
OpenDS Primer Aquarium
OpenDS Primer AquariumOpenDS Primer Aquarium
OpenDS Primer Aquarium
 
Fuji Overview
Fuji OverviewFuji Overview
Fuji Overview
 
Nuxeo 5.2 Glassfish
Nuxeo 5.2 GlassfishNuxeo 5.2 Glassfish
Nuxeo 5.2 Glassfish
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

EJB 3.1 and GlassFish v3 Prelude

  • 1. TM Enterprise JavaBeans (EJBTM) 3.1 Kenneth Saks Senior Staff Engineer SUN Microsystems
  • 2. EJB 3.1 Specification • Goals > Continued focus on ease-of-use > New features • JSR (Java Specification Request) 318 > Part of Java EE 6 > Java Persistence API will evolve separately ( JSR 317 ) > Public Draft Released October 2008 • Caveat – APIs still subject to change 2
  • 3. Ease of Use Improvements • Optional Local Business Interfaces • Simplified Packaging in .war • EJB “Lite” • Portable Global JNDI Names • Simplified Unit Testing 3
  • 4. Session Bean with “No-interface” View @Stateless public class HelloBean { public String sayHello(String msg) { return “Hello “ + msg; } } // Client of HelloBean no-interface view @EJB HelloBean h; … h.sayHello(“bob”); 4
  • 5. Web/EJB Application in TM Java EE Platform 5 foo.ear foo.ear lib/foo_common.jar foo_web.war WEB-INF/web.xml com/acme/Foo.class WEB-INF/classes/ com/acme/FooServlet.class foo_web.war WEB-INF/classes com/acme/Foo.class OR WEB-INF/web.xml WEB-INF/classes/ com/acme/FooServlet.class foo_ejb.jar com/acme/FooBean.class foo_ejb.jar com/acme/Foo.class com/acme/FooBean.class 5
  • 6. Web/EJB Application in TM Java EE Platform 6 foo.war WEB-INF/classes/ com/acme/FooServlet.class WEB-INF/classes/ com/acme/FooBean.class 6
  • 7. EJB “Lite” vs. Full EJB 3.1 API EJB Lite Full = Lite + : • Local Session Beans • Message Driven Beans • Annotations / ejb-jar.xml • EJB Web Service • CMT / BMT Endpoints • Declarative Security • RMI-IIOP Interoperability • Interceptors • 2.x / 3.x Remote view • 2.x Local view • Timer Service • CMP / BMP 7
  • 8. Portable Global JNDI Names “java:global[/<app-name>]/<module- name>/<bean-name>” // Client in a Java EE container @EJB(mappedName= ”java:global/hello/HelloBean”) Hello hello; // Client in a Java SE environment Hello hello = (Hello) new InitialContext() lookup(“java:global/hello/HelloBean”); 8
  • 9. Enhanced Testing Support public class BankTester { public static void main(String[] args) { EJBContainer container = EJBContainer.createEJBContainer(); // Acquire EJB component reference BankBean bank = (BankBean)container.getContext(). lookup(“java:global/bank/BankBean”); testBank(bank); ... container.close(); } 9
  • 10. Example : Embeddable API (cont.) % java -classpath bankClient.jar : bank.jar : javaee.jar : <vendor_rt>.jar com.acme.BankTester 10
  • 11. New Features • Singletons • Application startup / shutdown callbacks • Calendar-based timer expressions • Automatic timer creation • Simple Asynchrony 11
  • 12. Simple Singleton @Singleton public class SharedBean { private SharedData shared; @PostConstruct private void init() { shared = ...; } public int getXYZ() { return shared.xyz; } } 12
  • 13. Singleton Client @Stateless public class FooBean { @EJB private SharedBean shared; public void foo() { int xyz = shared.getXYZ(); ... } } 13
  • 14. Automatic Timer Creation @Stateless public class BankBean { @PersistenceContext EntityManager accountDB; @Resource javax.mail.Session mailSession; // Callback the 1st of each month at 8 a.m. @Schedule(hour=”8”, dayOfMonth=”1”) void sendMonthlyBankStatements() { ... } } 14
  • 15. Simple Asynchrony @Stateless public class DocBean { @Resource SessionContext ctx; public void processDocument(Document document) { DocBean me = ctx.getBusinessObject(DocBean.class); me.doAnalysisA(document); me.doAnalysisB(document); } @Asynchronous public void doAnalysisA(Document d) {...} @Asynchronous public void doAnalysisB(Document d) {...} } 15
  • 16. Asynchronous Operation Results -- Client @EJB Processor processor; Task task = new Task(...); Future<int> computeTask = processor.compute(task); ... int result = computeTask.get(); 16
  • 17. EJB 3.1 and Glassfish V3 Prelude • Glassfish V3 is reference implementation for EJB 3.1 • V3 Prelude has preview implementations of these EJB 3.1 features : > No-interface view > .war packaging of stateless session beans > Singletons > Portable Global JNDI Names • EJB 3.1 preview module available from Update Tool 17
  • 18. For More Information • JSR 318 Home : http://jcp.org/en/jsr/detail?id=318 > Send comments to jsr-318-comments@jcp.org • Blog : http://blogs.sun.com/kensaks/ • Reference Implementation : GlassFish project V3 > http://glassfish.dev.java.net > ejb@glassfish.dev.java.net 18