@@ -0,0 +1,2937 @@
+/** Copyright (c) 2012 Memorial Sloan-Kettering Cancer Center.%0A**%0A** This library is free software; you can redistribute it and/or modify it%0A** under the terms of the GNU Lesser General Public License as published%0A** by the Free Software Foundation; either version 2.1 of the License, or%0A** any later version.%0A**%0A** This library is distributed in the hope that it will be useful, but%0A** WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF%0A** MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and%0A** documentation provided hereunder is on an %22as is%22 basis, and%0A** Memorial Sloan-Kettering Cancer Center %0A** has no obligations to provide maintenance, support,%0A** updates, enhancements or modifications.  In no event shall%0A** Memorial Sloan-Kettering Cancer Center%0A** be liable to any party for direct, indirect, special,%0A** incidental or consequential damages, including lost profits, arising%0A** out of the use of this software and its documentation, even if%0A** Memorial Sloan-Kettering Cancer Center %0A** has been advised of the possibility of such damage.  See%0A** the GNU Lesser General Public License for more details.%0A**%0A** You should have received a copy of the GNU Lesser General Public License%0A** along with this library; if not, write to the Free Software Foundation,%0A** Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.%0A**/%0A%0A// package%0Apackage org.mskcc.cbio.importer.fetcher.internal;%0A%0A// imports%0Aimport org.mskcc.cbio.importer.Fetcher;%0Aimport org.mskcc.cbio.importer.FileUtils;%0Aimport org.mskcc.cbio.importer.model.ReferenceMetadata;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A%0A/**%0A * Class which implements the fetcher interface.%0A */%0Afinal class ReferenceDataFetcherImpl implements Fetcher %7B%0A%0A%09// our logger%0A%09private static final Log LOG = LogFactory.getLog(ReferenceDataFetcherImpl.class);%0A%0A%09// ref to file utils%0A%09private FileUtils fileUtils;%0A%0A%09/**%0A%09 * Constructor.%0A     *%0A%09 * Takes a FileUtils reference.%0A     *%0A%09 * @param fileUtils FileUtils%0A%09 */%0A%09public ReferenceDataFetcherImpl(final FileUtils fileUtils) %7B%0A%0A%09%09// set members%0A%09%09this.fileUtils = fileUtils;%0A%09%7D%0A%0A%09/**%0A%09 * Fetchers data from the Broad.%0A%09 *%0A%09 * @throws Exception%0A%09 */%0A%09@Override%0A%09public void fetch() throws Exception %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09/**%0A%09 * Fetchers reference data from an external datasource.%0A%09 *%0A     * @param referenceMetadata ReferenceMetadata%0A%09 * @throws Exception%0A%09 */%0A%09@Override%0A%09public void fetchReferenceData(final ReferenceMetadata referenceMetadata) throws Exception %7B%0A%0A%09%09if (LOG.isInfoEnabled()) %7B%0A%09%09%09LOG.info(%22fetchReferenceData(), fetching reference file: %22 + referenceMetadata.getReferenceFile());%0A%09%09%09LOG.info(%22fetchReferenceData(), destination: %22 + referenceMetadata.getReferenceFileDestination());%0A%09%09%7D%0A%0A%09%09fileUtils.downloadFile(referenceMetadata.getReferenceFile(),%0A%09%09%09%09%09%09%09   referenceMetadata.getReferenceFileDestination());%0A%09%7D%0A%7D%0A

update to fetch reference data