Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

JavaBeansTM Short Course
Introduction

By MageLang Institute

[Tutorial Contents] [Introduction]

Introduction

Welcome to the JavaBeans exercises. These exercises show how to use JavaBeans and its component parts to develop component-based solutions with Java. There are exercises to create Beans, and examine Bean metadata (the structure of the Bean). Also, the exercises tour the Bean Development Kit (BDK) and its BeanBox, along with adding Beans into its Toolbox. In addition, they will show you how to use Java's reflection API, sign code, and get support/resource files to go along with your Beans.

There are 9 exercises to complete:

  1. BDK Introduction with John Wayne

    This exercise takes you on a tour of the Beans Development Kit (BDK) 1.0. It introduces the BeanBox, a test Bean container, and demonstrates some of the example Beans. Finally, it walks you through the process of connecting some of the example Beans together to provide a juggling Duke.

    Educational goal(s):

    • What the Beans Development Kit (BDK) is
    • What the BDK is good for
    • Sample the BDK Beans
    • How to connect Beans
    • How to change Bean properties

  2. Creating The First Bean with Kaidi
    This exercise takes your through the steps to create your first Bean.

    Educational goal(s):

    • What defines a Bean.
    • How to create a Bean.

  3. From Kiva Han to Central Perk

    This exercise builds upon the basic KivaHan bean, from the Kaidi exercise, into the sophisticated CentralPerk bean. Instead of being a non-scrolling billboard like Kaidi, CentralPerk is a customizable scrolling bean, with perking events and constrained properties. The skeleton for CentralPerk provides a scrolling billboard, you get to add the parts that make it a Bean.

    Educational goal(s):

    • How to create Bean components
    • How to create constrained properties
    • How to source events
    • What is required to be persistent

  4. Inspecting Beans with BeanInfo and Juan Valdez

    Using BeanInfo and reflection help Juan Valdez inspect his beans. This exercise shows you how to get access to bean information without directly calling methods or inspecting properties. Instead, you ask a Bean's BeanInfo what it knows about and use this to access a Bean's properties and determine what kind of event listeners you can register.

    The task of this exercise is to complete the inspect method of the Valdez skeleton to list the names and values of all properties and names and listener types for all event listeners of the Bean.

    Educational goal(s):

    • How to inspect Beans with BeanInfo
    • How to discover Bean events and property
    • How to invoke methods without knowing their names

  5. Packaging Central Perk with Marcel

    Marcel is Ross's monkey on Friends. He's going to help you package up our Central Perk Bean, from the CentralPerk exercise, into a .jar file for use within the BeanBox, or some other builder tool. You'll also create a supporting BeanInfo class for the Bean.

    Educational goal(s):

    • How to package up a Bean
    • How to create a manifest file
    • How to load beans into the BeanBox ToolBox

  6. Getting Resources with Clara Barton

    With applets, you can use getCodeBase, getDocumentBase, and getParameter to get support files or run-time settings. Since Beans are stand-along components, where would you locate an image or sound file for it to use? If kept on YOUR central server, the Bean user would have to have access to your server at run-time. If your server is offline, busy, or just not available to the user, they would not have access to the necessary support file. If the Bean was used in an applet, this would trigger a security exception if the applet was untrusted.

    Beans get around this limitation through the use of Java resource files. The support file or information can be provided within the Bean's .jar file or can be located locally within the user's CLASSPATH.

    Educational goal(s):

    • What resources are for Beans
    • How to load support/resource files

  7. Saving Billboards with Casey Kasem

    This exercise adds a Customizer to the CentralPerk Billboard Bean. Also, you create a testing application with Bean save/restore capabilities.

    Educational goal(s):

    • How to create a Bean Customizer
    • How to Serialize Beans for saving and reloading
    • How to access/use Customizer

  8. Reflective Programming with Sigmud Freud (optional)

    Use of the reflection API is important when creating tools. They need to be able to inspect Java Beans to see how they work. This exercise shows you how to duplicate javap functionality through the use of the Reflection/Introspection capabilities of Java.

    Educational goal(s):

    • How to use the Reflection API
    • How to inspect Beans without BeanInfo

  9. Signing Declarations with John Hancock (optional)

    If you sell a Bean that requires it to be trusted when downloaded over the Internet, you need to digitally sign it. Then, for each and every user, they need to identify you as trusted and install your public X.509 key, into their Java key database. (Code signing is only one way of limiting access in Java. See the Java Security API Overview for more.)

    This exercise takes you through the steps to sign an applet that uses the results from the Reflective Programming with Freud exercise.

    Educational goal(s):

    • How to sign Jar files / Beans
    • How to create privilidged Beans
Copyright © 1997 MageLang Institute. All Rights Reserved.

[ This page was updated: 9-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.