@Override public List<Item> getChildren() { return new FileSearcher().searchFiles(path, "glob:**/*", false).stream().map(p -> (Item)new FileSystemFolder(p, this)).collect(Collectors.toList()); }
private void load() { searchFiles(tibcoAdaptersPath, "glob:**/*", false). stream(). map(p -> p.getFileName().toString()). map(s -> T.V(s, new FileSearcher().searchFiles(tibcoAdaptersPath.resolve(s), "glob:**/*", false).stream().sorted((a,b) -> b.toString().compareTo(a.toString())).findFirst().get())). map(adPath -> new FileSearcher().searchFiles(adPath.getB().resolve("lib"), "glob:**/*.jar", true). stream(). map(p -> new LoadZipFile().load(p).stream().filter(v -> v.getA().matches(".*com.tibco.deployment.*xml")) adaptersPropertiesNames = getPropertiesNamesAndValues(adapterProperties); List<Path> BWPaths = new FileSearcher().searchFiles(tibcoBWPath, "glob:**/*", false).stream().sorted((a,b) -> b.toString().compareTo(a.toString())).collect(Collectors.toList()); Map<String, NodeBuilder> bwProperties = BWPaths. stream().
ConfigComparer configComparer = new ConfigComparer(loader); List<Path> builtEars = new FileSearcher().searchFiles(built, "glob:**/*"+mask+"*.ear", false); List<Path> initBuiltEars = new FileSearcher().searchFiles(initBuilt, "glob:**/*"+mask+"*.ear", false);
public static void main(String[] args) { ArgumentParser argParser = ArgumentParsers.newArgumentParser("EAR Version Extractor", true, "-") .description("Extracts version from ear files in given directory."); argParser.addArgument("-directory").type(String.class).required(true).help("Path to directory with ears"); argParser.addArgument("-out").choices("LIST", "FILES").required(true).help("Output type - LIST or FILES"); Namespace res = argParser.parseArgsOrFail(args); String directory = res.get("directory"); String out = res.getString("out"); List<T.V2<Path, String>> output = new FileSearcher().searchFiles(Paths.get(directory), "glob:**/*.ear", false). stream().parallel(). map(p -> getVersionFromEAR(p)). collect(Collectors.toList()); if ("LIST".equals(out)) { output.forEach(v -> System.out.println(v.getA().getFileName() + "\t" + v.getB())); } else { output.forEach(v -> { Path versionPath = Paths.get(v.getA().toString().replace(".ear", ".version")); try(FileWriter ww = new FileWriter(versionPath.toFile()); BufferedWriter w = new BufferedWriter(ww)) { w.write(v.getB()); } catch(IOException e) { throw new RuntimeException("Could not write version to file: " + v.getA(), e); } }); } }
public FullConfigsModel(Repository repo, SDKPropertiesLoader loader) { this.repo = repo; this.bwPropertiesNames = loader.getBwPropertiesNames(); this.adaptersPropertiesNames = loader.getAdaptersPropertiesNames(); this.availableAdapters = loader.getAvailableAdapters(); Path configPath = repo.getPath().getParent().resolve("_config"); availableArchives = repo.findAll(i -> i.getItemType() == ItemType.Archive).stream().map(i -> new Archive(i)).collect(Collectors.toList()); availableEnvironemnts = new FileSearcher().searchFiles(configPath, "glob:**/*", false).stream().filter(p -> p.toFile().isDirectory()).map(p -> new Environment(p)).collect(Collectors.toList()); availableArchives.forEach(archive -> { availableEnvironemnts.stream(). map(e -> T.V(e,archive, getConfigPath(archive, e))). filter(fc -> fc.getC().toFile().exists()). map(fc -> T.V(fc.getA(), fc.getB(), new XmlBuilderFactory().loadFromFile(fc.getC()))). forEach(fc -> { configs.put(T.V(fc.getA(), fc.getB()), fc.getC()); origConfigs.put(T.V(fc.getA(), fc.getB()), fc.getC().copy()); }); ; }); }
List<T.V2<StreamSource, NodeBuilder>> wsdls= new FileSearcher().searchFiles(wsdlsPath, "glob:**/*.wsdl", true). stream().flatMap(p -> loadSchemasFromWSDL(p)). collect(Collectors.toList());
XmlBuilderFactory fac = new XmlBuilderFactory(); NormalizeConfig norm = new NormalizeConfig(loader); new FileSearcher().searchFiles(Paths.get("T:/source/R170624/_config/ENV_EAI_TST/"), "glob:**/*.xml", true). stream().map(p -> T.V(p, p.getParent().getParent().getParent().getParent().resolve("R170903/_config/ENV_EAI_TST2/").resolve(p.getFileName()))). filter(v -> v.getB().toFile().exists()).
Path deploymentListPath = configPath.resolve("deploymentList.xml"); NodeBuilder deploymentList = new XmlBuilderFactory().loadFromFile(deploymentListPath); new FileSearcher().searchFiles(branchPath, "glob:**/vcrepo.dat", true).stream(). parallel(). map(p -> checkVariables(sdkLoader, p.getParent(), prefFilePath, branchPath, configPath, exportPath, deploymentList)).
public static void main(String[] args) { ArgumentParser argParser = ArgumentParsers.newArgumentParser("EAR Version Updater", true, "-") .description("Updates version in ear files in given directory."); argParser.addArgument("-directory").type(String.class).required(true).help("Path to directory with ears"); argParser.addArgument("-version").type(String.class).required(true).help("Version that will be written in Tibco.xml"); Namespace res = argParser.parseArgsOrFail(args); String directory = res.get("directory"); String version = res.getString("version"); new FileSearcher().searchFiles(Paths.get(directory), "glob:**/*.ear", false). stream().parallel(). map(p -> T.V(p, new LoadZipFile().load(p))). map(v -> T.V(v.getA(), getVersion(v), v.getB())). filter(v -> v.getB().isPresent()). map(v -> T.V(v.getA(), new XmlBuilderFactory().parseDocument(new ByteArrayInputStream(v.getB().get().getB())), v.getB(), v.getC())). forEach(v -> { v.getB().search("version").forEach(vnode -> { System.out.println(v.getA() + " " + vnode.getTextContent() + " -> " + version); vnode.setTextContent(version); }); byte[] bytes = v.getB().toString().getBytes(); V3<String, byte[], ZipEntry> zipFileEntry = v.getC().get(); zipFileEntry.setB(bytes); new LoadZipFile().updateFile(v.getA(), v.getD()); }); }