|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ide.model.DefaultSubDirtyable
oracle.ide.net.URLPath
public class URLPath
An instance of URLPath
represents a path that is made up entirely of URL
s. 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.
Constructor Summary | |
---|---|
URLPath() Creates a URLPath that is initially empty. |
|
URLPath(int initialCapacity) Creates an empty URLPath with the specified initial capacity. |
|
URLPath(java.util.List entries) Creates a URLPath that is linked directly to the specified List . |
|
URLPath(ListStructure entries) Deprecated. since 11.0. Use URLPath(List) . This constructor is being maintained only for binary compatibility with 10.1.3. |
|
URLPath(java.net.URL entry) Creates a URLPath that initially contains the specified URL as its sole entry. |
|
URLPath(java.net.URL[] entries) Creates a URLPath initialized with the specified array of URL objects. |
|
URLPath(URLPath urlPath) Copy constructor. |
Method Summary | |
---|---|
void |
add(java.util.Collection<?> entries) Adds the entries from the specified Collection to 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 URL to the end of the URLPath , if it is not already on the URLPath . |
void |
add(java.net.URL[] entries) Adds the given URL objects in order to the end of the URLPath . |
void |
add(URLPath urlPath) Adds the entries from the specified URLPath to 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 true if the specified URL is currently on this URLPath . |
java.lang.Object |
copyTo(java.lang.Object object) Copies the internal state of this object to the specified copy . |
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 implement equals(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() Deprecated. Use asList() instead. |
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() Convience method to get the first URL entry contained within the URLPath . |
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 . |
static URLPath |
newURLPathFromString(java.lang.String entries) This is a factory method for creating a URLPath instance based on a typical path string, such as that that is returned by System.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 URLPath instance to be equivalent to the specified array of URL s. |
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 URL that is bound to a corresponding resource on this URLPath . |
java.net.URL |
toQualifiedURL(java.lang.String relativePath) Given a relative spec, this method attempts to construct a fully qualified URL that points to the corresponding resource on this URLPath . |
java.net.URL[] |
toQualifiedURL(java.lang.String relativePath, boolean firstMatch) Given a relative spec, this method attempts to construct an array of fully qualified URL s that points to the corresponding resource on this URLPath . |
java.lang.String |
toRelativePath(java.net.URL url) Given an URL , this method attempts to derive its relative path with respect to this instance of URLPath . |
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 |
Methods inherited from class oracle.ide.model.DefaultSubDirtyable |
---|
getOwner, isDirty, markDirty, setOwner |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public 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 URLPath
public 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(List)
. This constructor is being maintained only for binary compatibility with 10.1.3.URLPath
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
that is linked directly to the specified List
. Any changes made to the URLPath will be reflected in the List and vice versa.
java.lang.IllegalArgumentException
- if any item in the List is null or is not a URL.public URLPath(URLPath urlPath)
Method Detail |
---|
public java.lang.Object copyTo(java.lang.Object object)
Copyable
this
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:
The parameter passed into thepublic 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 Copyable
object
- 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.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()
public java.net.URL[] getEntries()
URLPath
instance as an array of URL
s. If the URLPath
is empty, then then this method returns an URL
array of size 0.public 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)
URL
s 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)
URL
s 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
. In numerous places in the IDE, we need the first path only.URL
in the URLPath
public 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.iterator
in interface java.lang.Iterable<java.net.URL>
public 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 URL
s (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 URL
s. 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.toBoundURL(java.lang.String)
, URLFileSystem.exists(java.net.URL)
public java.net.URL[] toQualifiedURL(java.lang.String relativePath, boolean firstMatch)
URL
s 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.toBoundURL(java.lang.String)
, URLFileSystem.exists(java.net.URL)
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.Object
protected 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.Object
public boolean validateAllEntriesExist()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |