// Path: opennms-pris-api/src/main/java/org/opennms/pris/api/Source.java
// public interface Source {
// 
//     /**
//      * Factory interface for creating {@link Source}s.
//      */
//     public static interface Factory {
//         
//         /**
//          * Returns the identifier used to created a source using this factory.
//          * 
//          * @return the identifier string
//          */
//         String getIdentifier();
// 
//         /**
//          * Creates a source.
//          * 
//          * @param config the configuration used to build the source
//          * 
//          * @return the created source
//          */
//         Source create(final InstanceConfiguration config);
//     }
// 
//     /**
//      * Loads some information and returns them.
//      *
//      * There is no requirement to the returned object as long as there is a
//      * mapper available for mapping this data.
//      *
//      * @return the loaded information
//      *
//      * @throws Exception
//      */
//     Object dump() throws Exception;
// }
// 
// Path: opennms-pris-api/src/main/java/org/opennms/pris/api/InstanceConfiguration.java
// public interface InstanceConfiguration extends Configuration {
//    
//     /**
//      * Returns the identifier of the instance.
//      * 
//      * @return the identifier string
//      */
//     String getInstanceIdentifier();
//     
//     /**
//      * Return a decorator Configuration containing every key from the current
//      * Configuration that starts with the specified prefix.
//      * 
//      * The prefix is removed from the keys in the subset.
//      * 
//      * Since the subset is a decorator and not a modified copy of the initial
//      * Configuration, any change made to the subset is available to the
//      * Configuration, and reciprocally.
//      *
//      * @param prefix The prefix used to select the properties
//      * 
//      * @return a subset configuration
//      */
//     InstanceConfiguration subset(final String prefix);
// }


import java.nio.file.Path;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.kohsuke.MetaInfServices;
import org.opennms.ocs.inventory.client.request.logic.GetSnmpDevicesLogic;
import org.opennms.ocs.inventory.client.response.snmp.SnmpDevices;
import org.opennms.pris.api.Source;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opennms.pris.api.InstanceConfiguration;
/**
 * *****************************************************************************
 * This file is part of OpenNMS(R).
 *
 * Copyright (C) 2014 The OpenNMS Group, Inc. OpenNMS(R) is Copyright (C) 1999-2014 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.opennms.pris.plugins.ocs.source;


public class OcsSnmpDevicesSource extends AbstractOcsSource {

    private static final Logger LOGGER = LoggerFactory.getLogger(OcsSnmpDevicesSource.class);

    public OcsSnmpDevicesSource(final InstanceConfiguration config) {
        super(config);
    }

    @Override
    public Object dump() throws Exception {
        final GetSnmpDevicesLogic ocsClient = new GetSnmpDevicesLogic();

        ocsClient.init(this.getUrl(),
// Path: opennms-pris-api/src/main/java/org/opennms/pris/api/Source.java
// public interface Source {
// 
//     /**
//      * Factory interface for creating {@link Source}s.
//      */
//     public static interface Factory {
//         
//         /**
//          * Returns the identifier used to created a source using this factory.
//          * 
//          * @return the identifier string
//          */
//         String getIdentifier();
// 
//         /**
//          * Creates a source.
//          * 
//          * @param config the configuration used to build the source
//          * 
//          * @return the created source
//          */
//         Source create(final InstanceConfiguration config);
//     }
// 
//     /**
//      * Loads some information and returns them.
//      *
//      * There is no requirement to the returned object as long as there is a
//      * mapper available for mapping this data.
//      *
//      * @return the loaded information
//      *
//      * @throws Exception
//      */
//     Object dump() throws Exception;
// }
// 
// Path: opennms-pris-api/src/main/java/org/opennms/pris/api/InstanceConfiguration.java
// public interface InstanceConfiguration extends Configuration {
//    
//     /**
//      * Returns the identifier of the instance.
//      * 
//      * @return the identifier string
//      */
//     String getInstanceIdentifier();
//     
//     /**
//      * Return a decorator Configuration containing every key from the current
//      * Configuration that starts with the specified prefix.
//      * 
//      * The prefix is removed from the keys in the subset.
//      * 
//      * Since the subset is a decorator and not a modified copy of the initial
//      * Configuration, any change made to the subset is available to the
//      * Configuration, and reciprocally.
//      *
//      * @param prefix The prefix used to select the properties
//      * 
//      * @return a subset configuration
//      */
//     InstanceConfiguration subset(final String prefix);
// }


// Path: opennms-pris-plugins/opennms-pris-plugins-ocs/src/main/java/org/opennms/opennms/pris/plugins/ocs/source/OcsSnmpDevicesSource.java
import java.nio.file.Path;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.kohsuke.MetaInfServices;
import org.opennms.ocs.inventory.client.request.logic.GetSnmpDevicesLogic;
import org.opennms.ocs.inventory.client.response.snmp.SnmpDevices;
import org.opennms.pris.api.Source;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opennms.pris.api.InstanceConfiguration;

/**
 * *****************************************************************************
 * This file is part of OpenNMS(R).
 *
 * Copyright (C) 2014 The OpenNMS Group, Inc. OpenNMS(R) is Copyright (C) 1999-2014 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.opennms.pris.plugins.ocs.source;


public class OcsSnmpDevicesSource extends AbstractOcsSource {

    private static final Logger LOGGER = LoggerFactory.getLogger(OcsSnmpDevicesSource.class);

    public OcsSnmpDevicesSource(final InstanceConfiguration config) {
        super(config);
    }

    @Override
    public Object dump() throws Exception {
        final GetSnmpDevicesLogic ocsClient = new GetSnmpDevicesLogic();

        ocsClient.init(this.getUrl(),
                       this.getUsername(),