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);
}
java类javax.management.NotCompliantMBeanException的实例源码
RMIConnectorLogAttributesTest.java 文件源码
项目:openjdk-jdk10
阅读 34
收藏 0
点赞 0
评论 0
DefaultMBeanServerInterceptor.java 文件源码
项目:jdk8u-jdk
阅读 23
收藏 0
点赞 0
评论 0
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);
}
}
Engine.java 文件源码
项目:sepatools
阅读 26
收藏 0
点赞 0
评论 0
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;
}
MBeanServerAccessController.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
Introspector.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
MBeanServerAccessController.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
MBeanTest.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
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;
}
}
}
DefaultMBeanServerInterceptor.java 文件源码
项目:OpenJSharp
阅读 26
收藏 0
点赞 0
评论 0
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();
}
MBeanTest.java 文件源码
项目:jdk8u-jdk
阅读 30
收藏 0
点赞 0
评论 0
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;
}
}
}
MBeanFallbackTest.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
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;
}
}
}
DefaultMBeanServerInterceptor.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
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);
}
}
MBeanSupport.java 文件源码
项目:OpenJSharp
阅读 27
收藏 0
点赞 0
评论 0
<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);
}
MBeanAnalyzer.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
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);
}
}
MBeanServerAccessController.java 文件源码
项目:OpenJSharp
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
MBeanServerAccessController.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
RoleInfo.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
/**
* 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;
}
DefaultMBeanServerInterceptor.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
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);
}
MXBeanProxy.java 文件源码
项目:jdk8u-jdk
阅读 24
收藏 0
点赞 0
评论 0
public MXBeanProxy(Class<?> mxbeanInterface) {
if (mxbeanInterface == null)
throw new IllegalArgumentException("Null parameter");
final MBeanAnalyzer<ConvertingMethod> analyzer;
try {
analyzer =
MXBeanIntrospector.getInstance().getAnalyzer(mxbeanInterface);
} catch (NotCompliantMBeanException e) {
throw new IllegalArgumentException(e);
}
analyzer.visit(new Visitor());
}
Introspector.java 文件源码
项目:jdk8u-jdk
阅读 31
收藏 0
点赞 0
评论 0
/**
* Basic method for testing that a MBean of a given class can be
* instantiated by the MBean server.<p>
* This method checks that:
* <ul><li>The given class is a concrete class.</li>
* <li>The given class exposes at least one public constructor.</li>
* </ul>
* If these conditions are not met, throws a NotCompliantMBeanException.
* @param c The class of the MBean we want to create.
* @exception NotCompliantMBeanException if the MBean class makes it
* impossible to instantiate the MBean from within the
* MBeanServer.
*
**/
public static void testCreation(Class<?> c)
throws NotCompliantMBeanException {
// Check if the class is a concrete class
final int mods = c.getModifiers();
if (Modifier.isAbstract(mods) || Modifier.isInterface(mods)) {
throw new NotCompliantMBeanException("MBean class must be concrete");
}
// Check if the MBean has a public constructor
final Constructor<?>[] consList = c.getConstructors();
if (consList.length == 0) {
throw new NotCompliantMBeanException("MBean class must have public constructor");
}
}
Scheduler.java 文件源码
项目:sepatools
阅读 23
收藏 0
点赞 0
评论 0
public Scheduler(EngineProperties properties,Processor processor) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
requestHandler = new RequestResponseHandler(properties);
tokenHandler = new TokenHandler(properties);
if (processor == null) logger.error("Processor is null");
else {
this.processor = processor;
this.processor.addObserver(this);
}
}
Processor.java 文件源码
项目:sepatools
阅读 30
收藏 0
点赞 0
评论 0
public Processor(SPARQL11Properties properties) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
//Create SPARQL 1.1 interface
endpoint = new SPARQL11Protocol(properties);
logger.info(endpoint.toString());
//Create processor to manage (optimize) QUERY and UPDATE request
queryProcessor = new QueryProcessor(endpoint);
updateProcessor = new UpdateProcessor(endpoint);
//Subscriptions manager
spuManager = new SPUManager(endpoint);
spuManager.addObserver(this);
}
JMXProxyTest.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
private static void testNonCompliant(Class<?> iface, boolean isMx) throws Exception {
try {
System.out.println("Creating a proxy for non-compliant " +
(isMx ? "MXBean" : "MBean") + " " +
iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Proxy");
if (isMx) {
JMX.newMXBeanProxy(mbs, on, iface);
} else {
JMX.newMBeanProxy(mbs, on, iface);
}
fail("Created a proxy for non-compliant " +
(isMx ? "MXBean" : "MBean") + " - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
success("Proxy not created");
} else {
throw e;
}
}
}
Engine.java 文件源码
项目:sepatools
阅读 33
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {
System.out.println("##########################################################################################");
System.out.println("# SEPA Engine Ver 0.6 Copyright (C) 2016-2017 #");
System.out.println("# University of Bologna (Italy) #");
System.out.println("# #");
System.out.println("# This program comes with ABSOLUTELY NO WARRANTY #");
System.out.println("# This is free software, and you are welcome to redistribute it under certain conditions #");
System.out.println("# GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 #");
System.out.println("# #");
System.out.println("# GitHub: https://github.com/vaimee/sepatools #");
System.out.println("# Web: http://wot.arces.unibo.it #");
System.out.println("##########################################################################################");
System.out.println("");
System.out.println("Dependencies");
System.out.println("com.google.code.gson 2.8.0 Apache 2.0");
System.out.println("com.nimbusds 4.34.2 The Apache Software License, Version 2.0");
System.out.println("commons-io 2.5 Apache License, Version 2.0");
System.out.println("commons-logging 1.2 The Apache Software License, Version 2.0");
System.out.println("org.apache.httpcomponents 4.5.3 Apache License, Version 2.0");
System.out.println("org.apache.httpcomponents 4.4.6 Apache License, Version 2.0");
System.out.println("org.apache.logging.log4j 2.8.1 Apache License, Version 2.0");
System.out.println("org.bouncycastle 1.56 Bouncy Castle Licence");
System.out.println("org.eclipse.paho 1.1.1 Eclipse Public License - Version 1.0");
System.out.println("org.glassfish.grizzly 2.3.30 CDDL+GPL");
System.out.println("org.glassfish.tyrus.bundles 1.13.1 Dual license consisting of the CDDL v1.1 and GPL v2");
System.out.println("org.jdom 2.0.6 Similar to Apache License but with the acknowledgment clause removed");
System.out.println("");
//Engine creation and initialization
Engine engine = new Engine();
engine.init();
//Starting main engine thread
engine.start();
}
Introspector.java 文件源码
项目:jdk8u-jdk
阅读 27
收藏 0
点赞 0
评论 0
/**
* Basic method for testing if a given class is a JMX compliant MBean.
*
* @param baseClass The class to be tested
*
* @return <code>null</code> if the MBean is a DynamicMBean,
* the computed {@link javax.management.MBeanInfo} otherwise.
* @exception NotCompliantMBeanException The specified class is not a
* JMX compliant MBean
*/
public static MBeanInfo testCompliance(Class<?> baseClass)
throws NotCompliantMBeanException {
// ------------------------------
// ------------------------------
// Check if the MBean implements the MBean or the Dynamic
// MBean interface
if (isDynamic(baseClass))
return null;
return testCompliance(baseClass, null);
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 25
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectInstance createMBean(String className, ObjectName name,
Object[] params, String[] signature) throws ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException {
throw new UnsupportedOperationException("Not supported by PogamutMBeanServer yet...");
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 23
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectInstance registerMBean(Object object, ObjectName name)
throws InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException {
ObjectInstance obj = mbs.registerMBean(object, name);
mBeans.add(new MBean1(name, object));
unregisteredMBeans.remove(new MBean1(name, object));
return obj;
}
JMXProxyTest.java 文件源码
项目:jdk8u-jdk
阅读 19
收藏 0
点赞 0
评论 0
private static void testCompliant(Class<?> iface, boolean isMx) throws Exception {
try {
System.out.println("Creating a proxy for compliant " +
(isMx ? "MXBean" : "MBean") + " " +
iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Proxy");
if (isMx) {
JMX.newMXBeanProxy(mbs, on, iface);
} else {
JMX.newMBeanProxy(mbs, on, iface);
}
success("Created a proxy for compliant " +
(isMx ? "MXBean" : "MBean") + " - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
fail("Proxy not created");
} else {
throw e;
}
}
}
MBeanServerAccessController.java 文件源码
项目:jdk8u-jdk
阅读 29
收藏 0
点赞 0
评论 0
/**
* Call <code>checkWrite()</code>, then forward this method to the
* wrapped object.
*/
public ObjectInstance registerMBean(Object object, ObjectName name)
throws
InstanceAlreadyExistsException,
MBeanRegistrationException,
NotCompliantMBeanException {
checkWrite();
return getMBeanServer().registerMBean(object, name);
}
AbstractAgent3D.java 文件源码
项目:Pogamut3
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected AgentJMXComponents createAgentJMX() {
return new AgentJMXComponents<IAgent3D>(this) {
@Override
protected AgentMBeanAdapter createAgentMBean(ObjectName objectName, MBeanServer mbs) throws MalformedObjectNameException, InstanceAlreadyExistsException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
return new Agent3DMBeanAdapter(AbstractAgent3D.this, objectName, mbs);
}
};
}
Introspector.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
private static <M> MBeanInfo
getClassMBeanInfo(MBeanIntrospector<M> introspector,
Class<?> baseClass, Class<?> mbeanInterface)
throws NotCompliantMBeanException {
PerInterface<M> perInterface = introspector.getPerInterface(mbeanInterface);
return introspector.getClassMBeanInfo(baseClass, perInterface);
}