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

下面列出了怎么用javax.management.modelmbean.InvalidTargetObjectTypeException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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;
}
 
源代码2 项目: 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;
}
 
源代码3 项目: Tomcat8-Source-Read   文件: BaseCatalinaMBean.java
protected T doGetManagedResource() throws MBeanException {
    try {
        @SuppressWarnings("unchecked")
        T resource = (T) getManagedResource();
        return resource;
    } catch (InstanceNotFoundException | RuntimeOperationsException |
            InvalidTargetObjectTypeException e) {
        throw new MBeanException(e);
    }
}
 
源代码4 项目: spring-analysis-note   文件: 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);
}
 
源代码5 项目: java-technology-stack   文件: 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);
}
 
public ModelMBean assemble(Object obj, ObjectName name) throws JMException {
  ModelMBeanInfo mbi = null;

  // use the default provided mbean which has been annotated with JMX
  // annotations
  LOG.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;
}
 
源代码7 项目: 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);
}
 
源代码8 项目: 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);
}
 
源代码9 项目: 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;
}
 
@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;
}
 
源代码11 项目: 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;
}
 
源代码12 项目: cxf   文件: RMEndpoint.java
void initialise(RMConfiguration config, Conduit c, EndpointReferenceType r,
    org.apache.cxf.transport.Destination d,
    Message message) {
    configuration = config;
    conduit = c;
    replyTo = r;
    createServices();
    createEndpoints(d);
    setPolicies(message);
    if (manager != null && manager.getBus() != null) {
        managedEndpoint = new ManagedRMEndpoint(this);
        instrumentationManager = manager.getBus().getExtension(InstrumentationManager.class);
        if (instrumentationManager != null) {
            ModelMBeanAssembler assembler = new ModelMBeanAssembler();
            ModelMBeanInfo mbi = assembler.getModelMbeanInfo(managedEndpoint.getClass());
            MBeanServer mbs = instrumentationManager.getMBeanServer();
            if (mbs == null) {
                LOG.log(Level.WARNING, "MBeanServer not available.");
            } else {
                try {
                    RequiredModelMBean rtMBean =
                        (RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean");
                    rtMBean.setModelMBeanInfo(mbi);
                    try {
                        rtMBean.setManagedResource(managedEndpoint, "ObjectReference");
                    } catch (InvalidTargetObjectTypeException itotex) {
                        throw new JMException(itotex.getMessage());
                    }
                    ObjectName name = managedEndpoint.getObjectName();
                    instrumentationManager.register(rtMBean, name);
                    modelMBean = rtMBean;
                } catch (JMException jmex) {
                    LOG.log(Level.WARNING, "Registering ManagedRMEndpoint failed.", jmex);
                }
            }
        }
    }
}
 
源代码13 项目: cxf   文件: InstrumentationManagerImpl.java
private void register(Object obj, ObjectName name, ModelMBeanInfo mbi, boolean forceRegistration)
    throws JMException {
    RequiredModelMBean rtMBean =
        (RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean");
    rtMBean.setModelMBeanInfo(mbi);
    try {
        rtMBean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException itotex) {
        throw new JMException(itotex.getMessage());
    }
    registerMBeanWithServer(rtMBean, persist(name), forceRegistration);
}
 
源代码14 项目: groovy   文件: JmxBuilderModelMBean.java
public JmxBuilderModelMBean(Object objectRef) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException {
    super.setManagedResource(objectRef, "ObjectReference");
}
 
源代码15 项目: wildfly-core   文件: TestModelMBean.java
@Override
public void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException,
        InstanceNotFoundException, InvalidTargetObjectTypeException {
}
 
源代码16 项目: Tomcat8-Source-Read   文件: BaseModelMBean.java
/**
 * Get the instance handle of the object against which we execute
 * all methods in this ModelMBean management interface.
 *
 * @return the backend managed object
 * @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;

}
 
源代码17 项目: Tomcat7.0.67   文件: 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;

}
 
源代码18 项目: tomcatsrc   文件: 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;

}
 
 类所在包
 类方法
 同包方法