geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject [deployment] Relationship management
Date Wed, 13 Aug 2003 21:47:47 GMT
I am 371 emails behind the list, but wanted to let you all know where I 
am with the relationship managements system.

The first thing necessary for a relationship it to define a 
relationship type in the system.  We have an MBean that creates a 
binary relationship (two roles) on start and removes the relationship 
when stopped.  The following is a complete MBean declaration (note: all 
attributes other then the name are optional)

<mbean code="org.apache.geronimo.jmx.Relationship" 
     <attribute name="Name">Twins</attribute>
     <attribute name="LeftRoleName">Good</attribute>
     <attribute name="LeftRoleClass"> some.good.BeanMBean</attribute>
     <attribute name="LeftRoleMinimum">1</attribute>
     <attribute name="LeftRoleMaximum">1</attribute>
     <attribute name="LeftRoleDescription">This is the Good 
     <attribute name="RightRoleName">Evil</attribute>
     <attribute name="RightRoleClass"> some.evil.BeanBean</attribute>
     <attribute name="RightRoleMinimum">1</attribute>
     <attribute name="RightRoleMaximum">1</attribute>
     <attribute name="RightRoleDescription">This is the Evil 

The default is for a relationship with two roles, "left" and "right", 
where each role is r/w, can have zero or more elements and can only 
contains MBeans of type "java.lang.Object" (anything).

We also now support MBean relationship declaration in our MBean 
deployment descriptor.  You can declare an MBean as follows.

<mbean code="some.good.Bean" name="geronimo.test:alignment=Good">
     <attribute name="Interval">3000000</attribute>

<mbean code="some.evil.Bean" name="geronimo.test:alignment=Evil">
     <attribute name="Interval">30000</attribute>
         name="basic good and evil"

The name and role attributes are required.  The type, target and target 
role attributes are only used if the  relationship is not found.  In 
the case where the relationship is not found, we create a new one of 
the specified type and assign the target to the target role.  The 
target and targetRole attributes are really only necessary for blind 
relationships or if the relationship has a minimal cardinality of 1.

Finally, I added the RelationshipMBeanProxyFactory creates a dynamic 
proxy to an MBean based on a relationship end point.  The interface 
type, relationship existience, and object existance is not enforced 
during construction. Instead, if a method is invoked on the proxy and 
there is no relationship registered with the specified id or if the 
target role does not conatin any objects, an InvocationTargetException 
is thrown, which contains an IllegalStateException.  If an interface 
method that is not implemented by the MBean is invoked, an 
InvocationTargetException is thrown, which contains an 

To invoke a method based on the above relationship you can simply do 

some.evil.BeanMBean evil = (some.evil.BeanMBean) 
         "basic good and evil",

There is also a overloaded method which does not take the interface 
class, but looks at the RoleInfo to determine the interface class.  
This only works if the role is defined in terms of interfaces and not 

I'm going to keep working on this, as this is a path to a simple 
dependency management system.  I'm not sure exactly how it will work, 
but I plan on having a special "Must be started" relationship which 
contains the object names of the MBeans that must be started before the 
an MBean is started.  I'm avoiding details, because I just don't know 
exactly how it will work.  BTW, I just writing the easy dependancy 
system, not the final dependancy startup/management system, so please 
don't worry we can rewrite it later (think XP -- something for today).


  * Dain Sundstrom
  * Partner
  * Core Developers Network

View raw message