本文整理汇总了Java中javax.management.NotCompliantMBeanException类的典型用法代码示例。如果您正苦于以下问题:Java NotCompliantMBeanException类的具体用法?Java NotCompliantMBeanException怎么用?Java NotCompliantMBeanException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotCompliantMBeanException类属于javax.management包,在下文中一共展示了NotCompliantMBeanException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTest
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private void doTest(JMXConnector connector) throws IOException,
MalformedObjectNameException, ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
System.out.println("DEBUG: Calling createMBean");
mbsc.createMBean(Name.class.getName(), objName);
System.out.println("DEBUG: Calling setAttributes");
AttributeList attList = new AttributeList();
attList.add(new Attribute("FirstName", ANY_NAME));
attList.add(new Attribute("LastName", ANY_NAME));
mbsc.setAttributes(objName, attList);
}
示例2: createMBean
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
public ObjectInstance createMBean(String className, ObjectName name,
Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException {
try {
return createMBean(className, name, null, true,
params, signature);
} catch (InstanceNotFoundException e) {
/* Can only happen if loaderName doesn't exist, but we just
passed null, so we shouldn't get this exception. */
throw EnvHelp.initCause(
new IllegalArgumentException("Unexpected exception: " + e), e);
}
}
示例3: init
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
public boolean init() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {
//Initialize SPARQL 1.1 processing service properties
endpointProperties = new SPARQL11Properties("endpoint.jpar");
//Initialize SPARQL 1.1 SE processing service properties
engineProperties = new EngineProperties("engine.jpar");
//SPARQL 1.1 SE request processor
processor = new Processor(endpointProperties);
//SPARQL 1.1 SE request scheduler
scheduler = new Scheduler(engineProperties,processor);
//SPARQL 1.1 Protocol handlers
httpGate = new HTTPGate(engineProperties,scheduler);
httpsGate = new HTTPSGate(engineProperties,scheduler,am);
//SPARQL 1.1 SE Protocol handler for WebSocket based subscriptions
websocketApp = new WSGate(engineProperties,scheduler);
secureWebsocketApp = new WSSGate(engineProperties,scheduler,am);
return true;
}
示例4: createMBean
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
/**
* Call <code>checkCreate(className)</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName)
throws
ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException,
InstanceNotFoundException {
checkCreate(className);
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
Object object = getMBeanServer().instantiate(className,
loaderName);
checkClassLoader(object);
return getMBeanServer().registerMBean(object, name);
} else {
return getMBeanServer().createMBean(className, name, loaderName);
}
}
示例5: getStandardMBeanInterface
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
/**
* Get the MBean interface implemented by a JMX Standard MBean class.
*
* @param baseClass The class to be tested.
*
* @return The MBean interface implemented by the Standard MBean.
*
* @throws NotCompliantMBeanException The specified class is
* not a JMX compliant Standard MBean.
*/
public static <T> Class<? super T> getStandardMBeanInterface(Class<T> baseClass)
throws NotCompliantMBeanException {
Class<? super T> current = baseClass;
Class<? super T> mbeanInterface = null;
while (current != null) {
mbeanInterface =
findMBeanInterface(current, current.getName());
if (mbeanInterface != null) break;
current = current.getSuperclass();
}
if (mbeanInterface != null) {
return mbeanInterface;
} else {
final String msg =
"Class " + baseClass.getName() +
" is not a JMX compliant Standard MBean";
throw new NotCompliantMBeanException(msg);
}
}
示例6: createMBean
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
/**
* Call <code>checkCreate(className)</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance createMBean(String className, ObjectName name)
throws
ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException {
checkCreate(className);
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
Object object = getMBeanServer().instantiate(className);
checkClassLoader(object);
return getMBeanServer().registerMBean(object, name);
} else {
return getMBeanServer().createMBean(className, name);
}
}
示例7: testNonCompliant
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private static void testNonCompliant(Class<?> iface, Object bean) throws Exception {
try {
System.out.println("Registering a non-compliant MBean " +
iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=NonCompliant");
mbs.registerMBean(bean, on);
fail("Registered a non-compliant MBean - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
success("MBean not registered");
} else {
throw e;
}
}
}
示例8: getNewMBeanClassName
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private static String getNewMBeanClassName(Object mbeanToRegister)
throws NotCompliantMBeanException {
if (mbeanToRegister instanceof DynamicMBean) {
DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
final String name;
try {
name = mbean.getMBeanInfo().getClassName();
} catch (Exception e) {
// Includes case where getMBeanInfo() returns null
NotCompliantMBeanException ncmbe =
new NotCompliantMBeanException("Bad getMBeanInfo()");
ncmbe.initCause(e);
throw ncmbe;
}
if (name == null) {
final String msg = "MBeanInfo has null class name";
throw new NotCompliantMBeanException(msg);
}
return name;
} else
return mbeanToRegister.getClass().getName();
}
示例9: testCompliant
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private static void testCompliant(Class<?> iface, Object bean) throws Exception {
try {
System.out.println("Registering a compliant MBean " +
iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Compliant");
mbs.registerMBean(bean, on);
success("Registered a compliant MBean - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
fail("MBean not registered");
} else {
throw e;
}
}
}
示例10: testPrivate
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private static void testPrivate(Class<?> iface, Object bean) throws Exception {
try {
System.out.println("Registering a private MBean " +
iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Compliant");
mbs.registerMBean(bean, on);
success("Registered a private MBean - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
fail("MBean not registered");
} else {
throw e;
}
}
}
示例11: MBeanSupport
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
<T> MBeanSupport(T resource, Class<T> mbeanInterfaceType)
throws NotCompliantMBeanException {
if (mbeanInterfaceType == null)
throw new NotCompliantMBeanException("Null MBean interface");
if (!mbeanInterfaceType.isInstance(resource)) {
final String msg =
"Resource class " + resource.getClass().getName() +
" is not an instance of " + mbeanInterfaceType.getName();
throw new NotCompliantMBeanException(msg);
}
ReflectUtil.checkPackageAccess(mbeanInterfaceType);
this.resource = resource;
MBeanIntrospector<M> introspector = getMBeanIntrospector();
this.perInterface = introspector.getPerInterface(mbeanInterfaceType);
this.mbeanInfo = introspector.getMBeanInfo(resource, perInterface);
}
示例12: MBeanAnalyzer
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
private MBeanAnalyzer(Class<?> mbeanType,
MBeanIntrospector<M> introspector)
throws NotCompliantMBeanException {
if (!mbeanType.isInterface()) {
throw new NotCompliantMBeanException("Not an interface: " +
mbeanType.getName());
} else if (!Modifier.isPublic(mbeanType.getModifiers()) &&
!Introspector.ALLOW_NONPUBLIC_MBEAN) {
throw new NotCompliantMBeanException("Interface is not public: " +
mbeanType.getName());
}
try {
initMaps(mbeanType, introspector);
} catch (Exception x) {
throw Introspector.throwException(mbeanType,x);
}
}
示例13: createMBean
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
/**
* Call <code>checkCreate(className)</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance createMBean(String className, ObjectName name,
Object params[], String signature[])
throws
ReflectionException,
InstanceAlreadyExistsException,
MBeanRegistrationException,
MBeanException,
NotCompliantMBeanException {
checkCreate(className);
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
Object object = getMBeanServer().instantiate(className,
params,
signature);
checkClassLoader(object);
return getMBeanServer().registerMBean(object, name);
} else {
return getMBeanServer().createMBean(className, name,
params, signature);
}
}
示例14: RoleInfo
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
/**
* Constructor.
*
* @param roleName name of the role
* @param mbeanClassName name of the class of MBean(s) expected to
* be referenced in corresponding role. If an MBean <em>M</em> is in
* this role, then the MBean server must return true for
* {@link MBeanServer#isInstanceOf isInstanceOf(M, mbeanClassName)}.
*
* <P>IsReadable and IsWritable defaulted to true.
* <P>Minimum and maximum degrees defaulted to 1.
* <P>Description of role defaulted to null.
*
* @exception IllegalArgumentException if null parameter
* @exception ClassNotFoundException As of JMX 1.2, this exception
* can no longer be thrown. It is retained in the declaration of
* this class for compatibility with existing code.
* @exception NotCompliantMBeanException As of JMX 1.2, this
* exception can no longer be thrown. It is retained in the
* declaration of this class for compatibility with existing code.
*/
public RoleInfo(String roleName,
String mbeanClassName)
throws IllegalArgumentException,
ClassNotFoundException,
NotCompliantMBeanException {
try {
init(roleName,
mbeanClassName,
true,
true,
1,
1,
null);
} catch (InvalidRoleInfoException exc) {
// OK : Can never happen as the minimum
// degree equals the maximum degree.
}
return;
}
示例15: registerMBean
import javax.management.NotCompliantMBeanException; //导入依赖的package包/类
public ObjectInstance registerMBean(Object object, ObjectName name)
throws InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException {
// ------------------------------
// ------------------------------
Class<?> theClass = object.getClass();
Introspector.checkCompliance(theClass);
final String infoClassName = getNewMBeanClassName(object);
checkMBeanPermission(infoClassName, null, name, "registerMBean");
checkMBeanTrustPermission(theClass);
return registerObject(infoClassName, object, name);
}