JavaONE 2007 - Kjartan Aanestad (Objectware)1 JavaONE 2007.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
Advertisements

Singleton vs utility class  at first glance, the singleton pattern does not seem to offer any advantages to using a utility class  i.e., a utility class.
Slides by Alex Mariakakis with material from David Mailhot, Hal Perkins, Mike Ernst Section 9: Design Patterns.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 3 Object Oriented Programming in Java Language Basics Classes,
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
Progress Report 11/1/01 Matt Bridges. Overview Data collection and analysis tool for web site traffic Lets website administrators know who is on their.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Web Services CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
dcDB Stored Procedures: An Overview
OSGi.
Configuration Management and Server Administration Mohan Bang Endeca Server.
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
1 v1.6 08/02/2006 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Refactoring 5.Debugging 6.Testing.
Javadoc. The Plan ● What is Javadoc? ● Writing Javadoc comments ● Using the Javadoc tool ● Demo ● Practice.
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
+ A Short Java RMI Tutorial Usman Saleem
Struts2 Plugin Development - Extending Struts2 Justin Yip.
Effective Java: Generics Last Updated: Spring 2009.
Porting Implementation of Packet Utilization Standard from ADA to JAVA Annelie Hultman (TEC-EME) Donata Pedrazzani (TEC-EMS) ESA/ESTEC 2004 JPUS de-briefing.
Tuscany 2.x Extensibility and SPIs Raymond Feng. Tuscany Extensibility Cx2x/Tuscany+2.x+Extensibility+and+SPIs#extensions.
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
Tu sca ny 1 Extending The Tuscany Java SCA Runtime 21 August 2006.
Introduction to TypeScript Sergey Barskiy Architect Level: Introductory.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
Slides adapted from Alex Mariakakis, with material from David Mailhot, Hal Perkins, Mike Ernst Section 9: Design Patterns.
© Keren Kalif Advanced Java Topics Written by Keren Kalif, Edited by Liron Blecher.
Tuscany Runtime Architecture. Contents Overview An example Bootstrap kernel Process of composite application.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Extending & Customizing XNAT with Modules Rick Herrick
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Classes Dwight Deugo Nesa Matic
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
OpenMRS Create New Module.
SourceAnatomy1 Java Source Anatomy Barb Ericson Georgia Institute of Technology July 2008.
Message Framework Topic subscribe for javascript/flex client.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
UAB Requirements for 2016 Ivan Prieto Barreiro 18/04/2016 UAB Requirements for
Distributed Objects. Contents I. The Roles of Client and Server II. Remote Method Calls III. The RMI Programming Model IV. Parameters and Return Values.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Principles of Software Development
V3 Domain Launching Byron Nevins Feb 11, 2008.
University of Central Florida COP 3330 Object Oriented Programming
Section 9: Design Patterns
Chapter 5 Remote Procedure Call
Introduction to Advanced Java Programming
Java Servlets By: Tejashri Udavant..
University of Central Florida COP 3330 Object Oriented Programming
Section 9: Design Patterns
Section 9: Design Patterns
Functional Programming with Java
DWR: Direct Web Remoting
File service architecture
Overview of Eclipse Lectures
Embracing Java 9 and beyond with Eclipse JDT
Section 8: Design Patterns
Section 9: Design Patterns
Section 9: Design Patterns
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Section 9: Design Patterns
Plug-In Architecture Pattern
Presentation transcript:

javaONE Kjartan Aanestad (Objectware)1 JavaONE 2007

2javaONE Kjartan Aanestad (Objectware) Agenda Reverse Ajax - DWR GlassFish V3 Effective Java Reloaded: This Time it's NOT for Real

3javaONE Kjartan Aanestad (Objectware) Reverse Ajax - DWR Joe Walker/Geert Bevin (TS-6410) New feature in DWR 2.0 CommunityOne: ICEfaces and Ajax Push

4javaONE Kjartan Aanestad (Objectware) Reversed Ajax – DWR: Overview The ability to asynchronously send data from a web-server to a browser

5javaONE Kjartan Aanestad (Objectware) Reversed Ajax – DWR: Overview Supports 3 methods of pushing the data to the browser: Polling – Browser makes regular request to the server Piggyback – Puts the response with the next request Comet (aka Long lived http) – Keeps the communication channel open to pass down information when time comes.

6javaONE Kjartan Aanestad (Objectware) Reversed Ajax – DWR: ”live” coding demo

7javaONE Kjartan Aanestad (Objectware) GlassFish V3 Jerome Dochez (TS-6503) Loosely based on the work for JSR 277 (Java Module System ) Due in Java SE 7 Architecture based on IoC, modules and maven 2

8javaONE Kjartan Aanestad (Objectware) GlassFish V3: Module subsystem The module subsystem is called HK2 (Hundred Kb Kernel) Module system based on maven Identified by name and version One classloader per module of 1 to n jars Exports a subset of its content (Service Provider Interface) Imports other modules (listed in manifest file)

9javaONE Kjartan Aanestad (Objectware) GlassFish V3: Module instances Modules identified by module instances at runtime 2 classloaders (public/private) Runtime network of class loaders

10javaONE Kjartan Aanestad (Objectware) GlassFish V3: Repository Repositories hold modules Add and remove at runtime Different types supported Directory based Maven Modules can be added/removed/updated from repositories

11javaONE Kjartan Aanestad (Objectware) GlassFish V3: Bootstrapping Module subsystems can bootstrap itself No need to define a classpath at invocation Packaged in a jar Implement the ApplicationStartup interface Declare dependencies in manifest

12javaONE Kjartan Aanestad (Objectware) GlassFish V3: Build System: Maven Each module is build from a maven project (pom.xml) com.sun.enterprise.glassfish gf-web-connector hk2-jar Running GlassFish retrieves the modules from the maven repository $ mvn gf:run

13javaONE Kjartan Aanestad (Objectware) GlassFish V3: Services GlassFish V3 use extensively Services to identify extension points like Application containers like web-app, Jruby, Phobos..) Administrative commands Services in V3: Interfaces are declared Implementations are public interface AdminCommand public class DeployCommand implements AdminCommand {...}

14javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: This Time it's NOT for Real Joshua Bloch (TS-2689) Effective Java still hasn’t been reloaded - It will be done later this year for sure.. Object creation Generics

15javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Object creation Static factories Map > m = new HashMap >(); Map > m = HashMap.newInstance(); Regrettably HashMap has no such method (yet) write your own, your generic classes can and should: public static HashMap newInstance() { return new HashMap (); }

16javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Object creation Builder pattern Ugly when constructors have many optional parameters new NutritionFacts(int servingSize, int servings, int calories, int fat, int sodium, int carbohydrate, 15 more optional params!); Builder constructor takes all required params One setter for each optional parameter Setter returns the builder to allow for chaining NutritionFacts locoCola = new NutritionFacts.Builder(240, 8).sodium(30).carbohydrate(28).build();

17javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Object creation public class NutritionFacts { public static class Builder { public Builder(int servingSize, int servings) { this.servingSize = servingSize; this.servings = servings; } public Builder calories(int val) { calories = val; return this; }... // 15 more setters public NutritionFacts build() { return new NutritionFacts(this); } private NutritionFacts(Builder builder) {.. } }

18javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Generics – bounded wildcards Use bounded wildcards to increase applicability of APIs public interface Shop { void buy(int numToBuy, Collection myColl); void sell(Collection myLot); } Collection subtyping doesn’t work! public interface Shop { void buy(int numToBuy, Collection myColl); void sell(Collection myLot); } Use when parameterized instance is a T producer (“for read/input”) Use when parameterized instance is a T consumer (“for write/output”)

19javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Generics – wildcard capture Control Wildcard-Capture Type system doesn’t know captured types are identical public static void rotate(List list) { if (list.size() == 0) return; list.add(list.remove(0)); } Solution: public static void rotate(List list) { rotateHelper(list); } // Generic helper method captures wildcard once private static void rotateHelper(List list) { if (list.size() == 0) return; list.add(list.remove(0)); }

20javaONE Kjartan Aanestad (Objectware) Effective Java Reloaded: Generics – miscellania final is the new private Minimizes mutability Clearly thread-safe—one less thing to worry about Use annotation every time you want to override Avoid overriding my mistake

javaONE Kjartan Aanestad (Objectware)21 JavaONE 2007 Kjartan Aanestad - Objectware