001/*
002 * Copyright (c) 2006-2011 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 *     Nuxeo - initial API and implementation
011 *
012 */
013
014package org.nuxeo.ecm.core.api.blobholder;
015
016import java.io.Serializable;
017
018import org.nuxeo.common.xmap.annotation.XNode;
019import org.nuxeo.common.xmap.annotation.XObject;
020import org.nuxeo.ecm.core.api.NuxeoException;
021
022/**
023 * XMap descriptor for contributed factories.
024 *
025 * @author tiry
026 */
027@XObject("blobHolderFactory")
028public class BlobHolderFactoryDescriptor implements Serializable {
029
030    private static final long serialVersionUID = 1L;
031
032    @XNode("@name")
033    protected String name;
034
035    @XNode("@docType")
036    protected String docType;
037
038    @XNode("@facet")
039    protected String facet;
040
041    @XNode("@class")
042    private Class adapterClass;
043
044    public String getName() {
045        return name;
046    }
047
048    public String getDocType() {
049        return docType;
050    }
051
052    public String getFacet() {
053        return facet;
054    }
055
056    public BlobHolderFactory getFactory() {
057        try {
058            return (BlobHolderFactory) adapterClass.newInstance();
059        } catch (ReflectiveOperationException e) {
060            throw new NuxeoException(e);
061        }
062    }
063
064}