javax.management.AttributeNotFoundException Java Examples
The following examples show how to use
javax.management.AttributeNotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManagementUtil.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Returns members for mentioned group. Scans groups list of memberMbeans * If group is null returns all members * @param connection * @param group * @return * @throws NullPointerException * @throws MalformedObjectNameException * @throws IOException * @throws ReflectionException * @throws MBeanException * @throws InstanceNotFoundException * @throws AttributeNotFoundException */ public static Set<String> getMembersForGroup(MBeanServerConnection connection, String group) throws MalformedObjectNameException, NullPointerException, InstanceNotFoundException, MBeanException, ReflectionException, IOException, AttributeNotFoundException { Set<String> memberSet = new HashSet<String>(); ObjectName ds = new ObjectName("GemFire:service=System,type=Distributed"); String[] memberList = (String[]) connection.invoke(ds, "listMembers", null, null); for(String member : memberList){ ObjectName memberMBean = new ObjectName("GemFire:type=Member,member="+member); String groups[] = (String[]) connection.getAttribute(memberMBean, "Groups"); for(String g : groups){ if(g.equals(group) || group==null){ memberSet.add(member); } } } return memberSet; }
Example #2
Source File: HeritrixProfile.java From webcurator with Apache License 2.0 | 6 votes |
/** * Remove items from a map if they are of the given type. This is * used to remove overridden filters from the Heritrix profile before * applying the overrides. * * @param complexElementName The name of the map. * @param type The classname of the type of object to remove. */ public void removeFromMapByType(String complexElementName, String type) { MapType mt = null; try { ComplexProfileElement ct = (ComplexProfileElement) getElement(complexElementName); mt = (MapType) ct.getValue(); List<ProfileElement> childList = ct.getChildren(true); Iterator<ProfileElement> children = childList.iterator(); while(children.hasNext()) { ProfileElement elem = children.next(); if(elem.getValue().getClass().getName().equals(type)) { mt.removeElement(crawlerSettings, elem.getName()); } } } catch(AttributeNotFoundException ex) { //TODO Should this be thrown or ignored? log.error("Could not find map with name " + complexElementName); } }
Example #3
Source File: GridTransactionsSystemUserTimeMetricsTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Checks if metrics have correct values with given delay mode. * * @param res Should contains the result of transaction completion - start time, completion time and MX bean * from which metrics can be received. * @param userDelayMode If true, we are checking metrics after transaction with user delay. Otherwise, * we are checking metrics after transaction with system delay. * @throws MBeanException If getting of metric attribute failed. * @throws AttributeNotFoundException If getting of metric attribute failed. * @throws ReflectionException If getting of metric attribute failed. */ private void checkTxDelays(ClientTxTestResult res, boolean userDelayMode) throws MBeanException, AttributeNotFoundException, ReflectionException { long userTime = (Long)res.mBean.getAttribute(METRIC_TOTAL_USER_TIME); long sysTime = (Long)res.mBean.getAttribute(METRIC_TOTAL_SYSTEM_TIME); if (userDelayMode) { assertTrue(userTime >= USER_DELAY); assertTrue(userTime < res.completionTime - res.startTime - sysTime + EPSILON); assertTrue(sysTime >= 0); assertTrue(sysTime < EPSILON); } else { assertTrue(userTime >= 0); assertTrue(userTime < EPSILON); assertTrue(sysTime >= SYSTEM_DELAY); assertTrue(sysTime < res.completionTime - res.startTime - userTime + EPSILON); } checkHistogram((long[])res.mBean.getAttribute(METRIC_SYSTEM_TIME_HISTOGRAM), 2); checkHistogram((long[])res.mBean.getAttribute(METRIC_USER_TIME_HISTOGRAM), 2); }
Example #4
Source File: RMIConnector.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { if (logger.debugOn()) logger.debug("getAttribute", "name=" + name + ", attribute=" + attribute); final ClassLoader old = pushDefaultClassLoader(); try { return connection.getAttribute(name, attribute, delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.getAttribute(name, attribute, delegationSubject); } finally { popDefaultClassLoader(old); } }
Example #5
Source File: RMIConnector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { if (logger.debugOn()) logger.debug("getAttribute", "name=" + name + ", attribute=" + attribute); final ClassLoader old = pushDefaultClassLoader(); try { return connection.getAttribute(name, attribute, delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.getAttribute(name, attribute, delegationSubject); } finally { popDefaultClassLoader(old); } }
Example #6
Source File: PerInterface.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
Object getAttribute(Object resource, String attribute, Object cookie) throws AttributeNotFoundException, MBeanException, ReflectionException { final M cm = getters.get(attribute); if (cm == null) { final String msg; if (setters.containsKey(attribute)) msg = "Write-only attribute: " + attribute; else msg = "No such attribute: " + attribute; throw new AttributeNotFoundException(msg); } return introspector.invokeM(cm, resource, (Object[]) null, cookie); }
Example #7
Source File: MemberInfoWithStatsMBeanGFEValidationDUnitTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private void verifyAttributes(ObjectName wrapper) throws AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException, IOException { logWriter.fine("Entered MemberInfoWithStatsMBeanGFEValidationDUnitTest.verifyAttributes() ..."); String id = (String) mbsc.getAttribute(wrapper, "Id"); String version = (String) mbsc.getAttribute(wrapper, "Version"); Integer refreshInterval = (Integer) mbsc.getAttribute(wrapper, "RefreshInterval"); AdminDistributedSystem adminDS = agent.getDistributedSystem(); String actualId = adminDS.getId(); String actualVersion = GemFireVersion.getGemFireVersion(); int actualRefreshInterval = adminDS.getConfig().getRefreshInterval(); assertTrue("AdminDistributedSystem id shown by MemberInfoWithStatsMBean " + "(as: "+id+") and actual (as: "+actualId+") do not match.", actualId.equals(id)); assertTrue("GemFire Version shown by MemberInfoWithStatsMBean " + "(as: "+version+") and actual(as: "+actualVersion+") do not match.", actualVersion.equals(version)); assertTrue("Refresh Interval shown by MemberInfoWithStatsMBean (as: "+ refreshInterval+") and actual (as :"+actualRefreshInterval+") do not match.", actualRefreshInterval == refreshInterval);//use auto-boxing logWriter.fine("Exited MemberInfoWithStatsMBeanGFEValidationDUnitTest.verifyAttributes() ..."); }
Example #8
Source File: RMIConnector.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { if (logger.debugOn()) logger.debug("getAttribute", "name=" + name + ", attribute=" + attribute); final ClassLoader old = pushDefaultClassLoader(); try { return connection.getAttribute(name, attribute, delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.getAttribute(name, attribute, delegationSubject); } finally { popDefaultClassLoader(old); } }
Example #9
Source File: PerInterface.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
Object getAttribute(Object resource, String attribute, Object cookie) throws AttributeNotFoundException, MBeanException, ReflectionException { final M cm = getters.get(attribute); if (cm == null) { final String msg; if (setters.containsKey(attribute)) msg = "Write-only attribute: " + attribute; else msg = "No such attribute: " + attribute; throw new AttributeNotFoundException(msg); } return introspector.invokeM(cm, resource, (Object[]) null, cookie); }
Example #10
Source File: PerInterface.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
void setAttribute(Object resource, String attribute, Object value, Object cookie) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final M cm = setters.get(attribute); if (cm == null) { final String msg; if (getters.containsKey(attribute)) msg = "Read-only attribute: " + attribute; else msg = "No such attribute: " + attribute; throw new AttributeNotFoundException(msg); } introspector.invokeSetter(attribute, cm, resource, value, cookie); }
Example #11
Source File: OldMBeanServerTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { String name = attribute.getName(); AttrMethods am = attrMap.get(name); if (am == null || am.setter == null) throw new AttributeNotFoundException(name); invokeMethod(am.setter, attribute.getValue()); }
Example #12
Source File: MBeanServerDelegateImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example #13
Source File: MBeanServerDelegateImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example #14
Source File: ConfigurationManagerService.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public void setAttribute( Attribute attribute ) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { UnitOfWork uow = uowf.newUnitOfWork(); try { EntityComposite configuration = uow.get( EntityComposite.class, identity ); AssociationStateHolder state = spi.stateOf( configuration ); AccessibleObject accessor = propertyNames.get( attribute.getName() ); Property<Object> property = state.propertyFor( accessor ); PropertyDescriptor propertyDescriptor = spi.propertyDescriptorFor( property ); if( EnumType.isEnum( propertyDescriptor.type() ) ) { //noinspection unchecked property.set( Enum.valueOf( (Class<Enum>) propertyDescriptor.type(), attribute.getValue().toString() ) ); } else { property.set( attribute.getValue() ); } try { uow.complete(); } catch( UnitOfWorkCompletionException e ) { throw new ReflectionException( e ); } } finally { uow.discard(); } }
Example #15
Source File: MBeanTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private Number validateTableAttr(String tableName, MBeanServerConnection mBeanServer, ObjectName name, Attribute attribute, String sql, OutputType type) throws TestException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException, IOException { mbeanHelper.runQueryAndPrintValue(sql); Number expected = (Number)mbeanHelper.runQueryAndGetValue(sql, type); Number actual = ((Number)mBeanServer.getAttribute(name, attribute.getName())); if(!actual.toString().equals(expected.toString())) { saveError(attribute.getName() + " attribute did not match for " + tableName + " where expected = " + expected + " and actual : " + actual); } else { Log.getLogWriter().info(attribute.getName() + " attribute match for " + tableName + " where expected = " + expected + " and actual : " + actual); } return actual; }
Example #16
Source File: ModelControllerMBeanHelper.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private String findAttributeName(Set<String> attributes, String attributeName) throws AttributeNotFoundException{ if (attributes.contains(attributeName)) { return attributeName; } for (String key : attributes) { if (NameConverter.convertToCamelCase(key).equals(attributeName)) { return key; } } throw JmxLogger.ROOT_LOGGER.attributeNotFound(attributeName); }
Example #17
Source File: OldMBeanServerTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { AttrMethods am = attrMap.get(attribute); if (am == null || am.getter == null) throw new AttributeNotFoundException(attribute); return invokeMethod(am.getter); }
Example #18
Source File: MBeanServerAccessController.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Call <code>checkRead()</code>, then forward this method to the * wrapped object. */ public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException { checkRead(); return getMBeanServer().getAttribute(name, attribute); }
Example #19
Source File: MBeanServerAccessController.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Call <code>checkWrite()</code>, then forward this method to the * wrapped object. */ public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { checkWrite(); getMBeanServer().setAttribute(name, attribute); }
Example #20
Source File: JmxClient.java From vjtools with Apache License 2.0 | 5 votes |
private Object getAttribute(ObjectName objName, String attrName) throws MBeanException, InstanceNotFoundException, AttributeNotFoundException, ReflectionException, IOException { final NameValueMap values = getCachedAttributes(objName, Collections.singleton(attrName)); Object value = values.get(attrName); if (value != null || values.containsKey(attrName)) { return value; } // Not in cache, presumably because it was omitted from the // getAttributes result because of an exception. Following // call will probably provoke the same exception. return conn.getAttribute(objName, attrName); }
Example #21
Source File: MBeanTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private void checkTableMBeanForGroup(MBeanServerConnection mbeanServer, boolean expectedBeans, String tableName, boolean populateBB, ClientVmInfo info, String memberId, String serverGroup, boolean verifyMBean) throws MalformedObjectNameException, IOException, TestException, AttributeNotFoundException { // query only those members which part of server group specified in // CREATE TABLE Log.getLogWriter().info("validating table mbean for table : " + tableName + " for serverGroup : " + serverGroup + " for member : " + memberId); if(DEFAULT_SERVER_GROUP.equals(serverGroup)) { if(isTableAndMemberOfSameServerGroup(tableName, memberId) && !isTablePartOfServerGroup(tableName, DEFAULT_SERVER_GROUP)) { Log.getLogWriter().info("member and table both are part of same server group and table is not part of default server group"); verifyTableMBeanShouldNotPresentInGroup(mbeanServer, tableName, memberId, DEFAULT_SERVER_GROUP); } else { Log.getLogWriter().info("member and table both are not part of same server group"); verifyTableMBeanForGroup(mbeanServer, expectedBeans, tableName, populateBB, memberId, serverGroup, verifyMBean); } } else { if (isMemberPartOfGroup(info.getClientName(), serverGroup) && isTablePartOfServerGroup(tableName, serverGroup)) { Log.getLogWriter().info("member and table both are part of same server group : " + serverGroup); verifyTableMBeanForGroup(mbeanServer, expectedBeans, tableName, populateBB, memberId, serverGroup, verifyMBean); verifyTableMBeanShouldNotPresentInGroup(mbeanServer, tableName, memberId, DEFAULT_SERVER_GROUP); } if (!isMemberPartOfGroup(info.getClientName(), serverGroup) && isTablePartOfServerGroup(tableName, serverGroup)) { Log.getLogWriter().info("member is not part of server group and table is part of server group : " + serverGroup); verifyTableMBeanForGroup(mbeanServer, expectedBeans, tableName, populateBB, memberId, DEFAULT_SERVER_GROUP, verifyMBean); verifyTableMBeanShouldNotPresentInGroup(mbeanServer, tableName, memberId, serverGroup); } if ( !isTablePartOfServerGroup(tableName, serverGroup) ) { Log.getLogWriter().info("table is not part of server group : " + serverGroup); verifyTableMBeanShouldNotPresentInGroup(mbeanServer, tableName, memberId, serverGroup); verifyTableMBeanForGroup(mbeanServer, expectedBeans, tableName, populateBB, memberId, DEFAULT_SERVER_GROUP, verifyMBean); } } }
Example #22
Source File: MBeanServerAccessController.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Call <code>checkRead()</code>, then forward this method to the * wrapped object. */ public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException { checkRead(); return getMBeanServer().getAttribute(name, attribute); }
Example #23
Source File: OldMBeanServerTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { String name = attribute.getName(); AttrMethods am = attrMap.get(name); if (am == null || am.setter == null) throw new AttributeNotFoundException(name); invokeMethod(am.setter, attribute.getValue()); }
Example #24
Source File: RMRest.java From scheduling with GNU Affero General Public License v3.0 | 5 votes |
@Override public void setMBeanInfo(String sessionId, ObjectName name, String type, String attr, String value) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MBeanException, AttributeNotFoundException, InvalidAttributeValueException, IllegalArgumentException { RMProxyUserInterface rm = checkAccess(sessionId); if ((type != null) && (attr != null) && (value != null)) { rm.setMBeanAttribute(name, type, attr, value); } }
Example #25
Source File: MBeanServerDelegateImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example #26
Source File: DefaultMBeanServerInterceptor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException { if (name == null) { throw new RuntimeOperationsException(new IllegalArgumentException("Object name cannot be null"), "Exception occurred trying to invoke the getter on the MBean"); } if (attribute == null) { throw new RuntimeOperationsException(new IllegalArgumentException("Attribute cannot be null"), "Exception occurred trying to invoke the getter on the MBean"); } name = nonDefaultDomain(name); if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { MBEANSERVER_LOGGER.logp(Level.FINER, DefaultMBeanServerInterceptor.class.getName(), "getAttribute", "Attribute = " + attribute + ", ObjectName = " + name); } final DynamicMBean instance = getMBean(name); checkMBeanPermission(instance, attribute, name, "getAttribute"); try { return instance.getAttribute(attribute); } catch (AttributeNotFoundException e) { throw e; } catch (Throwable t) { rethrowMaybeMBeanException(t); throw new AssertionError(); // not reached } }
Example #27
Source File: MBeanServerDelegateImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * This method always fail since all MBeanServerDelegateMBean attributes * are read-only. * * @param attribute The identification of the attribute to * be set and the value it is to be set to. * * @exception AttributeNotFoundException */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { // Now we will always fail: // Either because the attribute is null or because it is not // accessible (or does not exist). // final String attname = (attribute==null?null:attribute.getName()); if (attname == null) { final RuntimeException r = new IllegalArgumentException("Attribute name cannot be null"); throw new RuntimeOperationsException(r, "Exception occurred trying to invoke the setter on the MBean"); } // This is a hack: we call getAttribute in order to generate an // AttributeNotFoundException if the attribute does not exist. // Object val = getAttribute(attname); // If we reach this point, we know that the requested attribute // exists. However, since all attributes are read-only, we throw // an AttributeNotFoundException. // throw new AttributeNotFoundException(attname + " not accessible"); }
Example #28
Source File: JMXContextMBean.java From RDFS with Apache License 2.0 | 5 votes |
@Override public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { Number result = metrics.get(attribute); if (result == null) { throw new AttributeNotFoundException(attribute); } return result; }
Example #29
Source File: MBeanSupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }
Example #30
Source File: MBeanSupport.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public final void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { final String name = attribute.getName(); final Object value = attribute.getValue(); perInterface.setAttribute(resource, name, value, getCookie()); }