public class URLPath extends DefaultSubDirtyable implements Copyable, java.lang.Iterable<java.net.URL>
URLPath represents a path that is made
  up entirely of URLs.  This can be a class path, source
  path, doc path, etc.
  Access to the URL objects contained by URLPath
  is also allowed through these JavaBean accessor methods.  The main
  reason for this is that URLPath can then be used with
  a JavaBeans-driven marshalling framework for persistence.
  Therefore, an instance
  of URLPath can be embedded as a property within another
  JavaBean that is persisted.
  URLPath is essentially a wrapper on an underlying List
  of URL.  Access to the URLPath from multiple threads is
  safe if the underlying List implementation is thread safe, and
  if all iteration through the iterator returned by iterator() is
  done while holding the intrinsic lock on the object returned by
  iteratorLock().
| Constructor and Description | 
|---|
| URLPath()Creates a  URLPaththat is initially empty. | 
| URLPath(int initialCapacity)Creates an empty  URLPathwith the specified initial
  capacity. | 
| URLPath(java.util.List entries)Creates a  URLPathinstance that is linked directly to the
  specifiedList. | 
| URLPath(ListStructure entries)Creates a  URLPathinstance that is linked directly to the
  specifiedListStructure. | 
| URLPath(java.net.URL entry)Creates a  URLPaththat initially contains the
  specifiedURLas its sole entry. | 
| URLPath(java.net.URL[] entries)Creates a  URLPathinitialized with the specified
  array ofURLobjects. | 
| URLPath(URLPath urlPath)Copy constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(java.util.Collection<?> entries)Adds the entries from the specified  Collectionto this
 instance. | 
| void | add(java.util.List entries)Deprecated. 
 since 11.0. Use  add(Collection). This method is being
    retained only for binary compatibility with 10.1.3. | 
| void | add(java.net.URL entry)Adds the given  URLto the end of theURLPath,
  if it is not already on theURLPath. | 
| void | add(java.net.URL[] entries)Adds the given  URLobjects in order to the end of theURLPath. | 
| void | add(URLPath urlPath)Adds the entries from the specified  URLPathto this
  instance. | 
| java.util.List<java.net.URL> | asList()Returns the contents of the URLPath as a read-only List. | 
| boolean | contains(java.net.URL entry)Returns  trueif the specifiedURLis
  currently on thisURLPath. | 
| java.lang.Object | copyTo(java.lang.Object object)Copies the internal state of  thisobject to the
  specifiedcopy. | 
| protected void | copyToImpl(URLPath copy)Design pattern for supporting strongly typed copying. | 
| boolean | equals(java.lang.Object o) | 
| protected boolean | equalsImpl(URLPath urlPath)This is a helper method for  equals(Object)that can
  also be used by subclasses that implementequals(Object). | 
| void | expandToIncludeManifestClassPaths()Do not call this method unless you are certain it is necessary. | 
| void | expandToIncludeManifestClassPathsInterruptibly()Do not call this method unless you are certain it is necessary. | 
| java.util.List<java.lang.String> | getAllDirectories()Retrieves the list of all the directories currently present on this
  URLPath. | 
| java.util.List | getDirectories(java.lang.String relPath)Retrieves the list of all directories existing immediately under a relative
 path. | 
| java.util.List<java.lang.String> | getDirectories(java.lang.String relPath,
              URLFilter urlFilter)Retrieves the list of all directories existing immediately under a relative
 path that pass the specified filter. | 
| java.net.URL[] | getEntries()Returns the path represented by this URLPathinstance as an array
  ofURL. | 
| java.util.List<java.net.URL> | getFiles(java.lang.String relPath)Retrieves a list of URLs representing all the files contained under a
 relative path. | 
| java.util.List<java.net.URL> | getFiles(java.lang.String relPath,
        URLFilter urlFilter)Retrieves a list of URLs representing all the files contained under a
 relative path that pass the specified filter. | 
| java.util.List | getFilesAndDirectories(java.lang.String relPath,
                      boolean dirsBeforeFiles)Returns a List of URLs for all the files and directories
  contained within the specified relPath, relative to this URLPath. | 
| java.util.List<java.net.URL> | getFilesAndDirectories(java.lang.String relPath,
                      boolean dirsBeforeFiles,
                      URLFilter urlFilter)Returns a List of URLs for all the files and directories that
  pass the specified filter and are contained within the specified
  relPath, relative to this URLPath. | 
| java.net.URL | getFirstEntry()Convenience method to get the first  URLentry contained within
 theURLPath. | 
| java.net.URL | getLongestMatchingEntry(java.net.URL url)Returns the URLPath entry that is the closest parent to the specified
  URL. | 
| static URLPath | getURLPath(HashStructure hash,
          java.lang.String urlPathName)Retrieves the URLPath that is stored within the specified
  HashStructure at the specified name. | 
| java.util.Iterator<java.net.URL> | iterator()Returns an Iterator whose elements are all instances of  URL. | 
| java.lang.Object | iteratorLock()Get the  Objectwhose intrinsic lock which must be held while
 iterating this path using the iterator returned byiterator(). | 
| static URLPath | newURLPathFromString(java.lang.String entries)This is a factory method for creating a  URLPathinstance based on a typical path string, such as that that is
  returned bySystem.getProperty( "java.class.path" ). | 
| void | remove(java.net.URL entry) | 
| void | remove(java.net.URL[] entries) | 
| void | remove(URLPath urlPath) | 
| void | setEntries(java.net.URL[] entries)Sets the path represented by this  URLPathinstance
  to be equivalent to the specified array ofURLs. | 
| static boolean | setURLPath(HashStructure hash,
          java.lang.String urlPathName,
          URLPath urlPath)Stores the specified URLPath into the HashStructure at the specified
  name. | 
| int | size()Returns the number of entries in the  URLPath. | 
| java.net.URL | toBoundURL(java.lang.String relativePath)Given a relative spec, this method attempts to construct a fully
  qualified  URLthat is bound to a corresponding resource
  on thisURLPath. | 
| java.net.URL | toQualifiedURL(java.lang.String relativePath)Given a relative spec, this method attempts to construct a fully
  qualified  URLthat points to the corresponding resource
  on thisURLPath. | 
| java.net.URL[] | toQualifiedURL(java.lang.String relativePath,
              boolean firstMatch)Given a relative spec, this method attempts to construct an array of
  fully qualified  URLs that points to the corresponding resource
  on thisURLPath. | 
| java.lang.String | toRelativePath(java.net.URL url)Given an  URL, this method attempts to derive its relative
  path with respect to this instance ofURLPath. | 
| java.lang.String | toShortestRelativePath(java.net.URL url)Returns the path for the URL relative to the closest parent
  on this URLPath. | 
| java.lang.String | toString() | 
| java.lang.String[] | toStrings() | 
| boolean | validateAllEntriesExist()Validates the URLPath entries | 
getOwner, isDirty, markDirty, setOwnerpublic URLPath()
URLPath that is initially empty.public URLPath(int initialCapacity)
URLPath with the specified initial
  capacity.  Used to construct a URLPath whose
  contents are not initially known but where the number of entries
  can be estimated ahead of time.initialCapacity - the initial capacity of the
  URLPathpublic URLPath(java.net.URL entry)
URLPath that initially contains the
  specified URL as its sole entry.  If the entry is
  null, then the URLPath created
  is initially empty.public URLPath(java.net.URL[] entries)
URLPath initialized with the specified
  array of URL objects.  If the entries
  array is null or empty, then the
  URLPath created is initially empty.public URLPath(ListStructure entries)
URLPath instance that is linked directly to the
  specified ListStructure.  Any changes made to the URLPath
  will be reflected in the ListStructure and vice versa.java.lang.IllegalArgumentException - if any item in the ListStructure is
  null or is not a URL.public URLPath(java.util.List entries)
URLPath instance that is linked directly to the
  specified List.  Any changes made to the URLPath
  will be reflected in the List and vice versa.
  If the URLPath or the underlying List will be used on
  more than one thread, it is the callers responsibility to ensure that the
  List is a thread-safe implementation, such as those returned by
  the java.util.Collections.synchronized... methods.  Further, it
  is assumed that the lock used to synchornize access to the List
  is the intrinsic lock of the List itself.
java.lang.IllegalArgumentException - if any item in the List is
  null or is not a URL.public URLPath(URLPath urlPath)
public java.lang.Object copyTo(java.lang.Object object)
Copyablethis object to the
  specified copy.  If copy is
  null, then this method should create a new instance
  of this class and proceed to copy the internal state
  to the newly created object.  Generally, only the persistent
  state of the object should be copied, but whether or not it is
  appropriate to copy transient properties is at the discretion
  of the individual implementor.
  Regardless of whether the copy occurs to an existing object or to
  a newly created object, the return value is object to which
  this object's state was copied.
  There is a standard implementation pattern for the
  copyTo method that helps avoid problems that arise
  when a Copyable object is subclassed.  The pattern
  is:
    public Object copyTo( Object target )
    {
      final <this_class> copy =
        target != null ? (<this_class>) target : new <this_class>();
      copyToImpl( copy );
      return copy;
    }
    protected final void copyToImpl( <this_class> copy )
    {
      super.copyToImpl( copy );  //  if necessary
      //  put code here for copying the properties of <this_class>
    }
  copyToImpl method is
  the same type of this class.  The responsibility of
  copyToImpl is to copy the state of this
  class through direct access of the fields.  The
  copyToImpl method should not use getters and setters
  since these may be overridden, causing the state of
  this class to be incompletely copied.copyTo in interface Copyableobject - The target object to which the state of
  this object should be copied.  If target
  is null, then the copyTo method will
  return a new instance of this class.this
  object was copied.  If the target was
  non-null, then the return value is the same as the
  target object that was passed in; otherwise, the
  return value is a new instance of this class.protected final void copyToImpl(URLPath copy)
public void add(java.net.URL entry)
URL to the end of the URLPath,
  if it is not already on the URLPath.  If the
  parameter is null, then this method returns without
  doing anything.public void add(java.net.URL[] entries)
URL objects in order to the end of the
  URLPath.  Each URL is added only if it is
  not already on the URLPath.  Any null
  entries are ignored.  If the entries array itself
  is null, then this method returns without doing anything.public void add(java.util.Collection<?> entries)
Collection to this
 instance. The collection is not bound to the URLPath in any way; the items
 are simply copied from the specified collection into this URLPath instance.entries - a collection of entries to add. If null is passed, the
    URLPath will not be modified.@Deprecated public void add(java.util.List entries)
add(Collection). This method is being
    retained only for binary compatibility with 10.1.3.public void add(URLPath urlPath)
URLPath to this
  instance.public java.util.List<java.net.URL> asList()
  Note that this method must create a copy of the underying URL
  list for thread safety.  If you are just using this method to iterate
  the URL instances, it is generally more efficient to use the
  iterator() method, while holding the lock returned by
  iteratorLock().  If you are calling this method just to get the
  first entry, then it is much more efficient to call {#getFirstEntry}
  instead.
public java.net.URL[] getEntries()
URLPath instance as an array
  of URL.  If the URLPath is empty, then then this method
  returns an URL array of size 0.
  Note that this method copies the underying URL list into an
  array.  If you are just using this method to iterate the URL
  instances, it is generally more efficient to use the iterator()
  method, while holding the lock returned by iteratorLock().  If
  you are calling this method just to get the first entry, then it is much
  more efficient to call {#getFirstEntry} instead.
URL entries in this path, or an empty array if the
          path is emptypublic boolean contains(java.net.URL entry)
true if the specified URL is
  currently on this URLPath.public java.util.List<java.lang.String> getAllDirectories()
URLPath. The directories are sorted in a case-sensitive order.List containing the ordered list of directories.public void expandToIncludeManifestClassPaths()
This method iterates through each URL currently in in this URLPath, and if the URL is for a jar file, checks if the jar file has a manifest file with a Class-Path main attribute, and if that attribute exists, expands this URLPath to reference those jars and directories explicitly. This expansion proceeds recursively, avoiding duplicates and cycles, until all Class-Path attributes have attributes have been expanded. Calling this method performs the operation only once. Any URLs added subsequently will not be expanded automatically; another call to expandToIncludeManifestClassPaths() would be necessary.
public void expandToIncludeManifestClassPathsInterruptibly()
                                                    throws java.lang.InterruptedException
This method iterates through each URL currently in in this URLPath, and if the URL is for a jar file, checks if the jar file has a manifest file with a Class-Path main attribute, and if that attribute exists, expands this URLPath to reference those jars and directories explicitly. This expansion proceeds recursively, avoiding duplicates and cycles, until all Class-Path attributes have attributes have been expanded. Calling this method performs the operation only once. Any URLs added subsequently will not be expanded automatically; another call to expandToIncludeManifestClassPaths() would be necessary.
java.lang.InterruptedException - if the calling thread is interrupted while
          expanding the pathpublic java.util.List getDirectories(java.lang.String relPath)
URLs of the entries, not the specified relative path.relPath - the relative path under which to look for directories.List containing the ordered list of directories.public java.util.List<java.lang.String> getDirectories(java.lang.String relPath,
                                                       URLFilter urlFilter)
URLs of the entries, not the specified relative path.relPath - the relative path under which to look for directories.List containing the ordered list of directories.public java.util.List<java.net.URL> getFiles(java.lang.String relPath)
relPath - the relative path under which to look for files.List containing the ordered list of file URLs.public java.util.List<java.net.URL> getFiles(java.lang.String relPath,
                                             URLFilter urlFilter)
relPath - the relative path under which to look for files.List containing the ordered list of file URLs.public java.util.List getFilesAndDirectories(java.lang.String relPath,
                                             boolean dirsBeforeFiles)
public java.util.List<java.net.URL> getFilesAndDirectories(java.lang.String relPath,
                                                           boolean dirsBeforeFiles,
                                                           URLFilter urlFilter)
public java.net.URL getFirstEntry()
URL entry contained within
 the URLPath.URL in the URLPath,
         or null if the path is emptypublic static URLPath getURLPath(HashStructure hash, java.lang.String urlPathName)
setURLPath(HashStructure, String, URLPath).
  If the HashStructure does not contain any property by the
  specified urlPathName, an empty URLPath is returned.  This
  method will never return null.public static boolean setURLPath(HashStructure hash, java.lang.String urlPathName, URLPath urlPath)
getURLPath(HashStructure, String).
  If the URLPath is null, the corresponding ListStructure in the
  HashStructure is deleted.  To set an empty ListStructure instead,
  pass in a non-null, empty URLPath.
  Returns true if the underlying storage was modified;
  false otherwise.  If the specified URLPath is identical
  to what was already stored in the HashStructure, then no modification
  is made and this method returns false.public java.util.Iterator<java.net.URL> iterator()
URL.
  Calling the remove() method on the iterator will write through
  and change the URLPath.
  You must hold the lock returned by iteratorLock() while using
  the iterator returned by this method.  Failure to do so can result in
  ConcurrentModificationException.
iterator in interface java.lang.Iterable<java.net.URL>public java.lang.Object iteratorLock()
Object whose intrinsic lock which must be held while
 iterating this path using the iterator returned by iterator().
 This includes both explicit calls to iterator() as well as implicit
 calls made by for-each loops.Object whose intrinsic lock which must be held
         while iterating this pathpublic static URLPath newURLPathFromString(java.lang.String entries)
URLPath
  instance based on a typical path string, such as that that is
  returned by System.getProperty( "java.class.path" ).
  The exact format of the path string is platform-dependent, so the
  path string is tokenized using File.pathSeparator as the
  delimiter.
  Relative paths are converted to absolute paths, and any path
  entries whose name ends in ".jar" or
  ".zip" will be created as jar URLs (i.e.
  an URL with the "jar" protocol).
public void remove(java.net.URL entry)
public void remove(java.net.URL[] entries)
public void remove(URLPath urlPath)
public void setEntries(java.net.URL[] entries)
URLPath instance
  to be equivalent to the specified array of URLs.  If the
  argument is null, then the URLPath is
  cleared; subsequent calls to asList() would then
  return an empty URL list.public int size()
URLPath.public java.net.URL toQualifiedURL(java.lang.String relativePath)
URL that points to the corresponding resource
  on this URLPath.  If no matching URL can be
  constructed, then null is returned. An URL is
  deemed to match iff the URL points to an existing resource.
 In practical terms, it means that calling the method exists()
 on URLFileSystem returns true.
 Note that toQualifiedURL will generally return null if the
 desired resource only exists in memory (for example, if it is bound to
 an unsaved oracle.ide.model.Node. If in-memory resources are
 desired as well, use toBoundURL(String) instead.public java.net.URL[] toQualifiedURL(java.lang.String relativePath,
                                     boolean firstMatch)
URLs that points to the corresponding resource
  on this URLPath.  If no matching URL can be
  constructed, then null is returned. An URL is
  deemed to match iff the URL points to an existing resource.
 In practical terms, it means that calling the method exists()
 on URLFileSystem returns true.
 Note that toQualifiedURL will generally return null if the
 desired resource only exists in memory (for example, if it is bound to
 an unsaved oracle.ide.model.Node. If in-memory resources are
 desired as well, use toBoundURL(String) instead.public java.net.URL toBoundURL(java.lang.String relativePath)
URL that is bound to a corresponding resource
  on this URLPath.  If no matching URL can be
  constructed, then null is returned. The determination
 of whether an URL is bound is based on using the URLFileSystem
 method isBound, which uses one or more instances of
 URLExistsTest to determine whether someone claims ownership of the
 a resource bound that that URL. This differs from toQualifiedURL
 in that it may find in memory resources in addition to resources existing
 on the filesystem or some other more permanent location.URLFileSystem.exists(java.net.URL)public java.lang.String toRelativePath(java.net.URL url)
URL, this method attempts to derive its relative
  path with respect to this instance of URLPath.  If
  the specified URL does not point to a location that is
  on this URLPath, then null is returned.public java.lang.String toShortestRelativePath(java.net.URL url)
toRelativePath(URL).  If no entry on this
  URLPath is a parent for the specified URL or if the specified
  URL is null, this method returns null.public java.net.URL getLongestMatchingEntry(java.net.URL url)
public java.lang.String[] toStrings()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectprotected final boolean equalsImpl(URLPath urlPath)
equals(Object) that can
  also be used by subclasses that implement equals(Object).
  It assumes that the argument is not null.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean validateAllEntriesExist()