1 11 package org.eclipse.update.core.model; 12 13 import java.io.IOException ; 14 import java.io.InputStream ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IStatus; 18 import org.eclipse.update.core.Utilities; 19 import org.eclipse.update.internal.core.Messages; 20 import org.xml.sax.SAXException ; 21 22 38 39 public class FeatureModelFactory { 40 41 42 44 49 public FeatureModelFactory() { 50 super(); 51 } 52 53 64 public FeatureModel parseFeature(InputStream stream) 65 throws CoreException, SAXException { 66 return parseFeature(stream, null); 67 } 68 69 81 public FeatureModel parseFeature(InputStream stream, String location) 82 throws CoreException, SAXException { 83 DefaultFeatureParser parser = new DefaultFeatureParser(); 84 parser.init(this, location); 85 FeatureModel featureModel = null; 86 try { 87 featureModel = parser.parse(stream); 88 if (parser.getStatus()!=null) { 89 IStatus status = parser.getStatus(); 91 throw new CoreException(status); 92 } 93 } catch (IOException e) { 94 throw Utilities.newCoreException(Messages.FeatureModelFactory_ErrorAccesingFeatureStream, e); 95 } 96 return featureModel; 97 } 98 99 106 public FeatureModel createFeatureModel() { 107 return new FeatureModel(); 108 } 109 110 117 public IncludedFeatureReferenceModel createIncludedFeatureReferenceModel() { 118 return new IncludedFeatureReferenceModel(); 119 } 120 121 122 129 public InstallHandlerEntryModel createInstallHandlerEntryModel() { 130 return new InstallHandlerEntryModel(); 131 } 132 133 140 public ImportModel createImportModel() { 141 return new ImportModel(); 142 } 143 144 151 public PluginEntryModel createPluginEntryModel() { 152 return new PluginEntryModel(); 153 } 154 155 162 public NonPluginEntryModel createNonPluginEntryModel() { 163 return new NonPluginEntryModel(); 164 } 165 166 173 public URLEntryModel createURLEntryModel() { 174 return new URLEntryModel(); 175 } 176 } 177 | Popular Tags |