当前位置: 首页>>代码示例>>Java>>正文


Java InvalidAttributeValueException类代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:PerInterface.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RMIConnector.java

示例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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:RMIConnector.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:RMIConnectorLogAttributesTest.java

示例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);
    }

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DynamicWritableWrapper.java

示例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;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DynamicWritableWrapper.java

示例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));
}
 
开发者ID:kikinteractive,项目名称:ice,代码行数:26,代码来源:ConfigDynamicMBean.java

示例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));
}
 
开发者ID:kikinteractive,项目名称:ice,代码行数:17,代码来源:ConfigDynamicMBean.java

示例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;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:22,代码来源:ConfigurationManagerService.java

示例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();
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:21,代码来源:DataSourceConfigurationManagerService.java

示例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;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:18,代码来源:DataSourceConfigurationManagerService.java

示例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);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:21,代码来源:MBean.java

示例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;
}
 
开发者ID:DIA-NZ,项目名称:webcurator,代码行数:21,代码来源:HarvesterHeritrix.java

示例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);
    }

}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:20,代码来源:Scim2PatchService.java

示例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);

}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:20,代码来源:ScimResourceUtil.java


注:本文中的javax.management.InvalidAttributeValueException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。