001    /*
002     * Sonar, open source software quality management tool.
003     * Copyright (C) 2009 SonarSource SA
004     * mailto:contact AT sonarsource DOT com
005     *
006     * Sonar 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     * Sonar 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
017     * License along with Sonar; if not, write to the Free Software
018     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019     */
020    package org.sonar.api.resources;
021    
022    /**
023     * @since 1.10
024     */
025    public interface Resource<PARENT extends Resource<?>> {
026    
027      String SCOPE_SET = "PRJ";
028      String SCOPE_SPACE = "DIR";
029      String SCOPE_ENTITY = "FIL";
030    
031      /**
032       * Use SCOPE_SET instead
033       */
034      @Deprecated
035      String SCOPE_PROJECT = SCOPE_SET;
036    
037      /**
038       * Use SCOPE_SPACE instead
039       */
040      @Deprecated
041      String SCOPE_DIRECTORY = SCOPE_SPACE;
042    
043      /**
044       * Use SCOPE_ENTITY instead
045       */
046      @Deprecated
047      String SCOPE_FILE = SCOPE_ENTITY;
048    
049    
050      String QUALIFIER_VIEW = "VW";
051      String QUALIFIER_SUBVIEW = "SVW";
052      String QUALIFIER_PROJECT = "TRK";
053      String QUALIFIER_MODULE = "BRC";
054      String QUALIFIER_PACKAGE = "PAC";
055      String QUALIFIER_DIRECTORY = "DIR";
056      String QUALIFIER_FILE = "FIL";
057      String QUALIFIER_CLASS = "CLA";
058      String QUALIFIER_UNIT_TEST_CLASS = "UTS";
059    
060      /**
061       * Use QUALIFIER_PROJECT instead
062       */
063      @Deprecated
064      String QUALIFIER_PROJECT_TRUNK = QUALIFIER_PROJECT;
065    
066      /**
067       * Use QUALIFIER_MODULE instead
068       */
069      @Deprecated
070      String QUALIFIER_PROJECT_BRANCH = QUALIFIER_MODULE;
071    
072      String getKey();
073    
074      String getName();
075    
076      String getDescription();
077    
078      Language getLanguage();
079    
080      String getScope();
081    
082      String getQualifier();
083    
084      /**
085       * The parent is used to build the resources tree, for example for relations between classes, packages and projects.
086       * <p>Return null if the parent is the project.</p>
087       */
088      PARENT getParent();
089    
090      /**
091       * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example
092       * to match resource exclusions.
093       *
094       * @param antPattern Ant-like pattern (with **, * and ?). It includes file suffixes.
095       * @return true if the resource matches the Ant pattern
096       */
097      boolean matchFilePattern(String antPattern);
098    }