/*L
 *  Copyright SAIC, Ellumen and RSNA (CTP)
 *
 *
 *  Distributed under the OSI-approved BSD 3-Clause License.
 *  See http://ncip.github.com/national-biomedical-image-archive/LICENSE.txt for details.
 */

package gov.nih.nci.nbia.dicomtags;


public class DicomTagViewerFactory {
	public static DicomTagViewer getDicomTagViewer() {
		if(instance==null) {
			instance = createDicomTagViewer();
		}
		return instance;
	}
	
	/////////////////////////////////////PRIVATE////////////////////////////////////
	
	private static DicomTagViewer instance;
	
	
	private static DicomTagViewer createDicomTagViewer() {
		String dicomTagViewerClassName = System.getProperty("dicomTagViewer.className");

		if(dicomTagViewerClassName==null) {
			throw new RuntimeException("dicomTagViewer.className must be defined in system properties");
		}
		else {
			try {
				ClassLoader loader = Thread.currentThread().getContextClassLoader();
				Class clazz = Class.forName(dicomTagViewerClassName, false, loader);
				DicomTagViewer dicomTagViewer =  (DicomTagViewer)clazz.newInstance();
				return dicomTagViewer;
			}
			catch(Exception ex) {
				throw new RuntimeException(ex);
			}
		}			
	}	
}

@@ -607,570 +607,51 @@
 ) %7B%0A
-%09%09String dicomTagViewerClassName = System.getProperty(%22dicomTagViewer.className%22);%0A%0A%09%09if(dicomTagViewerClassName==null) %7B%0A%09%09%09throw new RuntimeException(%22dicomTagViewer.className must be defined in system properties%22);%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09try %7B%0A%09%09%09%09ClassLoader loader = Thread.currentThread().getContextClassLoader();%0A%09%09%09%09Class clazz = Class.forName(dicomTagViewerClassName, false, loader);%0A%09%09%09%09DicomTagViewer dicomTagViewer =  (DicomTagViewer)clazz.newInstance();%0A%09%09%09%09return dicomTagViewer;%0A%09%09%09%7D%0A%09%09%09catch(Exception ex) %7B%0A%09%09%09%09throw new RuntimeException(ex);%0A%09%09%09%7D%0A%09%09%7D%09
+          return new LocalDicomTagViewer();
 %09%09%0A%09

Fix for dicom headers