예제 #1
0
  @SuppressWarnings("unchecked")
  @HideFromClient
  private <T extends Resource> T getResource(String name, Class<T> resourceType) {
    Assert.notNull(name, "Name must not be null");
    Assert.notNull(resourceType, "ResourceType must not be null");

    Folder root;
    String resourceName;
    if (name.equals("/common")) {
      root = this.fileSystem.getCommonFolder();
      resourceName = "";
    } else if (name.startsWith("/common/")) {
      root = this.fileSystem.getCommonFolder();
      resourceName = name.substring("/common/".length());
    } else {
      root = this.projectManager.getCurrentProject().getRootFolder();
      resourceName = name;
    }

    if (resourceName.length() == 0) {
      Assert.isInstanceOf(resourceType, root);
      return (T) root;
    }

    return root.jail().get(resourceName, resourceType);
  }
예제 #2
0
 // cftempfix
 public Project(Folder projectRootFolder, String projectName) {
   super();
   this.projectRootFolder = projectRootFolder.jail();
   this.projectName = projectName;
   this.mavenProject = projectRootFolder.getFile(ProjectConstants.POM_XML).exists();
 }