001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 */
017package org.nuxeo.ecm.diff.content.adapter;
018
019import java.io.Serializable;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * Descriptor for contributed content diff Adapter factories.
026 *
027 * @author Antoine Taillefer
028 * @since 5.6
029 */
030@XObject(value = "contentDiffAdapter")
031public class ContentDiffAdapterFactoryDescriptor implements Serializable {
032
033    private static final long serialVersionUID = 1L;
034
035    @XNode("@name")
036    private String name;
037
038    @XNode("@enabled")
039    private boolean enabled = true;
040
041    @XNode("@typeName")
042    private String typeName;
043
044    @XNode("@class")
045    private Class<?> adapterClass;
046
047    public Class<?> getAdapterClass() {
048        return adapterClass;
049    }
050
051    public boolean isEnabled() {
052        return enabled;
053    }
054
055    public void setEnabled(boolean enabled) {
056        this.enabled = enabled;
057    }
058
059    public String getName() {
060        return name;
061    }
062
063    public void setName(String name) {
064        this.name = name;
065    }
066
067    public String getTypeName() {
068        return typeName;
069    }
070
071    public void setTypeName(String typeName) {
072        this.typeName = typeName;
073    }
074
075    public ContentDiffAdapterFactory getNewInstance() {
076        try {
077            return (ContentDiffAdapterFactory) adapterClass.newInstance();
078        } catch (ReflectiveOperationException e) {
079            throw new RuntimeException(e);
080        }
081    }
082
083}