Search in sources :

Example 1 with AttributeGroup

use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.

the class CollectionSetUtils method flatten.

public static List<String> flatten(CollectionSet collectionSet) {
    final List<String> strings = new ArrayList<>();
    collectionSet.visit(new AbstractCollectionSetVisitor() {

        CollectionResource resource;

        AttributeGroup group;

        @Override
        public void visitResource(CollectionResource resource) {
            this.resource = resource;
        }

        @Override
        public void visitGroup(AttributeGroup group) {
            this.group = group;
        }

        @Override
        public void visitAttribute(CollectionAttribute attribute) {
            strings.add(String.format("%s/%s/%s[%s,%s]", resource.getPath(), group.getName(), attribute.getName(), attribute.getStringValue(), attribute.getNumericValue()));
        }
    });
    return strings;
}
Also used : CollectionAttribute(org.opennms.netmgt.collection.api.CollectionAttribute) CollectionResource(org.opennms.netmgt.collection.api.CollectionResource) ArrayList(java.util.ArrayList) AttributeGroup(org.opennms.netmgt.collection.api.AttributeGroup) AbstractCollectionSetVisitor(org.opennms.netmgt.collection.support.AbstractCollectionSetVisitor)

Example 2 with AttributeGroup

use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.

the class AbstractCollectionResource method addAttribute.

/**
     * Adds the given attribute into the collection for this resource
     *
     * @param attr The Attribute to add
     */
public final void addAttribute(CollectionAttribute attr) {
    AttributeGroup group = getGroup(attr.getAttributeType().getGroupType());
    LOG.debug("Adding attribute {}: {} to group {}", attr.getClass().getName(), attr, group);
    group.addAttribute(attr);
}
Also used : AttributeGroup(org.opennms.netmgt.collection.api.AttributeGroup)

Example 3 with AttributeGroup

use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.

the class AbstractCollectionResource method visit.

/** {@inheritDoc} */
@Override
public void visit(CollectionSetVisitor visitor) {
    visitor.visitResource(this);
    for (AttributeGroup group : m_attributeGroups.values()) {
        group.visit(visitor);
    }
    visitor.completeResource(this);
}
Also used : AttributeGroup(org.opennms.netmgt.collection.api.AttributeGroup)

Example 4 with AttributeGroup

use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.

the class LatencyCollectionResource method visit.

/** {@inheritDoc} */
@Override
public void visit(CollectionSetVisitor visitor) {
    visitor.visitResource(this);
    for (AttributeGroup group : m_attributeGroups.values()) {
        group.visit(visitor);
    }
    visitor.completeResource(this);
}
Also used : AttributeGroup(org.opennms.netmgt.collection.api.AttributeGroup)

Example 5 with AttributeGroup

use of org.opennms.netmgt.collection.api.AttributeGroup in project opennms by OpenNMS.

the class LatencyCollectionResource method getGroup.

/**
     * Finds, or creates, and returns the AttributeGroup for the given group Type
     *
     * @param groupType a {@link org.opennms.netmgt.collection.api.AttributeGroupType} object.
     * @return a {@link org.opennms.netmgt.collection.api.AttributeGroup} object.
     */
public final AttributeGroup getGroup(AttributeGroupType groupType) {
    AttributeGroup group = m_attributeGroups.get(groupType);
    if (group == null) {
        group = new AttributeGroup(this, groupType);
        m_attributeGroups.put(groupType, group);
    }
    return group;
}
Also used : AttributeGroup(org.opennms.netmgt.collection.api.AttributeGroup)

Aggregations

AttributeGroup (org.opennms.netmgt.collection.api.AttributeGroup)17 CollectionAttribute (org.opennms.netmgt.collection.api.CollectionAttribute)4 CollectionResource (org.opennms.netmgt.collection.api.CollectionResource)3 AbstractCollectionSetVisitor (org.opennms.netmgt.collection.support.AbstractCollectionSetVisitor)3 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 CollectionSetVisitor (org.opennms.netmgt.collection.api.CollectionSetVisitor)1 TimeKeeper (org.opennms.netmgt.collection.api.TimeKeeper)1 AttributeGroupWrapper (org.opennms.netmgt.collection.support.AttributeGroupWrapper)1 CollectionAttributeWrapper (org.opennms.netmgt.collection.support.CollectionAttributeWrapper)1 CollectionResourceWrapper (org.opennms.netmgt.collection.support.CollectionResourceWrapper)1 CollectionSetVisitorWrapper (org.opennms.netmgt.collection.support.CollectionSetVisitorWrapper)1 ConstantTimeKeeper (org.opennms.netmgt.collection.support.ConstantTimeKeeper)1