/**
   * Handle apply or cleanup of annotations.
   *
   * @param visitor the metadata visitor
   * @param isApplyPhase is this apply phase
   * @throws Throwable for any error
   */
  protected void handleAnnotations(MetaDataVisitor visitor, boolean isApplyPhase) throws Throwable {
    if (visitor == null) throw new IllegalArgumentException("Null meta data visitor.");

    KernelControllerContext context = visitor.getControllerContext();
    Kernel kernel = context.getKernel();
    KernelMetaDataRepository repository = kernel.getMetaDataRepository();
    MetaData retrieval = repository.getMetaData(context);
    BeanInfo info = context.getBeanInfo();

    handleAnnotations(info, retrieval, visitor, isApplyPhase);
  }
 public Object getAttribute(ObjectName objectName, String attribute) throws Exception {
   String name = objectName.getCanonicalName();
   KernelRegistryEntry entry = kernel.getRegistry().getEntry(name);
   if (entry != null) {
     Object target = entry.getTarget();
     Field field = target.getClass().getField(attribute);
     return field.get(target);
   }
   return null;
 }
 public Object invoke(
     ObjectName objectName, String operationName, Object[] params, String[] signature)
     throws Exception {
   String name = objectName.getCanonicalName();
   KernelRegistryEntry entry = kernel.getRegistry().getEntry(name);
   if (entry != null) {
     Object target = entry.getTarget();
     Class[] types = new Class[signature.length];
     for (int i = 0; i < signature.length; ++i) {
       types[i] = Thread.currentThread().getContextClassLoader().loadClass(signature[i]);
     }
     Method method = target.getClass().getMethod(operationName, types);
     return method.invoke(target, params);
   }
   return null;
 }
 public KernelControllerListableBeanFactory(Kernel kernel) {
   super(kernel != null ? kernel.getController() : null);
   this.kernelController = kernel.getController();
 }
 public Set getMBeans(ObjectName query) throws Exception {
   Object target = kernel.getRegistry().getEntry(query);
   Set set = new HashSet();
   set.add(target);
   return set;
 }