example the composition fragment from lines 033
to 044. This fragment specifies the instantiation of
the SliderFieldPanel and the configuration
of its property currentValue. This is translated
into the following operators: IN ("sliderField",
"java.composite.SliderFieldPanel") and
IM ("sliderField", "setCurrentValue",
"void", <"10">).
ET (”javax.swing.JFrame”);
IM (”this”, ”setTitle”, ”void”, <”SpeedLogo Animation”>);
AA (”container”, ”private”, ”java.awt.Container”, ”1”, ”null”, ”local”);
IM (”this”, ”getContentPane”, ”container”, <>);
AA (”border”, ”private”, ”java.awt.BorderLayout”, ”1”, ”null”, ”local”);
IN (”border”, ”java.awt.BorderLayout”);
IM (”container”, ”setLayout”, ”void”, <”border”>);
AA (”color”, ”private”, ”java.awt.Color”, ”1”, ”null”, ”local”);
IN (”color”. ”java.awt.Color”, <”0xeeeeee”>);
IM (”this”, ”setBackground”, ”void”, <”color”>);
AA (”sliderField”, ”private”, ”java.composite.SliderFieldPanel”, ”1”,
”null”, ”global”);
IN (”sliderField”, ”java.composite.SliderFieldPanel”);
IM (”sliderField”, ”setCurrentValue”, ”void”, <”10”>);
AA (”logo”, ”private”, ”java.animation.Logo”, ”1”, ”null”, ”global”);
IN (”logo”, ”java.animation.Logo”);
IM (”logo”, ”startAnimation”, ”void”, <>);
IM (”sliderField”, ”addPropertyChangeListener”, ”void”,
<”new sliderField
PropertyChange()”>);
CC (”sliderField
PropertyChange”, ”java.beans.PropertyChangeListener”,
<>,
< AM (”propertyChange”, ”public”, ”void”,
<”java.beans.PropertyChangeEvent e”>, ”null”, ”null”,
{ AA (”value”, ”private”, ”int”, ”1”, ”null”, ”local”);
IM (”sliderFieldPanel”, ”getCurrentValue”, ”value”, <>);
IM (”logo”, ”setAnimationRate”, ”void”, <”value”>) ; }
>);
IM (”container”, ”add”, ”void”, <”logo”, ”BorderLayout.CENTER”>);
IM (”container”, ”add”, ”void”, <”sliderField”, ”BorderLayout.SOUTH”>);
Figure 6: The Sequence of Manipulation Operators for the
SpeedLogo Composition Script
Furthermore, the syntactic incompatibilities be-
tween components are handled within the internal
transformation module. Consider, for example, the
connection-based composition between the compo-
nent instances sliderField and logo described
in lines 056 to 080 of Figure 3 wherein the syn-
tactic incompatibility
1
between these two component
is transparent. This handler can be accomplished by
creaing an inner class that implements the required
interface (Stearns, 2001; Akerley et al., 1999).
As a next step, the manipulation operators are
translated into the desired programming language via
code generation plugins. Figure 7 gives the Java
1
The component instance sliderField allows
any component instance implemening the interface
PropertyChangeListener to register for the event
PropertyChange while the component instance logo
does not implement such interface.
equivalent of the sequence of manipulation operators
given in Figure 6 and the composition script given in
Figure 3.
public class SpeedLogo extends javax.swing.JFrame {
private java.animation.Logo logo;
private java.composite.SliderFieldPanel sliderField;
public SpeedLogo () {
java.awt.BorderLayout border;
java.awt.Container container;
java.awt.Color color;
border = new java.awt.BorderLayout();
container = getContentPane();
color = new java.awt.Color (0xeeeeee);
setTitle (”SpeedLogo Animation”);
setBackground (color);
container.setLayout (border);
sliderField = new java.composite.SliderFieldPanel();
sliderField.setCurrentValue (10);
logo = new java.animation.Logo();
logo.startAnimation();
container.add (logo, BorderLayout.CENTER);
container.add (sliderField, BorderLayout.SOUTH);
sliderField.addPropertyChangeListener
(new sliderField
PropertyChange());
}
class sliderField
PropertyChange
implements java.beans.PropertyChangeListener{
public void propertyChange
(java.beans.PropertyChangeEvent e) {
int value;
value = sliderField.getCurrentValue();
logo.setAnimationRate(value);
}
}
}
Figure 7: The Corresponding Java Code for the Manipula-
tion Operators in Figure 6
5 CONCLUSIONS
Our work makes the following contributions. It pro-
vides, to the best of our knowledge, the first at-
tempt at the standardization of component compo-
sitions elevating compositions to first class citizen-
ship status. We provide a CoCo composition model
that is both flexible and extensible, allowing develop-
ers to extend the standard to include at a later time
other composition styles of component-based devel-
opment. The composition model is described us-
ing XML schema. At the lowest level, composition
scripts can be described using the composition model
implementation to describe an actual composition of
two or more components. A composition script writ-
ten in XML documents conforms to a specified com-
ICEIS 2005 - DATABASES AND INFORMATION SYSTEMS INTEGRATION
344