This content has been marked as final.
Show 4 replies
-
1. Re: Pushing beans into the kernel
starksm64 Aug 9, 2006 7:44 AM (in response to starksm64)So the problem is that the KernelController knows nothing about the server. I did get past this doing:
// Register the Server instance in the kernel Kernel kernel = getKernel(); KernelController controller = kernel.getController(); KernelRegistry registry = kernel.getRegistry(); KernelConfigurator config = kernel.getConfigurator(); BeanInfo info = config.getBeanInfo(server.getClass());; AbstractBeanMetaData metaData = new AbstractBeanMetaData("org.jboss.system.server.Server", null); AbstractKernelControllerContext serverEntry = new AbstractKernelControllerContext(info, metaData, server); controller.install(serverEntry);
At first this failed because the server instance was being restarted by the kernel while it was already in start due to the ServerLoader calling start. I just worked around this for now by checking for a duplicate call. I need to figure out how to install a bean that is already started. -
2. Re: Pushing beans into the kernel
adrian.brock Aug 9, 2006 2:09 PM (in response to starksm64)"scott.stark@jboss.org" wrote:
So the problem is that the KernelController knows nothing about the server. I did get past this doing:// Register the Server instance in the kernel Kernel kernel = getKernel(); KernelController controller = kernel.getController(); KernelRegistry registry = kernel.getRegistry(); KernelConfigurator config = kernel.getConfigurator(); BeanInfo info = config.getBeanInfo(server.getClass());; AbstractBeanMetaData metaData = new AbstractBeanMetaData("org.jboss.system.server.Server", null); AbstractKernelControllerContext serverEntry = new AbstractKernelControllerContext(info, metaData, server); controller.install(serverEntry);
At first this failed because the server instance was being restarted by the kernel while it was already in start due to the ServerLoader calling start. I just worked around this for now by checking for a duplicate call. I need to figure out how to install a bean that is already started.
There currently is no way to do this.
Don't get hung up on the kernel controller.install(BeanMetaData)
this is just a convenience over the
controller.install(ControllerContext)
What you need to do is create an AbstractKernelControllerContext
that has a minimal set of actions
e.g. add/** The no actions */ private static final KernelControllerContextActions noActions = KernelControllerContextActions.getNoActions(); /** * Create an abstract controller context * with no actions and no meta data * * @name the name of the bean * @param target the target object */ public AbstractKernelControllerContext(Object name, Object target) { super(name, noActions, new AbstractDependencyInfo(), target); if (System.getSecurityManager() != null) accessContext = AccessController.getContext(); }
-
3. Re: Pushing beans into the kernel
starksm64 Aug 9, 2006 10:32 PM (in response to starksm64)Does http://jira.jboss.com/jira/browse/JBMICROCONT-62 apply to this?
-
4. Re: Pushing beans into the kernel
adrian.brock Aug 10, 2006 3:19 PM (in response to starksm64)It's related but not the same.
The feature there was to pass an Object and some metadata.
It goes through all the normal lifecycle except instantation.