Examples of ReflectionException


Examples of javax.management.ReflectionException

         metadata.mbean = ctor.newInstance(args);
      }
      catch (ClassNotFoundException x)
      {
         throw new ReflectionException(x);
      }
      catch (NoSuchMethodException x)
      {
         throw new ReflectionException(x);
      }
      catch (InstantiationException x)
      {
         throw new ReflectionException(x);
      }
      catch (IllegalAccessException x)
      {
         throw new ReflectionException(x);
      }
      catch (IllegalArgumentException x)
      {
         throw new ReflectionException(x);
      }
      catch (InvocationTargetException x)
      {
         Throwable t = x.getTargetException();
         if (t instanceof Error)
View Full Code Here

Examples of javax.management.ReflectionException

         MBeanAttributeInfo attr = attrs[i];
         if (attr == null) continue;

         if (attribute.equals(attr.getName()))
         {
            if (!attr.isReadable()) throw new ReflectionException(new NoSuchMethodException("No getter defined for attribute: " + attribute));

            // Found, invoke via reflection
            String prefix = null;
            if (attr.isIs())
               prefix = "is";
            else
               prefix = "get";

            try
            {
               return invoke(resource, prefix + attr.getName(), new Class[0], new Object[0]);
            }
            catch (InvalidAttributeValueException x)
            {
               throw new ReflectionException(x);
            }
         }
      }

      throw new AttributeNotFoundException("Attribute " + attribute + " not found");
View Full Code Here

Examples of javax.management.ReflectionException

         resource = getResourceOrThis();
         info = getMBeanInfo();
      }

      MBeanOperationInfo[] opers = info.getOperations();
      if (opers == null || opers.length == 0) throw new ReflectionException(new NoSuchMethodException("No operations defined for this MBean"));

      for (int i = 0; i < opers.length; ++i)
      {
         MBeanOperationInfo oper = opers[i];
         if (oper == null) continue;

         if (method.equals(oper.getName()))
         {
            MBeanParameterInfo[] parameters = oper.getSignature();
            if (params.length != parameters.length) continue;

            String[] signature = new String[parameters.length];
            for (int j = 0; j < signature.length; ++j)
            {
               MBeanParameterInfo param = parameters[j];
               if (param == null)
                  signature[j] = null;
               else
                  signature[j] = param.getType();
            }

            if (Utils.arrayEquals(params, signature))
            {
               // Found the right operation
               try
               {
                  Class[] classes = Utils.loadClasses(resource.getClass().getClassLoader(), signature);
                  return invoke(resource, method, classes, arguments);
               }
               catch (ClassNotFoundException x)
               {
                  throw new ReflectionException(x);
               }
               catch (InvalidAttributeValueException x)
               {
                  throw new ReflectionException(x);
               }
            }
         }
      }

      throw new ReflectionException(new NoSuchMethodException("Operation " + method + " with signature " + Arrays.asList(params) + " is not defined for this MBean"));
   }
View Full Code Here

Examples of javax.management.ReflectionException

         MBeanAttributeInfo attr = attrs[i];
         if (attr == null) continue;

         if (attribute.getName().equals(attr.getName()))
         {
            if (!attr.isWritable()) throw new ReflectionException(new NoSuchMethodException("No setter defined for attribute: " + attribute));

            try
            {
               String signature = attr.getType();
               Class cls = Utils.loadClass(resource.getClass().getClassLoader(), signature);
               invoke(resource, "set" + attr.getName(), new Class[]{cls}, new Object[]{attribute.getValue()});
               return;
            }
            catch (ClassNotFoundException x)
            {
               throw new ReflectionException(x);
            }
         }
      }

      throw new AttributeNotFoundException("Attribute " + attribute + " not found");
View Full Code Here

Examples of javax.management.ReflectionException

         Method method = findMethod(cls, name, params);
         return invokeMethod(method, resource, args);
      }
      catch (NoSuchMethodException x)
      {
         throw new ReflectionException(x);
      }
      catch (IllegalAccessException x)
      {
         throw new ReflectionException(x);
      }
      catch (IllegalArgumentException x)
      {
         throw new InvalidAttributeValueException(x.toString());
      }
View Full Code Here

Examples of javax.management.ReflectionException

         Class cls = cl.loadClass(className);
         return deserializeImpl(cls.getClassLoader(), bytes);
      }
      catch (ClassNotFoundException x)
      {
         throw new ReflectionException(x);
      }
   }
View Full Code Here

Examples of javax.management.ReflectionException

         Class cls = getClassLoaderRepository().loadClass(className);
         return deserializeImpl(cls.getClassLoader(), bytes);
      }
      catch (ClassNotFoundException x)
      {
         throw new ReflectionException(x);
      }
   }
View Full Code Here

Examples of javax.management.ReflectionException

         Class cls = getModifiableClassLoaderRepository().loadClass(className);
         return instantiateImpl(className, cls.getClassLoader(), null, parameters, args).mbean;
      }
      catch (ClassNotFoundException x)
      {
         throw new ReflectionException(x);
      }
   }
View Full Code Here

Examples of javax.management.ReflectionException

         return metadata.instance;
      }
      catch (ClassNotFoundException x)
      {
         throw new ReflectionException(x);
      }
   }
View Full Code Here

Examples of javax.management.ReflectionException

            } catch (NoSuchAttributeException e) {
                // ignored - caller will simply find no value
            } catch (GBeanNotFoundException e) {
                throw (InstanceNotFoundException)new InstanceNotFoundException(name.getCanonicalName()).initCause(e);
            } catch (InternalKernelException e) {
                throw new ReflectionException(unwrapInternalKernelException(e));
            } catch (Exception e) {
                // ignored - caller will simply find no value
            }
        }
        return attributeList;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.