SubjectThis tutorial describes the use of 'Metadata' to extend the capabilities
of the core Whitebeam system beyond the capabilities originally envisaged by
the designers.
OverviewOne of JavaScript's many strengths is the ability to dynamically create arbitrarily
complex data structures. Unlike many programming languages these types do not
need to be rigorously defined upfront and designed into the system. Instead
an object can be created and properties added to it at will. There is no 'class
definition' that lays down membership rules for JavaScript objects. Consider
the following code fragment:
var anObject = new Object;
anObject.name = "Fred";
anObject.sname = "Bloggs";
anObject.company = "Whitebeam";
anObject.age = 28;
This code fragment defines an object with four properties. This object
can now be used within the applications. Later, supposing requirements change,
we can add a new property, say:
anObject.job = "engineer";
This allows for rapid application development and modification. The Whitebeam
System is designed to work with and harness this flexibility. There is limited
usefulness in a system that provides the designer with such a powerful development
tool as JavaScript then handicaps that is real applications by not providing
some level of that flexibility in the underlying application code. Consider
the above example again. The Whitebeam System provides
business templates that encapsulate some functionality. These templates
are provided by Whitebeam. But they need to be extensible in the same way the
JavaScript object is extensible - quickly and easily. Extending the example
above - suppose the properties of the object are to be stored in a template.
If the template were initially designed just for the initial four properties
the designer would have to come back to Whitebeam and ask for a modification.
Every designer would want something different! The JavaScript extensibility concept is harnessed by the Whitebeam System to
allow Integration Partners to easily enhance their applications beyond the basic
functionality defined by Whitebeam. In the Whitebeam environment these arbitrary
structures are referred to as 'Metadata'
objects. Within JavaScript these objects are no different from any other JavaScript
object. Whitebeam's flexibility comes in the ability to integrate these objects
easily into the non-JavaScript aspects of the system. Many Whitebeam Business
Templates can store these arbitrary structures transparently. In effect providing
integration partners to extend the basic data set of a template to suit the
specific requirements of their customers. The system allows the objects to be
stored in client side cookies or in server side session data.
As far as the Integration Partner or Web Designer is concerned Metadata objects
are simply JavaScript objects. The programmer defines the properties of that
object in any form they require for their application. Some of the properties
can be simple strings, others can themselves be objects or arrays containing
other objects and arrays etc.
Once the object has been defined the Whitebeam Environment provides the
means of storing those objects in various 'useful' places - consider the
power of being able to create your own set of properties and being able to
store those against, say, a persons data, or along with a catalogue item.
Or storing as set of arbitrary data items against a user session.
A simple example is that of the
rb.page.session
object that allows authors to store session data to be retrieve during later requests.
|