本文整理汇总了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);
}
}
示例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());
}
示例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);
//}
}
示例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);
}
}
示例5: newInstance
import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
@Override
public ValueProvider newInstance(FolderEntry projectFolder) {
return new GradleValueProvider(projectFolder);
}
示例6: GradleValueProvider
import org.eclipse.che.api.project.server.FolderEntry; //导入依赖的package包/类
public GradleValueProvider(FolderEntry projectFolder) {
this.projectFolder = projectFolder;
}
示例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));
}
示例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;
}
示例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);
}