| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FreeHepDetector |
|
| 1.5;1,5 |
| 1 | /* | |
| 2 | * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | /* $Id: FreeHepDetector.java,v 584e9b40f728 2009/04/09 07:41:44 maxberger $ */ | |
| 18 | ||
| 19 | package net.sourceforge.jeuclid.converter; | |
| 20 | ||
| 21 | import net.sourceforge.jeuclid.elements.support.ClassLoaderSupport; | |
| 22 | ||
| 23 | import org.apache.commons.logging.Log; | |
| 24 | import org.apache.commons.logging.LogFactory; | |
| 25 | ||
| 26 | /** | |
| 27 | * Detects if FreeHep is in the class path and registers it if its available. | |
| 28 | * | |
| 29 | * @version $Revision: 584e9b40f728 $ | |
| 30 | */ | |
| 31 | public final class FreeHepDetector implements ConverterDetector { | |
| 32 | /** | |
| 33 | * Logger for this class | |
| 34 | */ | |
| 35 | 209 | private static final Log LOGGER = LogFactory |
| 36 | .getLog(FreeHepDetector.class); | |
| 37 | ||
| 38 | /** | |
| 39 | * Default constructor. | |
| 40 | */ | |
| 41 | 209 | public FreeHepDetector() { |
| 42 | // Empty on purpose | |
| 43 | 209 | } |
| 44 | ||
| 45 | /** | |
| 46 | * Detects if FreeHep is in the classpath. | |
| 47 | * | |
| 48 | * @param registry | |
| 49 | * ConverterRegisty to register with. | |
| 50 | */ | |
| 51 | public void detectConversionPlugins(final ConverterRegistry registry) { | |
| 52 | ||
| 53 | try { | |
| 54 | 209 | ClassLoaderSupport.getInstance().loadClass( |
| 55 | "org.freehep.util.export.ExportFileType"); | |
| 56 | 209 | FreeHepInternalDetector.actuallyDetectConversionPlugins(registry); |
| 57 | 0 | } catch (final ClassNotFoundException e) { |
| 58 | 0 | FreeHepDetector.LOGGER.debug(e); |
| 59 | 209 | } |
| 60 | 209 | } |
| 61 | } |