david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2001, 2004 IBM Corporation and others. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | * Jens Lukowski/Innoopract - initial renaming/restructuring |
| 11 | * |
| 12 | *******************************************************************************/ |
| 13 | package org.eclipse.wst.sse.ui.internal.reconcile.validator; |
| 14 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 15 | import java.lang.reflect.InvocationTargetException; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 16 | import java.util.ArrayList; |
| 17 | import java.util.Arrays; |
| 18 | import java.util.HashMap; |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 19 | import java.util.HashSet; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 20 | import java.util.Iterator; |
| 21 | import java.util.List; |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 22 | import java.util.Set; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 23 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 24 | import org.eclipse.core.resources.IFile; |
| 25 | import org.eclipse.core.resources.IProject; |
| 26 | import org.eclipse.core.resources.ResourcesPlugin; |
| 27 | import org.eclipse.core.runtime.IPath; |
| 28 | import org.eclipse.core.runtime.Path; |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 29 | import org.eclipse.core.runtime.Platform; |
| 30 | import org.eclipse.core.runtime.content.IContentType; |
| 31 | import org.eclipse.core.runtime.content.IContentTypeManager; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 32 | import org.eclipse.jface.text.IDocument; |
| 33 | import org.eclipse.jface.text.ITypedRegion; |
| 34 | import org.eclipse.jface.text.reconciler.DirtyRegion; |
| 35 | import org.eclipse.jface.text.reconciler.IReconcileResult; |
| 36 | import org.eclipse.jface.text.reconciler.IReconcileStep; |
nitind | f8e7763 | 2005-09-07 23:49:25 +0000 | [diff] [blame] | 37 | import org.eclipse.jface.text.source.ISourceViewer; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 38 | import org.eclipse.wst.sse.core.StructuredModelManager; |
| 39 | import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; |
pavery | b0763c0 | 2005-10-17 15:55:28 +0000 | [diff] [blame] | 40 | import org.eclipse.wst.sse.ui.internal.IReleasable; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 41 | import org.eclipse.wst.sse.ui.internal.Logger; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 42 | import org.eclipse.wst.sse.ui.internal.reconcile.DocumentAdapter; |
pavery | 1f1588d | 2006-02-15 20:44:54 +0000 | [diff] [blame] | 43 | import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey; |
pavery | dc8b306 | 2005-10-24 20:43:42 +0000 | [diff] [blame] | 44 | import org.eclipse.wst.sse.ui.internal.reconcile.StructuredTextReconcilingStrategy; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 45 | import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 46 | import org.eclipse.wst.validation.internal.ConfigurationManager; |
| 47 | import org.eclipse.wst.validation.internal.ProjectConfiguration; |
| 48 | import org.eclipse.wst.validation.internal.ValidationRegistryReader; |
david_williams | 49d24fb | 2005-04-08 21:16:59 +0000 | [diff] [blame] | 49 | import org.eclipse.wst.validation.internal.provisional.core.IValidator; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 50 | |
| 51 | |
| 52 | /** |
pavery | f918eb2 | 2005-03-29 18:26:53 +0000 | [diff] [blame] | 53 | * Special validator strategy. Runs validator steps contributed via the |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 54 | * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code> extension |
| 55 | * point |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 56 | * |
| 57 | * @author pavery |
| 58 | */ |
pavery | dc8b306 | 2005-10-24 20:43:42 +0000 | [diff] [blame] | 59 | public class ValidatorStrategy extends StructuredTextReconcilingStrategy { |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 60 | |
| 61 | private String[] fContentTypeIds = null; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 62 | private List fMetaData = null; |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 63 | /** validator id (as declared in ext point) -> ReconcileStepForValidator * */ |
| 64 | private HashMap fVidToVStepMap = null; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 65 | private ProjectConfiguration fProjectConfiguration = null; |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 66 | |
| 67 | /* |
| 68 | * List of ValidatorMetaDatas of total scope validators that have been run |
| 69 | * since beginProcessing() was called. |
| 70 | */ |
| 71 | private List fTotalScopeValidatorsAlreadyRun; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 72 | |
nitind | f8e7763 | 2005-09-07 23:49:25 +0000 | [diff] [blame] | 73 | public ValidatorStrategy(ISourceViewer sourceViewer, String contentType) { |
| 74 | super(sourceViewer); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 75 | fMetaData = new ArrayList(); |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 76 | fContentTypeIds = calculateParentContentTypeIds(contentType); |
pavery | 55ae447 | 2005-02-16 23:00:16 +0000 | [diff] [blame] | 77 | fVidToVStepMap = new HashMap(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 78 | } |
| 79 | |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 80 | public void addValidatorMetaData(ValidatorMetaData vmd) { |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 81 | fMetaData.add(vmd); |
| 82 | } |
| 83 | |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 84 | public void beginProcessing() { |
| 85 | if (fTotalScopeValidatorsAlreadyRun == null) |
| 86 | fTotalScopeValidatorsAlreadyRun = new ArrayList(); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * The content type passed in should be the most specific one. TODO: This |
| 91 | * exact method is also in ValidatorMetaData. Should be in a common place. |
| 92 | * |
| 93 | * @param contentType |
| 94 | * @return |
| 95 | */ |
| 96 | private String[] calculateParentContentTypeIds(String contentTypeId) { |
| 97 | |
| 98 | Set parentTypes = new HashSet(); |
| 99 | |
| 100 | IContentTypeManager ctManager = Platform.getContentTypeManager(); |
| 101 | IContentType ct = ctManager.getContentType(contentTypeId); |
| 102 | String id = contentTypeId; |
| 103 | |
| 104 | while (ct != null && id != null) { |
| 105 | |
| 106 | parentTypes.add(id); |
| 107 | ct = ctManager.getContentType(id); |
| 108 | if (ct != null) { |
| 109 | IContentType baseType = ct.getBaseType(); |
| 110 | id = (baseType != null) ? baseType.getId() : null; |
| 111 | } |
| 112 | } |
| 113 | return (String[]) parentTypes.toArray(new String[parentTypes.size()]); |
| 114 | } |
| 115 | |
pavery | 3f79184 | 2006-02-15 21:32:25 +0000 | [diff] [blame] | 116 | protected boolean canHandlePartition(String partitionType) { |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 117 | ValidatorMetaData vmd = null; |
| 118 | for (int i = 0; i < fMetaData.size(); i++) { |
| 119 | vmd = (ValidatorMetaData) fMetaData.get(i); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 120 | if (vmd.canHandlePartitionType(getContentTypeIds(), partitionType)) |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 121 | return true; |
| 122 | } |
| 123 | return false; |
| 124 | } |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 125 | |
| 126 | protected boolean containsStep(IReconcileStep step) { |
| 127 | return fVidToVStepMap.containsValue(step); |
| 128 | } |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 129 | |
| 130 | /** |
david_williams | 4ad020f | 2005-04-18 08:00:30 +0000 | [diff] [blame] | 131 | * @see org.eclipse.wst.sse.ui.internal.provisional.reconcile.AbstractStructuredTextReconcilingStrategy#createReconcileSteps() |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 132 | */ |
| 133 | public void createReconcileSteps() { |
| 134 | // do nothing, steps are created |
| 135 | } |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 136 | |
| 137 | public void endProcessing() { |
| 138 | fTotalScopeValidatorsAlreadyRun.clear(); |
| 139 | } |
| 140 | |
pavery | 1f1588d | 2006-02-15 20:44:54 +0000 | [diff] [blame] | 141 | /** |
| 142 | * All content types on which this ValidatorStrategy can run |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 143 | * |
pavery | 1f1588d | 2006-02-15 20:44:54 +0000 | [diff] [blame] | 144 | * @return |
| 145 | */ |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 146 | public String[] getContentTypeIds() { |
| 147 | return fContentTypeIds; |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 148 | } |
| 149 | |
pavery | dfec417 | 2005-11-09 21:42:30 +0000 | [diff] [blame] | 150 | /** |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 151 | * @param tr |
| 152 | * Partition of the region to reconcile. |
| 153 | * @param dr |
| 154 | * Dirty region representation of the typed region |
pavery | dfec417 | 2005-11-09 21:42:30 +0000 | [diff] [blame] | 155 | */ |
pavery | 46c93e7 | 2005-02-08 16:07:33 +0000 | [diff] [blame] | 156 | public void reconcile(ITypedRegion tr, DirtyRegion dr) { |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 157 | |
| 158 | if (isCanceled()) |
pavery | baf7e52 | 2005-07-07 20:44:14 +0000 | [diff] [blame] | 159 | return; |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 160 | |
pavery | dfec417 | 2005-11-09 21:42:30 +0000 | [diff] [blame] | 161 | IDocument doc = getDocument(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 162 | // for external files, this can be null |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 163 | if (doc == null) |
pavery | dfec417 | 2005-11-09 21:42:30 +0000 | [diff] [blame] | 164 | return; |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 165 | |
pavery | dfec417 | 2005-11-09 21:42:30 +0000 | [diff] [blame] | 166 | String partitionType = tr.getType(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 167 | |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 168 | ValidatorMetaData vmd = null; |
| 169 | List annotationsToAdd = new ArrayList(); |
david_williams | 5ce6d6c | 2006-05-28 23:58:12 +0000 | [diff] [blame^] | 170 | List stepsRanOnThisDirtyRegion = new ArrayList(1); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 171 | /* |
| 172 | * Loop through all of the relevant validator meta data to find |
| 173 | * supporting validators for this partition type. Don't check |
| 174 | * this.canHandlePartition() before-hand since it just loops through |
| 175 | * and calls vmd.canHandlePartitionType()...which we're already doing |
| 176 | * here anyway to find the right vmd. |
| 177 | */ |
| 178 | for (int i = 0; i < fMetaData.size() && !isCanceled(); i++) { |
| 179 | vmd = (ValidatorMetaData) fMetaData.get(i); |
| 180 | if (vmd.canHandlePartitionType(getContentTypeIds(), partitionType)) { |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 181 | /* |
| 182 | * Check if validator is enabled according to validation |
| 183 | * preferences before attempting to create/use it |
| 184 | */ |
| 185 | if (isValidatorEnabled(vmd)) { |
| 186 | int validatorScope = vmd.getValidatorScope(); |
| 187 | ReconcileStepForValidator validatorStep = null; |
| 188 | // get step for partition type |
| 189 | Object o = fVidToVStepMap.get(vmd.getValidatorId()); |
| 190 | if (o != null) { |
| 191 | validatorStep = (ReconcileStepForValidator) o; |
| 192 | } |
| 193 | else { |
| 194 | // if doesn't exist, create one |
| 195 | IValidator validator = vmd.createValidator(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 196 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 197 | validatorStep = new ReconcileStepForValidator(validator, validatorScope); |
| 198 | validatorStep.setInputModel(new DocumentAdapter(doc)); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 199 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 200 | fVidToVStepMap.put(vmd.getValidatorId(), validatorStep); |
| 201 | } |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 202 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 203 | if (!fTotalScopeValidatorsAlreadyRun.contains(vmd)) { |
| 204 | annotationsToAdd.addAll(Arrays.asList(validatorStep.reconcile(dr, dr))); |
david_williams | 5ce6d6c | 2006-05-28 23:58:12 +0000 | [diff] [blame^] | 205 | stepsRanOnThisDirtyRegion.add(validatorStep); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 206 | |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 207 | if (validatorScope == ReconcileAnnotationKey.TOTAL) { |
| 208 | // mark this validator as "run" |
| 209 | fTotalScopeValidatorsAlreadyRun.add(vmd); |
| 210 | } |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 211 | } |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 212 | } |
| 213 | } |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 214 | } |
| 215 | |
david_williams | 5ce6d6c | 2006-05-28 23:58:12 +0000 | [diff] [blame^] | 216 | TemporaryAnnotation[] annotationsToRemove = getAnnotationsToRemove(dr, stepsRanOnThisDirtyRegion); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 217 | if (annotationsToRemove.length + annotationsToAdd.size() > 0) |
| 218 | smartProcess(annotationsToRemove, (IReconcileResult[]) annotationsToAdd.toArray(new IReconcileResult[annotationsToAdd.size()])); |
| 219 | } |
| 220 | |
| 221 | public void release() { |
| 222 | super.release(); |
| 223 | Iterator it = fVidToVStepMap.values().iterator(); |
| 224 | IReconcileStep step = null; |
| 225 | while (it.hasNext()) { |
| 226 | step = (IReconcileStep) it.next(); |
| 227 | if (step instanceof IReleasable) |
| 228 | ((IReleasable) step).release(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 229 | } |
| 230 | } |
| 231 | |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 232 | /** |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 233 | * @see org.eclipse.wst.sse.ui.internal.reconcile.AbstractStructuredTextReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument) |
| 234 | */ |
| 235 | public void setDocument(IDocument document) { |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 236 | |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 237 | super.setDocument(document); |
nitind | b044597 | 2006-02-16 22:19:20 +0000 | [diff] [blame] | 238 | |
pavery | 55ae447 | 2005-02-16 23:00:16 +0000 | [diff] [blame] | 239 | // validator steps are in "fVIdToVStepMap" (as opposed to fFirstStep > |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 240 | // next step etc...) |
pavery | 55ae447 | 2005-02-16 23:00:16 +0000 | [diff] [blame] | 241 | Iterator it = fVidToVStepMap.values().iterator(); |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 242 | IReconcileStep step = null; |
| 243 | while (it.hasNext()) { |
| 244 | step = (IReconcileStep) it.next(); |
| 245 | step.setInputModel(new DocumentAdapter(document)); |
| 246 | } |
| 247 | } |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 248 | |
| 249 | /** |
| 250 | * Checks if validator is enabled according to Validation preferences |
| 251 | * |
| 252 | * @param vmd |
| 253 | * @return |
| 254 | */ |
| 255 | private boolean isValidatorEnabled(ValidatorMetaData vmd) { |
amywu | e6620de | 2006-04-13 22:03:17 +0000 | [diff] [blame] | 256 | boolean enabled = true; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 257 | ProjectConfiguration configuration = getProjectConfiguration(); |
| 258 | org.eclipse.wst.validation.internal.ValidatorMetaData metadata = ValidationRegistryReader.getReader().getValidatorMetaData(vmd.getValidatorClass()); |
| 259 | if (configuration != null && metadata != null) { |
amywu | e6620de | 2006-04-13 22:03:17 +0000 | [diff] [blame] | 260 | if (!configuration.isBuildEnabled(metadata) && !configuration.isManualEnabled(metadata)) |
| 261 | enabled = false; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 262 | } |
| 263 | return enabled; |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Gets current validation project configuration based on current project |
| 268 | * (which is based on current document) |
| 269 | * |
| 270 | * @return ProjectConfiguration |
| 271 | */ |
| 272 | private ProjectConfiguration getProjectConfiguration() { |
| 273 | if (fProjectConfiguration == null) { |
| 274 | IFile file = getFile(); |
| 275 | if (file != null) { |
| 276 | IProject project = file.getProject(); |
| 277 | if (project != null) { |
| 278 | try { |
| 279 | fProjectConfiguration = ConfigurationManager.getManager().getProjectConfiguration(project); |
| 280 | } |
| 281 | catch (InvocationTargetException e) { |
| 282 | Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | return fProjectConfiguration; |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * Gets IFile from current document |
| 293 | * |
nitind | 6f36001 | 2006-05-02 18:48:59 +0000 | [diff] [blame] | 294 | * @return IFile the IFile, null if no such file exists |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 295 | */ |
| 296 | private IFile getFile() { |
| 297 | IStructuredModel model = null; |
| 298 | IFile file = null; |
| 299 | try { |
| 300 | model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument()); |
| 301 | if (model != null) { |
| 302 | String baseLocation = model.getBaseLocation(); |
| 303 | // The baseLocation may be a path on disk or relative to the |
| 304 | // workspace root. Don't translate on-disk paths to |
| 305 | // in-workspace resources. |
| 306 | IPath basePath = new Path(baseLocation); |
nitind | 6f36001 | 2006-05-02 18:48:59 +0000 | [diff] [blame] | 307 | if (basePath.segmentCount() > 1) { |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 308 | file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath); |
nitind | 6f36001 | 2006-05-02 18:48:59 +0000 | [diff] [blame] | 309 | /* |
| 310 | * If the IFile doesn't exist, make sure it's not |
| 311 | * returned |
| 312 | */ |
| 313 | if (!file.exists()) |
| 314 | file = null; |
amywu | 7d8efb0 | 2006-04-13 04:08:07 +0000 | [diff] [blame] | 315 | } |
| 316 | } |
| 317 | } |
| 318 | finally { |
| 319 | if (model != null) { |
| 320 | model.releaseFromRead(); |
| 321 | } |
| 322 | } |
| 323 | return file; |
| 324 | } |
david_williams | cfdb2cd | 2004-11-11 08:37:49 +0000 | [diff] [blame] | 325 | } |