Search in sources :

Example 11 with AttributeIfc

use of org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc in project controller by opendaylight.

the class ObjectXmlWriter method prepareWriting.

@SuppressWarnings("checkstyle:hiddenField")
public Map<String, AttributeWritingStrategy> prepareWriting(final Map<String, AttributeIfc> yangToAttrConfig, final Document document) {
    Map<String, AttributeWritingStrategy> preparedWriting = Maps.newHashMap();
    for (Entry<String, AttributeIfc> mappedAttributeEntry : yangToAttrConfig.entrySet()) {
        String key = mappedAttributeEntry.getKey();
        AttributeIfc value = mappedAttributeEntry.getValue();
        AttributeWritingStrategy strat = prepareWritingStrategy(key, value, document);
        preparedWriting.put(key, strat);
    }
    return preparedWriting;
}
Also used : AttributeIfc(org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc)

Example 12 with AttributeIfc

use of org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc in project controller by opendaylight.

the class ObjectResolver method caseTOAttribute.

@Override
protected AttributeResolvingStrategy<?, ? extends OpenType<?>> caseTOAttribute(final CompositeType openType) {
    Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
    TOAttribute toAttribute = (TOAttribute) getLastAttribute();
    Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> innerMap = Maps.newHashMap();
    for (String innerName : openType.keySet()) {
        AttributeIfc innerAttributeIfc = toAttribute.getJmxPropertiesToTypesMap().get(innerName);
        innerMap.put(innerAttributeIfc.getAttributeYangName(), prepareStrategy(innerAttributeIfc));
    }
    return new CompositeAttributeResolvingStrategy(innerMap, openType, createYangToJmxMapping(toAttribute));
}
Also used : OpenType(javax.management.openmbean.OpenType) AttributeIfc(org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc) TOAttribute(org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute)

Example 13 with AttributeIfc

use of org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc in project controller by opendaylight.

the class ObjectMapper method caseTOAttribute.

@Override
protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseTOAttribute(final CompositeType openType) {
    Map<String, AttributeMappingStrategy<?, ? extends OpenType<?>>> innerStrategies = Maps.newHashMap();
    Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
    TOAttribute lastTO = (TOAttribute) getLastAttribute();
    for (Entry<String, AttributeIfc> innerAttrEntry : ((TOAttribute) getLastAttribute()).getJmxPropertiesToTypesMap().entrySet()) {
        innerStrategies.put(innerAttrEntry.getKey(), prepareStrategy(innerAttrEntry.getValue()));
    }
    return new CompositeAttributeMappingStrategy(openType, innerStrategies, createJmxToYangMapping(lastTO));
}
Also used : OpenType(javax.management.openmbean.OpenType) AttributeIfc(org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc) TOAttribute(org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute)

Example 14 with AttributeIfc

use of org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc in project controller by opendaylight.

the class ObjectXmlReader method caseListDependeciesAttribute.

@Override
protected AttributeReadingStrategy caseListDependeciesAttribute(final ArrayType<?> openType) {
    AttributeIfc lastAttribute = getLastAttribute();
    Preconditions.checkState(lastAttribute instanceof ListDependenciesAttribute);
    AttributeReadingStrategy innerStrategy = caseDependencyAttribute(SimpleType.OBJECTNAME);
    return new ArrayAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategy);
}
Also used : AttributeIfc(org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc) ListDependenciesAttribute(org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute)

Example 15 with AttributeIfc

use of org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc in project controller by opendaylight.

the class ObjectXmlReader method caseTOAttribute.

@Override
protected AttributeReadingStrategy caseTOAttribute(final CompositeType openType) {
    AttributeIfc lastAttribute = getLastAttribute();
    Preconditions.checkState(lastAttribute instanceof TOAttribute);
    Map<String, AttributeIfc> inner = ((TOAttribute) lastAttribute).getYangPropertiesToTypesMap();
    Map<String, AttributeReadingStrategy> innerStrategies = Maps.newHashMap();
    for (Entry<String, AttributeIfc> innerAttrEntry : inner.entrySet()) {
        AttributeReadingStrategy innerStrat = prepareReadingStrategy(innerAttrEntry.getKey(), innerAttrEntry.getValue());
        innerStrategies.put(innerAttrEntry.getKey(), innerStrat);
    }
    return new CompositeAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategies);
}
Also used : AttributeIfc(org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc) TOAttribute(org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute)

Aggregations

AttributeIfc (org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc)18 ListAttribute (org.opendaylight.controller.config.yangjmxgenerator.attribute.ListAttribute)7 JavaAttribute (org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute)6 TOAttribute (org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute)6 HashMap (java.util.HashMap)4 QName (org.opendaylight.yangtools.yang.common.QName)4 OpenType (javax.management.openmbean.OpenType)3 Test (org.junit.Test)3 DataSchemaNode (org.opendaylight.yangtools.yang.model.api.DataSchemaNode)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 SimpleType (javax.management.openmbean.SimpleType)2 ModuleMXBeanEntry (org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry)2 RuntimeBeanEntry (org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry)2 Rpc (org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry.Rpc)2 DependencyAttribute (org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute)2 ListDependenciesAttribute (org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute)2 IdentitySchemaNode (org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode)2