June 30, 2005

JavaOne 2005: Day Two

I'm there right from the beginning of morning. The day start with Sun's general session. A lot of was discussed about Brazilian's great health-care system (of course implemented in Java) and just hyping up Java in general, which I personally didn't find so useful.

Just by coincidence, I catched the end of Java Platform Clustering, which talked about application-level clustering for multiJVMs. It's called project Barcelona and the whole topic is very very interesting topic. Pretty much like anything else these days, it's available as an open-source implementation.

The meat of the day however was various EJB 3.0 session. I was really amazed how much simpler and cleaner EJB annotations makes to implement them as simple POJOs. I talked about that in the last post, but it was really the sessions today that made me understand its usefulness and elegance.

Besides that, the hot topic of the day and in the whole conference is SOA, service-oriented architecture. Saw some nice demos on implementing them (with heavy enterprise tools for obvious vendors, IBM and Sun), but read more about it below if you are interested.

One more topic that deserves a separate section for itself, was the last BOF of the day, JavaServer Faces Over The Phone: Building VoiceXML with Custom JSF Components and Render Kits. Interesting, no? I was the only person from my current company to join the BOF, and I had to save the day by loaning the presenter my laptop because his couldn't be connected with the projector for some reason. Well, at least I got the powerpoint without needing to wait for it to be published to the web site. Anyway, he's pretty interesting result was that he didn't find too many benefits in doing so, at least for simple VoiceXML anyways. Basically, he was suggesting to use plain JSTL pages instead. After the session, we talked about doing AJAX components for voiceXML, in which case the benefits should be much bigger.

---
Day two

JUICmidlet downloadable from java.net

Sun bought SeeBeyond

JCP the most successful community process
Brazilian health-care system open sourced; the shape of things to come
Government built custom code utilizing open source projects
2.5 million lines of code in total, done in 4 months


Mobile gaming overview
// Download this preso
SNAP Mobile
Java conterpart to N/gage arena technology from Nokia
multiplayer gaming technology that provides mobile devices access to
- web services
- online community services for IM and presence
- online game services (matchmaking, socre submission and retrieval, ranking)
- integration with game server for games with client-server architecture

SNAP architected around lobby and room concepts
Lobbies and rooms are used as routing groups for game messaging to optimize network traffic

SNAP client transport based on HTTP, but extensible
single point of contact between Java client terminals and online community services
session management
load balancing
scalability

Apache used as a command gateway
routes login, account creation and other queries directly to the web services
streamlined command-set supports matchmaking
StringTokernizer parses a string into tokens

SnapEventListener
Events are held server-side (VSC) until retrieved by client
Event callbacks could be very frequent and would resoult in high network overhead
Client has the choice to retrieve event asynchronously or synchronously

Java Platform Clustering
Programming Cluster Isolates
// Get the slides of this presentation
Isolate isolate = new Isolate();

Isolate Aps
need resource management facilities
Can do much better than current JVM software

RM API for a single node
programmatic control over a set of resources
extensible set of resources
isolates a re grouped into resource domains
one domain controls one resource
multiple isolates can be bound to the same domain

heapDomain1 = ResourceDomain.newDomain(HEAP_MEM);
heapdomain1.setConsumeAction(new Constrain() {...});

Cluster extensions
Everything works as before on a single node
almost everything works as before for multiple nodes

local vs. global maangement
local resource domians, isolates must be co-located on the same node

global management
can be managed remotely

fine-grained RM over a cluster
- blurring node boundaries

Current Status of Java technology-based clustering
- research focused on platform single system image
- products building ad hoc solutions
Cluster-MVM tries to bridge the gap
- single-system image of isolates
- flexible and powerful
The Barcelona Project Web pages
http://research.sun.com/projects/barcelona
JSF 121
TS-7212

EJB 3.0 Goals
Can leave EJB 1, 2 just the way they are
EJB 2.1 component are still supported in EJB 3 containers

migrate server side only

session beans become POJOs as described in the simplified API
// step by step instructions in slides

migrating entity beans
container-managed relationships
java code needs to do the management (LinkedList)
easiest to add a single line to the relationship modifier methods
put the remoteness, transactions and security in session bean
not pretty, not recommnded, should not be a common case

General session with Oracle
// Get slides of this session

JavaServer Faces as the SOA gui
Wow - AJAX GUI, looks really nice
Oracle will contribute ADF faces to MyFaces project! confirmed on stage

EJB 3.0 with metadata is just unbelievably great

Oracle's EJB 3.0 container will become the reference EJB 3.0 implementation!

SOA is hot

Integrate Services
Orchestrate Services - BPEL
Business Process Expression Language

no infrastructure code polluting business logic code

implement business process rules graphically
will create a two-way BPEL description

Secure Services
Manage Services

Web based security manager
can enforce encryption on specific elements

Monitor Services

Pretty impressive AJAX application, no polling

Layers:
----
Common Metadata Repository
JSF EJB 3.0 BPEL
Enterprise Service Bus
J2EE 1.4
WSIF & JBI

Oracle's SOA platform works with Spring and other most popular frameworks

Oracle 10g

Impressive

BeanShell JSF BOF
// Get the slides of this presentation
BS 2.0 what's new:
performance
error reporting
new language features
applet friendly
- mix-in (importObject(map);put("foo", "bar);
- properties style auto-allocation: foo.bar.gee = 42; // foo was undefined

full language support with 1.4
some Java 5 features, boxing, enhanced for loops, static imports

can paste class sources, load from sources etc.
true scripted classes:
- generated classes with real Java types, backed by the interpreter
- scripts can now go anywhere Java goes: Extend/
- expose all methods and typed variables of the class
- bound in the namespace in which they are declared
- may freely mix loose / script syntax with full Java class syntax
HelloWorld.bsh
showMessage() {print("hello!");}
count = 5;
class HelloWorld extends Thread {...}

full Java semantics
- this, super, static and instance variables and blocks
- full superclass visibility
- full constructors functionality this(), super(), controlled superclass construction

Light weight bytecode generator (17K subset of ASM)
stub classes delegate all method and constructor calls to interpreter. All fields generated to class.
Generated accessor methods for superclass visibility

limitations
- reflective access permissions
- bugs to work out

New APIs
javax.script (JSR-223) Powerful, pluggable scripting languages for Java
the BeanShell API Compiler - true persistent classes backed by scripts

minimalist language neutral script generation capabilities

BeanShell generated stub classes can now be saved to ordinary dot class files
Class initialization code launches an interpreter for the associated script file
indistinguishable from ordinary classes to the outside world
script files can evolve after the class is generated as long as they fulfill the basic contract(!)
can contain any amount of additional "loose" Java code in or outside the class body
real classes as properties files... (James Gosling)
servlets and web apps with runtime modifiable classes

next steps:
- java 5 syntax compatibility
- performance, control, security
- pluggable, extensible syntax?

targeted for 3.0
- generics, annotations, varargs... what are we going to do with those?
- could just ignore, but other possibilities as well

Performance
more bytecode where allowed?
current implementation is (almost) pure reflection
tuning - we have not yet begun to tune

Uh oh battery dying...

Recharged me and the battery, back for
JavaServer Faces Over The Phone:
Building VoiceXML with Custom JSF Components and Render Kits

Problem overview
VoiceXML vs. HTML
Brickwall when starting

Provide additional functionality to a component

UIComponentBase a convenient base class
UIOutput not good, just for simple string output

Interfaces to implement: StateHolder / ValueHolder

Direct implementation: component handles its own rendering
Delegated implementation: component delegates the rendering to a renderer

com.voicerite.Prompt
... just basic stuff

saveState save the object in a serializable object - like most MyFaces components

Choose the class the Tag will subclass

Configure UI Component

which version of voiceXML?
Is it complete?
Pros/Cons?

Benefits:
Changing locale easy, not too many benefits in it actually

Components need to be bigger, customized, contain error handling, validation to get benefits
Identify reuse possibilities
Benefits in implementing renderkits for different voice browsers

IBM open-source voicedialog taglib - taglibs usuallly a give-away with the server

mingling recognization code with business code

in voiceXML the things that will kill you are those left out of the spec

Posted by thoughts at 07:39 AM | Comments (0) | TrackBack

June 29, 2005

JavaOne 2005: Day One

Big. Just big. I've been in various conferences before, but never before in Java One. There's only one word to describe it: Big. Some say JavaOne has become smaller since the previous year, but for this type of programming/fairly focused, academic conference it's still much bigger than any other I've been in. I was hoping more for a little bit relaxing week, but no, this is serious business. The lines to the registration were just ridiculuously long so I opted for getting a little red sticker that staff was giving out to get to the general session. It's 8:51 and the opening keynote is about to start. Armed with my new external battery I'm ready to hang in there till the last BOF sessions that end around midnight(!).

I'll post a notes of each day on my blog. I'll give a summary of most interesting things and post the raw notes in the extended entry.

On the first day, I picked up two immediately useful things for both Bounty and Pinnacles. First is JConsole, that's been added into Java SE 5. Previously you could get it at as add-on for Java 1.4. JConsole is an extensible Java perfomance analysis tool capable of gathering data over time, producing very nice graphs and exporting to different output format. Naturally, Sun has extensive documentation on how to use JConsole..

Another, potentially very useful thing for us are annotations in Java SE 5. I've known about it for a while, thought it as useful and done some simple tests, but it's only when I saw presentation on EJB 3.0 with dramatically simplified programming model and radically reduced lines of code needed to implement EJB persistence. Annotations are similar to XDoclet, but better as its implemented as a built-in language feature. In many cases, it removes the needed to implement any external descriptors, be it for the web services or for persistence mapping. And mind you, with EJB 3.0, persistence is not a EE-only feature, but you can use it with SE.

There was alos a lot of information about next versions of Java and what's going to happen in the future, but read more from the raw notes in the extended entry. The theme overall is Java is becoming easier to use and more focused on desktop. Maybe the time really is right this time. I have to say one more thing about the audience: during the opening keynote, Jonathan Schwartz asked all coders to rise their hand. About 80-90% of people raised their hand - another thing why I already like this conference.

---
Day One

Sun to continue opening up their code. Open sourced their enterprise server under CDDL. J2SE internals open sourced.

AMD 64 very well positioned, mentioned a lot with Solaris platform.

The latter half of the general session mostly product announcements. Next version of Sun Java Creator (Creator2) and Sun Enterprise look interesting.

Sun Ultra 20 Workstation
AMD Opteron 144 CPU 1.8GHz/1 MB
512MB-2GB

Java ME roadmap 3:30pm Esplanade 303/305

J2SE 6.0 -> Java SE 6

All new Java APIs go through the JCP

There won't be 5.1 out and solid -> only patch releases

Java SE 6 Mustang mid2006
Java SE 7 Dolphin early2008

Theme is compatibility, stability, quality
Diagnosability, monitoring & management
XML & Web Services
Ease-of-Development
The Desktop
Become more open

Mustang adds JMX upgrades, JConsole upgrades, JVM level diagnostics

Web Seriveces is emerging key interop standard
Web Services client stack
- Client focused, but also lightweight server
- Includes updated core XML stack

Scripting language support, including Rhino JavaScript engine
JDBC 4.0 including EoD features, XML data support
javadoc update

Desktop Java is critical to overall Java success

Mustang includes full Longhorn support,
including Avalon look-and-feel

GUI upgrades
LCD font rendering support
windows system tray suppport
graphics pipeline boosts

mustang.dev.java.net
Weekly builds
source available under Sun Java Research license
binaries under Java evaluation license

Dolphin...
New packaging/deployment architecture
- separate distribution v. caching v. loading

EoD improvements in Java EE 5
POJO-based programming
extensive use of annotations
resource injection - inversion of control

Annotations
- for defining and using web services
- to map Java classes to XML
- to greatly simplify EJB development
- to map Java classes to databases

EE 5

new persistence API
- Resolved EJB /JDO conflict
- Much simpler than EJC CMP
- Feedback overwhelmingly positive
- Persistence API also usable in non-JEE platform
- Dramatic simplification of all bean types
- dependency/resource injection
- Interceptors

easy web apps with JavaServer Faces

annotations.. Transactional helloworld

import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.annotation..
@WebService
@Stateless
public class HelloWord {
@Resource private EntityManager em;
}


General Session / BEA at 1:15pm

POJO support
Meta Data
Dependency injection
Aspect-oriented programming

enabling technology
simplify implementation

Bea WebLogic Server
Certified leading open-source projects
- Beehive, Struts, Spring, JSF

WebLogic Workshop
Geronimo, Tomcat

support for different containers

Java is becoming easier
67% of new large-scale application will emit business event
50% of large enterprises will rely on complex/ecent processing

innovations needed in new programming paradigms, JVM innovations in reliability
previous JVMs: one size fits all, multiplatform focus

Current JVM development
performance driven, specialization emerging

JVMs to obtain true operational robustness
extensive administrative tooling
detect memory leaks
minimize GC pause times

BEA JRockit - the fastest enterprise JVM
Operational diagnostics
production memory leak detection
Trouble spots linked to source code

blending open source and commercial solutions
Always on reliability for JVM


Tigers and Dolphins and oh my...
New Release model
FEature releases 18-24
Update releases 2-3

Faster, more responsive platform evolution
Critical fixes delivered, and adopted, more rapidly
Releases more likely to ship on time
Effective as of JSE 5 platform

Mustang Compiler updates
- classloader verifies classes
annotation processor
@ToDo("Should be package-private")

public class ToDoProcessor implements AnnotationProcessor

JDBC simplified
Streaming api for XML

JAXB 2.0 Java XML binding
@XmlType
public class Favorites {

}
to generate Java from XML


@SuppressWarnings("deprecation") (should work in JSE 5, but buggy)

Free disk space
dir.getUsableSapce()
dir.getTotalSpace()
dir.getFreeSpace()
it's df in Java!

prompts for passwords without a VUI
System.console();

Class-Path Wildcards
javac -cp '..:./jaxb/lib/*' Sum.java

JConsole improvements
- Reworked UI
- Attach-on-demand
- Deadlock detector

Improved out-of-Memory Handling

java.awt.Desktop
void launchBrowser(URI u) {
Desktop dt = Desktop.getDesktop();
dt.browse(u);
}

java.awt.{SystemTray, TrayIcon}

Anti-Aliased LCD Text

Swing Native Look & Feel Fidelity in Longhorn

No More Scary Security Dialog!

Performance improvements both 32 & 64 bit environments
http://mustang.dev.java.net

Dolphin
JAR files haven't scaled well
- sharing
- isolation
- versioning
- native code
- composition
- dependencies
JSR 277

Language-level XML
feature.add({ user }
{ time }

TS-7955 Evolving the language We 11:00am?

300 JSE core developers

EJB 3.0
@Stateless
public class PayrollBean implements Payroll

// independency injection
@Resource DataSource empDB;

Annotations
@EJB
- EJB business interfaces, references to home interfaces (when accessgin EJB 2.1 components)

@Resource for almost evertyhing else

Number of annotations is simplified from EJB 3.0 specification early drafts

Dynamic Lookup JNDI APIs removed from developer's view

Container Services: Security
@RolesAllowed("HR_PayrollAdministrative")

Conatiner calls bean upon lifecycle events
Even notification
@PostConstruct
@Predestroy
@PrePassivate
@PostActivate

Interceptors
Ease of use facility for more advanced developers

Annotations vs. deployment descriptors
annotations
- make deployment descriptors unnecessary
- default cases don't need to be specified
- commonly used cases can be specified easily

Deployment descriptors remain available as alternative

EJB 3.0 persistence
- support for light-weight domain modleing, including inheritance and polymorphism
- complete query capabilities
- support for object-relational mapping specification
- make entity instances usable outside the EJB container

Evolution into "common" Java persistence API
- merger of expertise from Hibernate, Java Data Objects, TopLink, EJB technology vendors and individuals
- support for pluaggable third-party persistence providers

Entitities are simple Java classes
- concrete classes - support use of new
- Getter/setter "property" methods or persistent instance variables
- No required bean interfaces
- No required callback interfaces

Usable as detached objects in other application tiers

Persistence Focus: O/R mapping
- developer is aware of mapping between DB schema and domain object model
- at query language level
- at object/data transfer and faulting level
- developer is in control of the contracts


Create a Dynamic Application Profiler Using Java SE 5 features
// Get the files for this presentation (TS-3103) at http://javaoneonline.mentorware.net/servlet/mware.servlets.StudentServlet?mwaction=generic&subsysid=2000&file=tech_sessions
// Lot's of code in the presentation you can use yourself
java.lang.management
java.lang.instrument
Java Management Extensions JMX API to create a dynamic application profiler

Understand use of BCI
- Use BCI as a tool to answer questions about your application's performance
Understand the Java SE 5 Java agent technology

Profiling agent, two stages
JVM MBeans
Sampling profiler
- wkaes up periodically
- collects information
- drives request for additional, detailed information
- Export through JMX technology
Detailed Collector
- Wakes up periodically
- Checks for work to do

Calling MBeans

java.lang.management.ManagementFactory

Create a new platform MXBean proxy

Get the reference to the MBeanServer
synchronized javax.management.MBeanServer..

ThreadMBBean.getThreadInfo()
getCurrentThreadCpuTime();
getCurrentThreadUserTime();

JRat BCEL-Based
Wrapping for collection of timing information

start-up java.lang.instrument
Class redefinition
Premain-Class
-javaagent:jarpath

BOFS

Continuous integration with CVSNT, CruiseControl, Ant, JUnit, JFCUnit and more on Microsoft Windows

CruiseControl for automated builds
- Feedback on code coverage, build status etc.
- mail integration

JFCUnit for Java GUI testing
- timing issues: individual test that re-run themselves - more threads, more issues - Doesn't work headless, need dedicated system

Windows setup
- create a local tester account with administrative access
JavaService http://forge.object.web.org/project/showfiles.php?group_id?=137
CVSMailer only on Windows

No code coverage tool in use, evaluating TestCoverage

Efficient XML
// Catched the end of this session while waiting for Kito Mann's

the idea is to tell something about the XML schema to the parser so it can optimize loading and storing it more efficiently

Kito Mann's Exploring the Java Server Faces Ecosystem

JSF Console from James Holmes, free Eclipse plugin

Stan Silvert Tuesday 2:45pm

Shale 2:15pm

Opne source/free tools
JSF FormBuilder
XDoclet
EasyWizard
AppFuse

Facelets, templating approach using JSF 1.2 functionality
Nirvana, HTML -> jsp generation

Posted by thoughts at 01:25 PM | Comments (3) | TrackBack

June 16, 2005

Some JSF headaches

Just run into this nice little "feature" with JSF - mapping Faces servlet to /* leads to an infinite loop. Well, it's pretty logical when explained, but unfortunately the whole JSF spec is full of these little peculiarities. Some other examples are using < redirect /> looses the messages, the infamous back button problem with server-side state saving etc.

It's still the best web app framework for Java at the moment, but there's a lot of work ahead. Luckily, we can proactively fix these problems in MyFaces - you too can participate to this Apache project.

Posted by thoughts at 04:32 PM | Comments (0) | TrackBack