geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <>
Subject References to Beans (EJBContainers...)
Date Wed, 02 Feb 2005 16:04:57 GMT
To all, most likely Alan,

A little confusion on my end.  I was trying to use the 
ReferenceCollectionListern to handle adding and removing of 
EJBContainers.   Originally I was thinking of uisng the ContainerIndex 
like the EJBServer does.  I have a GBean with the following:

1. I suppose the kernel creates a collection of containers during server 
startup and passes them to my gbean.
2. During runtime as ejbs are deployed (started) the kernel will end up 
calling memberAdded. (Likewise with the stop/undeploy an ejb with 

    public static final GBeanInfo GBEAN_INFO;

    static {
        GBeanInfoBuilder infoFactory = new 


        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
        infoFactory.addAttribute("args", ArrayList.class, true);
        infoFactory.addAttribute("props", Properties.class, true);
        infoFactory.addAttribute("ip", String.class, true);
        infoFactory.addAttribute("port", int.class, true);
        infoFactory.addReference("AdapterManager", AdapterManager.class);
        infoFactory.addReference("Containers", EJBContainer.class); // 
Use this?
ContainerIndex.class);  // or Use this?

        infoFactory.setConstructor(new String[]{"classLoader", 
"AdapterManager", "ContainerIndex"});

        GBEAN_INFO = infoFactory.getBeanInfo();

    public static GBeanInfo getGBeanInfo() {
        return GBEAN_INFO;

    public void memberAdded(ReferenceCollectionEvent event) {
        EJBContainer container = (EJBContainer) event.getMember();

        // TODO: How does this method differ from setContainers()???

        log.debug( "RmiIiopServerGBean.memberAdded(): container = " + 
container );
        log.debug( "RmiIiopServerGBean.memberAdded(): containerID = " + 
container.getContainerID() );


    public void memberRemoved(ReferenceCollectionEvent event) {
        EJBContainer container = (EJBContainer) event.getMember();

        log.debug( "RmiIiopServerGBean.memberRemoved(): container = " + 
container );
        log.debug( "RmiIiopServerGBean.memberRemoved(): containerID = " 
+ container.getContainerID() );


    public void setContainers(Collection containers) {
        log.debug( "RmiIiopServerGBean.setContainers(): containers = " + 
containers );
        ReferenceCollection ref = (ReferenceCollection) containers;

        this.containers = containers;

In my plan, I have:

1. In the reference for Contains, I have a name pattern for EJBs.  
However, I don't seem to be able to add a wildcard to represent any/all 
containers.  I have tried various settings all result in either a 
Malformed exception or other.
2. I suspect that I shouldn't use ContainerIndex, but rather Containers.
3. I have also observed that when using ContainerIndex, the kernel is 
able to start my GBean since there is a valid object reference for 
ContainerIndex.  I have seen messages on the console that indicate that 
the kernel is awaiting an object reference for ContainerIndex.  This is 
probably due to the fact that I don't currently have an ejb deployed.

    <gbean name="interop:type=AdapterManager,name=AdapterManager" 

    <gbean name="interop:type=NetworkService,name=RMIIIOP" 
        <attribute name="name">RMIIIOP</attribute>
        <attribute name="port">9000</attribute>
        <attribute name="address"></attribute>
        <attribute name="allowHosts"></attribute>
        <attribute name="priority">5</attribute>
        <attribute name="threads">20</attribute>
        <attribute name="logOnSuccess">HOST,NAME,THREADID,USERID</attribute>
        <attribute name="logOnFailure">HOST,NAME</attribute>

    <gbean name="interop:type=Server,name=RMIIIOP" 

View raw message