001/*
002 * (C) Copyright 2006-2008 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 * Contributors:
015 *     Stephane Lacoin (Nuxeo EP Software Engineer)
016 */
017package org.nuxeo.runtime.management;
018
019import java.io.Serializable;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * @author Stephane Lacoin (Nuxeo EP Software Engineer)
026 */
027@XObject("service")
028public class ServiceDescriptor implements Serializable {
029
030    private static final long serialVersionUID = 6338431911839779273L;
031
032    protected ServiceDescriptor(String qualifiedName, Class<?> implClass) {
033        name = qualifiedName;
034        resourceClass = implClass;
035        ifaceClass = null;
036    }
037
038    public ServiceDescriptor() {
039    }
040
041    @XNode("@name")
042    private String name;
043
044    @XNode("@class")
045    private Class<?> resourceClass;
046
047    @XNode("@iface")
048    private Class<?> ifaceClass;
049
050    public String getName() {
051        return name;
052    }
053
054    public Class<?> getResourceClass() {
055        return resourceClass;
056    }
057
058    public Class<?> getIfaceClass() {
059        return ifaceClass;
060    }
061
062    @Override
063    public String toString() {
064        if (name != null) {
065            return name;
066        }
067        return resourceClass.getCanonicalName();
068    }
069
070}