/integrations/opennms-vmware/src/main/java/org/opennms/netmgt/collectd/vmware/cim/VmwareCimCollectionAttributeType.java
https://github.com/ajakubo1/opennms · Java · 66 lines · 29 code · 7 blank · 30 comment · 2 complexity · d2ab1052300f5ca9a932a74aab8a3f5d MD5 · raw file
- /*******************************************************************************
- * This file is part of OpenNMS(R).
- *
- * Copyright (C) 2012 The OpenNMS Group, Inc.
- * OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
- *
- * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
- *
- * OpenNMS(R) is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * OpenNMS(R) is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with OpenNMS(R). If not, see:
- * http://www.gnu.org/licenses/
- *
- * For more information contact:
- * OpenNMS(R) Licensing <license@opennms.org>
- * http://www.opennms.org/
- * http://www.opennms.com/
- *******************************************************************************/
- package org.opennms.netmgt.collectd.vmware.cim;
- import org.opennms.netmgt.collection.api.AttributeGroupType;
- import org.opennms.netmgt.collection.api.CollectionAttribute;
- import org.opennms.netmgt.collection.api.Persister;
- import org.opennms.netmgt.collection.support.AbstractCollectionAttributeType;
- import org.opennms.netmgt.config.vmware.cim.Attrib;
- public class VmwareCimCollectionAttributeType extends AbstractCollectionAttributeType {
- private final Attrib m_attribute;
- public VmwareCimCollectionAttributeType(final Attrib attribute, final AttributeGroupType groupType) {
- super(groupType);
- m_attribute = attribute;
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public void storeAttribute(final CollectionAttribute attribute, final Persister persister) {
- if ("string".equalsIgnoreCase(m_attribute.getType())) {
- persister.persistStringAttribute(attribute);
- } else {
- persister.persistNumericAttribute(attribute);
- }
- }
- @Override
- public String getName() {
- return m_attribute.getAlias();
- }
- @Override
- public String getType() {
- return m_attribute.getType();
- }
- }