Mercurial > hg > digilib
view common/src/main/java/digilib/image/DocuImageFactory.java @ 1180:5abbf21fdf9f
changed DigilibConfiguration to work with inheritance. DigilibServletConfiguration takes the role of Initialiser. DocuImage gets a static factory.
author | robcast |
---|---|
date | Thu, 04 Apr 2013 18:43:13 +0200 |
parents | |
children | 43d48324dceb |
line wrap: on
line source
package digilib.image; /* * #%L * digilib-common * %% * Copyright (C) 2013 MPIWG Berlin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% * Author: Robert Casties (robcast@berlios.de) */ import org.apache.log4j.Logger; /** * Static factory for DocuImages. * * @author casties * */ public class DocuImageFactory { /** Log4J logger */ protected static Logger logger = Logger.getLogger(DocuImageFactory.class); /** AuthOps implementation class */ protected static Class<DocuImage> docuImageClass; /** * Creates a new DocuImage instance. * * The type of DocuImage is specified by docuimage-class. * * @return DocuImage */ public static DocuImage getInstance() { DocuImage di = null; try { di = docuImageClass.newInstance(); } catch (Exception e) { logger.error("Unable to create DocuImage instance!", e); } return di; } /** set the DocuImage implementation class. * @param clazz */ public static void setDocuImageClass(Class<DocuImage> clazz) { DocuImageFactory.docuImageClass = clazz; } }