001 /* 002 * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 /* $Id: FreeHepDetector.java,v 584e9b40f728 2009/04/09 07:41:44 maxberger $ */ 018 019 package net.sourceforge.jeuclid.converter; 020 021 import net.sourceforge.jeuclid.elements.support.ClassLoaderSupport; 022 023 import org.apache.commons.logging.Log; 024 import org.apache.commons.logging.LogFactory; 025 026 /** 027 * Detects if FreeHep is in the class path and registers it if its available. 028 * 029 * @version $Revision: 584e9b40f728 $ 030 */ 031 public final class FreeHepDetector implements ConverterDetector { 032 /** 033 * Logger for this class 034 */ 035 private static final Log LOGGER = LogFactory 036 .getLog(FreeHepDetector.class); 037 038 /** 039 * Default constructor. 040 */ 041 public FreeHepDetector() { 042 // Empty on purpose 043 } 044 045 /** 046 * Detects if FreeHep is in the classpath. 047 * 048 * @param registry 049 * ConverterRegisty to register with. 050 */ 051 public void detectConversionPlugins(final ConverterRegistry registry) { 052 053 try { 054 ClassLoaderSupport.getInstance().loadClass( 055 "org.freehep.util.export.ExportFileType"); 056 FreeHepInternalDetector.actuallyDetectConversionPlugins(registry); 057 } catch (final ClassNotFoundException e) { 058 FreeHepDetector.LOGGER.debug(e); 059 } 060 } 061 }