001/*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2014 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * SonarQube is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.batch.scm;
021
022import org.sonar.api.BatchExtension;
023import org.sonar.api.CoreProperties;
024import org.sonar.api.batch.InstantiationStrategy;
025
026import java.io.File;
027
028/**
029 * See {@link CoreProperties#LINKS_SOURCES_DEV} to get old Maven URL format.
030 * @since 5.0
031 */
032@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
033public abstract class ScmProvider implements BatchExtension {
034
035  /**
036   * Unique identifier of the provider. Can be passed to {@link CoreProperties#SCM_PROVIDER_KEY}
037   * Can be used in SCM URL to define the provider to use.
038   */
039  public abstract String key();
040
041  /**
042   * Does this provider able to manage files located in this directory.
043   * Used by autodetection. Not considered if user has forced the provider key.
044   * @return false by default
045   */
046  public boolean supports(File baseDir) {
047    return false;
048  }
049
050  public BlameCommand blameCommand() {
051    throw new UnsupportedOperationException("Blame command is not supported by " + key() + " provider");
052  }
053
054}