1 /* 2 * $HeadURL: https://mindtreeinsight.svn.sourceforge.net/svnroot/mindtreeinsight/releng/maven-nsis-plugin/branches/maven-nsis-plugin-0.2.0/src/main/java/com/mindtree/techworks/insight/releng/mvn/nsis/io/DefaultProjectFileReader.java $ 3 * 4 * Copyright (c) 2007 MindTree Consulting Ltd. 5 * 6 * This file is part of Insight Release Engineering Tools. 7 * 8 * Insight Release Engineering Tools is free software: you can redistribute it 9 * and/or modify it under the terms of the GNU General Public License as 10 * published by the Free Software Foundation, either version 3 of the License, 11 * or (at your option) any later version. 12 * 13 * Insight Release Engineering Tools is distributed in the hope that it will be 14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 16 * Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along with 19 * Insight Release Engineering Tools. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 package com.mindtree.techworks.insight.releng.mvn.nsis.io; 22 23 import java.io.File; 24 import java.io.FileReader; 25 import java.io.IOException; 26 27 import org.codehaus.plexus.util.xml.pull.XmlPullParserException; 28 29 import com.mindtree.techworks.insight.releng.mvn.nsis.model.NsisProject; 30 import com.mindtree.techworks.insight.releng.mvn.nsis.model.io.xpp3.NsisProjectXpp3Reader; 31 32 /** 33 * Default Xpp3 implementation of the project file reader. 34 * 35 * @author <a href="mailto:bindul_bhowmik@mindtree.com">Bindul Bhowmik</a> 36 * @version $Revision: 235 $ $Date: 2009-03-27 15:00:18 -0600 (Fri, 27 Mar 2009) $ 37 * 38 * @plexus.component role="com.mindtree.techworks.insight.releng.mvn.nsis.io.ProjectFileReader" role-hint="default" 39 */ 40 public class DefaultProjectFileReader implements ProjectFileReader { 41 42 /* (non-Javadoc) 43 * @see com.mindtree.techworks.insight.releng.mvn.nsis.io.ProjectFileReader#readProject(java.io.File) 44 */ 45 public NsisProject readProject(File nsisProjectFile) throws IOException { 46 FileReader fileReader = new FileReader(nsisProjectFile); 47 NsisProjectXpp3Reader reader = new NsisProjectXpp3Reader(); 48 try { 49 return reader.read(fileReader); 50 } catch (XmlPullParserException e) { 51 throw new IOException("Error parsing Xml: " + e.getMessage() 52 + " at Line:" + e.getLineNumber() + " Column:" 53 + e.getColumnNumber()); 54 } 55 } 56 57 58 }