Overview
This course teaches how to develop advanced Java applications using RAD 7.0. The advanced features of Java that developers may be using in many different types of programs are covered.
Topics
- JavaBeans
- JUnit
- JDBC
- Java Logging API
- Internationalization
- The Reflection API
- Architecture
- Threads
- Networking
- Distributed Objects
- Parsing XML with SAX
- Parsing XML with DOM
- JNI
- Security
- Summary of Recent Java Changes
Audience
This course is intended for programmers who are familiar with Java and want to learn about the advanced features of Java.
Practical Work
The labs cover many advanced topics that students will encounter when programming Java applications. Together these labs give students practical hands-on experience in creating and deploying advanced Java technologies using RAD 7.0.
Learning Objectives
After completing this course, the student should be able to:
- Test Java code using JUnit
- Understand how to connect to databases and work with data
- Use the logging capabilities built into the Java language
- Use the support for multiple languages provided by Java
- Use the reflection API to programmatically obtain details
on Java classes
- Provide better architecture for Java programs
- Work with multi-threaded Java applications
- Use networking and distributed technologies of Java
- Work with XML from Java code
- Use Java capabilities to intergrate with non-Java code
- Use the security APIs provided with the Java language
Prerequisites
A good understanding of object-oriented programming using Java.
Course Duration
5 Days
Course outline
1. JavaBeans
- JavaBeans
- Overview
- Structure
- Life Cycle
- Properties
- Example
- Making a Bean
2. JUnit
- Objectives
- What is JUnit?
- Who uses JUnit?
- Why JUnit?
- The xUnit Philosophy
- Test-Driven Design
- A JUnit Test
- Running the Tests
- Swing-based Test Runner
- Text-based Test Runner
- JUnit Basics
- assertTrue
- assertEquals
- assertSame
- assertNull
- The Failure Message
- The Test Class
- The Test Method
- The Test Suite
- JUnit Design
- Testing Strategies
- Specific Techniques
- Testing simple Java classes
- Testing with Databases
- Testing Web Applications
- JUnit with Ant
- JUnit with Eclipse
- Create a Test Case
- Test Case "Stubs"
- Running Tests
- Eclipse Test Runner Icons
- Rerun an Individual Test
- Failure Trace
- Debug with JUnit
- Test Suite Wizard
3. JDBC
- Java Database Connectivity
- Overview
- Types of Drivers
- Making a Connection
- Statements
- Execute, Update and ResultSets
- Prepared Statements
- Stored Procedures
- Transactions
- Connection Pooling
4. Java Logging API
- Objectives
- Overview of Java Logging
- Control Flow of Logging
- Loggers
- Logging API - Handlers
- Logging API Formatters & Log Manager
- Example Logging Configuration File
- Logging Example
5. Internationalization
- Objectives
- Internationalization
- Locale
- Dates
- User Interface design
- Resource Bundles
- Other Local Customs
- How Java Represents Characters
- Text Files
- Text files
- Summary
6. The Reflection API
- Overview
- Dynamic Facilities In Java
- What this dynamic aspect implies
- Considerations
- The Class class
- Examining Classes
- The Example From Last Time
- An Example
- Reflection Allows
- Reflection Also Allows
- When not to use Reflection
- Examining Classes
- Manipulating Objects
- Creating Objects
- Getting Field Values
- Setting Field Values
- An example
- Example Continued
- Arrays
- Summary
7. Architecture
- Architecture
- Tiered Architectures
- Presentation Layer
- Middle Tier
- Model View Controller
- Extensible Markup Language
- XML
8. Threads
- Threads
- Overview of Threads
- Threads in Java Programming
- Write a Runnable Class
- Create Threads
- Another Way of Creating Threads
- Two ways of creating threads
- States in a Thread s Lifetime
- JVM Scheduler
- Control and Schedule Thread
- Executor Interface
- Callable<V> Interface
- ExecutorService Interface
- Future<T> Object
- Coordinating the Concurrency of Multiple threads
- Synchronization
- How Does the Object Lock Flag Work
- Using the synchronized keyword
- The implication of synchronization
- Example of Synchronization - Producer/Consumer
- Example of Synchronization MyStack
- Example of Synchronization Producer
- Example of Synchronization Producer
- Example of Synchronization Consumer
- Example of Synchronization Consumer
- Example of Synchronization SyncTest
- But
- Coordinating Thread Cooperation
- wait() and notify()
- Example of Coordination Producer/Consumer
- Example of Coordination MyStack
- Example of Coordination MyStack
- Results
- Deadlock
9. Networking
- Java Networking
- Overview
- URL Connections
- Browser Example
- InetAddress
- Socket Classes
- Simple Clients and Servers
- Multithreaded Servers
- UDP Sockets
10. Distributed Objects
- Overview
- Serialization
- Externalizable
- Remote Method Invocation
- Steps to implement RMI
- RMI Remote Object Registry
- RMI Dynamic class loading
- RMI Dynamic class loading
- RMI and Applets
- Summary
11. Parsing XML with SAX
- Obtaining a Parser
- SAX
- How it Works
- Core SAX2 Handler Classes
- SAX2 DefaultHandler
- SAX Events
- Ignorable Whitespace
- XML Reader Interface
- XMLReader Features
- XMLReader Factory
- Prepare SAX Parser Object
- Parse XML with SAX Steps
- Define an Event Handler
- Prepare SAX Parser Object
- Define an Event Handler startElement()
- Define an Event Handler Element Attributes
- Define an Event Handler Get Number of Attributes
- Define an Event Handler Get Name of Attributes
- Define an Event Handler Get Attribute Values
- Define an Event Handler Get Attribute Types
- Define an Event Handler An Example
- Define an Event Handler characters()
- Using characters()
- Define an Event Handler Error Handling
- Define an Event Handler ErrorHandler interface
- Parse XML Document
- Simple SAX Parser
- Run the SAX Application
- EntityResolver
- Locator
- Document Locator
12. Parsing XML with DOM
- Topics
- DOM
- Limitations of SAX
- XML as an Object Model
- Nodes
- The Basic Node Types
- Less Common Node Types
- Node Interface
- Node Interface
- Document Interface
- NodeList Interface
- Element Interface
- Attr Interface
- Text Interface
- DOM Parsing
- Parse XML with DOM Steps
- Prepare DOM Parser Object
- Parse XML Document
- Parse Exceptions
- Example SimpleDOMParser
- Example SimpleDOMParser
- Example SimpleDOMParser
13. JNI
- JNI - Java Native Interface
- Overview
- JNI Architecture
- Calling C Functions
- The Header File
- Passing Simple Parameters
- Mapping Java Types
- Calling Java Methods
- The Invocation API
- Exception Handling
- Native Exception to Java
- Java Exception In Native Code
- Code Sample
14. Security
- Java Security
- Attacks and Dangers
- Overview of JDK Security Features
- Overview of JDK Security Features cont
- Basic Concepts of Computer Security
- Encryption
- Cryptography Algorithm
- Message Digest
- Symmetric Ciphers
- Asymmetric Ciphers
- Digital Signature
- Authentication
- Certificate Manipulation
- Java Cryptography Architecture (JCA)
- Java Cryptography Extension
- Using the MessageDigest Class
- Example of Using the MessageDigest Class
- Example of Using MessageDigest Class cont
- Example of Using MessageDigest Class cont
- Using the Signature Class
- Java Security Architecture
- JDK 1.0 Security Model Sandbox
- JDK 1.1 Security Model Trusted Signed Code
- JDK 1.2 Security Model Security Policy
- JDK 1.4 Security Enhancement
- Protection Domains and Security Policies
- ProtectionDomain Class
- Permission Classes
- Using Permission Classes
- Policy Class
- Policy Configuration File
- AccessController Class
- SecurityManager Class
- Using the SecurityManager Class
- Dynamic Class Loader
- Loader Classes
- Example of Security Check in a Class Loader
- Java Security Tools
- Using Java Security Tools Code Signing
- Using Java Security Tools Code Signing
15. Summary of Recent Java Changes
- JDK 1.4 New Features
- JDK 1.4 New Features
- JDK 1.4 New I/O API
- Buffer
- Channel
- Simple Write Example
- Simple Read Example
- File Locking
- Simple Locking Example
- Memory Mapping File
- Example Memory Mapping
- Regular Expression Search
- JDBC 3.0 Enhancements
- XML Processing Using JAXP
- Example SAX Handler
- Example: Begin Parsing
- Example: Build DOM Document
- Example: Save DOM Document in a File
- XML Serialization Format
- Chained Exception
- JDK 1.4 - Assertions
- When to use Assertions
- Enabling Assertions
- Java 5-Type Safe Enums
- Java 5 Generic Types
- Java 5 Autoboxing/Unboxing
- Java 5 For-each syntax
- Java 5 Variable-length argument lists
- Java 5 Static import
- Java 5 Annotations
- Java 5 Library Additions
|