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


Java Paths.get方法代码示例

本文整理汇总了Java中org.uberfire.java.nio.file.Paths.get方法的典型用法代码示例。如果您正苦于以下问题:Java Paths.get方法的具体用法?Java Paths.get怎么用?Java Paths.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.uberfire.java.nio.file.Paths的用法示例。


在下文中一共展示了Paths.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTemplateContent

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Override
public String getTemplateContent(String url) {

    String pluginTemplateContent = getRuntimePluginTemplateContent(url);
    if (isAJarPluginTemplate(pluginTemplateContent)) {
        return pluginTemplateContent;
    }

    String realPath = PluginUtils.getRealPath("plugins");
    if (realPath == null) {
        LOGGER.info("Not fetching template content for " + url + " because getRealPath() is"
                            + " returning null. (This app is probably deployed in an unexploded .war)");
        return "";
    }
    final Path template;
    if (url.startsWith("/")) {
        template = Paths.get(URI.create("file://" + realPath + url));
    } else {
        template = Paths.get(URI.create("file://" + realPath + "/" + url));
    }

    if (Files.isRegularFile(template)) {
        return new String(Files.readAllBytes(template));
    }
    return "";
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:RuntimePluginServiceImpl.java

示例2: directoryContent

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
private Collection<String> directoryContent(final String directory,
                                            final String glob) {
    String realPath = PluginUtils.getRealPath(directory);
    if (realPath == null) {
        LOGGER.info("Not listing directory content for " + directory + "/" + glob +
                            " because getRealPath() is returning null. (This app is probably deployed in an unexploded .war)");
        return Collections.emptyList();
    }
    final Collection<String> result = new ArrayList<String>();

    final Path pluginsRootPath = Paths.get(URI.create("file://" + realPath));

    if (Files.isDirectory(pluginsRootPath)) {
        final DirectoryStream<Path> stream = Files.newDirectoryStream(pluginsRootPath,
                                                                      glob);

        for (final Path activeJS : stream) {
            result.add(new String(Files.readAllBytes(activeJS)));
        }
    }

    return result;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:24,代码来源:RuntimePluginServiceImpl.java

示例3: process

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Override
public ProcessedPoms process(final CompilationRequest req) {
    Path mainPom = Paths.get(req.getInfo().getPrjPath().toString(),
                             POM_NAME);
    if (!Files.isReadable(mainPom)) {
        return new ProcessedPoms(Boolean.FALSE,
                                 Collections.emptyList());
    }

    PomPlaceHolder placeHolder = editor.readSingle(mainPom);
    Boolean isPresent = isPresent(placeHolder);   // check if the main pom is already scanned and edited
    if (placeHolder.isValid() && !isPresent) {
        List<String> pomsList = new ArrayList<>();
        MavenUtils.searchPoms(Paths.get(req.getInfo().getPrjPath().toString()),
                              pomsList);// recursive NIO search in all subfolders
        if (pomsList.size() > 0) {
            processFoundPoms(pomsList,
                               req);
        }
        return new ProcessedPoms(Boolean.TRUE,
                                 pomsList);
    } else {
        return new ProcessedPoms(Boolean.FALSE,
                                 Collections.emptyList());
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:27,代码来源:DefaultIncrementalCompilerEnabler.java

示例4: getWatchable

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
public Path getWatchable() {
    if (watchable == null) {
        return null;
    }
    try {
        return Paths.get(watchable);
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:11,代码来源:WatchEventsWrapper.java

示例5: context

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Override
public Object context() {
    return new WatchContext() {

        @Override
        public Path getPath() {
            return newPath != null ? lookup(newPath) : null;
        }

        @Override
        public Path getOldPath() {
            return oldPath != null ? lookup(oldPath) : null;
        }

        private Path lookup(URI uri) {
            Path path = null;
            try {
                path = Paths.get(uri);
            } catch (Exception e) {
                LOGGER.error("Error trying to translate to path uri: " + uri);
            }
            return path;
        }

        @Override
        public String getSessionId() {
            return sessionId;
        }

        @Override
        public String getMessage() {
            return message;
        }

        @Override
        public String getUser() {
            return userName;
        }
    };
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:41,代码来源:JGitWatchEvent.java

示例6: testDependentEnumIndexing

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testDependentEnumIndexing() throws Exception {
    final String carFQN = "com.myteam.repro.Car";
    final Path testedPath = Paths.get(getClass().getResource("cars/src/main/resources/com/myteam/repro/cars.enumeration").toURI());
    final Set<KProperty<?>> properties = indexer.fillIndexBuilder(testedPath).build();
    final ModuleDataModelOracle oracle = indexer.getModuleDataModelOracle(testedPath);
    Assertions.assertThat(oracle.getModuleModelFields().keySet()).contains(carFQN);
    final AbstractListAssert carFields = Assertions.assertThat(properties).filteredOn("name", "ref:field:" + carFQN);
    carFields.filteredOn("value", "price").hasSize(1);
    carFields.filteredOn("value", "color").hasSize(1);
    final AbstractListAssert javaClasses = Assertions.assertThat(properties).filteredOn("name", "ref:java");
    javaClasses.filteredOn("value", carFQN).hasSize(1);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:14,代码来源:EnumIndexVisitorCDITest.java

示例7: testOutputWithTakari

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testOutputWithTakari() throws Exception {
    Path tmpRoot = Files.createTempDirectory("repo");
    Path tmpNio = Files.createDirectories(Paths.get(tmpRoot.toString(),
                                                    "dummy"));
    TestUtil.copyTree(Paths.get("src/test/projects/dummy"),
                      tmpNio);

    Path tmp = Paths.get(tmpNio.toAbsolutePath().toString());

    AFCompiler compiler = MavenCompilerFactory.getCompiler(Decorator.LOG_OUTPUT_AFTER);

    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp);
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(),
                                                           info,
                                                           new String[]{MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE},
                                                           new HashMap<>(),
                                                           Boolean.TRUE);
    CompilationResponse res = compiler.compileSync(req);
    if (res.getMavenOutput().isPresent() && !res.isSuccessful()) {
        TestUtil.writeMavenOutputIntoTargetFolder(res.getMavenOutput().get(),
                                                  "MavenOutputTest.testOutputWithTakari");
    }
    Assert.assertTrue(res.isSuccessful());
    Assert.assertTrue(res.getMavenOutput().isPresent());
    Assert.assertTrue(res.getMavenOutput().get().size() > 0);

    TestUtil.rm(tmpRoot.toFile());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:30,代码来源:MavenOutputTest.java

示例8: setUp

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    mavenRepo = Paths.get(System.getProperty("user.home"),
                          "/.m2/repository");

    if (!Files.exists(mavenRepo)) {
        if (!Files.exists(Files.createDirectories(mavenRepo))) {
            throw new Exception("Folder not writable in the project");
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:12,代码来源:KieMavenOutputTest.java

示例9: testOutputWithTakari

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testOutputWithTakari() throws Exception {
    Path tmpRoot = Files.createTempDirectory("repo");
    Path tmpNio = Files.createDirectories(Paths.get(tmpRoot.toString(),
                                                    "dummy"));
    TestUtil.copyTree(Paths.get("src/test/projects/dummy"),
                      tmpNio);

    Path tmp = Paths.get(tmpNio.toAbsolutePath().toString());

    AFCompiler compiler = KieMavenCompilerFactory.getCompiler(
            KieDecorator.LOG_OUTPUT_AFTER);

    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp);
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(),
                                                           info,
                                                           new String[]{MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE},
                                                           new HashMap<>(),
                                                           Boolean.TRUE);
    CompilationResponse res = compiler.compileSync(req);
    if (res.getMavenOutput().isPresent() && !res.isSuccessful()) {
        TestUtil.writeMavenOutputIntoTargetFolder(res.getMavenOutput().get(),
                                                  "KieMavenOutputTest.testOutputWithTakari");
    }
    assertTrue(res.isSuccessful());
    assertTrue(res.getMavenOutput().isPresent());
    assertTrue(res.getMavenOutput().get().size() > 0);

    TestUtil.rm(tmpRoot.toFile());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:31,代码来源:KieMavenOutputTest.java

示例10: setUp

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    fileSystemTestingUtils.setup();
    ioService = fileSystemTestingUtils.getIoService();

    mavenRepo = Paths.get(System.getProperty("user.home"),
                          "/.m2/repository");

    if (!Files.exists(mavenRepo)) {
        logger.info("Creating a m2_repo into " + mavenRepo);
        if (!Files.exists(Files.createDirectories(mavenRepo))) {
            throw new Exception("Folder not writable in the project");
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:16,代码来源:DefaultMavenCompilerTest.java

示例11: setUp

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {

    mavenRepo = Paths.get(System.getProperty("user.home"),
                          "/.m2/repository");

    if (!Files.exists(mavenRepo)) {
        logger.info("Creating a m2_repo into " + mavenRepo);
        if (!Files.exists(Files.createDirectories(mavenRepo))) {
            throw new Exception("Folder not writable in the project");
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:14,代码来源:KieDefaultMavenIncrementalCompilerTest.java

示例12: processFoundPoms

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
private void processFoundPoms(List<String> poms,
                                CompilationRequest request) {

    for (String pom : poms) {
        Path tmpPom = Paths.get(pom);
        PomPlaceHolder tmpPlaceHolder = editor.readSingle(tmpPom);
        if (!isPresent(tmpPlaceHolder)) {
            editor.write(tmpPom,
                         request);
        }
    }
    Path mainPom = Paths.get(request.getInfo().getPrjPath().toAbsolutePath().toString(),
                             POM_NAME);
    request.getInfo().lateAdditionEnhancedMainPomFile(mainPom);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:16,代码来源:DefaultIncrementalCompilerEnabler.java

示例13: setUp

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    mavenRepo = Paths.get(System.getProperty("user.home"),
                          ".m2/repository");

    if (!Files.exists(mavenRepo)) {
        logger.info("Creating a m2_repo into:" + mavenRepo.toString());
        if (!Files.exists(Files.createDirectories(mavenRepo))) {
            throw new Exception("Folder not writable in the project");
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:13,代码来源:KieMetadataTest.java

示例14: testIncrementalWithPluginEnabledThreeTime

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testIncrementalWithPluginEnabledThreeTime() throws Exception {
    Path tmpRoot = Files.createTempDirectory("repo");
    //NIO creation and copy content
    Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(),
                                                  "dummy"));
    TestUtil.copyTree(Paths.get("src/test/projects/dummy"),
                      temp);
    //end NIO

    AFCompiler compiler = KieMavenCompilerFactory.getCompiler(KieDecorator.NONE);

    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(temp);
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo.toAbsolutePath().toString(),
                                                           info,
                                                           new String[]{MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE},
                                                           new HashMap<>(),
                                                           Boolean.FALSE);
    CompilationResponse res = compiler.compileSync(req);
    if (res.getMavenOutput().isPresent() && !res.isSuccessful()) {
        TestUtil.writeMavenOutputIntoTargetFolder(res.getMavenOutput().get(),
                                                  "KieDefaultMavenIncrementalCompilerTest.testIncrementalWithPluginEnabledThreeTime");
    }
    Assert.assertTrue(res.isSuccessful());

    res = compiler.compileSync(req);
    Assert.assertTrue(res.isSuccessful());

    res = compiler.compileSync(req);
    Assert.assertTrue(res.isSuccessful());

    Path incrementalConfiguration = Paths.get(temp.toAbsolutePath().toString(),
                                              "/target/incremental/io.takari.maven.plugins_takari-lifecycle-plugin_compile_compile");
    Assert.assertTrue(incrementalConfiguration.toFile().exists());

    TestUtil.rm(tmpRoot.toFile());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:38,代码来源:KieDefaultMavenIncrementalCompilerTest.java

示例15: get

import org.uberfire.java.nio.file.Paths; //导入方法依赖的package包/类
@Override
public Path get(final String first,
                final String... more) throws IllegalArgumentException {
    return Paths.get(first,
                     more);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:7,代码来源:AbstractIOService.java


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