...

Java™: What can it do and where is it going? 9/1/2004

by user

on
Category: Documents
45

views

Report

Comments

Transcript

Java™: What can it do and where is it going? 9/1/2004
Java™: What can it do and where is it going?
Andy Brodie
9/1/2004
Java: What is can do and where is it going?
Presentation Contents
 What is Java?
 Java and XML
 Java and Web Services
 The Future
2
Java: What can it do and where is it going?
What is Java?
9/1/2004
Java: What is can do and where is it going?
The Java Language
 “The Java™ programming language is a general-purpose,
concurrent, class-based, object-oriented language “ – Java
Language Specification
 Provides many features of object orientation technology.
 Largely copies the C syntax
int main(int argc, char **argv)
{
public static void main(String[] args){
for (int i=0; i<argc; i++) {
printf(“%s\n”,argv[i]);
}
4
for (int i=0; i<args.length; i++) {
System.out.print(args[i] + “\n”);
}
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Java is not C++…
 Java does not have:
Pointers … well… almost…
Garbage collection.
Operator Overloading.
Arrays as first class objects and
bounds checking.
Goto.
Structs or unions.
Multiple Inheritance.
5
 C++ does not have:
Built in program documentation
(javadoc).
Templates.
A single “root” object, from which all
others inherit.
Automatic Type conversion.
A dedicated immutable “String” type.
#typedefs, #define, or #anything!
Primitive type size consistency.
Default arguments.
Automatically nulled variables.
No explicit in-lining
Built-in concurrency.
Java: What can it do and where is it going?
Java: What is can do and where is it going?
The different types of Java
 Java™ 2 Platform, Micro Edition (J2ME)
For consumer electronics and embedded devices.
 Java™ 2 Platform, Standard Edition (J2SE)
“Normal” Java
 Java™ 2 Platform, Enterprise Edition (J2EE)
An extension to J2SE that provides:
Rapid development and deployment of enterprise applications.
Covers Security, Transactions, Distribution
Containers supplying runtime support for J2EE application components.
Encourages 3-tier architectures with separation of business and display logic.
6
Java: What can it do and where is it going?
Java: What is can do and where is it going?
A Brief History of Java
Number of Classes
0
 1990 – James Gosling, Patrick Naughton
and Mike Sheridan start project Oak.
 1997 – Java SDK 1.1 Released
 1998 – Java 2 Language Released (1.2
 2000 – J2SE SDK 1.3
Java Version
 1996 –Java SDK 1.0 Released (first
commercial)
1000
1.0.2
202
1.1
477
1.2
1524
1.3
1840
1.4
2724
1.5
3278
 2002 – J2SE SDK 1.4
 2004 – J2SE 5.0 Released (J2SE SDK
5.0)
7
Java: What can it do and where is it going?
2000
3000
4000
Java: What is can do and where is it going?
The Java Virtual Machine (JVM)
 Java source is compiled in to byte code.
 Byte code executes on the Java Virtual Machine (JVM).
Platform independent execution environment that abstracts operating
system specifics from the developer/user.
The byte code is interpreted by the JVM at runtime.
(Similar to Pascal’s PCode.)
 The Just In Time (JIT) compiler converts Java bytes codes into
native machine code for quicker execution.
Allows Java performance to be comparable to C++.
 The JVM forms a “sandbox” to execute applications.
8
Java: What can it do and where is it going?
Java: What is can do and where is it going?
The Sandbox
 A term often banded around to describe Java applications and applet
environments.
 Consists of 3 parts:
The byte code verifier – stops “bad” programs from executing
The class loader – loads code in to memory.
The security manager – polices the executing code.
Operating System
JVM
Byte
Code
Verifier
9
Class Loader
Application
Java: What can it do and where is it going?
Security
Manager
Java: What is can do and where is it going?
How multi-platform is J2SE?
 Java is often touted as “multi-platform”, but how many platforms have
JREs or JDKs?
Windows IA32
Solaris x86
IBM NUMA-Q
Solaris
Mac OS X
Linux S/390 64
Linux IA64
I5/OS
Windows IA-64
Solaris SPARC
10
Linux/S390
AIX/PPC64
OS/2
Linux IA32
Linux IA32
zOS
Java: What can it do and where is it going?
Mac OS Classic
Linux IA64
AIX/PPC32
HP-UX
Irix
Windows IA64
Windows IA-32
Java: What is can do and where is it going?
Enforcing J2SE compatibility
 Sun licenses the Java Compatibility Kit (JCK) to J2SE vendors
 Latest version contains 45,194 individual tests.
Up from Java 2 JCK which had 27,309.
 Why do you need the JCK?
Without a successful pass you cannot call it Java or use the Java logo.
11
Java: What can it do and where is it going?
Java: What is can do and where is it going?
How many J2EE licensees are there?
 32 at last count…
Trifork Technologies
IronFlare
Data Direct Technologies
Sonic Software Corporation
SeeBeyond
ObjectWeb
Tmax Soft
Macromedia
JBoss Group
SpiritSoft
Hitachi
Pramati
NEC
Apache Software Foundation
BEA Systems
SAP
webMethods
Borland Group
ATG
Fujitsu
Oracle Corporation
Kingdee Middleware
SAS Institute, Inc.
12
Sun Microsystems
IBM
Novell (Silverstream)
Sybase, Inc.
HP
Nokia
IONA Technologies
Caucho Technology Inc.
Java: What can it do and where is it going?
TIBCO Software Inc.
Java: What is can do and where is it going?
J2EE Compatibility
 In the same way that Sun controls the use of the Java logo.
J2EE implementations must pass a compatibility suite.
 There are compliant implementations of J2EE 1.4 from:
IBM - WebSphere Application Server Technology for Developers v6.0
JBoss – JBoss Application Server (open source)
Oracle – Oracle application Server Containers for J2EE 10g
Sun – Sun Java System Application Server Platform Edition 8
TMax Soft – JEUS 5.0
Trifork – Trifork T4 Application Server
13
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Who “controls” Java?
 Sun has ultimate control of Java.
 The Java Community Process – http://www.jcp.org
Produce Java Specification Requests (JSRs) determine future direction of
the Java language and libraries.
338 JSRs have been produced so far.
Almost all new language features and standard libraries come via the
JCP.
 Participated in by Java licensees and vendors:
Such as: IBM, Apple, BEA Systems, Compaq, HP, Novell, Symantec,
Wind River, Oracle and Silverstream
14
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Microsoft .NET and Java
The Equivalences
Java Platform
.NET
 Which is better?
Java Virtual
Machine (JVM)
Common Language
Runtime (CLR)

BOTH are here to stay.
Byte Code
Microsoft Intermediate
Language (MSIL)

.NET and Java platform provide some
equivalent facilities, shown here
Swing
Windows Forms
J2SE/J2EE
.NET Framework class
library
EJB
COM+ Services
J2EE Server
.NET Framework
JSP
ASP.NET
JDBC
ODBC
J2ME
.NET Compact
Framework

Can .NET and Java work together?
Service-Oriented Architectures and Web
Services fit both .NET and J2EE.
The WS-I profiles promote interoperability
between .NET and Java applications via
Web Services.
The Web Service Interoperability
Organization produces WS-I Profiles.
See http://www.ws-i.org.
15
Java: What can it do and where is it going?
Java: What is can do and where is it going?
C# - The Closest Language to Java
 C# bears more than a passing resemblance to Java.
 However…
The are plenty of pitfalls for the Java programmer to fall in to by expecting
C# to behave the same way as Java.
E.g. No checked exceptions, casting objects changes their behaviour
…and several for a C# programmer to fall in to by expecting Java to
behave the same way as C#!
E.g. Switch statement fall-through and constructors with same name
as enclosing type.
16
Java: What can it do and where is it going?
Java and XML
Java provision for the processing of XML data.
9/1/2004
Java: What is can do and where is it going?
Java and XML
 Java includes libraries specifically for XML document generation, parsing
and transformation:
Java API for XML Parsing: JAXP
Supports DOM and SAX W3C standards for document parsing and
representation.
TRansformation API for XML- TRAX
Supports the XSLT language for specifying transformations of XML.
Java API for XML Bindings – JAXB
Static and Dynamic generation Java classes based on XML.
Java API for XML-based Remote Procedure Calls – JAX-RPC
Invocation of methods on remote services using XML-based calls.
18
Java: What can it do and where is it going?
Java: What is can do and where is it going?
JAXP Example: Parsing an XML document
 Creating an document object model (DOM) of an XML document is easy:
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new File(xmlInputFile));
 From here you can read, edit and write out the document.
 For large XML documents, there is Simple API for XML (SAX), that is an “event
driven” way of reading a document.
19
Java: What can it do and where is it going?
Java: What is can do and where is it going?
TRAX: Transforming XML documents
 Transformations are done via the eXtensible Stylesheet Language
Transformation (XSLT) specification.
 Each stylesheet is an XML document that contains a mix of
declarative and programmatic constructs to transform an XML
document in to another (XML or plain text) document.
 Java provides the TRAX API to apply stylesheets to XML
documents.
20
Java: What can it do and where is it going?
Java and Web Services
9/1/2004
Java: What is can do and where is it going?
What is a Web Service?
 “A Web service is a software system designed to support interoperable
machine-to-machine interaction over a network. It has an interface described in
a machine-processable format (specifically WSDL). Other systems interact with
the Web service in a manner prescribed by its description using SOAP
messages, typically conveyed using HTTP with an XML serialization in
conjunction with other Web-related standards.” – The W3C.
 Helped to develop standards for web services…
Invocation: Simple Object Access Protocol (SOAP)
Description: Web Service Definition Language (WSDL)
Location: Universal Description, Discovery and Integration Project (UDDI)
Transport: HyperText Transport Protocol (HTTP)
22
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Web Services, Java and J2EE
 Web Services are gaining popularity and recognition as an important technology for
the future of business computing.
 Tools, specifications and libraries to make it easy to create, publish and invoke Web
Services from within a Java environment.
See the Web Services Interoperability WS-I Basic Profile on http://www.ws-i.org.
Enabling inter-operability between Java and non-Java services.
 Support for Web Services described in J2EE 1.4 Specification
Also JSR-109 - Web Services for J2EE, Version 1.0
J2EE 1.4 platform provides tools and libraries to facilitate the development and deployment
of web services in a J2EE container.
Many vendors provide tooling to automatically generate WSDL and SOAP interfaces.
You don’t want to be writing XML by hand!
For example: WebSphere Application Developer Studio (WSAD).
23
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Java API for XML-based Remote Procedure Calls
(JAX-RPC)
 Developed through JSR-101.
 JAX-RPC 1.0 defines APIs and conventions for supporting XML based RPC in the
Java platform.
 JAX-RPC 1.1 adds support for the WS-I Basic Profile 1.0 to improve interoperability
between JAX-RPC implementations and with services implemented using other
technologies.
 JAX-RPC is designed to keep the platform independence of Web Services and
XML.
 Describes a reversible mapping from WSDL 1.1 to Java
Target namespaces can be mapped to and from Java packages
Port types can be mapped to and from Java classes
Operations can be mapped to and from methods
Etc.
24
Java: What can it do and where is it going?
The Future
Where J2SE and J2EE are going
9/1/2004
Java: What is can do and where is it going?
J2SE 5.0
 The product formerly known as J2SE 1.5, a.k.a. Tiger
Version number changes as the language is changing, not just the supplied libraries.
 Released Java 5 on September 30th 2004.
 New language features:
Annotations
Generic Types
Enumerated types
Automatic conversion between primitive and object types: “Autoboxing”
Memory Model
Variable arguments: “varargs”
Enhanced loop syntax
Static Imports
 Over 8002 features, enhancements and bug fixes integrated in to J2SE 5.0.
26
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Some of the J2SE 5.0 features
 Autoboxing:
Automatic conversion between primitive types and their object equivalents.
Integer six = new Integer(5) + 1;
 Enhanced loops:
int myArray[] = new int[10];
int total;
for (i : myArray) { total += i; }
 Annotations:
Simple markers or data structures compiled in to class files.
Similar to javadoc tags, such as @deprecated.
@api public void doIt();
27
Java: What can it do and where is it going?
Java: What is can do and where is it going?
J2SE 5.0 Language Features (cont.)
 Generics (a.k.a. Parameterized Types)
E.g. not just a set of objects, but a set of strings.
Collection content types can be enforced at the language level.
Simplifies code and improves robustness.
NOT C++ Templates!!
 Enumerated Types
True type-safe enumerated types (unlike C).
Can use constants inside switch statements.
 Static Imports
Allows usage of static constants and methods without needing to qualify.
import static com.xyz.ConstantsClass.*;
message.setReliability(MY_FINAL_VALUE);
28
Java: What can it do and where is it going?
Java: What is can do and where is it going?
Java 2 Enterprise Edition 1.5 (JSR-244)
 Theme is “Ease of Development”
J2EE often criticised for complexity….
… when it was specifically designed to make life easier!
 Still in the very early stages, expert group is being formed.
 What’s proposed for J2EE 1.5?
Enterprise Javabeans 3.0 - JSR-220
Abolishes local and remote bean and home interfaces.
Replaced by Java 5 annotations
JavaServer Faces - JSR-127
A user interface (UI) framework for Java Web Applications.
Emphasises the re-use aspects of UI components.
Web Services Metadata for the Java Platform (JSR-181)
Uses annotations to declare how Java methods should be presented as Web Services.
Java APIs for XML Binding (JAXB) 2.0 (JSR-222)
Java API for XML based Remote Procedure Calls (JAX-RPC) 2.0 (JSR-224)
Standard Tag Library for Java Server Pages (JSTL) 1.1 (JSR-52)
29
Java: What can it do and where is it going?
End.
Thank you for listening!
9/1/2004
Fly UP