001/*
002 * (C) Copyright 2006-2010 Nuxeo SA (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 *     Thierry Delprat
016 */
017package org.nuxeo.apidoc.introspection;
018
019import org.nuxeo.apidoc.api.BaseNuxeoArtifact;
020import org.nuxeo.apidoc.api.ComponentInfo;
021import org.nuxeo.apidoc.api.ServiceInfo;
022import org.nuxeo.apidoc.api.VirtualNodesConsts;
023
024public class ServiceInfoImpl extends BaseNuxeoArtifact implements ServiceInfo {
025
026    protected final String serviceClassName;
027
028    protected final ComponentInfo component;
029
030    public ServiceInfoImpl(String serviceClassName, ComponentInfo component) {
031        this.serviceClassName = serviceClassName;
032        this.component = component;
033    }
034
035    @Override
036    public String getId() {
037        return serviceClassName;
038    }
039
040    @Override
041    public String getArtifactType() {
042        return TYPE_NAME;
043    }
044
045    @Override
046    public String getVersion() {
047        return component.getVersion();
048    }
049
050    @Override
051    public String getComponentId() {
052        return component.getId();
053    }
054
055    @Override
056    public String getHierarchyPath() {
057        return component.getHierarchyPath() + "/" + VirtualNodesConsts.Services_VNODE_NAME + "/" + this.getId();
058    }
059
060}