300 likes | 458 Views
Java™: What can it do and where is it going?. Andy Brodie. Title slide. Presentation Contents. What is Java? Java and XML Java and Web Services The Future. What is Java?. Sectional slide. The Java Language.
E N D
Java™: What can it do and where is it going? Andy Brodie Title slide
Presentation Contents • What is Java? • Java and XML • Java and Web Services • The Future
What is Java? Sectional slide
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) { for (int i=0; i<argc; i++) { printf(“%s\n”,argv[i]); } public static void main(String[] args){ for (int i=0; i<args.length; i++) { System.out.print(args[i] + “\n”); }
Java does not have: Pointers … well… almost… Operator Overloading. Goto. Structs or unions. Multiple Inheritance. Templates. Automatic Type conversion. #typedefs, #define, or #anything! Default arguments. No explicit in-lining C++ does not have: Garbage collection. Arrays as first class objects and bounds checking. Built in program documentation (javadoc). A single “root” object, from which all others inherit. A dedicated immutable “String” type. Primitive type size consistency. Automatically nulled variables. Built-in concurrency. Java is not C++…
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.
A Brief History of Java • 1990 – James Gosling, Patrick Naughton and Mike Sheridan start project Oak. • 1996 –Java SDK 1.0 Released (first commercial) • 1997 – Java SDK 1.1 Released • 1998 – Java 2 Language Released (1.2 • 2000 – J2SE SDK 1.3 • 2002 – J2SE SDK 1.4 • 2004 – J2SE 5.0 Released (J2SE SDK 5.0)
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.
Class Loader Security Manager Byte Code Verifier 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 Application
How multi-platform is J2SE? • Java is often touted as “multi-platform”, but how many platforms have JREs or JDKs? Windows IA32 Linux IA32 Solaris x86 IBM NUMA-Q Solaris Linux/S390 AIX/PPC64 OS/2 Mac OS X Mac OS Classic Linux IA32 Linux S/390 64 Linux IA64 AIX/PPC32 Linux IA64 HP-UX Windows IA-64 I5/OS Irix Windows IA64 Solaris SPARC zOS Windows IA-32
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 cannotcall it Java or use the Java logo.
How many J2EE licensees are there? • 32 at last count… Trifork Technologies IronFlare Data Direct Technologies Sonic Software Corporation SeeBeyond ObjectWeb JBoss Group Tmax Soft Macromedia SpiritSoft Hitachi Pramati NEC Apache Software Foundation Nokia Sun Microsystems SAP webMethods BEA Systems ATG IBM Fujitsu Borland Group Novell (Silverstream) Sybase, Inc. Oracle Corporation IONA Technologies HP Kingdee Middleware TIBCO Software Inc. Caucho Technology Inc. SAS Institute, Inc.
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
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
Microsoft .NET and Java • Which is better? • BOTH are here to stay. • .NET and Java platform provide some equivalent facilities, shown here • 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.
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.
Java and XML Java provision for the processing of XML data. Sectional slide
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.
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.
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.
Java and Web Services Sectional slide
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)
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).
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.
The Future Where J2SE and J2EE are going Sectional slide
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.
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();
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);
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)
End. Thank you for listening! Sectional slide