Tabnine Logo
Directory
Code IndexAdd Tabnine to your IDE (free)

How to use
Directory
in
org.sonar.api.resources

Best Java code snippets using org.sonar.api.resources.Directory (Showing top 20 results out of 315)

origin: fabriciocolombo/sonar-delphi

public Directory getDirectory(java.io.File dir, Project module) {
 Directory directory = Directory.fromIOFile(dir, module);
 if (directory == null || directory.getKey() == null) {
  return Directory.create(DEFAULT_PACKAGE_NAME);
 }
 return directory;
}
origin: stackoverflow.com

 var d = new Directory();
d.addLocation(1, "foo", "foo place");
d.addLocation(2, "bar", "bar place");

console.log(d.locations);
origin: org.codehaus.sonar/sonar-plugin-api

@Override
public String toString() {
 return new ToStringBuilder(this)
  .append("key", getKey())
  .append("path", getPath())
  .toString();
}
origin: org.codehaus.sonar/sonar-plugin-api

/**
 * Internal use only.
 * @deprecated since 5.1 use {@link FileSystem#inputDir(java.io.File)}
 */
@Deprecated
public static Directory create(String relativePathFromBaseDir) {
 Directory d = new Directory();
 String normalizedPath = normalize(relativePathFromBaseDir);
 d.setKey(normalizedPath);
 d.setPath(normalizedPath);
 return d;
}
origin: org.codehaus.sonar/sonar-batch

@Override
public Resource toResource(File file) {
 if (file == null || !file.exists()) {
  return null;
 }
 String relativePath = pathResolver.relativePath(getBasedir(), file);
 if (relativePath == null) {
  return null;
 }
 return file.isFile() ? org.sonar.api.resources.File.create(relativePath) : org.sonar.api.resources.Directory.create(relativePath);
}
origin: org.codehaus.sonar/sonar-batch

isDir = true;
Directory referenceDir = (Directory) reference;
relativePathFromSourceDir = referenceDir.relativePathFromSourceDir();
if (Directory.ROOT.equals(relativePathFromSourceDir)) {
 relativePathFromSourceDir = "";
 Bucket b = getBucket(isDir ? Directory.fromIOFile(abs, getProject()) : File.fromIOFile(abs, getProject()));
 if (b != null) {
  return b;
origin: stackoverflow.com

Directory d = new Directory(directoryDataFile);
Scanner stdin = new Scanner(System.in);
System.out.println("Directory Server is Ready!");
    if (d.inDirectory(name))
      System.out.println(name + " is in the directory");
    else
      System.out.println(name + " is NOT in the directory");
  } else if (command.equalsIgnoreCase("add")) {
    if (d.add(name))
      System.out.println(name + "has been added");
    else
      System.out.println(name + "is already in directory");
  } else if (command.equalsIgnoreCase("delete")) {
    if (d.delete(name))
      System.out.println(name + "has been deleted");
    else
  d.closeDirectory();
  break;
origin: org.codehaus.sonar-plugins.java/sonar-java-plugin

 private void initSetOfDirs(Project project) {
  dirsWithoutPackageInfo = Sets.newHashSet();
  ActiveRule activeRule = rulesProfile.getActiveRule(CheckList.REPOSITORY_KEY, PackageInfoCheck.RULE_KEY);
  if (activeRule != null) {
   CodeVisitor check = checkInstanceOf(activeRule.getRule().ruleKey());
   if (check != null) {
    Set<File> dirs = ((PackageInfoCheck) check).getDirectoriesWithoutPackageFile();
    for (File dir : dirs) {
     dirsWithoutPackageInfo.add(Directory.fromIOFile(dir, project));
    }
   }
  }
 }
}
origin: org.codehaus.sonar/sonar-plugin-api

/**
 * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)}
 */
@Deprecated
public Directory(String relativePathFromSourceDir, Language language) {
 this.relativePathFromSourceDir = parseKey(relativePathFromSourceDir);
}
origin: org.codehaus.sonar/sonar-plugin-api

@Override
public String getName() {
 return getKey();
}
origin: org.codehaus.sonar-plugins.java/sonar-java-plugin

public void reportIssueForPackageInfo(Directory directory, Project project) {
 if (dirsWithoutPackageInfo == null) {
  initSetOfDirs(project);
 }
 if (dirsWithoutPackageInfo.contains(directory)) {
  Issuable issuable = resourcePerspectives.as(Issuable.class, directory);
  if (issuable != null) {
   Issue issue = issuable.newIssueBuilder().ruleKey(RuleKey.of(CheckList.REPOSITORY_KEY, PackageInfoCheck.RULE_KEY))
     .message("Add a 'package-info.java' file to document the '" + directory.getPath() + "' package").build();
   issuable.addIssue(issue);
  }
 }
}
origin: org.codehaus.sonar/sonar-plugin-api

/**
 * @since 4.2
 * @deprecated since 5.1 use {@link FileSystem#inputDir(java.io.File)}
 */
@Deprecated
@CheckForNull
public static Directory fromIOFile(java.io.File dir, Project module) {
 String relativePathFromBasedir = new PathResolver().relativePath(module.getBaseDir(), dir);
 if (relativePathFromBasedir != null) {
  return Directory.create(relativePathFromBasedir);
 }
 return null;
}
origin: org.sonarsource.sonarqube/sonar-batch

isDir = true;
Directory referenceDir = (Directory) reference;
relativePathFromSourceDir = referenceDir.relativePathFromSourceDir();
if (Directory.ROOT.equals(relativePathFromSourceDir)) {
 relativePathFromSourceDir = "";
 java.io.File dirOrFile = pathResolver.relativeFile(projectDef.getBaseDir(), src);
 java.io.File abs = new java.io.File(dirOrFile, relativePathFromSourceDir);
 Bucket b = getBucket(isDir ? Directory.fromIOFile(abs, getProject()) : File.fromIOFile(abs, getProject()));
 if (b != null) {
  return b;
origin: org.codehaus.sonar/sonar-plugin-api

/**
 * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)}
 */
@Deprecated
public File(String relativeDirectoryPathFromSourceDir, String filename) {
 this.filename = StringUtils.trim(filename);
 if (StringUtils.isBlank(relativeDirectoryPathFromSourceDir)) {
  this.relativePathFromSourceDir = filename;
 } else {
  this.relativePathFromSourceDir = new StringBuilder().append(Directory.parseKey(relativeDirectoryPathFromSourceDir)).append(Directory.SEPARATOR).append(this.filename)
   .toString();
 }
}
origin: org.codehaus.sonar/sonar-plugin-api

@Override
public boolean matchFilePattern(String antPattern) {
 WildcardPattern matcher = WildcardPattern.create(antPattern, "/");
 return matcher.match(getKey());
}
origin: stackoverflow.com

 Directory dir = new Directory(null);
String folderName = dir.folderName;
origin: org.codehaus.sonar/sonar-batch

 @Override
 public Resource getResource(InputPath inputPath) {
  Resource r;
  if (inputPath instanceof InputDir) {
   r = Directory.create(((InputDir) inputPath).relativePath());
  } else if (inputPath instanceof InputFile) {
   r = File.create(((InputFile) inputPath).relativePath());
  } else {
   throw new IllegalArgumentException("Unknow input path type: " + inputPath);
  }
  return getResource(r);
 }
}
origin: org.codehaus.sonar/sonar-batch

private String oldParentKey(String oldKey) {
 String cleanKey = StringUtils.trim(oldKey.replace('\\', '/'));
 if (cleanKey.indexOf(Directory.SEPARATOR) >= 0) {
  String oldParentKey = Directory.parseKey(StringUtils.substringBeforeLast(oldKey, Directory.SEPARATOR));
  oldParentKey = StringUtils.removeStart(oldParentKey, Directory.SEPARATOR);
  oldParentKey = StringUtils.removeEnd(oldParentKey, Directory.SEPARATOR);
  return oldParentKey;
 } else {
  return Directory.ROOT;
 }
}
origin: stackoverflow.com

super(new Directory("." + System.getProperty("path.separator")), new StandardAnalyzer(), MaxFieldLength.UNLIMITED);
origin: org.sonarsource.sonarqube/sonar-batch

 @Override
 public Resource getResource(InputPath inputPath) {
  Resource r;
  if (inputPath instanceof InputDir) {
   r = Directory.create(((InputDir) inputPath).relativePath());
  } else if (inputPath instanceof InputFile) {
   r = File.create(((InputFile) inputPath).relativePath());
  } else {
   throw new IllegalArgumentException("Unknow input path type: " + inputPath);
  }
  return getResource(r);
 }
}
org.sonar.api.resourcesDirectory

Most used methods

  • create
    Internal use only.
  • fromIOFile
  • <init>
  • getKey
  • getPath
  • parseKey
  • relativePathFromSourceDir
    Internal.
  • add
  • closeDirectory
  • delete
  • equals
  • inDirectory
  • equals,
  • inDirectory,
  • normalize,
  • setKey,
  • setPath

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now