Skip to Content Java Solaris Communities Partners My Sun Sun Store United States Worldwide

»  Bienvenue Sun Labs Europe
»  Beyond Firewalls: Public Utility Computing for Private Networks
Brazil Project: The Future of Web Application Development
»  Paperless Publishing with a Twist: It May Work
»  Online Privacy: Taking it Personally
»  It's Come to This - http://www.myfridge/check_ice.html
»  Racing Toward the Future...

BRAZIL PROJECT: THE FUTURE OF WEB APPLICATION DEVELOPMENT

by Jon Byous

The Brazil Technology Architecture

The Brazil architecture is described by four characteristics:

A rich toolkit of powerful, reusable parts
 
Large applications achieved by combining simple parts in consistent ways
 
Small applications are simple to build
 
There is no preconceived notion or rigid structure of file systems

These four components, and the interrelationships between them, define the Brazil architecture, prototyped in the Java programming language.

Java[tm] technology-based objects represent two of the components, objects, called Server and Request. The third component, a Java technology interface-definition called a Handler, is the mechanism by which functionality is added into the Brazil architecture.

The final Brazil toolkit component is the data structure for managing the information flow between the other parts, It's called the Brazil technology properties, named after the Java technology class used in the prototype implementation. The properties are the name/value pairs that represent the current state of a URL request, along with methods for managing both the lexical and temporal scope of the data.

Brazil technology supports other Sun technologies, including Java[tm] Messaging Service (JMS), Jini[tm] connection technology, and Java[tm] Reliable Multicast Service (JRMS).

BRAZIL August 21, 2000 -- Code named "the Brazil project," a technology developed and tested at Sun Labs over the last two years is now available for download. If you are a developer using Java[tm] technology, it's worth a serious look.

The Brazil project is a web-based infrastructure that links people securely to information, computers and other devices leveraging existing standards and protocols.

The framework enables stand-alone systems to work together within the Web space. A strong authentication architecture allows extranets to access intranets in an open environment without compromising security. The Brazil project's approach extends the endpoints of a network to new applications and smaller devices. At the same time it can incorporate legacy applications into the system.

Simply put, the Brazil project is a toolkit for building next-generation web-based applications.

"We're not even sure what 'next-generation' applications will look like," says lead architect Stephen Uhler, who wrote much of the code for the Brazil project. "But we're pretty sure the Brazil toolkit will be useful in building them."

The Brazil project started off as an HTTP stack designed with a very small footprint. It was originally intended to serve as a URL-based interface for smart cards, allowing them to be accessed from a web browser. Once the power of this simple Java technology-based code was understood, it evolved into a more general toolkit for putting URL-based interfaces on a wide range of applications and devices. More and more applications for the Brazil project continue to be explored and the limits for this technology have not yet been defined.

The Brazil project promotes the functionality of portals and content aggregators. It does this by sitting between the content providers and the users to offer fully personalized and customized content pulled from a variety of independent web sources.

The Distributed-Content Web

The Brazil toolkit and architecture is capable of building both ultra-small and large enterprise-class applications -- all run through a web browser interface.

As a micro-server, Brazil technology lets developers attach simple devices to the web with the barest of capabilities, squeezing into the tiniest places. As a meta-server, Brazil technology is the mechanism for synthesizing, transforming, and integrating content retrieved from traditional content servers as well as from millions of micro-servers.

Uhler explains, "Currently, the web consists of browsers talking to web servers. In our vision, web servers will be augmented by meta-servers, which do the content aggregation and portaling. In addition there will be micro-servers, which produce tiny bits of content that, although not suitable for browsers directly, can be useful in conjunction with the meta-servers. The Brazil framework can be used to build applications for all three levels -- web servers, for meta-servers and for micro-servers."

Brazil technology prototypes are running on large computers as HTTP servers, on workstations and PCs as a personal web server, and on embedded computers, such as TINI, for HTTP-addressable devices and appliances. For Palm-like devices and cell phones, current transcoding solutions tend to be special purpose, however, the Brazil toolkit would address this opportunity as just another web application.

Unlike most other application technologies, a typical Brazil technology application uses content that is distributed on lots of other web sites all over the Internet. "For example, all of the content for most web sites is contained at the doc-root of that particular domain," says Uhler. "But Brazil allows you to include content from other sites, delivered within the same look and feel of the main site."

In other words, Brazil makes it possible to dynamically extract content from existing web sites and present this content in a look and feel that matches the "home site" from which the user is coming.

Brazil technology actually responds to a URL request from a browser by going to other sites, getting many pieces of content, analyzing it all, rewriting it, putting it all together, and transforming it before it is sent to the user.

Charles Jackson, Sun Labs Internet Manager, describes one scenario: "Let's say we have posted an article on an external web site for Sun Labs. If people access the article from java.sun.com, the article will appear with the look and feel of that site, not the Sun Labs site. If they link to it from the sun.com site, it will appear as a sun.com page. It's like a chameleon."

Piece Your Application Together from Parts

"You can think of the Brazil toolkit as an erector set of parts or pieces you assemble in different ways to make your application," says Uhler.

But the parts have very interesting capabilities. One part lets you gather content from other URLs. Another part is an HTML parser that breaks content down into its constituent pieces. Another part allows you to make HTML templates into which you can stuff content extracted from other places.

And these are just three of the Brazil toolkit's snap-together pieces, called Handlers.

Handlers deliver dynamic loading of application functionality and configurations, resolved and loaded at runtime.

"The sophistication of your application is really just dependent on how sophisticated you are at putting together these primitive pieces," says Uhler. "In addition, because you will probably want to build some new pieces, or Handlers, of your own, the Brazil toolkit was designed to make it easy to add new little bits of functionality to an application, combining them with all the bits that are already there."

"It's really easy for Brazil toolkit Handlers to work together -- eliminating the need for monolithic applications," says Uhler. "In addition, within any given application, there are probably several Handlers that you would want to toss back into the toolkit for reuse in other applications."

The Brazil toolkit comes with a collection of general-purpose Handlers, some of which were custom-developed for specific applications but are generically highly reusable.

Accelerated Development Cycles

With the Brazil toolkit, there's exactly one interface and two methods. Functionality is added to the server adding lots of little pieces that all implement the same "little" interface with just two methods.

According to Uhler, "When you're just using two methods, it's really easy to have one Handler call another Handler that calls another Handler -- it's just as easy to be a 'container' as a 'containee' within Brazil. Consequently, the pieces tend to compose well."

The idea was to provide a very flexible, malleable toolkit for writing applications very quickly which are designed for the new paradigms in web applications, whatever they may turn out to be.

The Brazil Toolkit Language

The Brazil toolkit interfaces are based on the Java language for the advantages of its strong typing. However, the Brazil Handlers communicate with each other with no type-checking involved.

"That creates a wide degree of flexibility to use the Handlers in ways that weren't originally intended by the designer," says Uhler. "The typing doesn't get in the way of doing whatever you want with the Handlers. That tends to promote easy reusability of the Handlers."

The Brazil toolkit uses its own Brazil Scripting Language (BSL), to take the information communicated between Handlers and use it for dynamic HTML generation.

BSL allows for the separation of the Java language Handlers from the HTML web page look and feel. The Handlers never generate HTML, and the page's HTML is just that. The advantage here is that making changes in the HTML doesn't require a programmer looking over the shoulder of the web developer to avoid or correct mistakes inadvertently made to the Java technology code in the process. And vice versa.

Mount and Transform Web Content in Two Easy Steps

"Let's say I want to build a web site where some of the content is contained on a different server," says Uhler. "I use the Brazil Handler ProxyHandler. It makes the content files of another site look as if they were local to my machine. How?"

"The Handler creates the illusion that the 'different server' pages are actually on my machine, sitting in a directory under the doc-root. UNIX allows you to do a network file system mount, to specify a file system on a file server to appear as if the files were contained on the second machine," explains Uhler. "The Brazil toolkit borrows this concept in a Handler that does exactly the same thing with web sites. I can specify 'mount www.sun.com' on, say, /foo. Then, if I go to my web site, /foo/test.HTML, I see the sun.com site on my site. This particular Handler simply mounts web sites instead of file systems. No problem. And of course, it rewrites the URLs to support the illusion that the mounted content resides on my machine."

That's just one example. "To take it a step further, I can also use a Handler that rewrites each content page of the mounted web site to look just like the existing pages of my site," says Uhler. "It throws away the original style and replaces it with my site's look and feel."

No longer does the content server have to produce both the content and its presentation (look and feel). They're easily separable.

Those two steps, mounting and transforming web content, require just two of the Handlers provided with the Brazil toolkit.

The Possibilities ...

"Whenever you write anything these days, you want to write it with a web interface," says Brazil project team member Rinaldo Di Giorgio. "What's perhaps the simplest and easiest way to do that? The Brazil toolkit."

Di Giorgio continues, "This technology today would allow a credit card company to access any given customer's smart card if the card is slipped into a reader. If the customer had a problem, the credit card agent could make secure adjustments to the data in the card from any desktop reader."

Di Giorgio has developed a larger number of applications that allow him and his clients to be more productive, using the Brazil technology. He is currently working with Sun customers to develop financial, gaming, and wireless applications using the Brazil technology.

Di Girogio has written Brazil technology handlers for smartcards, home automation, real-time telemetry, wireless devices, and personal security services.

"Another scenario would be to see a Brazil technology-driven personal search engine -- sort of your own search-and-organize butler for all of your own files," adds Di Giorgio.

More than a Web Server

"The world is full of web servers, and the Brazil project was never intended to be a web server. In fact, the original name for the Brazil project was NAWS -- Not A Web Server," says Uhler.

"A traditional web server is generally a pretty complex piece of software that you point your browser to, and it roots around and finds HTML pages and a file system and gives them to you," says Uhler. "This is not what we wanted to do. Instead of delivering static content and files, we wanted to try to figure out where the web was headed over the next few years and build an architecture for that vision."

Of course, you can configure the Brazil toolkit as a web server, but that's not what it was designed for.

"People already understand and can relate to what web servers do, so we use that as kind of a point of departure in talking about the Brazil toolkit's functionality, says Uhler. "The Brazil project was meant to do something way beyond that." But for immediate purposes, it's at least a new way of building present-day web applications.

As a demonstration of the Brazil technology's flexibility, Stephen Uhler sent the writer of this story a .jar file containing a small Brazil toolkit web server and a web site attached to an email. This made it possible to view Uhler's restricted web pages locally. Sending web servers and complete sites as attachments to emails is a new concept, but with Brazil technology, it works.

The Brazil technology documentation summary says, "By using a simple interface, in conjunction with powerful, reusable components, the Brazil technology system is able to deliver a wide range of flexible web solutions, ranging from tiny micro-servers, to traditional web capabilities to fully functional meta-servers that provide sophisticated portal and content aggregation capabilities."

The bottom line is that the Brazil toolkit gives developers a new and easy way to put reusability to work through a collection of special-purpose Handlers to build a new class of applications based on mix-and-match parts that work together.

See Also

Download the Brazil Toolkit
(http://research.sun.com/brazil/)

Brazil Project Discussion Forum
(http://forum.java.sun.com/forum.jsp?forum=64)

Brazil and Home Automation
(http://research.sun.com/features/myfridge/)

How Handlers Work in Web-Accessible Home Automation
(http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-javadev.html)

Serve Clients' Specific Protocol Requirements with Brazil
(http://www.javaworld.com/javaworld/jw-08-2000/jw-0811-javadev.html)

Build multicast-aware apps with JRMS and Brazil
(http://www.javaworld.com/javaworld/jw-04-2001/jw-0420-javadev.html)

The Online Developer Documentation
(http://research.sun.com/brazil/api/) is also available.

Join the Brazil Project Mailing List. Send a blank email to brazil-interest-subscribe@sun.com.
(Mailing list terms of use).

Would you recommend this Sun site to a friend or colleague?
Contact About Sun News Employment Privacy Terms of Use Trademarks Copyright 1994-2008 Sun Microsystems, Inc.