001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 */
015package org.nuxeo.ecm.diff.content.adapter;
016
017import java.io.Serializable;
018
019import org.nuxeo.common.xmap.annotation.XNode;
020import org.nuxeo.common.xmap.annotation.XObject;
021
022/**
023 * Descriptor for contributed content diff Adapter factories.
024 *
025 * @author Antoine Taillefer
026 * @since 5.6
027 */
028@XObject(value = "contentDiffAdapter")
029public class ContentDiffAdapterFactoryDescriptor implements Serializable {
030
031    private static final long serialVersionUID = 1L;
032
033    @XNode("@name")
034    private String name;
035
036    @XNode("@enabled")
037    private boolean enabled = true;
038
039    @XNode("@typeName")
040    private String typeName;
041
042    @XNode("@class")
043    private Class<?> adapterClass;
044
045    public Class<?> getAdapterClass() {
046        return adapterClass;
047    }
048
049    public boolean isEnabled() {
050        return enabled;
051    }
052
053    public void setEnabled(boolean enabled) {
054        this.enabled = enabled;
055    }
056
057    public String getName() {
058        return name;
059    }
060
061    public void setName(String name) {
062        this.name = name;
063    }
064
065    public String getTypeName() {
066        return typeName;
067    }
068
069    public void setTypeName(String typeName) {
070        this.typeName = typeName;
071    }
072
073    public ContentDiffAdapterFactory getNewInstance() {
074        try {
075            return (ContentDiffAdapterFactory) adapterClass.newInstance();
076        } catch (ReflectiveOperationException e) {
077            throw new RuntimeException(e);
078        }
079    }
080
081}