// 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 org.opennms.pris.api.InstanceConfiguration;
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.GetComputersLogic;
import org.opennms.ocs.inventory.client.response.Computers;
import org.opennms.pris.api.Source;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
                       this.getPassword(),
                       this.getChecksum(),
                       this.getTags());

        Computers computers = ocsClient.getComputers();

        //** dump the computers into a file as xml
        if (this.getConfig().containsKey("target")) {
            Path dumpComputers = this.getConfig().getPath("target");
            try {
                JAXBContext jaxbContext = JAXBContext.newInstance(Computers.class);
                Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
                jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
                jaxbMarshaller.marshal(computers, dumpComputers.toFile());
            } catch (JAXBException ex) {
                LOGGER.error("Dumping computers to file '{}' has failed.", dumpComputers, ex);
            }
        }
        return computers;
    }

    @MetaInfServices
    public static class Factory implements Source.Factory {

        @Override
        public String getIdentifier() {
            return "ocs.computers";
        }

        @Override
// 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/OcsComputersSource.java
import org.opennms.pris.api.InstanceConfiguration;
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.GetComputersLogic;
import org.opennms.ocs.inventory.client.response.Computers;
import org.opennms.pris.api.Source;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

                       this.getPassword(),
                       this.getChecksum(),
                       this.getTags());

        Computers computers = ocsClient.getComputers();

        //** dump the computers into a file as xml
        if (this.getConfig().containsKey("target")) {
            Path dumpComputers = this.getConfig().getPath("target");
            try {
                JAXBContext jaxbContext = JAXBContext.newInstance(Computers.class);
                Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
                jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
                jaxbMarshaller.marshal(computers, dumpComputers.toFile());
            } catch (JAXBException ex) {
                LOGGER.error("Dumping computers to file '{}' has failed.", dumpComputers, ex);
            }
        }
        return computers;
    }

    @MetaInfServices
    public static class Factory implements Source.Factory {

        @Override
        public String getIdentifier() {
            return "ocs.computers";
        }

        @Override
        public Source create(final InstanceConfiguration config) {