Java TechnologyJava TechnologyCommunity Development: Community Development: JDK Collaboration JDK Collaboration (Peabody) and GlassFish(Peabody) and GlassFish
Rima Patel SriganeshRima Patel SriganeshStaff EngineerStaff EngineerSun Microsystems, Inc.Sun Microsystems, [email protected]@sun.com
Sun and Open * Computing java.net The Future of Java SE - Mustang The Future of Java EE - GlassFish Resources, Summary, and Call For
Action
Agenda
SSun and Open * computingun and Open * computing
Sun Proprietary/Confidential: Internal Use Only4
Open * Computing
“Innovation Happens Elsewhere!” -Bill Joy
Sun Proprietary/Confidential: Internal Use Only5
Massive Community Growth
• Java.sun.com• Sun Developer Network (SDN)• NetBeans.org• Java.net
Sun Proprietary/Confidential: Internal Use Only6
Java.sun.com
• The home for Java developers> 130M+ page views a month> 1.2M+ J2EE Application Server downloads> 400K+ J2SE SDK downloads a month> 1M+ Wireless Toolkit downloads> 68k+ China eCommunity members
Sun Proprietary/Confidential: Internal Use Only7
Sun Developer Network www.sun.com/developers
● Content– Developer portal– Cool stuff– White papers– Code samples
● Training– Classes– Seminars– Webinars
● Support– Knowledge base– Forums (5000+ active) – User Groups (537 and growing)
● Software – Electronic download– Quarterly freeware mailing
● 769,000 unique registrations● 112,000 members of SDN Mobility Program
Sun Proprietary/Confidential: Internal Use Only8
NetBeans.org
● Center for Innovation, News and Support
● 3.5 Million Downloads of NetBeans tool
● 100 add-ons and extensions● 27,000 registered users● Visitors from 160 countries● Active Community supporting
developers in English, French, Russian, Japanese, and simplified Chinese
Sun Proprietary/Confidential: Internal Use Only9
● 60 million downloads and growing● 100,000 community members● Over 40 community localisations● 15 local-language mail lists for self-help● Community ports to virtually every known platform● Archival document formats!● Conversion to and from Microsoft Office formats● No virus problems● Open APIs● StarOffice has enterprise-level support & warranty
OpenOffice.org
Java.netJava.net
Sun Proprietary/Confidential: Internal Use Only11
• Shared vision, goals• Agreed sharing
(license)• Agreed relationships
(governance)• Committed members
Not Just Open Source; One Size Doesn't Fit All!
Building Open Communities
Open Communities
Access toTechnologyand Ideas
OpenDevelopment
BroadParticipation
InclusiveProcess
Sun Proprietary/Confidential: Internal Use Only12
Java.net• Goal is to stimulate the expansion of Java by
building a web-based community where developers, educators, researchers, and others to learn, teach, and collaborate
• The Single Source for Java Technology Collaboration> Unifying Community of other Java communities> 50K+ members> 917 Projects
Sun Proprietary/Confidential: Internal Use Only13
Java Community (diverse and rich)
JCP determineschange to Java Platform
Valu
e C
hain
applications
solutions servicesproducts
CoreJava
java.sun.com● downloads● information
End-use “consumers” ofJava Technology
Disparate onlineresources, tools,
ISV sites, code, etc.
ContentSites
Opensourcetools
CodeGaming
Community
StandardsBody
Academia/Research ISV
Community
Sun Proprietary/Confidential: Internal Use Only14
•Tools•Code
•Content
•Opensource
JCP determineschange to Java Platform
java.net willfacilitate multipleJava communities,with collaboration tools for development
comm
unity Acom
munity B
comm
unity Ccom
munity D co
mm
unity
EFe
dera
ted
com
mun
ity F
Fede
rate
dco
mm
unity
GFe
dera
ted
com
mun
ity H
CoreJava
java.sun.com● downloads● information
End-use “consumers” ofJava Technology
applicationssolutions services
products
Valu
e C
hain
java.net (collaboration is key)
Sun Proprietary/Confidential: Internal Use Only15
Sun Proprietary/Confidential: Internal Use Only16
Key java.net FeaturesCollaboration
WeblogsWikis – Collaborative Web PagesMailing ListsForums – Project/Community Discussion Forums
InformationRSS – Content Syndication NewsfeedsNews – Relevant Project/Community InformationJavapedia (an encyclopedia of everything Java related)
DevelopmentCVS Source Trees – Source Repository, VersioningIssuezilla – Bugs & Issues TrackingHelp Wanted – to match projects and developers
Sun Proprietary/Confidential: Internal Use Only17
Communities on java.netJava Web Services & XMLJava DesktopJava ToolsJava Patterns...
Mustang (Java SE 6.0)GlassFish (Java EE 5.0) Many more ...
Java CommunicationsJAINJava Games...
NetBeansJiniProject JXTALinux...
Sun Proprietary/Confidential: Internal Use Only18
The Future of Java SE The Future of Java SE MustangMustang● JDK Collaboration Project ● How to Get Started How to Get Started ● How to Build MustangHow to Build Mustang● How to Submit Bug FixesHow to Submit Bug Fixes● New features in MustangNew features in Mustang
Sun Proprietary/Confidential: Internal Use Only20
1.4.0 Merlin 2002/2/131.4.1 Hopper 2002/10/161.4.2 Mantis 2003/5/2915.0 Tiger 2004/9/301.6.0 Mustang 2006/Q31.7.0 Dolphin 2008/Q1
2005 JavaOneSM Conference | Session 7264 | 21
Sun Proprietary/Confidential: Internal Use Only22
Why Make Java Technology More Transparent?
• We listened• Developer mindshare is vital• Build grassroots support• Win the competition for
developer attention• Channel enthusiasm for
community development
...all while retaining compatibility
Sun Proprietary/Confidential: Internal Use Only23
What Java Developers Ask For:
❑
Preserve the Java technology
compatibility promise❑
Fix bugs themselves❑
Contribute fixes and features❑
See the source code
Sun Proprietary/Confidential: Internal Use Only24
Licenses for JDK
• Java Research License (JRL) • Java Internal Use License (JIUL) • Java Distribution License (JDL)
Sun Proprietary/Confidential: Internal Use Only25
Java Research License (JRL)• For academics, researchers,
the curious, contributors• Greatly simplified:
> Simple 2-pager, click-through> Allows very broad use for research> “Residual knowledge” does not prevent
non-Sun work> No copyright or patent rights> No compatibility, TCK requirements
• No commercial use, redistribution• Contribution agreement for giving
code back – must be compatible• JCP remains steward of Java APIs
http://java.net/jrl.html
Sun Proprietary/Confidential: Internal Use Only26
• Enterprise customers can deploy their own bugfixes> Sun can enforce compatibility but doesn't
require running TCK> Honor system - “At the customers own risk”> Some guidelines: no API changes
• For internal use inside their 4 walls > Includes software powering public websites> Excludes external distribution
• Allows sharing of bugfixes> Encourages but doesn't require returning fixes
• All about peace of mind
Java Internal Use License (JIUL)
Sun Proprietary/Confidential: Internal Use Only27
Java Distribution License (JDL)• Commercial redistribution
license> Principal successor to SCSL> Simplified (more readable)
commercial use license• Includes main commercial
terms from SCSL> Requires passing the TCK> Includes TCK license> Optional support agreement> Requires trademark
agreement• No surprises
Sun Proprietary/Confidential: Internal Use Only28
What Java Developers Get With JDK Collaboration
❑
Preserve compatibility: must
pass TCK, JDL for commercial
use, redistribution
❑
Fix bugs: JIUL license❑
Contribute: jdk.contributor role❑
See: source code posted, JRL
❑ ✔❑ ✔
❑ ✔❑ ✔
Sun Proprietary/Confidential: Internal Use Only29
Contributions Integrated
6207243: Non-varargs warnings during Andy Trippbuild, should be cleaned up b34
6257449: Concurrency bug in sound Jesse SterrUlawCodec with tempBuffer b34
4238932: A JTextField in gridBagLayout Swen Meierdoes not properly set MinimumSize b42
THANK YOU!
Sun Proprietary/Confidential: Internal Use Only30
Contributions In Process
4094886: java.io: Need a way to convert Readers into InputStreams4306897: Add java.util.Arrays.binarySearch(a, key, fromIndex, toIndex)4346256: Provide an AbstractTreeModel for the TreeModel hierarchy5015163: String merge/join facility that would be the inverse of
java.lang.String.split()5025230: Creating thread local variables from within ThreadLocal.initialValue()6176992: Add support to java.lang.Class for wrapper type conversions6182942: JButton.isEnabled() return false however the button is enabled6197726: IdentityHashMap.EntrySet.toArray(T[] a) is incorrectly implemented6205522: Javadoc warnings for GregorianCalendar6232484: ArrayList made from IdentityHashMap.entrySet() fails to create properly6245410: javax.swing.text.html.CSS.Attribute: BACKGROUND_POSITION,
TEXT_DECORATION is not w3c spec compliant6246565: File descriptor leak when using DatagramChannel.socket()6248507: AbstractStringBuilder.replace does not handle count < start < end6254531: ThreadLocal leak when value references ThreadLocal
Sun Proprietary/Confidential: Internal Use Only31
Contributions In Process
4094886: java.io: Need a way to convert Readers into InputStreams4306897: Add java.util.Arrays.binarySearch(a, key, fromIndex, toIndex)4346256: Provide an AbstractTreeModel for the TreeModel hierarchy5015163: String merge/join facility that would be the inverse of
java.lang.String.split()5025230: Creating thread local variables from within ThreadLocal.initialValue()6176992: Add support to java.lang.Class for wrapper type conversions6182942: JButton.isEnabled() return false however the button is enabled6197726: IdentityHashMap.EntrySet.toArray(T[] a) is incorrectly implemented6205522: Javadoc warnings for GregorianCalendar6232484: ArrayList made from IdentityHashMap.entrySet() fails to create properly6245410: javax.swing.text.html.CSS.Attribute: BACKGROUND_POSITION,
TEXT_DECORATION is not w3c spec compliant6246565: File descriptor leak when using DatagramChannel.socket()6248507: AbstractStringBuilder.replace does not handle count < start < end6254531: ThreadLocal leak when value references ThreadLocalXXXXXX: YOUR FAVORITE BUG OR RFE HERE
2005 JavaOneSM Conference | Session 7264 | 32
http://mustang.dev.java.net
The Future of Java SE The Future of Java SE MustangMustang● JDK Collaboration ProjectJDK Collaboration Project ● How to Get StartedHow to Get Started ● How to Build MustangHow to Build Mustang● How to Submit Bug FixesHow to Submit Bug Fixes● New features in MustangNew features in Mustang
Sun Proprietary/Confidential: Internal Use Only34
How to Get Started1) Sign up on java.net, click thru JRL, sign, return contribution agreement2) Download, explore, get it to build on your system3) Check bug parade or try fixing that bug you really hate4) Start simple, pick something self-contained,
learn the process5) Submit your fix:
https://jdk-collaboration.dev.java.net/6) Work with the Sun engineer on that module to
test, validate, and integrate your fix7) Feel good about what you've done!
Some other things to try: test your app on Mustang, use the source to understand and optimize, check out the lab, post to forums, use code
in research/academia
Sun Proprietary/Confidential: Internal Use Only35
“How To” Tutorials People Wrote • Building JDK 6.0 on Windows XP
> http://blogs.sun.com/roller/page/kto?entry=building_the_jdk_6_0• Java and "Open Source": Good News and Bad News
- By Andy Tripp> http://www.javalobby.org/articles/fixing-the-jdk/
The Future of Java SE The Future of Java SE MustangMustang● JDK Collaboration ProjectJDK Collaboration Project ● How to Get Started How to Get Started ● How to Build MustangHow to Build Mustang● How to Submit Bug FixesHow to Submit Bug Fixes● New features in MustangNew features in Mustang
Sun Proprietary/Confidential: Internal Use Only37
Introduction
• Machine setup (one time procedure)• Source trees• Binary files needed• Common build procedures• Common build problems
Sun Proprietary/Confidential: Internal Use Only38
Machine Setup: Common Needs• Disk Space Needs: 2G minimum• CPU/RAM considerations: 650MHz 512Mb
minimum• Common Build Tools Needed
> ZIP & UNZIP> GNU Make (gnumake)
• Unix tools (On Windows, use mks or cygwin)• Native compilers• Misc SDK's and/or components
Sun Proprietary/Confidential: Internal Use Only39
Machine Setup: Linux• Linux
Verifying that your release of Linux can successfully build; might take some time due to compatibility problems with the C/C++ runtime library, i.e. It's not obvious which Linux's are compatible.
> X86 – Linux RedHat A.S. 2.1 Update 1> Motif needed
Sun Proprietary/Confidential: Internal Use Only40
Machine Setup: Windows• Windows (most complicated setup)
> Compilers>Visual Studio .NET Professional 2003
– Contains newer Platform SDK– Contains newer unicows.lib
> DirectX SDK 9.0 (or 7.0 but hard to find)> MKS or CYGWIN> UNICOWS.DLL
Sun Proprietary/Confidential: Internal Use Only41
Machine Setup: Solaris• Solaris
> Compilers>Sun Studio 10
> AMD64 must build using Solaris 10> Builds on Solaris N will work on Solaris N+i
>Where i = 0, 1, 2, ...
Sun Proprietary/Confidential: Internal Use Only42
Install Mustang source and binary
1. JDK 6.0 Binary Snapshot Release> http://download.java.net/jdk6/binaries/> jdk-6_0-ea-bin-b53-solaris-sparc-22_sep_2005.sh> Set environment variable MUSTANG_BIN
2. JDK 6.0 Source Snapshot Release> http://download.java.net/jdk6/> Set environment variable MUSTANG_SRC > jdk-6_0-ea-src-b53-jrl-22_sep_2005.jar
3. Ant 1.6.2 or later> Set ANT_HOME
4. Nebeans 4.1> Set NETBEANS_HOME
Sun Proprietary/Confidential: Internal Use Only43
Source Trees• Control (~30 files)
> Contains the makefiles used to perform complete builds of the product
• HotSpot (~3,000 files)> Contains the HotSpot VM C++ source and the Serviceability
Agent Java source• J2SE (~30,000 files)
> Contains the makefiles and Java source to everything in rt.jar and tools.jar, plus more
> Also includes C and C++ source for many of the native JNI libraries
Sun Proprietary/Confidential: Internal Use Only44
Source Trees• Motif (~500 files)
> Contains the source to the Motif libraries, needed on Linux• Deploy (~2,000 files)
> Contains the makefiles and sources for the Java plugins• Install (~500 files)
> Contains the makefiles and source to build the install bundles (not normally needed by developers)
Sun Proprietary/Confidential: Internal Use Only45
Binary Files Needed• Binary download for source area (fonts misc extra
files), this should be overlayed over source download tree.
• BOOTDIR (previous release of JDK 5.0)• Built Mustang (for imports, can also serve as
BOOTDIR)• Mozilla Headers (needed to build plugin)
Sun Proprietary/Confidential: Internal Use Only46
Common Build Procedures• Control Builds
> Examples:>Builds complete product:
gnumake SKIP_FASTDEBUG_BUILD=true scsl>Could Skip hotspot build (importing it in from a previous
build)gnumake BUILD_HOTSPOT=false scsl
Sun Proprietary/Confidential: Internal Use Only47
Common Build Problems• Missing files
> Missing font files (added sanity check for this)• Native compiler unknowns• Specific OS version issues (SP's patches)• Where it's built determines where it can run• Clean/Clobber build issues
(INCREMENTAL_BUILD=true)
Sun Proprietary/Confidential: Internal Use Only48
Issues• Machine setup needs simplification, Windows in
particular• Stick with free or freely available build tools• Build variations need to be allowed and
documented (ANT, subset builds, etc.)• Relax sanity error checks where we can• Add sanity checks as encountered
The Future of Java SE The Future of Java SE MustangMustang● JDK Collaboration ProjectJDK Collaboration Project ● How to Get Started How to Get Started ● How to Build MustangHow to Build Mustang● How to Submit Bug FixesHow to Submit Bug Fixes● New features in MustangNew features in Mustang
Sun Proprietary/Confidential: Internal Use Only50
Sun Proprietary/Confidential: Internal Use Only51
The Future of Java SE The Future of Java SE MustangMustang● JDK Collaboration Project JDK Collaboration Project ● How to Get Started How to Get Started ● How to Build MustangHow to Build Mustang● How to Submit Bug FixesHow to Submit Bug Fixes● New features in MustangNew features in Mustang
Sun Proprietary/Confidential: Internal Use Only53
Approved Mustang Component JSRs202: Class File Update199: Compiler API269: Annotation Processors260: Javadoc™ Tag Update Ease of Development221: JDBC™ 4.0223: Scripting105: XML Digital Signature173: Streaming API for XML XML222: JAXB 2.0250: Common Annotations181: WS Metadata Web Services224: JAX-WS 2.0
The Future of Java EE The Future of Java EE GlassfishGlassfish●GlassFish OverviewGlassFish Overview●Building GlassFishBuilding GlassFish●Java EE 5 FeaturesJava EE 5 Features●Sun Java System Application ServerSun Java System Application Server●GrizzlyGrizzly
Sun Proprietary/Confidential: Internal Use Only55
What is GlassFish?• Sun's Open Source Application Server Platform
Edition 9> CDDL license> Open processes
• Open access to code and binaries> CVS access to source code> Nightly builds, weekly promoted builds
• Must support Java EE compatibility• Renewed partnership between Sun and the larger
enterprise Java community
Sun Proprietary/Confidential: Internal Use Only56
Common Development and Distribution License(CDDL) - pronounced 'cuddle'
• Takes the well known Mozilla Public License (MPL) and makes it reusable without modification
• Clear, consistent, not burdensome for contributors• As reusable and general as possible• Meets the open source definition of Open Source
Initiative• “...CDDL... Everything is in place for it to work
well.” Linus Torvalds 2/1/05
Sun Proprietary/Confidential: Internal Use Only57
Open Source Definitionwww.opensource.org/docs/definition.php
• Free Redistribution• Source Code (Integrity of the Author's source code)• Derived Works• No Discrimination Against Persons or Groups• No Discrimination Against Fields of Endeavor• Distribution of License
> License Must Not Be Specific to a Product> License Must Not Restrict Other Software> License Must Be Technology-Neutral
Sun Proprietary/Confidential: Internal Use Only58
Open Source Definitionwww.opensource.org/docs/definition.php
• Distribution of License• License Must Not Be Specific to a Product• License Must Not Restrict Other Software• License Must Be Technology-Neutral
Sun Proprietary/Confidential: Internal Use Only59
Why Become Part of the GlassFish Project
• Contribute to world class application server> Involved in the implementation of cutting edge Enterprise
Java, Web Services, SOA standards, Grizzly> Easy build environment
• Access to nightly and promoted builds> New Java EE 5 features > Bug fixes
• Interact with a great group of people inside and outside of Sun
• Fully Participative Community> Already non-Sun committers
Sun Proprietary/Confidential: Internal Use Only60
How to Get Involved• Join discussions on mailing lists and forums• Download and tryout the binary builds • Submit bugs or request for enhancements
> IssueTracker• Submit a patch to fix a bug or provide an
enhancment to issue from> IssueTracker> Web Bugs
• Checkout the GlassFish people page> http://wiki.java.net/bin/view/Projects/GlassFishPeoplePage
Sun Proprietary/Confidential: Internal Use Only61
GlassFish Supports• Supports all platforms
> Solaris, Solarix_X86, Windows, Linux and MacOS• Java Blueprints Solution Catalog EA release runs
on GlassFish> includes design guidelines, code and applications for
JavaServer Faces and AJAX• NetBeans 5.0 support for GlassFish
> You can use NetBeans to develop applications on GlassFish
The Future of Java EE The Future of Java EE GlassfishGlassfish●GlassFish OverviewGlassFish Overview●Building GlassFishBuilding GlassFish●Java EE 5 FeaturesJava EE 5 Features●Sun Java System Application ServerSun Java System Application Server●GrizzlyGrizzly
Sun Proprietary/Confidential: Internal Use Only63
Building GlassFish• Build steps to follow
> Need Maven, JDK 5 and cvs client> Member of GlassFish and accept license> Checkout bootstrap module> Edit property files> Checkout rest of server> Build and configure server
• Full set of instructions on GlassFish site -really quite easy to build> https://glassfish.dev.java.net/public/BuildGlassFish.html
Sun Proprietary/Confidential: Internal Use Only64
Building GlassFish in NetBeans• Build steps to follow
> Need NetBeans 4.1/NetBeans 5.0, Maven, JDK 5 and cvs client> Create the workspace home> Get the GlassFish Source> Set the project properties> Get, configure and test the GlassFish Image
• Over 30 GlassFish NetBeans Projects available• Checkout, open and modify a GlassFish module project
in NetBeans• Full set of instructions on NetBeans site – really quite
easy to build> http://www.netbeans.org/kb/41/glassfish.html
Sun Proprietary/Confidential: Internal Use Only65
Code organization
• Modules - way of dividing up the app server to help navigate the code
• Webtier and most of administration online are up• EJB 3.0 pieces are being added
> Session bean code is in> Persistence code is expected to be added during 10/2005
• Others coming soon> JMS, JavaMail
Sun Proprietary/Confidential: Internal Use Only66
Demo Scenario• Building GlassFish using NetBeans
> http://www.netbeans.org/kb/41/glassfish.html • Checking out a couple of modules for modification
> admin-cli > appserv-docs
• Modify the code > admin-cli
• Rebuild the GlassFish and test the modification
The Future of Java EE The Future of Java EE GlassfishGlassfish●GlassFish OverviewGlassFish Overview●Building GlassFishBuilding GlassFish●Java EE 5 FeaturesJava EE 5 Features●Sun Java System Application ServerSun Java System Application Server●GrizzlyGrizzly
Sun Proprietary/Confidential: Internal Use Only68
Agenda
• Java EE 5 Theme: Ease of development• EJB 3.0
> Ease of development> Persistence> Interoperability with EJB 2.1
• Web services enhancements> JAXB 2.0> JAX-WS 2.0
• JavaSever Faces 1.2
Sun Proprietary/Confidential: Internal Use Only69
The J2EETM Challenge
• J2EE is enormously powerful> The industry standard for robust enterprise apps
• But that power sometimes gets in the way> Too difficult to get started> Even simple apps need boring boilerplate
• Can we keep the power, but make typical development tasks simpler?
• YES: and that is the focus of Java EE 5!
Sun Proprietary/Confidential: Internal Use Only70
Ease of Development Improvements in JavaTM EE 5
• POJO-based programming (Plain Old Java Object)> More freedom, fewer requirements
• Extensive use of annotations> Reduced need for deployment descriptors
• Resource Injection> Inversion of control
• New APIs and frameworks
Sun Proprietary/Confidential: Internal Use Only71
Ease of Development Features in EJB 3.0● Fewer classes and interfaces● Dependency injection● Simple lookups● No required container interfaces● No required deployment descriptor● Simplified persistence● Object/relational mapping
Sun Proprietary/Confidential: Internal Use Only72
JavaTM EE 5 Major Features
• Simplified web services support• More web service standards support• Greatly simplified EJBTM development• New persistence API• Easy web applications with JavaServerTM Faces
Sun Proprietary/Confidential: Internal Use Only73
JavaTM EE 5 • EJB 3.0 (JSR-220)• JavaServer Faces (JSR-252)• StAX (JSR-173)• Web Services Metadata (JSR-181)• New persistence API (JSR-220)• JAXB (JSR-222)• JAX-WS (JSR-224)• Common Annotations (JSR-250)
Sun Proprietary/Confidential: Internal Use Only74
Primary Goal of EJB 3.0
Ease of Development!
Sun Proprietary/Confidential: Internal Use Only75
EJB 2.1
• Very powerful, but complex to use> Too many classes, interfaces > Java Naming and Directory Interface™
(JNDI) API lookups> javax.ejb interfaces> Awkward programming model> Deployment descriptors> Entity bean anti-patterns> ...
Sun Proprietary/Confidential: Internal Use Only76
EJB 3.0 Example@Stateless public class PayrollBean
implements Payroll {
@Resource DataSource empDB;
public void setBenefitsDeduction (int empId, double deduction) { ... Connection conn = empDB.getConnection(); ...}
...}
Sun Proprietary/Confidential: Internal Use Only77
Dependency Injection
• Resources a bean depends upon are injected when bean instance is constructed
• References to:> EJBContext> DataSources> UserTransaction> Environment entries> EntityManager> TimerService> Other EJB beans> ...
Sun Proprietary/Confidential: Internal Use Only78
Dependency Injection
• Annotations> @EJB
> References to EJB business interfaces> References to Home interfaces (when accessing
EJB 2.1 components)> @Resource
> Almost everything else> Number of annotations is simplified from EJB 3 specification
early draft• Injection can also be specified using deployment
descriptor elements
Sun Proprietary/Confidential: Internal Use Only79
Simplified Client View
• Session beans have plain Java language business interface > No more EJB(Local)Home interface > No more EJB(Local)Object interface
• Bean class implements interface> Looks like normal Java class to bean developer
• Looks like normal Java language interface to client (POJI)
Sun Proprietary/Confidential: Internal Use Only80
EJB 3.0 Client Example// EJB 3.0 client view
@EJB ShoppingCart myCart;
...
Collection widgets = myCart.startToShop(“widgets”);
...
Sun Proprietary/Confidential: Internal Use Only81
EJB 3.0
Persistence
Sun Proprietary/Confidential: Internal Use Only82
Persistence Goals of EJB 3.0
• Simplify entity bean programming model• Support for light-weight domain modeling,
including:> Inheritance and polymorphism
• Complete query capabilities• Support for object/relational mapping
specification• Make entity instances usable outside the EJB
container> Remove need for DTOs and similar antipatterns
Sun Proprietary/Confidential: Internal Use Only83
Persistence Model in EJB 3.0
• Entities are simple Java classes> Concrete classes—support use of new> Getter/setter “property” methods or persistent
instance variables> No required bean interfaces> No required callback interfaces
• Usable as “detached” objects in other application tiers> No more need for DTOs (Data Transfer Objects)
Sun Proprietary/Confidential: Internal Use Only84
EntityManager
• EntityManager serves as untyped “home” for entity operations
• Methods for lifecycle operations> Persist, remove, merge, flush, refresh, etc.
• Similar in functionality to Hibernate Session, JDO PersistenceManager, etc.
Sun Proprietary/Confidential: Internal Use Only85
Persistence Focus: O/R Mapping
• Ease-of-use facility for Java developers mapping domain object model to a relational database
• Developer is aware of mapping between DB schema and domain object model> Developer is in control of mapping> Developer can rely on mapping and its semantics
• Mappings may be expressed using metadata annotations or XML> Default mappings provided
Sun Proprietary/Confidential: Internal Use Only86
EJB 3.0
Interoperability with EJB 2.1
Sun Proprietary/Confidential: Internal Use Only87
EJB 3.0/2.x Technology Interoperability and Migration• Applications written to EJB 2.1 specification and
earlier work unchanged in EJB 3.0 containers• Migration path to EJB 3.0 APIs
> New applications can be clients of older beans> Older clients can be clients of new EJB 3.0 components
> Without change to preexisting client view
Sun Proprietary/Confidential: Internal Use Only88
Web Services
JAX-WS and JAXB Integration
Sun Proprietary/Confidential: Internal Use Only89
Java Support for Web Services
• JAX-RPC 2.0 renamed to JAX-WS 2.0 (Java API for XML Web Services)
• Implements new WS stack> JAX-WS 2.0 and JAXB 2.0> Designed for growth (JAX-WSA, others)
• Heavy use of annotations> Ease-of-development> Portability
• Supports Fast Infoset> Better Performance
Sun Proprietary/Confidential: Internal Use Only90
JAX-WS and JAXB Integration
• JAX-WS delegates all data binding to JAXB• Development time
> JAXB generates Java types from a WSDL’s schemas> JAXB generates the WSDL’s schema from Java types
• Runtime> JAX-WS un/marshalls the message (soap:envelope)> JAXB un/marshalls the payload (soap:body child,
soap:header and soapfault elements)> StAX based parser is the handoff
Sun Proprietary/Confidential: Internal Use Only91
Division of LaborDivision of Labor
<soapenv:Envelope xmlns:soapenv=...> <soapenv:Header> <ns1:age xmlns:ns1="http://foo">33</ns1:name> </soapenv:Header> <soapenv:Body> <ans:getRecord xmlns:ans="http://echo.org/"> <first>Fred</first> <last>Jones</last> </ans:getRecord> </soapenv:Body></soapenv:Envelope>
JAXBJAX-WS
Sun Proprietary/Confidential: Internal Use Only92
Web Services
JAXB 2.0
Sun Proprietary/Confidential: Internal Use Only93
JAXB 2.0 Is Now Bi-Directional
• 1.0: Schema Java only> JAXB is for compiling schema> Don’t touch the generated code
• 2.0: Java XML + schema compiler> JAXB is about persisting POJOs to XML> Annotations for controlling XML representation> Modify the generated code to suit your taste
Sun Proprietary/Confidential: Internal Use Only94
Web Services
JAX-WS 2.0
Sun Proprietary/Confidential: Internal Use Only95
JAX-RPC 1.1 RI Issues
• Supports only SOAP 1.1over HTTP• Limited XML Schema support• Little Control of Mapping Java and WSDL/
XML Schema• Large non-portable applications• Large runtime• Web Service development is too complex• Servlet container is required
Sun Proprietary/Confidential: Internal Use Only96
JAX-WS 2.0 RI
• New Architecture• Improved Data Binding• Annotations • Java SE 6 Endpoints
Sun Proprietary/Confidential: Internal Use Only97
JAX-WS 2.0 New Architecture
• Multiple protocols> SOAP 1.1, SOAP 1.2, XML
• Multiple encodings > XML, MTOM/XOP, FAST Infoset (Binary XML)
• Multiple transports > HTTP> Others to be added in future releases
Sun Proprietary/Confidential: Internal Use Only98
Improved Data Binding
• JAX-RPC 1.1 Issues> Defines its own data binding rules> Only a portion of XML Schema supported> javax.xml.soap.SOAPElement (DOM)
• JAX-WS 2.0> Uses JAXB 2.0 for data binding (100% XML Schema)> Very few DOM-like mappings
Sun Proprietary/Confidential: Internal Use Only99
Customizations in WSDL/XML Schema to Java Mapping
• JAXB customizations > XML Schema to Java
• JAX-WS customizations > Similar to JAXB customizations> WSDL to Java
• Can live> In-lined in the WSDL as WSDL extension> As external file (pass to JAX-WS tools)
Sun Proprietary/Confidential: Internal Use Only100
Preview: Java Technology, Annotations, WSDL
• Java class is annotated with @WebService> Becomes wsdl:port-type element in the WSDL world
• Java Methods are annotated with @WebMethod> Becomes a wsdl:operation element in the WSDL world
• Java Methods parameters mapping to XML is now handled by JAXB > wsdl:message part element types are now defined in
a separate schema file imported by the wsdl
What changes in Java EE 5
Sun Proprietary/Confidential: Internal Use Only101
Web Service Example
@WebService(name=”MySimpleWS”);public class RandomClass {
@WebMethodpublic String sayHello(String s) {...}public void unpublished() {...}
}
Sun Proprietary/Confidential: Internal Use Only102
Web Service Client
• New standard annotations : > @WebServiceRef to express dependencies on
a Web service > @PortComponentRef to express a dependency
on a port definition within a service • Can be overridden by service-ref deployment
descriptors
What changes in Java EE 5
Sun Proprietary/Confidential: Internal Use Only103
Web Service Client Example@WebServiceRef(
wsdlLocation= ”http://localhost:8080/SayHelloService?WSDL”);)
static javaone.SayHelloService wsService;
public static void main(String[] args) {
javaone.SayHello wsPort = wsService.getHello();wsPort.sayHello(“JavaOne Attendees”);
}
Sun Proprietary/Confidential: Internal Use Only104
JavaServer Faces 1.2
Sun Proprietary/Confidential: Internal Use Only105
JavaServer™ Faces (JSF) Framework Is…
A server side user interface (UI) component framework for Java™ technology-based web applications.
Drag-and-drop UI components to build a web Application.
Sun Proprietary/Confidential: Internal Use Only106
JSF Architecture
HTML RenderKit
AppBackend
DesktopBrowser
Phone
Frontctrl
JSF Page
JSF Page
WML
HTML
Server
WML RenderKit
Sun Proprietary/Confidential: Internal Use Only107
Important Basic Capabilities
• Extensible UI component model• Flexible rendering model• Event handling model• Validation framework• Basic page navigation support• Internationalization• Accessibility• Tool friendly
Sun Proprietary/Confidential: Internal Use Only108
JavaTM EE 5 Status
• Most specs available for review now• Specs at Proposed Final Draft stage – Q3 2005• Java EE 5 SDK Beta release – Q4 2005• Java EE 5 Final release – Q1 2006
The Future of Java EE The Future of Java EE GlassfishGlassfish●GlassFish OverviewGlassFish Overview●Building GlassFishBuilding GlassFish●Java EE 5 FeaturesJava EE 5 Features●Sun Java System Application ServerSun Java System Application Server●GrizzlyGrizzly
Sun Proprietary/Confidential: Internal Use Only110
Java Enterprise System Application Platform Suite Q4 2005
Java
Stu
dio
Ente
rpri
se a
nd
Java
Stu
dio
Cre
ator
UM
L, J
ava
EE
, Jav
aSer
ver F
aces
, B
PE
L/B
PM
N, P
ortle
tBui
lder
and
co
llabo
ratio
n to
ols
to c
reat
e si
mpl
e or
co
mpl
ex s
ervi
ces
Portal ServerAggregation, security, mobility, collaboration, personalization,
search, and device-independence
Application ServerClustering, transactions, scalability, performance and high availability
Business IntegrationBPEL, Data Transform, JBI
Serv
ice
Regi
stry
Stor
e se
rvic
es m
eta
data
for d
isco
very
an
d co
mpo
sitio
n
Access ManagerUser authentication and access control
Message Broker
Sun Proprietary/Confidential: Internal Use Only111
Sun Java System Application Server• Platform Edition: fast and lightweight
> GlassFish Project> Basis for Java EE SDK> Free for development, deployment and (re)distribution> Integrates with NetBeans™, Sun Java Studio Enterprise,
Sun Java Studio Creator software, and Eclipse• Standard Edition
> Advanced security, out-of-the-box> Self-managing and self-healing> Clustering and multi-machine administration
• Enterprise Edition supports 99.999% availability> Very small downtime, no data loss, full recovery
Sun Proprietary/Confidential: Internal Use Only112
Developer View: Platform Edition• Entirely Java technology• Fast startup• Fast deployment • Available on all major platforms
> Solaris™ OS, Microsoft Windows, Linux, MacOS • Same performance as the high-end versions
> Multi-machine admin and availability are omitted> Seamless migration to advanced versions of product
Sun Proprietary/Confidential: Internal Use Only113
Performance• Highly scalable HTTP path
> Grizzly: thousands of connections with few threads, all written in Java language (go to TS-3227)
> Fast web services using Fast Infoset (go to TS-7187)• High-performance JMS broker• Improved Enterprise JavaBeans™ (EJB™)
specification performance> Relationship prefetching> Read-only EJB specification-based beans
• Optimized XA transactions
Sun Proprietary/Confidential: Internal Use Only114
Sun Java System Application Server Platform Edition
• The first and only free application server to publish SPECjAppServer results
• Comparable performance to our SE publication> PE: 298 JOPS on 6 CPUs> SE: 1201 JOPS on 26 CPUs
The Future of Java EE The Future of Java EE GlassfishGlassfish●GlassFish OverviewGlassFish Overview●Building GlassFishBuilding GlassFish●Java EE 5Java EE 5●Sun Java System Application ServerSun Java System Application Server●GrizzlyGrizzly
Sun Proprietary/Confidential: Internal Use Only116
What Is the Grizzly HTTP Framework?
Introduction to Grizzly
• Grizzly is a HTTP framework> Uses lower level Java NIO primitives> Easy-to-use, high-performance APIs for socket
communications• Grizzly brings non-blocking sockets to the
HTTP processing layer
Sun Proprietary/Confidential: Internal Use Only117
Grizzly Architecture
• A Task-based architecture has been used, each task representing an operation when manipulating the byte stream> AcceptTask for managing OP_ACCEPT> ReadTask for managing OP_READ> ProcessorTask for parsing/processing
the byte stream• Tasks can execute on their own thread, on a
shared thread or using the Selector thread
Sun Proprietary/Confidential: Internal Use Only118
Benchmark Results
2 CPU 6 CPU 16 CPU0
250500750
100012501500175020002250250027503000 Traditional I/O
C-Based ServerC-Based ServerGrizzly
% o
f Tra
ditio
nal I
/O S
core
Sun Proprietary/Confidential: Internal Use Only119
Demo Scenario• Building EJB 3.0 app through NetBeans over
GlassFish> http://j2ee.netbeans.org/NetBeans_EJB3.html
Resources and Summary &Resources and Summary &Call for ActionCall for Action
Sun Proprietary/Confidential: Internal Use Only121
Resources• Java.net• http://mustang.dev.java.net• New features of Mustang
> http://java.sun.com/developer/technicalArticles/J2SE/Desktop/Mustang_build39.html
• http://glassfish.dev.java.net• http://java.sun.com/javaee
Sun Proprietary/Confidential: Internal Use Only122
Call For Action
• Become a member of java.net• Participate in any of the java.net community
projects
Yes, your effort will make a difference!
Sun Proprietary/Confidential: Internal Use Only123
Call for Action For GlassFish Project • Become a user and tell your friends
> Download a build> Deploy your application> Learn the new Java EE 5 technologies> Give us feedback
• Become a contributor, we need your help> Grizzly module is implementing new features> Admin module looking for help implementing new features> Bug fixes> Improve build infrastructure and how maven is used
• Write tutorials and articles, get published
Java TechnologyJava TechnologyCommunity Development: Community Development: Peabody and GlassFishPeabody and GlassFish
Rima Patel SriganeshRima Patel SriganeshStaff EngineerStaff EngineerSun Microsystems, Inc.Sun Microsystems, [email protected]@sun.com