Raccoon is a java orientated framework and it's aim is to ease the work of java developpers. As such, in every java application, developpers handle JavaBeans when manipulating data which is a sort of intelligent equivalent of the C Structure.
Now when this data (a java bean instance) is to be sent over the TIB, the current TIB/Rendezvous API doesn't take a java bean natively: the native format is a TibrvMsg instance or the MTree instance, depending on whether you're using the TIB/Rendezvous API or the TIB/Adapter SDK.
So what Raccoon offers is automatic conversion from a java bean instance to an MTree or TibrvMsg instance and back. Therefore java developpers using the Raccoon framework don't need any TIBCO specific knowledge. However for this automatic conversion to be possible there are certain rules to respect; these rules are delved into in the following sections.
The name of the module that handles automatic conversion from JavanBeans to a TibrvMsg or MTree instance is called BadhnAti. This word comes from Sanskrit and it means 'he who binds'.
Currently Raccoon distinguishes two types of Java Beans:
Regarding support: Raccoon is capable of handling AE v3.0 compliant messages and Rv messages that are compliant to the Message Broker v3.x format. It is important to note that Rv messages are not compatible with AE messages, this is why Raccoon supports specifically these two types.
Regarding multi-threading issues our reference is the java bean specification, in particular paragraphe 2.8:
"Java Beans should assume that they are running in a multi-threaded environment and that several
different threads may be simultaneously delivering events and/or calling methods and/or setting
properties. It is the responsibility of each java bean developer to make sure that their bean behaves
properly under multi-threaded access. For simple beans this can generally be handled by simply making all
the methods synchronized".
However we understand that it isn't always possible to have a thread safe java bean, therefore Raccoon offers a special EventListener that handles of pool of java bean instances. Each java bean instance is associated to a unique thread. Of course it is up to the java developper to implement a method called clone() :o)
The BadhnAti module assumes that java bean properties aren't bound. If the java bean has bound
properties then the BadhnAti module will not guarantee the behaviour and may fail to dynamically
instanciate the java bean.
When introspecting a java bean it is impossible to determine (to our knowledge anyway) the
behaviour of bound properties.
What is a bound property?
Sometimes when a bean property changes then either the bean container or some other bean may wish to be
notified of the change. The notification should be sent after the property has been modified.
A component can choose to provide a change notification service for some or all of its properties.
Such properties are commonly known as bound properties, as they allow other components to bind special
behaviour to property changes.
The BadhnAti module assumes that java bean properties aren't constrained. If the java bean has
constrained properties then the BadhnAti module will not handle exceptions and may fail to dynamically
instanciate the java bean.
When introspecting a java bean it is impossible to determine (to our knowledge anyway) the
behaviour of constrained properties. Of course one could implement iterative behaviour: try until
succeed but we haven't.
What is a constrained property?
Sometimes when a property change occurs some other bean may wish to validate the change and reject it
if it is inappropriate.
We refer to properties that undergo this kind of checking as constrained properties.
In Java Beans, constrained property setter methods are required to support the
PropertyVetoException
. This documents to the users of the constrained property that
attempted updates may be vetoed.
public <PropertyType> get<PropertyName>();
public void set<PropertyName>(<PropertyType> pNewValue);
If the Bean Introspector module locates a matching pair of get<PropertyName>()
and set<PropertyName>
methods than the property propertyName
is
considered to be a serializable property and will be sent over the messaging layer.
public boolean is<PropertyName>();
public boolean has<PropertyName>();
If the Bean Introspector module locates a matching pair of is<PropertyName>()
and set<PropertyName>
or has<PropertyName>()
and
set<PropertyName>
methods than the property propertyName
is
considered to be a serializable property and will be sent over the messaging layer.
<PropertyElement>[]
than a search for the following methods will occur:
public <PropertyType> get<PropertyName>(int pIndexOfElement);
public void set<PropertyName>(int pIndexOfElement, <PropertyType> pNewValue);
If the Bean Introspector module locates a matching pair of get<PropertyName>()
and set<PropertyName>
methods than the property propertyName
is
considered to be a serializable property and will be sent over the messaging layer.String[]
named address
is:
public String[] getAddress();
public void setAddress(String[] pNewValue);
public String getAddress(int pIndexOfElement);
public void setAddress(int pIndexOfElement, String pNewValue);
java.util.Vector
)
public <PropertyType> get<PropertyName>();
public void set<PropertyName>(<PropertyType> pNewValue);
public void add<PropertyName>(<CollectionType> pNewValueToAdd);
If the Bean Introspector module locates a matching pair of get<PropertyName>()
,
add<PropertyName>()
and set<PropertyName>
methods than the
property propertyName
is considered to be a serializable property and will be sent over
the messaging layer.
Vector
of String
named address
is:
public Vector getAddress();
public void setAddress(Vector pNewValue);
public void addAddress(String pNewValueToAdd);
It also acceptable to have an adder that is written without an 's', for example:
public Vector getFriends();
public void setFriends(Vector pNewValue);
public void addFriend(Friend pNewFriend);