Friday 16 August 2013

Updates in JDK 1.6 - 51

Learning Objectives
After completing this session, you will be able to:
‰  Describe the key features of Java SE (Standard Edition) 6 (JDK 1.6)
The Java SE 6 (JDK 1.6) Top 10 Features
The top 10 features of JDK 1.6 are:
‰  Scripting
‰  Web Services
‰  Database (JDBC 4.0, Java DB)
‰  More Desktop APIs
‰  Monitoring and Management
‰  Compiler Access
‰  Pluggable Annotations
‰  Desktop Deployment
‰  Security
‰  Quality, Compatibility, and Stability
Motivation for Scripting Support
‰  Scripting support provides developers an opportunity to leverage the advantages of
different languages in the same application.
‰  It extends scripting languages applying the powerful Java technology libraries.
‰  It provides reuse of code modules in other programming languages.
‰  It produces an environment in which developers and end users can collaborate to
create more useful and dynamic applications.
‰  You can now mix in JavaScript technology with your Java technology source code,
useful for prototyping. Also useful when you have teams with a variety of skill sets.
oScripting for the Java Platform (JSR 223):
oMechanism for configuring script engines into Java SE
oAPIs for mixing script fragments into Java applications
oA JavaScript engine is included in the implementation of Java SE 6 of Sun:
oMozilla Rhino engine
oConformant scripting engines: scripting.java.net
Scripting: Developer Example
// create a ScriptEngineManager
ScriptEngineManager m = new ScriptEngineManager();
// get an instance of JavaScript script engine
ScriptEngine engine = m.getEngineByName("js");
// evaluate a script
engine.eval("alert(\"Hello World!\")");
Web Services Support on Java SE 6 Platform
‰  JAX-WS
‰  Data binding using JAXB 2.0
‰  Updates to the JAXP, which includes StaX
Standards supported are:
‰  SOAP 1.2
‰  WS-I Basic Profile 1.1
‰  XML-binary Optimized Packaging (XOP) and SOAP Message Transmission
Optimization Mechanism (MTOM)
‰  Representational State Transfer (REST)
‰  Totally on XML schema
API Support
‰  Java SE 6 provides support for the JAX- WS Web services stack.
‰  For the client side: Service class for creating proxy
‰  For the server side: Endpoint class for publication
Database: JDBC 4.0 Support
‰  Developers will get the updated JDBC 4.0, which focuses on ease of use.
‰  It contains many feature additions like support for XML as an SQL datatype and better
integration of Binary Large OBjects (BLOBs) and Character Large OBjects (CLOBs)
into the APIs.
‰  Additional features that improve ease of use include removal of some JDBC
boilerplate and some of the new annotations that make SQL strings embed better into
your JDBC application – like decorating your getAllUsers() method with an
@Query(sql=”select * from user”) annotation, and that being all you need.
Java DB
‰  Java DB is based on Apache Derby:
‰  JDBC conformant all-Java relational database
‰  Bundled and pre-configured in JDK
Desktop APIs
AWT (Abstract Window Toolkit) improvements are:
‰  Tray icon
‰  Splash screen
‰  Desktop class
‰  Dialog Modality enhancements and API
‰  Text printing
Swing improvement:
‰  GroupLayout: Basis for NetBeans GUI Builder (Matisse)
‰  JTable sorting and filtering
‰  SwingWorker
Splash Screen: Overview
‰  Before Java SE 6, Java run time needs to be fully loaded and initialized before a visual
image can be displayed.
‰  Splash screen allows displaying a splash screen for the application instantly before the
Java runtime software starts:
‰  GIF (Graphic Interchange Format), PNG (Portable Network Graphics), and JPEG
(Joint Photographic Experts Group) images supported
‰  Transparency, translucency, and animation supported
‰  Closed automatically when first top-level window displays
Splash Screen: Usage
Display from command line:
java -splash:image.gif TheApp
Display from MANIFEST.MF (in a jar file):
Splashscreen-Image: image.gif
Painting: You can change the image shown after the splash screen is loaded, but before the
application starts.
SplashScreen splash = SplashScreen.getSplashScreen();
Graphics2D g = splash.createGraphics();
// your painting code here
splash.update();
Desktop APIs
‰  GUI developers get a large number of new tricks to play like the ever popular yet
newly incorporated SwingWorker utility to help you with threading in GUI apps, JTable
sorting and filtering, and a new facility for quick splash screens to quiet impatient
users.
‰  Desktop class has an enumeration of actions that may be supported for a file or URI
like BROWSE, EDIT, MAIL, OPEN, and PRINT.
‰  File processing: Opening, editing, and printing files with applications registered in
native system
‰  Browsing: Opening a URL with the default browser
‰  Email: Sending a message with the default mail client
Dialog Modality Enhancement
‰  New modality model is introduced:
‰  This new model allows the developer to scope, or limit the modality blocking of a
dialog box, based on the modality type that the developer chooses.
‰  This new model allows windows and dialog boxes to be truly parentless.
‰  This new model solves the problem of interacting with JavaHelp in J2SE 1.5 when
modal dialog box is on the front.
Security
Security added important new APIs:
‰  XML Digital Signature (XMLDSig) API (JSR 105)
‰  Smart Card I/O API (JSR 268)
Security improved authentication schemes:
‰  JAAS-based authentication using LDAP
‰  Native Platform Java GSSAPI (Generic Security Services Application Programming
Interface)
Java SE 6 has simplified the job of its security administrators by providing various new ways to
access platform-native security services, such as native Public Key Infrastructure (PKI) and
cryptographic services on Microsoft Windows for secure authentication and communication, Java
Generic Security Services (Java GSS) and Kerberos services for authentication, and access to
LDAP servers for authenticating users.
Summary
‰  The key features of Java SE 6 (Mustang) (JDK 1.6) are:
oScripting
oWeb Services
oDatabase (JDBC 4.0, Java DB)
oMore Desktop APIs
oMonitoring and Management
oCompiler Access
oPluggable Annotations
oDesktop Deployment
oSecurity
oQuality, Compatibility, and Stability
Test Your Understanding
1.State true or false for the following:
a)JDBC 4.0 is available with Java SE v5 (Tiger).
b)With Java SE 6, applications can use JAX-WS to build web applications and web
services, incorporating the newer XML-based web services functionality.
c)A JavaScript engine named as Mozilla Rhino engine is included in the Sun’s
implementation of Java SE 6.

No comments:

Post a Comment