本文整理汇总了Java中javax.management.InvalidAttributeValueException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidAttributeValueException类的具体用法?Java InvalidAttributeValueException怎么用?Java InvalidAttributeValueException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidAttributeValueException类属于javax.management包,在下文中一共展示了InvalidAttributeValueException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
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);
}
示例2: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute="
+ attribute);
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例3: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute name="
+ attribute.getName());
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例4: doTest
import javax.management.InvalidAttributeValueException; //导入依赖的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);
}
示例5: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public synchronized void setAttribute(final Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
Attribute newAttribute = attribute;
if (configBeanModificationDisabled.get()) {
throw new IllegalStateException("Operation is not allowed now");
}
if ("Attribute".equals(newAttribute.getName())) {
setAttribute((Attribute) newAttribute.getValue());
return;
}
try {
if (newAttribute.getValue() instanceof ObjectName) {
newAttribute = fixDependencyAttribute(newAttribute);
} else if (newAttribute.getValue() instanceof ObjectName[]) {
newAttribute = fixDependencyListAttribute(newAttribute);
}
internalServer.setAttribute(objectNameInternal, newAttribute);
} catch (final InstanceNotFoundException e) {
throw new MBeanException(e);
}
}
示例6: setAttributes
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public AttributeList setAttributes(final AttributeList attributes) {
AttributeList result = new AttributeList();
for (Object attributeObject : attributes) {
Attribute attribute = (Attribute) attributeObject;
try {
setAttribute(attribute);
result.add(attribute);
} catch (final InvalidAttributeValueException | AttributeNotFoundException | MBeanException
| ReflectionException e) {
LOG.warn("Setting attribute {} failed on {}", attribute.getName(), moduleIdentifier, e);
throw new IllegalArgumentException(
"Setting attribute failed - " + attribute.getName() + " on " + moduleIdentifier, e);
}
}
return result;
}
示例7: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
{
ConfigDescriptor desc = descLookupByAttributeName.get(attribute.getName());
if (desc == null) {
log.warn("Attribute Set name={} value={} requested on MXBean {}, but no matching configDescriptor found.",
attribute.getName(), attribute.getValue(), mbeanName);
throw new AttributeNotFoundException();
}
// get appropriate config value converter and test the conversion for immediate error feedback
ConfigValueConverter<?> converter = (ConfigValueConverter<?>) this.injectorRef.get().getInstance(Key.get(Types.newParameterizedType(ConfigValueConverter.class, desc.getConfigType())));
String strValue = attribute.getValue() == null ? null : attribute.getValue().toString();
try {
converter.apply(strValue);
}
catch (Exception ex) {
log.warn("Attribute Set name={} value={} requested on MXBean {}, but value failed to convert to type {}",
attribute.getName(), attribute.getValue(), mbeanName, desc.getConfigType().getTypeName());
throw new InvalidAttributeValueException("Failed to parse value: " + ex.getMessage());
}
// emit event
this.eventSink.fireEvent(desc.getConfigName(), Optional.ofNullable(strValue));
}
示例8: setAttributes
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public AttributeList setAttributes(AttributeList attributes)
{
List<String> toGet = new ArrayList<>();
for (Attribute attrib : attributes.asList()) {
try {
setAttribute(attrib);
toGet.add(attrib.getName());
}
catch (AttributeNotFoundException | InvalidAttributeValueException | MBeanException | ReflectionException ex) {
// warn is logged by individual setAttribute calls
log.debug("Could not set attribute {} on MXBean {}", attrib.getName(), mbeanName, ex);
}
}
return getAttributes(toGet.stream().toArray(String[]::new));
}
示例9: setAttributes
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public AttributeList setAttributes( AttributeList attributeList )
{
AttributeList list = new AttributeList();
for( int i = 0; i < list.size(); i++ )
{
Attribute attribute = (Attribute) list.get( i );
try
{
setAttribute( attribute );
list.add( attribute );
}
catch( AttributeNotFoundException | InvalidAttributeValueException | ReflectionException | MBeanException e )
{
e.printStackTrace();
}
}
return list;
}
示例10: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@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 );
property.set( attribute.getValue() );
try {
uow.complete();
} catch ( UnitOfWorkCompletionException e ) {
throw new ReflectionException( e );
}
} finally {
uow.discard();
}
}
示例11: setAttributes
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public AttributeList setAttributes( AttributeList attributeList )
{
AttributeList list = new AttributeList();
for ( int i = 0; i < list.size(); i++ ) {
Attribute attribute = ( Attribute ) list.get( i );
try {
setAttribute( attribute );
list.add( attribute );
} catch ( AttributeNotFoundException | InvalidAttributeValueException | ReflectionException | MBeanException e ) {
e.printStackTrace();
}
}
return list;
}
示例12: setAttribute
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
@Override
public void setAttribute(final Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
{
try {
String name = attribute.getName();
Object value = attribute.getValue();
attribute(name).setValue(value);
}
catch (Exception e) {
log.warn("Failed to set attribute: {}", attribute, e);
// TODO: Sort out the proper exception handling/wrapping
Throwables.propagateIfPossible(e, AttributeNotFoundException.class);
Throwables.propagateIfPossible(e, InvalidAttributeValueException.class);
Throwables.propagateIfPossible(e, MBeanException.class);
Throwables.propagateIfPossible(e, ReflectionException.class);
throw new MBeanException(e);
}
}
示例13: getSettingsHandler
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
/**
* @return
*/
private XMLSettingsHandler getSettingsHandler() {
XMLSettingsHandler settings = job.getSettingsHandler();
if (settings == null || settings.getOrder() == null) {
File profile = new File(job.getDirectory() + File.separator + PROFILE_NAME);
try {
settings = new XMLSettingsHandler(profile);
settings.initialize();
}
catch (InvalidAttributeValueException e) {
if (log.isErrorEnabled()) {
log.error("Failed to get settings for job " + name + ": " + e.getMessage(), e);
}
throw new HarvesterException("Failed to get settings for job " + name + ": " + e.getMessage(), e);
}
}
return settings;
}
示例14: applyPartialUpdate
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
private void applyPartialUpdate(String attribute, String subAttribute, List<Map<String, Object>> list, int index, Object value,
Class <? extends BaseScimResource> cls) throws InvalidAttributeValueException {
if (subAttribute.length()==0) {
//Updates the whole item in the list after passing mutability check, see section 3.5.2 RFC 7644:
//"Each operation against an attribute MUST be compatible with the attribute's mutability and schema ... "
Map<String, Object> map=IntrospectUtil.strObjMap(value);
for (String subAttr : map.keySet())
assertMutability(attribute, list.get(index).get(subAttr), map.get(subAttr), cls);
list.set(index, map);
}
else{
//Updates a subattribute only
assertMutability(attribute + "." + subAttribute, list.get(index).get(subAttribute), value, cls);
list.get(index).put(subAttribute, value);
}
}
示例15: transferToResource
import javax.management.InvalidAttributeValueException; //导入依赖的package包/类
private static BaseScimResource transferToResource(BaseScimResource origin, final BaseScimResource destination,
List<Extension> extensions, boolean replacing) throws InvalidAttributeValueException{
log.debug("transferToResource. Processing {} operation", replacing ? "replace" : "add");
Map<String, Object> fromMap = mapper.convertValue(origin, new TypeReference<Map<String,Object>>(){});
Map<String, Object> toMap = mapper.convertValue(destination, new TypeReference<Map<String,Object>>(){});
log.debug("transferToResource. Recursive traversal of resource is taking place");
traversalClass tclass=new traversalClass(origin.getClass());
tclass.traverse("", fromMap, toMap, replacing);
attachExtensionInfo(fromMap, toMap, extensions, replacing);
if (tclass.error==null)
return mapper.convertValue(toMap, origin.getClass());
else
throw new InvalidAttributeValueException(tclass.error);
}