@Override public String getName() { return _delegate.getName(); }
private boolean isValidDirectory(IDirectory dir) { return !dir.getName().equals("META-INF"); }
private boolean isValidDirectory(IDirectory dir) { return !dir.getName().equals("META-INF"); }
private String getEntryName() { if (_entry != null) { return _entry.getName(); } else { String result = _name; IDirectory parent = _parent; while (!(parent instanceof JarFileDirectoryImpl)) { result = parent.getName() + "/" + result; parent = parent.getParent(); } return result; } }
private String getEntryName() { if (_entry != null) { return _entry.getName(); } else { String result = _name; IDirectory parent = _parent; while (!(parent instanceof JarFileDirectoryImpl)) { result = parent.getName() + "/" + result; parent = parent.getParent(); } return result; } }
private static void scanPaths(List<IDirectory> paths, Set<String> extensions, List<IDirectory> roots) { extensions.add(".java"); extensions.add(".xsd"); extensions.addAll(Arrays.asList(GosuClassTypeLoader.ALL_EXTS)); //noinspection Convert2streamapi for (IDirectory root : paths) { // roots without manifests are considered source roots if (!Extensions.containsManifest(root) || !Extensions.getExtensions(root, Extensions.CONTAINS_SOURCES).isEmpty() || // Weblogic packages all WEB-INF/classes content into this JAR // http://middlewaremagic.com/weblogic/?p=408 // http://www.coderanch.com/t/69641/BEA-Weblogic/wl-cls-gen-jar-coming // So we need to always treat it as containing sources root.getName().equals("_wl_cls_gen.jar")) { if( !roots.contains( root ) ) { roots.add( root ); } } } }
public List<Pair<String, IFile>> findAllFilesByExtension(String extension) { List<Pair<String, IFile>> results = new ArrayList<>(); for (IDirectory sourceEntry : _module.getSourcePath()) { if (sourceEntry.exists()) { String prefix = sourceEntry.getName().equals(IModule.CONFIG_RESOURCE_PREFIX) ? IModule.CONFIG_RESOURCE_PREFIX : ""; addAllLocalResourceFilesByExtensionInternal(prefix, sourceEntry, extension, results); } } return results; }
protected List<IDirectory> createDefaultGosuClassSearchPath() { List<IDirectory> gosuClassSearchPath = new ArrayList<IDirectory>(); List<? extends IDirectory> sourceEntries = TypeSystem.getCurrentModule().getSourcePath(); for (IDirectory dir : sourceEntries) { if (_modules.isEmpty()) { gosuClassSearchPath.add(dir); } else { // TODO - AHK - This seems rather unnecessary: we should have a way to already know what the module root is IDirectory moduleRoot = ClasspathToGosuPathEntryUtil.findModuleRootFromSourceEntry(dir); if (_modules.contains(moduleRoot.getName())) { gosuClassSearchPath.add(dir); } } } return gosuClassSearchPath; }
copy( child, new File( to, child.getName() ) );
public List<Pair<String, IFile>> findAllFilesByExtension(String extension) { List<Pair<String, IFile>> results = new ArrayList<Pair<String, IFile>>(); for (IDirectory dir : _module.getRoots()) { IDirectory configDir = dir.dir(IModule.CONFIG_RESOURCE_PREFIX); if (configDir.exists()) { addAllLocalResourceFilesByExtensionInternal(IModule.CONFIG_RESOURCE_PREFIX, configDir, extension, results); } } for (IDirectory sourceEntry : _module.getSourcePath()) { if (sourceEntry.exists() && !sourceEntry.getName().equals(IModule.CONFIG_RESOURCE_PREFIX)) { addAllLocalResourceFilesByExtensionInternal("", sourceEntry, extension, results); } } return results; }
private void processDirectory(PackageToClassPathEntryTreeMap node, IFileSystemGosuClassRepository.ClassPathEntry entry, IDirectory path) { if (_excludedPath.contains(path)) { return; } IDirectory entryPath = entry.getPath(); if (entryPath.equals(path) || !CommonServices.getPlatformHelper().isPathIgnored(entryPath.relativePath(path))) { List<? extends IDirectory> dirs = path.listDirs(); for (IDirectory dir : dirs) { if (isValidDirectory(dir)) { PackageToClassPathEntryTreeMap child = node.createChildForDir(entry, dir.getName()); processDirectory(child, entry, dir); } } } }
private void processDirectory(PackageToClassPathEntryTreeMap node, IFileSystemGosuClassRepository.ClassPathEntry entry, IDirectory path) { IDirectory entryPath = entry.getPath(); if (entryPath.equals(path) || !CommonServices.getPlatformHelper().isPathIgnored(entryPath.relativePath(path))) { List<? extends IDirectory> dirs = path.listDirs(); for (IDirectory dir : dirs) { if (isValidDirectory(dir)) { PackageToClassPathEntryTreeMap child = node.createChildForDir(entry, dir.getName()); processDirectory(child, entry, dir); } } } }
private void addAllLocalResourceFilesByExtensionInternal(String relativePath, IDirectory dir, String extension, List<Pair<String, IFile>> results) { List<IDirectory> excludedPath = Arrays.asList(_module.getFileRepository().getExcludedPath()); if ( excludedPath.contains( dir )) { return; } if (!CommonServices.getPlatformHelper().isPathIgnored(relativePath)) { for (IFile file : dir.listFiles()) { if (file.getName().endsWith(extension)) { String path = appendResourceNameToPath(relativePath, file.getName()); results.add(new Pair<String, IFile>(path, file)); } } for (IDirectory subdir : dir.listDirs()) { String path = appendResourceNameToPath(relativePath, subdir.getName()); addAllLocalResourceFilesByExtensionInternal(path, subdir, extension, results); } } }
private static void addAllLocalResourceFilesByExtensionInternal(String relativePath, IDirectory dir, String extension, List<Pair<String, IFile>> results) { if (!CommonServices.getPlatformHelper().isPathIgnored(relativePath)) { for (IFile file : dir.listFiles()) { if (file.getName().endsWith(extension)) { String path = appendResourceNameToPath(relativePath, file.getName()); results.add(new Pair<String, IFile>(path, file)); } } for (IDirectory subdir : dir.listDirs()) { String path = appendResourceNameToPath(relativePath, subdir.getName()); addAllLocalResourceFilesByExtensionInternal(path, subdir, extension, results); } } }
public boolean isPathIgnored(String relativePath) { final IFile file = CommonServices.getFileSystem().getIFile(new File(relativePath)); if (file != null && file.exists() && isConfigFile(file)) { final IModule module = TypeSystem.getExecutionEnvironment().getModule(file); if (module != null) { for (IDirectory dir : module.getSourcePath()) { if ("config".equals(dir.getName()) && file.isDescendantOf(dir)) { return false; } } } //System.out.println("Ignoring: " + relativePath); return true; } // for (String pattern : IGNORE_DIRECTORY_PATTERNS) { // if (relativePath.contains(pattern)) { // return true; // } // } return HASH.matches(relativePath); }
copyExamples( child, PathUtil.create( to, child.getName() ) );
public boolean isPathIgnored(String relativePath) { if (relativePath == null) { return true; } final IFile file = CommonServices.getFileSystem().getIFile(new File(relativePath)); // AHK - We use file.getParent().hasChild() instead of file.exists() since we don't want to hit the disk // for the file existence check if we don't have to, and hasChild() will usually work off the cached sub-files // of a given directory if (file != null && file.getParent() != null && file.getParent().hasChildFile(file.getName()) && isConfigFile(file)) { final IModule module = TypeSystem.getExecutionEnvironment().getModule(file); if (module != null) { for (IDirectory dir : module.getSourcePath()) { if ("config".equals(dir.getName()) && file.isDescendantOf(dir)) { return false; } } } //System.out.println("Ignoring: " + relativePath); return true; } // for (String pattern : IGNORE_DIRECTORY_PATTERNS) { // if (relativePath.contains(pattern)) { // return true; // } // } return HASH.matches(relativePath); }
private static IDirectory executeOnSourceDirectory(IDirectory dir, SourceDirectoryBlock block){ IFile moduleFile = dir.file("pom.xml"); IDirectory foundModule = null; if (moduleFile != null && moduleFile.exists()) { // This entry is itself a module, so return that block.doIt(dir, moduleFile); } else if (!dir.getName().endsWith(".jar")) { IDirectory parentDir = dir.getParent(); if (parentDir != null) { IFile parentModuleFile = parentDir.file("pom.xml"); if (parentModuleFile.exists() && moduleContainsSourceDir(parentModuleFile, dir)) { // Module.xml file in the parent directory, so that directory is a module block.doIt(parentDir, parentModuleFile); } else { // No module.xml file in the parent directory either, the original directory is the module block.doIt(dir, null); } } else { // No parent directory at all, so just the original directory is the module block.doIt(dir, null); } } else { // It's a jar file with no module.xml inside, so the jar is the module block.doIt(dir, null); } return foundModule; }
private static IDirectory executeOnSourceDirectory(IDirectory dir, SourceDirectoryBlock block){ IFile moduleFile = dir.file("pom.xml"); IDirectory foundModule = null; if (moduleFile != null && moduleFile.exists()) { // This entry is itself a module, so return that block.doIt(dir, moduleFile); } else if (!dir.getName().endsWith(".jar")) { IDirectory parentDir = dir.getParent(); if (parentDir != null) { IFile parentModuleFile = parentDir.file("pom.xml"); if (parentModuleFile.exists() && moduleContainsSourceDir(parentModuleFile, dir)) { // Module.xml file in the parent directory, so that directory is a module block.doIt(parentDir, parentModuleFile); } else { // No module.xml file in the parent directory either, the original directory is the module block.doIt(dir, null); } } else { // No parent directory at all, so just the original directory is the module block.doIt(dir, null); } } else { // It's a jar file with no module.xml inside, so the jar is the module block.doIt(dir, null); } return foundModule; }