Oh, I'm hanging out on IRC if you want to pop in and say hello (server: irc.freenode.net, channel #geronimo). I'd love to give you an overview on how to adapt a protocol for use in OpenEJB and the architecture for network services. There is plenty of work to be done there.

-David

On Feb 2, 2005, at 8:04 AM, Mark wrote:

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 memberRemoved)


   public static final GBeanInfo GBEAN_INFO;

static {
GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(RmiIiopServerGBean.class);


       infoFactory.addInterface(SocketService.class);

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?
infoFactory.addReference("ContainerIndex", 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;
ref.addReferenceCollectionListener(this);


       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" class="org.apache.geronimo.interop.adapter.AdapterManagerGBean"/>

<gbean name="interop:type=NetworkService,name=RMIIIOP" class="org.openejb.server.StandardServiceStackGBean">
<attribute name="name">RMIIIOP</attribute>
<attribute name="port">9000</attribute>
<attribute name="address">127.0.0.1</attribute>
<attribute name="allowHosts">127.0.0.1</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>
<reference name="Server">interop:type=Server,name=RMIIIOP</reference>
</gbean>


<gbean name="interop:type=Server,name=RMIIIOP" class="org.apache.geronimo.interop.rmi.iiop.server.RmiIiopServerGBean">
<reference name="ContainerIndex">openejb:type=ContainerIndex</reference>
<reference name="Containers">openejb.server:EJBModule=ejbhw,*</reference>
<reference name="AdapterManager">interop: type=AdapterManager,name=AdapterManager</reference>
</gbean>



Reply via email to