Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.jdeveloper.vcs.util
Class VCSFileSystemUtils

java.lang.Object
  extended by oracle.jdeveloper.vcs.util.VCSFileSystemUtils


public final class VCSFileSystemUtils
extends java.lang.Object

Utility class for file system operations.

Since:
9.0.5

Method Summary
static java.net.URL[] canonicalizeURLs(java.net.URL[] urls)
          Canonicalizes the given URLs and returns them in a new array.
static java.net.URL[] coalesceURLs(java.net.URL[] urls)
          Coalesces the given URLs in such a manner that the selection is suitable for a recursive directory-based operation.
static ContentType getContentType(java.lang.String extension)
          Gets the ContentType for the given extension.
static java.net.URL[] getContentTypeURLs(java.net.URL[] urls, ContentType contentType)
          Gets the URLs, of those supplied, which have the given content type associated in the IDE.
static java.net.URL getDirectoryPathURL(java.net.URL url)
          Gets the directory path-style URL representing the given URL.
static java.net.URL[] getParentURLs(java.net.URL url)
          Gets all parent URLs for the given file.
static java.net.URL[] getParentURLs(java.net.URL[] urls)
          Gets the set of all parent URLs for the given set of URLs.
static java.lang.String getPlatformPathName(java.net.URL url)
          Gets the platform-dependent String representation of the URL.
static java.lang.String[] getURLFileNames(java.net.URL[] urls)
          Gets the filenames (including extensions) of the given URLs.
static boolean isBaseURLFor(java.net.URL url1, java.net.URL url2)
          Asks whether url1 represents a directory and url2 points to a location within url1's directory tree.
static boolean isContentTypeBinary(java.net.URL url)
          Asks whether the given URL contains binary content, according to the IDE's content type registry.
static boolean isNonEditable(java.net.URL url)
           
static java.lang.String[] listBinaryExtensions()
          List all recognized binary file extensions registered with the IDE.
static java.util.Map<VCSHashURL,java.util.Collection<java.lang.String>> mapFilenamesByParent(java.net.URL[] urls)
          Organizes the given URLs by their parent directories.
static java.util.Map<VCSHashURL,java.util.Collection<java.net.URL>> mapURLsByParent(java.net.URL[] urls)
          Organizes the given URLs by their parent directories.
static java.net.URL newFileURL(java.lang.String filePath)
          Creates a new URL using the "file" protocol.
static java.net.URL[] newTargetURLs(java.net.URL[] urls, java.net.URL target)
          Creates new URLs for the target URL directory.
static java.io.InputStream openConflictsStreamAsContributor(java.net.URL url, java.lang.String charsetName)
          Opens an InputStream on the given URL, which contains diff3-style merge conflicts.
static java.util.Map<java.net.URL,java.util.Collection<java.lang.String>> organizeFilenamesByParent(java.net.URL[] urls)
          Deprecated. replaced by mapFilenamesByParent(java.net.URL[]). It is bad practice to store URLs in Collections that require (or encourage) comparisons of keys or entries. URL.equals(Object) and URL.hashCode perform host comparison by name resolution through the DNS, which may be inordinately slow. The VCSHashURL wrapper class is provided to work around this problem.
static java.util.Map<ContentType,java.util.Collection<java.net.URL>> organizeURLsByContentType(java.net.URL[] urls)
          Organizes the given URLs by their content type.
static java.util.Map<java.net.URL,java.util.Collection<java.net.URL>> organizeURLsByParent(java.net.URL[] urls)
          Deprecated. replaced by mapURLsByParent(java.net.URL[]). It is bad practice to store URLs in Collections that require (or encourage) comparisons of keys or entries. URL.equals(Object) and URL.hashCode perform host comparison by name resolution through the DNS, which may be inordinately slow. The VCSHashURL wrapper class is provided to work around this problem.
static void registerDecorator(java.lang.String protocol, URLFileSystemHelperDecorator decorator)
          Registers the specified URLFileSystemHelperDecorator as an element in the chain of objects that can handle URLFileSystem operations for URLs of the specified protocol.
static void registerFileType(java.lang.String extension, ContentType contentType)
          Registers a default file type against the given extension in the IDE.
static java.net.URL[] removeRefAndQueryParts(java.net.URL[] urls)
          Removes the reference and query parts of the given URLs.
static java.net.URL searchSystemPath(java.lang.String name)
          Searches the system environment path for a named executable URL.
static java.net.URL[] searchSystemPathFully(java.lang.String name)
          Searches the full system environment path for all named executable URLs.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

organizeURLsByParent

@Deprecated
public static final java.util.Map<java.net.URL,java.util.Collection<java.net.URL>> organizeURLsByParent(java.net.URL[] urls)
Deprecated. replaced by mapURLsByParent(java.net.URL[]). It is bad practice to store URLs in Collections that require (or encourage) comparisons of keys or entries. URL.equals(Object) and URL.hashCode perform host comparison by name resolution through the DNS, which may be inordinately slow. The VCSHashURL wrapper class is provided to work around this problem.
Organizes the given URLs by their parent directories.
Parameters:
urls - the URLs to organize.
Returns:
the resulting data structure (URL -> Collection), where Collection is a collection of URLs.

mapURLsByParent

public static final java.util.Map<VCSHashURL,java.util.Collection<java.net.URL>> mapURLsByParent(java.net.URL[] urls)
Organizes the given URLs by their parent directories.
Parameters:
urls - the URLs to organize.
Returns:
the resulting data structure (URL -> Collection), where Collection is a collection of URLs.

organizeFilenamesByParent

@Deprecated
public static final java.util.Map<java.net.URL,java.util.Collection<java.lang.String>> organizeFilenamesByParent(java.net.URL[] urls)
Deprecated. replaced by mapFilenamesByParent(java.net.URL[]). It is bad practice to store URLs in Collections that require (or encourage) comparisons of keys or entries. URL.equals(Object) and URL.hashCode perform host comparison by name resolution through the DNS, which may be inordinately slow. The VCSHashURL wrapper class is provided to work around this problem.
Organizes the given URLs by their parent directories.
Parameters:
urls - the URLs to organize.
Returns:
the resulting data structure (URL -> Collection), where Collection is a collection of filenames.

mapFilenamesByParent

public static final java.util.Map<VCSHashURL,java.util.Collection<java.lang.String>> mapFilenamesByParent(java.net.URL[] urls)
Organizes the given URLs by their parent directories.
Parameters:
urls - the URLs to organize.
Returns:
the resulting data structure (URL -> Collection), where Collection is a collection of filenames.

getURLFileNames

public static final java.lang.String[] getURLFileNames(java.net.URL[] urls)
Gets the filenames (including extensions) of the given URLs.
Parameters:
urls - the URLs whose filenames should be obtained.
Returns:
an array of filenames.

canonicalizeURLs

public static final java.net.URL[] canonicalizeURLs(java.net.URL[] urls)
Canonicalizes the given URLs and returns them in a new array.
Parameters:
urls - the URLs to canonicalize.
Returns:
the array of canonicalized URLs.

searchSystemPath

public static final java.net.URL searchSystemPath(java.lang.String name)
Searches the system environment path for a named executable URL.
Parameters:
name - the name of the executable file (minus extension) to search for.
Returns:
the accepted URL found first on the system path. (null-capable)

searchSystemPathFully

public static final java.net.URL[] searchSystemPathFully(java.lang.String name)
Searches the full system environment path for all named executable URLs.
Parameters:
name - the name of the executable files (minus extension) to search for.
Returns:
the accepted URLs found first on the system path.

getParentURLs

public static final java.net.URL[] getParentURLs(java.net.URL url)
Gets all parent URLs for the given file.
Parameters:
url - file.
Returns:
the array of parent directory URLs.

getParentURLs

public static final java.net.URL[] getParentURLs(java.net.URL[] urls)
Gets the set of all parent URLs for the given set of URLs.
Parameters:
urls -
Returns:
the set of parent URLs

isBaseURLFor

public static final boolean isBaseURLFor(java.net.URL url1,
                                         java.net.URL url2)
Asks whether url1 represents a directory and url2 points to a location within url1's directory tree. If the URLs are equal and do not represent directories, this method will return with true (unlike the URLFileSystem implementation).
Parameters:
url1 - the potential base URL.
url2 - the URL to test.
Returns:
a verdict on whether url1 is a base URL.

newTargetURLs

public static final java.net.URL[] newTargetURLs(java.net.URL[] urls,
                                                 java.net.URL target)
Creates new URLs for the target URL directory.
Parameters:
urls - the source URLs on which new URLs are based.
target - the target URL directory.
Returns:
the target URLs.

newFileURL

public static final java.net.URL newFileURL(java.lang.String filePath)
Creates a new URL using the "file" protocol. If the argument is a directory format path then a directory URL will be created.
Parameters:
filePath - the path for the URL to create.
Returns:
the created URL instance.

getPlatformPathName

public static final java.lang.String getPlatformPathName(java.net.URL url)
Gets the platform-dependent String representation of the URL. If the argument is a directory URL then a directory format path will be returned.
Parameters:
url - the URL for the path to return.
Returns:
The path portion of the specified URL in platform-dependent notation.

removeRefAndQueryParts

public static final java.net.URL[] removeRefAndQueryParts(java.net.URL[] urls)
Removes the reference and query parts of the given URLs. Non-sanitizing.
Parameters:
urls - the URLs whose reference and query parts will be removed.
Returns:
the new URLs based on those given, minus reference and query information.

getContentType

public static final ContentType getContentType(java.lang.String extension)
Gets the ContentType for the given extension.
Parameters:
extension - the file extension.
Returns:
the associated content type. (null-capable)

getContentTypeURLs

public static final java.net.URL[] getContentTypeURLs(java.net.URL[] urls,
                                                      ContentType contentType)
Gets the URLs, of those supplied, which have the given content type associated in the IDE.
Parameters:
urls - the URLs whose content types will be checked.
contentType - the content type to filter by.
Returns:
the URLs with the given content type.

organizeURLsByContentType

public static final java.util.Map<ContentType,java.util.Collection<java.net.URL>> organizeURLsByContentType(java.net.URL[] urls)
Organizes the given URLs by their content type.
Parameters:
urls - the URLs to organize.
Returns:
the resulting data structure (ContentType -> Collection), where Collection is a collection of URLs. Note that a null ContentType key indicates that URLs do not have an associated registered file type.

registerFileType

public static final void registerFileType(java.lang.String extension,
                                          ContentType contentType)
Registers a default file type against the given extension in the IDE.
Parameters:
extension - the extension to register.
contentType - the associated content type.

getDirectoryPathURL

public static final java.net.URL getDirectoryPathURL(java.net.URL url)
Gets the directory path-style URL representing the given URL. If the URL aleady represents a directory path, this method will return the same URL without transformations.
Parameters:
url - the URL.
Returns:
the directory path equivalent URL.

coalesceURLs

public static final java.net.URL[] coalesceURLs(java.net.URL[] urls)
Coalesces the given URLs in such a manner that the selection is suitable for a recursive directory-based operation. This will eliminate all URLs representing paths underneath other (directory style) paths in the selection.
Parameters:
urls - the URLs to coalesce.
Returns:
the array of coalesced URLs.

registerDecorator

public static void registerDecorator(java.lang.String protocol,
                                     URLFileSystemHelperDecorator decorator)
Registers the specified URLFileSystemHelperDecorator as an element in the chain of objects that can handle URLFileSystem operations for URLs of the specified protocol.

If the protocol is null or the empty string or if decorator is null, this method does nothing.

Parameters:
protocol - the protocol whose helper chain should be decorated.
decorator - the decorator instance.

isNonEditable

public static boolean isNonEditable(java.net.URL url)

openConflictsStreamAsContributor

public static final java.io.InputStream openConflictsStreamAsContributor(java.net.URL url,
                                                                         java.lang.String charsetName)
                                                                  throws java.io.IOException
Opens an InputStream on the given URL, which contains diff3-style merge conflicts. The resulting stream is a partial reconstruction of the local contributor to the conflicts file, before the merge. It is the same as the contents of the conflicts file with all blocks from the local file selected, and blocks from the conflicting file ignored.
Parameters:
url - the URL to open.
charsetName - the encoding of the stream.
Returns:
an InputStream on the deconstructed conflicts file.
Throws:
java.io.IOException - if an I/O error occurs while creating the input stream.

listBinaryExtensions

public static final java.lang.String[] listBinaryExtensions()
List all recognized binary file extensions registered with the IDE. Extensions are in the sanitized form, so they will include the leading '.' before the suffix.
Returns:
the array of recognized extensions.

isContentTypeBinary

public static final boolean isContentTypeBinary(java.net.URL url)
Asks whether the given URL contains binary content, according to the IDE's content type registry.
Parameters:
url - the URL.
Returns:
a verdict on whether the content type associated with the URL suffix is ContentType.BINARY.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


Copyright © 1997, 2013, Oracle. All rights reserved.