当前位置: 首页>>代码示例>>Java>>正文


Java FolderEntry类代码示例

本文整理汇总了Java中org.eclipse.che.api.project.server.FolderEntry的典型用法代码示例。如果您正苦于以下问题:Java FolderEntry类的具体用法?Java FolderEntry怎么用?Java FolderEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FolderEntry类属于org.eclipse.che.api.project.server包,在下文中一共展示了FolderEntry类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateProject

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Override
public void onCreateProject(
    Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options)
    throws ForbiddenException, ConflictException, ServerException {

  VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
  FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));

  try (InputStream packageJson =
          getClass().getClassLoader().getResourceAsStream("files/default_package");
      InputStream personJson =
          getClass().getClassLoader().getResourceAsStream("files/default_person")) {
    FolderEntry myJsonFiles = baseFolder.createFolder("myJsonFiles");
    baseFolder.createFile(FILE_NAME, packageJson);
    myJsonFiles.createFile("person.json", personJson);
  } catch (IOException ioEx) {
    throw new ServerException(ioEx.getLocalizedMessage(), ioEx);
  }
}
 
开发者ID:eclipse,项目名称:che-archetypes,代码行数:20,代码来源:JsonExampleCreateProjectHandler.java

示例2: testShouldReturnEmptyValueForEmptyProjectFolder

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Test
public void testShouldReturnEmptyValueForEmptyProjectFolder() throws Exception {
    vfs.createFolder(vfs.getMountPoint().getRoot().getId(), "empty");
    final VirtualFile project = vfs.getMountPoint().getVirtualFile("/empty");

    assertTrue(project.isFolder());

    final FolderEntry projectFolder = new FolderEntry(workspace, project);
    final GradleProjectManager gradleProjectManager = new GradleProjectManager(new DefaultProjectConnectionFactory());
    final ValueProviderFactory valueProviderFactory = new GradleValueProviderFactory(gradleProjectManager);
    final ValueProvider valueProvider = valueProviderFactory.newInstance(projectFolder);

    List<String> computedPath = valueProvider.getValues(PROJECT_PATH_VAR);
    assertTrue(computedPath.isEmpty());
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:16,代码来源:GradleValueProviderFactoryTest.java

示例3: onCreateProject

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Override
public void onCreateProject(FolderEntry baseFolder, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
    //TODO enable only when generate is passed
    //if (options != null && options.containsKey(OPTION_GENERATE)) {
        //TODO check if we should start it in another thread
    generateProject(baseFolder, attributes, options, LineConsumerFactory.NULL);
    //}
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:9,代码来源:AdaptiveProjectGenerator.java

示例4: generateProject

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
private void generateProject(FolderEntry baseFolder, @Nullable Map<String, AttributeValue> attributes, Map<String, String> options, LineConsumerFactory lineConsumerFactory) {
    try {
        File workDir = ((VirtualFileImpl) baseFolder.getVirtualFile()).getIoFile();
        File generatorLog = ((VirtualFileImpl) baseFolder.createFile(GENERATION_LOG, new byte[0], "text/plain").getVirtualFile()).getIoFile();
        SimpleCommandLineExecutor executor = new SimpleCommandLineExecutor();
        LineConsumer consumer = lineConsumerFactory.newLineConsumer();
        executor.execute(new GeneratorCommandBuilder(baseFolder.getVirtualFile().getName()).withAttributes(attributes).withOptions(options), workDir, generatorLog, consumer);
        if (!executor.isSuccess()) {
            LOG.warn("There was an error executing the generator command");
        }

    } catch (Exception e) {
        LOG.warn("Error executing the generator", e);
    }
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:16,代码来源:AdaptiveProjectGenerator.java

示例5: newInstance

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Override
public ValueProvider newInstance(FolderEntry projectFolder) {
    return new GradleValueProvider(projectFolder);
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:5,代码来源:GradleValueProviderFactory.java

示例6: GradleValueProvider

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
public GradleValueProvider(FolderEntry projectFolder) {
    this.projectFolder = projectFolder;
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:4,代码来源:GradleValueProviderFactory.java

示例7: testValueProvider

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Test
public void testValueProvider() throws Exception {
    final URL resource = getClass().getClassLoader().getResource("pro/javax/che/plugin/gradle/server/quickstart.zip");

    assertNotNull(resource);

    vfs.importZip(vfs.getMountPoint().getRoot().getId(), resource.openStream(), true, false);

    final VirtualFile project = vfs.getMountPoint().getVirtualFile("/quickstart");

    assertTrue(project.isFolder());

    final FolderEntry projectFolder = new FolderEntry(workspace, project);
    final GradleProjectManager gradleProjectManager = new GradleProjectManager(new DefaultProjectConnectionFactory());
    final ValueProviderFactory valueProviderFactory = new GradleValueProviderFactory(gradleProjectManager);
    final ValueProvider valueProvider = valueProviderFactory.newInstance(projectFolder);

    //Check variables

    List<String> computedPath = valueProvider.getValues(PROJECT_PATH_VAR);
    List<String> expectedPath = singletonList(":");
    assertTrue(elementsEqual(computedPath, expectedPath));

    List<String> computedBuildDir = valueProvider.getValues(PROJECT_BUILD_DIR_VAR);
    List<String> expectedBuildDir = singletonList("build");
    assertTrue(elementsEqual(computedBuildDir, expectedBuildDir));

    List<String> computedBuildScript = valueProvider.getValues(PROJECT_BUILD_SCRIPT_VAR);
    List<String> expectedBuildScript = singletonList("build.gradle");
    assertTrue(elementsEqual(computedBuildScript, expectedBuildScript));

    List<String> computedTasks = valueProvider.getValues(PROJECT_TASKS_VAR);
    List<String> expectedTasks = newArrayList(":assemble", ":build", ":buildDependents", ":buildEnvironment", ":buildNeeded",
                                              ":check", ":classes", ":clean", ":cleanEclipse", ":components", ":dependencies",
                                              ":dependencyInsight", ":eclipse", ":help", ":init", ":jar", ":javadoc", ":model",
                                              ":projects", ":properties", ":tasks", ":test", ":testClasses", ":uploadArchives",
                                              ":wrapper");
    assertTrue(elementsEqual(computedTasks, expectedTasks));

    List<String> computedDescription = valueProvider.getValues(PROJECT_DESCRIPTION_VAR);
    List<String> expectedDescription = singletonList("");
    assertTrue(elementsEqual(computedDescription, expectedDescription));

    List<String> computedSourceDirectories = valueProvider.getValues(PROJECT_SOURCE_DIR_VAR);
    List<String> expectedSourceDirectories = newArrayList("src/main/resources", "src/main/java");
    assertTrue(elementsEqual(computedSourceDirectories, expectedSourceDirectories));

    List<String> computedTestDirectories = valueProvider.getValues(PROJECT_TEST_DIR_VAR);
    List<String> expectedTestDirectories = newArrayList("src/test/resources", "src/test/java");
    assertTrue(elementsEqual(computedTestDirectories, expectedTestDirectories));

    List<String> computedGradleVersion = valueProvider.getValues(PROJECT_GRADLE_VERSION_VAR);
    List<String> expectedGradleVersion = singletonList("2.10");
    assertTrue(elementsEqual(computedGradleVersion, expectedGradleVersion));
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:56,代码来源:GradleValueProviderFactoryTest.java

示例8: findWrapperPropertiesFile

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
public static java.io.File findWrapperPropertiesFile(FolderEntry projectFolder) {
    java.io.File ioProjectFolder = projectFolder.getVirtualFile().getIoFile();
    java.io.File wrapperPropertiesFile = getGradleWrapperPropertiesFilePath(ioProjectFolder);
    return wrapperPropertiesFile.isFile() ? wrapperPropertiesFile : null;
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:6,代码来源:GradleProjectManager.java

示例9: importSources

import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Override
public void importSources(FolderEntry baseFolder, String location, Map<String, String> parameters) throws ForbiddenException, ConflictException, UnauthorizedException, IOException, ServerException {
    generateProject(baseFolder, Collections.emptyMap(), parameters, LineConsumerFactory.NULL);
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:5,代码来源:AdaptiveProjectGenerator.java


注:本文中的org.eclipse.che.api.project.server.FolderEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。