3D PLM Enterprise Architecture |
Webtop |
CATlets in the PortalThe CATlet MVC paradigm and its development |
Technical Article |
This article presents the CATlet architecture and development. |
Basically a CATlet can be assimilated to a Java Bean but it is a more than a Java Bean in the way it is designed to fit inside the Portal and as such has built-in functionalities to enhance this integration. But don't mess with this: we didn't say a CATlet can only exist inside the Portal. As a standard Java Bean a CATlet can be instantiated anywhere outside the Portal and any Java Bean can be instantiated inside the Portal (but with a degraded integration).
A CATlet is a graphical container and is built around the
model-view-controller paradigm (named MVC afterward). The CATlet is itself the
controller of the whole component and aggregates its views and models. A CATlet
can have many views and models but most of the time it has only one for each. Be
careful that we use the term CATlet to represent two things: the whole component
(Model View and Controller) as well as the controller itself. This may be
confusing but in fact they represent quite the same thing: The CATlet is the
graphical controller component added inside the Portal and it is the only part
of the MVC, visible from outside.
All the intelligence of the MVC component is located in the CATlet (the
Controller). The model is meant to store the data of this component and the view
to display whole or part of these data. Model and view are instantiated by the
CATlet. They should not know (i.e. no reference) each other or the CATlet that
created them. This way you strongly reduce the tight between components and
views or models can be reused in other contexts.
Now, these three components (model, view and controller) have to communicate
which each others. As the CATlet knows (i.e. has a reference) the model and the
view, the CATlet communicates with the model and the view via method calls. As
the model knows neither the view nor the CATlet it can only communicate with
them by sending events, subscription being through the CATlet. For the view it
is the same kind of communication as for the model with the difference that
usually the view doesn't have to directly communicate with the model.
The communication flow between these components is as follow:
[Top]
Main statements from this schema are that
To program a CATlet, a programmer needs to write the client model-view-controller of its CATlet (using base classes delivered by the infrastructure), write the communication classes (event listener and publisher).
[Top]
A java-bean is a elementary Java component allowing to users to build other components. Each CATlet is also a java-bean and is itself made of other java-beans.
To be considered as a java-bean, a component must follow the Java Bean design patterns. These design patterns describe mainly how to define your object methods, its events and properties. Following this design pattern make a lot easier communication and connection between beans as well a configuration of your object at runtime. Please refer to the JavaBean specification document for more detail about this design pattern.
An important property of the java-beans event model is that to communicate, beans don't have to know each other at build time. This way, beans can be completely independent, providing the following benefits :
[Top]
A CATlet is basically made of three kind of elements:
The beanified MVC protocol describes precisely the events and properties flows between the model, view and controller. The benefits of this protocol are:
The controller must extend one of these classes CATlet or JCATlet (AWT or Swing implentation of the ICAtlet interface) from the package com.dassault_systemes.catweb.base.catlet. Within it you need to:
The model must extend the class Model (from package com.dassault_systemes.catweb.base.catlet.model). Within it you need to:
The view must implement the interface ViewInterface (from package com.dassault_systemes.catweb.base.catlet.view). Within it you need to
The following diagram shows the different kind of communication that exist between the models, views and controller :
[Top]
The Hookup is a component delivered in the CATlet infrastructure that allows you to make your CATlet communicating with each other without knowing themselves.
The Hookup uses a publish-subscribe mechanism based on the java-beans events model. When a CATlet is interested in listening some events, it must get a reference on an object which fires these events to subscribe on it. When you don't have a reference on such object, just tell the Hookup that you are interesting in listening some particular events (this is called subscribing). On the other side, when you may fire events, tell the Hookup that you can fire these king of events (this is called publishing). This way, when the Hookup has a subscriber interested in listening events that one of its publishers fire, it will act as a third party and make this subscriber subscribes to this publisher (as defined in the java-beans event model). Up to this point, both beans are connected and when the publisher fires an event, the subscriber is notified on the corresponding listener interface (as defined in the java-beans event model).
At no moment the publisher had a reference on the subscriber nor the subscriber had a reference on the publisher. The drawback of this mechanism is that you can't control to which CATlet you fire your events, except if the events you fire contains additional information that will let the subscriber filter the received events.
An other mechanism provided by the Hookup is the notion of persistent events. If a publisher has fired an event and decided that this event will be persistent, each time a new subscriber declares itself as being interested in this kind of events, it will automatically receive this event.
This describes briefly how to publish and subscribe
[Top]
In order to benefit from services of the environment it lives in, the CATlet may communicate with it. Even if the CATlet's main and dedicated environment is the Portal desktop, it may have others environment it doesn't know. This is why all the requests are processed to the CommonSupport which redirects them to interfaces which implementation differ from the environment. The requests this CommonSupport object support are:
As the environment in which the CATlets live may change, some of these requests may be processed or not depending on the capabilities of the environment.
[Top]
The CATlet life cycle is the following one:
At each state of this life cycle, the CATlet may take special action:
[Top]
[1] | Declare a CATlet in the Portal |
[2] | Programming Command |
[Top] |
Version: 1 [Sep 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.