Thanks for your "fundu" (Indian word for great ) suggestions for my last query.
Here is the next one.
What is the best possible way to design a system in which one component act as a
parent for other component. By parent, i mean that the child component is created only
from the parent compA and when parent is closed , all the child instances created from
it should get closed.
Here CompA is a parent component and CompB is child.
//@avalon component
Class CompA
{
// stores the B components
Hashtable m_StorageForB = new Hashtable();
// B is also a component
public CompB createB(int type)
{
// look up compB
CompB b = m_serviceManager.lookup("service.B");
// pass some parameters to compB
b.setters();
}
// APIs to get an already instantiated B.
//
// As it is not possible to lookup a component which provides xxx service and has yyy
attributes which are not static in nature. (attributes like hashcode of the
component), i have to store the key/instance of compB.
//
public B getB(int type)
{
return m_StorageForB .get(type);
}
public void close()
{
// close all the elements of B that are created by this component
}
}
}
-Aseem
Fiorano MailServer
All incoming and outgoing mails are scanned for Virus and Spam
http://www.fiorano.com