001/*
002 * Copyright (c) 2006-2013 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Vladimir Pasquier <vpasquier@nuxeo.com>
011 *     Antoine Taillefer <ataillefer@nuxeo.com>
012 *
013 */
014
015package org.nuxeo.ecm.core.api.thumbnail;
016
017import java.io.Serializable;
018
019import org.nuxeo.common.xmap.annotation.XNode;
020import org.nuxeo.common.xmap.annotation.XObject;
021import org.nuxeo.ecm.core.api.NuxeoException;
022
023/**
024 * XMap descriptor for contributed thumbnail factories.
025 *
026 * @since 5.7
027 */
028@XObject("thumbnailFactory")
029public class ThumbnailFactoryDescriptor implements Serializable {
030
031    private static final long serialVersionUID = 1L;
032
033    @XNode("@name")
034    protected String name;
035
036    @XNode("@docType")
037    protected String docType;
038
039    @XNode("@facet")
040    protected String facet;
041
042    @XNode("@factoryClass")
043    private Class<? extends ThumbnailFactory> factoryClass;
044
045    public String getName() {
046        return name;
047    }
048
049    public String getDocType() {
050        return docType;
051    }
052
053    public String getFacet() {
054        return facet;
055    }
056
057    public ThumbnailFactory getFactory() {
058        try {
059            return (ThumbnailFactory) factoryClass.newInstance();
060        } catch (ReflectiveOperationException e) {
061            throw new NuxeoException(e);
062        }
063    }
064
065}