Java 类javax.management.modelmbean.InvalidTargetObjectTypeException 实例源码

项目:monarch    文件:MX4JModelMBean.java   
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException {
  Logger logger = getLogger();
  Object target = descriptor.getFieldValue("targetObject");
  if (logger.isEnabledFor(Logger.TRACE))
    logger.trace("targetObject is: " + target);
  if (target == null) {
    target = getManagedResource();
  } else {
    String targetObjectType = (String) descriptor.getFieldValue("targetObjectType");
    if (logger.isEnabledFor(Logger.TRACE))
      logger.trace("targetObjectType is: " + targetObjectType);
    if (targetObjectType == null) {
      // Not defined, assume object reference
      targetObjectType = OBJECT_RESOURCE_TYPE;
    }

    if (!isResourceTypeSupported(targetObjectType))
      throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
  }
  return target;
}
项目:gemfirexd-oss    文件:MX4JModelMBean.java   
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException
{
   Logger logger = getLogger();
   Object target = descriptor.getFieldValue("targetObject");
   if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObject is: " + target);
   if (target == null)
   {
      target = getManagedResource();
   }
   else
   {
      String targetObjectType = (String)descriptor.getFieldValue("targetObjectType");
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObjectType is: " + targetObjectType);
      if (targetObjectType == null)
      {
         // Not defined, assume object reference
         targetObjectType = OBJECT_RESOURCE_TYPE;
      }

      if (!isResourceTypeSupported(targetObjectType)) throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
   }
   return target;
}
项目:gemfirexd-oss    文件:MX4JModelMBean.java   
private Object resolveTargetObject(Descriptor descriptor) throws MBeanException
{
   Logger logger = getLogger();
   Object target = descriptor.getFieldValue("targetObject");
   if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObject is: " + target);
   if (target == null)
   {
      target = getManagedResource();
   }
   else
   {
      String targetObjectType = (String)descriptor.getFieldValue("targetObjectType");
      if (logger.isEnabledFor(Logger.TRACE)) logger.trace("targetObjectType is: " + targetObjectType);
      if (targetObjectType == null)
      {
         // Not defined, assume object reference
         targetObjectType = OBJECT_RESOURCE_TYPE;
      }

      if (!isResourceTypeSupported(targetObjectType)) throw new MBeanException(new InvalidTargetObjectTypeException(targetObjectType));
   }
   return target;
}
项目:lams    文件:SpringModelMBean.java   
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
项目:lams    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:monarch    文件:MX4JModelMBean.java   
public void setManagedResource(Object resource, String resourceType) throws MBeanException,
    RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
  if (resource == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
  if (!isResourceTypeSupported(resourceType))
    throw new InvalidTargetObjectTypeException(resourceType);

  Logger logger = getLogger();
  if (logger.isEnabledFor(Logger.DEBUG))
    logger.debug("Setting managed resource to be: " + resource);
  m_managedResource = resource;
}
项目:spring4-understanding    文件:SpringModelMBean.java   
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
项目:my-spring-cache-redis    文件:SpringModelMBean.java   
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
项目:gemfirexd-oss    文件:MX4JModelMBean.java   
public void setManagedResource(Object resource, String resourceType) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
   if (resource == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
   if (!isResourceTypeSupported(resourceType)) throw new InvalidTargetObjectTypeException(resourceType);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Setting managed resource to be: " + resource);
   m_managedResource = resource;
}
项目:spring    文件:SpringModelMBean.java   
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
项目:flowable-engine    文件:DefaultManagementMBeanAssembler.java   
@Override
public ModelMBean assemble(Object obj, ObjectName name) throws JMException {
    ModelMBeanInfo mbi = null;

    // use the default provided mbean which has been annotated with JMX
    // annotations
    LOGGER.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj);
    mbi = assembler.getMBeanInfo(obj, null, name.toString());

    if (mbi == null) {
        return null;
    }

    RequiredModelMBean mbean = new RequiredModelMBean(mbi);

    try {
        mbean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException e) {
        throw new JMException(e.getMessage());
    }

    // Allows the managed object to send notifications
    if (obj instanceof NotificationSenderAware) {
        ((NotificationSenderAware) obj).setNotificationSender(new NotificationSenderAdapter(mbean));
    }

    return mbean;
}
项目:gemfirexd-oss    文件:MX4JModelMBean.java   
public void setManagedResource(Object resource, String resourceType) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
   if (resource == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MANAGED_RESOURCE_CANNOT_BE_NULL.toLocalizedString()));
   if (!isResourceTypeSupported(resourceType)) throw new InvalidTargetObjectTypeException(resourceType);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Setting managed resource to be: " + resource);
   m_managedResource = resource;
}
项目:Wilma    文件:HttpServerMBean.java   
/** Constructor. 
 * @exception MBeanException 
 * @exception InstanceNotFoundException 
 */
protected HttpServerMBean(HttpServer httpServer)
    throws MBeanException, InstanceNotFoundException
{
    _httpServer=httpServer;
    _httpServer.addEventListener(this);
    try{super.setManagedResource(_httpServer,"objectReference");}
    catch(InvalidTargetObjectTypeException e){log.warn(LogSupport.EXCEPTION,e);}
}
项目:Wilma    文件:HttpServerMBean.java   
public void setManagedResource(Object o,String s)
    throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException
{
    if (o!=null)
        ((HttpServer)o).addEventListener(this);
    super.setManagedResource(o,s);
}
项目:serialisation    文件:XmlUnmarshaller.java   
private Class<?> getType(Attributes attributes, String nomAttribut) throws ClassNotFoundException, InvalidTargetObjectTypeException {
    Class<?> typeToUnmarshall;
    String typeEcrit = attributes.getValue("type");
    if(typeEcrit != null){
        typeToUnmarshall = getTypeDepuisNom(attributes.getValue("type"));
        if(isFirst) 
            checkType(typeToUnmarshall);
    }else{
        typeToUnmarshall = getType(nomAttribut);
    }
    return typeToUnmarshall;
}
项目:serialisation    文件:XmlUnmarshaller.java   
@SuppressWarnings("unchecked")
private <T> void checkType(Class<T> typeToUnmarshall) throws InvalidTargetObjectTypeException {
    try {
        U test = (U) createInstance(typeToUnmarshall);
        test.getClass();
    } catch (Exception e) {
        LOGGER.error("le type attendu n'est pas celui du XML ou n'est pas instanciable", e);
        throw new InvalidTargetObjectTypeException(e, "not instanciable from " + typeToUnmarshall.getName());
    }
}
项目:serialisation    文件:XmlUnmarshaller.java   
protected void startElement(String qName, Attributes attributes) throws ClassNotFoundException, NotImplementedSerializeException, InvalidTargetObjectTypeException, InstanciationException, EntityManagerImplementationException{
    setCache(attributes);
    Class<?> type = getType(attributes, qName);
    isFirst = false;
    if(type != null){
        ActionXml<?> action = (ActionXml<?>) getAction(type);
        setNom(action, qName);
        setFieldInformation(action);
        setId(attributes, action);
        pileAction.push(action);
    }
}
项目:class-guard    文件:SpringModelMBean.java   
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
项目:Camel    文件:SpringManagementMBeanAssembler.java   
public ModelMBean assemble(MBeanServer mBeanServer, Object obj, ObjectName name) throws JMException {
    ModelMBeanInfo mbi = null;

    // prefer to use the managed instance if it has been annotated with Spring JMX annotations
    if (obj instanceof ManagedInstance) {
        Object custom = ((ManagedInstance) obj).getInstance();
        if (custom != null && ObjectHelper.hasAnnotation(custom.getClass().getAnnotations(), ManagedResource.class)) {
            LOG.trace("Assembling MBeanInfo for: {} from custom @ManagedResource object: {}", name, custom);
            // get the mbean info from the custom managed object
            mbi = springAssembler.getMBeanInfo(custom, name.toString());
            // and let the custom object be registered in JMX
            obj = custom;
        }
    }

    if (mbi == null) {
        if (ObjectHelper.hasAnnotation(obj.getClass().getAnnotations(), ManagedResource.class)) {
            // the object has a Spring ManagedResource annotations so assemble the MBeanInfo
            LOG.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj);
            mbi = springAssembler.getMBeanInfo(obj, name.toString());
        } else {
            // fallback and let the default mbean assembler handle this instead
            return super.assemble(mBeanServer, obj, name);
        }
    }

    LOG.trace("Assembled MBeanInfo {}", mbi);

    RequiredModelMBean mbean = (RequiredModelMBean) mBeanServer.instantiate(RequiredModelMBean.class.getName());
    mbean.setModelMBeanInfo(mbi);

    try {
        mbean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException e) {
        throw new JMException(e.getMessage());
    }

    // Allows the managed object to send notifications
    if (obj instanceof NotificationSenderAware) {
        ((NotificationSenderAware)obj).setNotificationSender(new NotificationSenderAdapter(mbean));
    }

    return mbean;
}
项目:groovy    文件:JmxBuilderModelMBean.java   
public JmxBuilderModelMBean(Object objectRef) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
    super.setManagedResource(objectRef, "ObjectReference");
}
项目:wildfly-core    文件:TestModelMBean.java   
@Override
public void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException,
        InstanceNotFoundException, InvalidTargetObjectTypeException {
}
项目:tomcat7    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:apache-tomcat-7.0.73-with-comment    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:lazycat    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute all
 * methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException
 *                if the managed resource object cannot be found
 * @exception InvalidTargetObjectTypeException
 *                if the managed resource object is of the wrong type
 * @exception MBeanException
 *                if the initializer of the object throws an exception
 * @exception RuntimeOperationsException
 *                if the managed resource or the resource type is
 *                <code>null</code> or invalid
 */
public Object getManagedResource() throws InstanceNotFoundException, InvalidTargetObjectTypeException,
        MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException(new IllegalArgumentException("Managed resource is null"),
                "Managed resource is null");

    return resource;

}
项目:class-guard    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:apache-tomcat-7.0.57    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:apache-tomcat-7.0.57    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}
项目:WBSAirback    文件:BaseModelMBean.java   
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @exception InstanceNotFoundException if the managed resource object
 *  cannot be found
 * @exception InvalidTargetObjectTypeException if the managed resource
 *  object is of the wrong type
 * @exception MBeanException if the initializer of the object throws
 *  an exception
 * @exception RuntimeOperationsException if the managed resource or the
 *  resource type is <code>null</code> or invalid
 */
public Object getManagedResource()
    throws InstanceNotFoundException, InvalidTargetObjectTypeException,
    MBeanException, RuntimeOperationsException {

    if (resource == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Managed resource is null"),
             "Managed resource is null");

    return resource;

}