Esempio n. 1
0
 /**
  * Provides the PicoContainer, that can resolve the components to register as MBean.
  *
  * @see com.picocontainer.PicoVisitor#visitContainer(com.picocontainer.PicoContainer)
  */
 @Override
 public boolean visitContainer(final PicoContainer pico) {
   super.visitContainer(pico);
   picoContainer = pico;
   visited.clear();
   return CONTINUE_TRAVERSAL;
 }
Esempio n. 2
0
 /**
  * Entry point for the visitor traversal.
  *
  * @return Returns a {@link Set} with all ObjectInstance instances retrieved from the {@link
  *     MBeanServer} for the registered MBeans.
  * @see com.picocontainer.visitors.AbstractPicoVisitor#traverse(java.lang.Object)
  */
 @Override
 public Object traverse(final Object node) {
   super.traverse(node);
   picoContainer = null;
   final Set set = new HashSet(registeredInfo);
   registeredInfo.clear();
   return set;
 }
Esempio n. 3
0
 /**
  * Register the component as MBean. The implementation uses the known DynamicMBeanProvider
  * instances to get the MBean from the component.
  *
  * @see com.picocontainer.PicoVisitor#visitComponentAdapter(com.picocontainer.ComponentAdapter)
  */
 @Override
 public void visitComponentAdapter(final ComponentAdapter componentAdapter) {
   super.visitComponentAdapter(componentAdapter);
   if (picoContainer == null) {
     throw new JMXRegistrationException(
         "Cannot start JMXVisitor traversal with a ComponentAdapter");
   }
   if (!visited.contains(componentAdapter.getComponentKey())) {
     visited.add(componentAdapter.getComponentKey());
     for (final DynamicMBeanProvider provider : mBeanProviders) {
       final JMXRegistrationInfo info = provider.provide(picoContainer, componentAdapter);
       if (info != null) {
         registeredInfo.add(register(info.getMBean(), info.getObjectName()));
         break;
       }
     }
   }
 }