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 * The interface to implement to create a resource in Sonar 024 * 025 * @since 1.10 026 */ 027 public interface Resource<PARENT extends Resource> { 028 029 String SCOPE_SET = "PRJ"; 030 String SCOPE_SPACE = "DIR"; 031 String SCOPE_ENTITY = "FIL"; 032 033 /** 034 * Use SCOPE_SET instead 035 */ 036 @Deprecated 037 String SCOPE_PROJECT = SCOPE_SET; 038 039 /** 040 * Use SCOPE_SPACE instead 041 */ 042 @Deprecated 043 String SCOPE_DIRECTORY = SCOPE_SPACE; 044 045 /** 046 * Use SCOPE_ENTITY instead 047 */ 048 @Deprecated 049 String SCOPE_FILE = SCOPE_ENTITY; 050 051 052 String QUALIFIER_VIEW = "VW"; 053 String QUALIFIER_SUBVIEW = "SVW"; 054 String QUALIFIER_PROJECT = "TRK"; 055 String QUALIFIER_MODULE = "BRC"; 056 String QUALIFIER_PACKAGE = "PAC"; 057 String QUALIFIER_DIRECTORY = "DIR"; 058 String QUALIFIER_FILE = "FIL"; 059 String QUALIFIER_CLASS = "CLA"; 060 String QUALIFIER_UNIT_TEST_CLASS = "UTS"; 061 062 /** 063 * Use QUALIFIER_PROJECT instead 064 */ 065 @Deprecated 066 String QUALIFIER_PROJECT_TRUNK = QUALIFIER_PROJECT; 067 068 /** 069 * Use QUALIFIER_MODULE instead 070 */ 071 @Deprecated 072 String QUALIFIER_PROJECT_BRANCH = QUALIFIER_MODULE; 073 074 /** 075 * @return the resource key 076 */ 077 String getKey(); 078 079 /** 080 * @return the resource name 081 */ 082 String getName(); 083 084 /** 085 * @return the resource long name 086 */ 087 String getLongName(); 088 089 /** 090 * @return the resource description 091 */ 092 String getDescription(); 093 094 /** 095 * @return the language 096 */ 097 Language getLanguage(); 098 099 /** 100 * @return the scope 101 */ 102 String getScope(); 103 104 /** 105 * @return the qualifier 106 */ 107 String getQualifier(); 108 109 /** 110 * The parent is used to build the resources tree, for example for relations between classes, packages and projects. 111 * <p>Return null if the parent is the project.</p> 112 */ 113 PARENT getParent(); 114 115 /** 116 * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example 117 * to match resource exclusions. 118 * 119 * @param antPattern Ant-like pattern (with **, * and ?). It includes file suffixes. 120 * @return true if the resource matches the Ant pattern 121 */ 122 boolean matchFilePattern(String antPattern); 123 }