/** {@inheritDoc} */ @Override public boolean shouldPersist(ServiceParameters params) { return m_wrapped.shouldPersist(params); }
protected boolean isCollectionEnabled(CollectionResource resource) { return resource.shouldPersist(svcParams); }
/** * Push {@link CollectionResource} instances directly onto the stack without checking * {@link #top()} since they are the top-level resources. * * @param resource a {@link org.opennms.netmgt.collection.api.CollectionResource} object. */ public void pushShouldPersist(CollectionResource resource) { push(resource.shouldPersist(m_params)); }
public void addResourceToBuilder(CollectionSetBuilder builder, CollectionResource collectionResource) { SnmpCollectionResource snmpResource = (SnmpCollectionResource) collectionResource; AbstractResource builderResource; if(collectionResource instanceof NodeInfo) { NodeInfo nodeInfo = (NodeInfo) collectionResource; builderResource = new NodeLevelResource(nodeInfo.getNodeId()); } else if(collectionResource instanceof IfInfo) { IfInfo ifInfo = (IfInfo) collectionResource; builderResource = new InterfaceLevelResource(new NodeLevelResource(ifInfo.getNodeId()), ifInfo.getAttributesMap().get("snmpifname")); } else if(collectionResource instanceof GenericIndexResource) { GenericIndexResource genericResource = (GenericIndexResource) collectionResource; ResourceType resourceType = ((GenericIndexResourceType)genericResource.getResourceType()).getResourceType(); builderResource = new GenericTypeResource(new NodeLevelResource(genericResource.getCollectionAgent().getNodeId()) ,resourceType ,genericResource.getInstance()); } else { // We don't do anything for AliasedResource as discussed with jesse - AliasedResource is not used currently LOG.warn("we don't support {}, will ignore it", collectionResource.getClass().getName()); return; } // we add only groups that should be persisted to the CollectionBuilder since it doesn't have the concept // of "shouldPersist". Collection<AttributeGroup> groups = snmpResource.getGroups(); if(collectionResource.shouldPersist(params)) { addGroupsToBuilder(builder, builderResource, groups); } }