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:
-
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
-
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.
-
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
-
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
-
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
-
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
-
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
-
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
-
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.
|
|