@Override public ResourcePath getPath() { return _delegate.getPath(); }
public static List<String> makeStringPaths( List<IDirectory> sourcePaths ) { List<String> paths = new ArrayList<String>(); for( IDirectory dir: sourcePaths ) { paths.add( dir.getPath().getPathString() ); } return paths; }
@Override public boolean isDescendantOf( IDirectory dir ) { return dir.getPath().isDescendant(_path); }
public static List<String> makeStringPaths( List<IDirectory> sourcePaths ) { List<String> paths = new ArrayList<String>(); for( IDirectory dir: sourcePaths ) { paths.add( dir.getPath().getPathString() ); } return paths; }
@Override public boolean isDescendantOf( IDirectory dir ) { return dir.getPath().isDescendant(_path); }
@Override public boolean isChildOf(IDirectory dir) { return dir.getPath().isChild(_path); }
@Override public boolean isChildOf(IDirectory dir) { return dir.getPath().isChild(_path); }
public static String getTypeNameFromFile( IDirectory root, IFile file ) { String strClassPath = root.getPath().getFileSystemPathString() + File.separatorChar; String strQualifiedClassName = file.getPath().getFileSystemPathString().substring( strClassPath.length() ); int iDot = strQualifiedClassName.lastIndexOf( '.' ); if( iDot >= 0 ) { strQualifiedClassName = strQualifiedClassName.substring( 0, iDot ); strQualifiedClassName = strQualifiedClassName.replace( '/', '.' ).replace( '\\', '.' ); } if( strQualifiedClassName.startsWith( "." ) ) { strQualifiedClassName = strQualifiedClassName.substring( 1 ); } return strQualifiedClassName; }
@Override public boolean isDescendantOf(IDirectory dir) { return dir.getPath().isDescendant(getPath()); }
@Override public boolean isDescendantOf(IDirectory dir) { return dir.getPath().isDescendant(getPath()); }
@Override public boolean isDescendantOf(IDirectory dir) { return dir.getPath().isDescendant(getPath()); }
@Override public boolean isDescendantOf(IDirectory dir) { return dir.getPath().isDescendant(getPath()); }
@Override public int getClassPathLength() { return getEntry().getPath().getPath().getFileSystemPathString().length(); }
@Override public int getClassPathLength() { return getEntry().getPath().getPath().getFileSystemPathString().length(); }
@Override public String getClassNameFromFile( IDirectory root, IFile file, String[] fileExts ) { String strClassPath = root.getPath().getFileSystemPathString() + File.separatorChar; String strQualifiedClassName = file.getPath().getFileSystemPathString().substring( strClassPath.length() ); if( !Util.isClassFileName( strQualifiedClassName, fileExts ) ) { String strExts = ""; for( String strExt : fileExts ) { strExts += " " + strExt; } throw new IllegalArgumentException( file.getPath().getName() + " is not a legal Gosu class name. It does not end with [" + strExts.trim() + "]" ); } strQualifiedClassName = strQualifiedClassName.substring( 0, strQualifiedClassName.lastIndexOf( '.' ) ); strQualifiedClassName = strQualifiedClassName.replace( '/', '.' ).replace( '\\', '.' ); if( strQualifiedClassName.startsWith( "." ) ) { strQualifiedClassName = strQualifiedClassName.substring( 1 ); } return strQualifiedClassName; }
public void initWatching() { _directoryWatcher = new DirectoryWatcher(); List<? extends IDirectory> sourceEntries = TypeSystem.getCurrentModule().getSourcePath(); for (IDirectory sourceEntry : sourceEntries) { // Ignore /classes directories and jar files if (!sourceEntry.getPath().getName().equals("classes") && !sourceEntry.getPath().getName().endsWith(".jar") && sourceEntry.isJavaFile()) { _directoryWatcher.watchDirectoryTree(sourceEntry.toJavaFile().toPath()); } } }
@Override public String getClassNameFromFile( IDirectory root, IFile file, String[] fileExts ) { String strClassPath = root.getPath().getFileSystemPathString() + File.separatorChar; String strQualifiedClassName = file.getPath().getFileSystemPathString().substring( strClassPath.length() ); if( !Util.isClassFileName( strQualifiedClassName, fileExts ) ) { String strExts = ""; for( String strExt : fileExts ) { strExts += " " + strExt; } throw new IllegalArgumentException( file.getPath().getName() + " is not a legal Gosu class name. It does not end with [" + strExts.trim() + "]" ); } strQualifiedClassName = strQualifiedClassName.substring( 0, strQualifiedClassName.lastIndexOf( '.' ) ); strQualifiedClassName = strQualifiedClassName.replace( '/', '.' ).replace( '\\', '.' ); if( strQualifiedClassName.startsWith( "." ) ) { strQualifiedClassName = strQualifiedClassName.substring( 1 ); } return strQualifiedClassName; }
public static void getExtensions(Collection<String> result, IDirectory dir, String headerName) { IFile manifestFile = dir.file( "META-INF/MANIFEST.MF" ); if (manifestFile == null || !manifestFile.exists()) { return; } InputStream in = null; try { in = manifestFile.openInputStream(); Manifest manifest = new Manifest(in); scanManifest(result, manifest, headerName); } catch (Exception e) { // FIXME: For some reason, WebSphere changes JARs in WEB-INF/lib, breaking signatures. So ignore errors. ResourcePath path = dir.getPath(); String str = path != null ? path.getFileSystemPathString() : dir.toString(); CommonServices.getEntityAccess().getLogger().warn("Cannot read manifest from jar " + str + ", ignoring"); } finally { if (in != null) { try { in.close(); } catch (IOException e) { // Ignore } } } }
private GosucModule makeModule( IModule module ) { final IDirectory outputPath = module.getOutputPath(); return new GosucModule( module.getName(), GosucUtil.makeStringPaths( module.getSourcePath() ), GosucUtil.makeStringPaths( module.getJavaClassPath() ), outputPath != null ? outputPath.getPath().getPathString() : null, makeDependencies( module.getDependencies() ) ); }
private GosucModule makeModule( IModule module ) { final IDirectory outputPath = module.getOutputPath(); return new GosucModule( module.getName(), GosucUtil.makeStringPaths( module.getSourcePath() ), GosucUtil.makeStringPaths( module.getJavaClassPath() ), GosucUtil.makeStringPaths( module.getBackingSourcePath() ), outputPath != null ? outputPath.getPath().getPathString() : null, makeDependencies( module.getDependencies() ), GosucUtil.makeStringPaths( module.getExcludedPaths() )); }