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

E13403-04

oracle.jdeveloper.java.locator
Class URLClassLocator

java.lang.Object
  extended by oracle.jdeveloper.java.locator.BaseClassLocator
      extended by oracle.jdeveloper.java.locator.URLClassLocator
All Implemented Interfaces:
JavaClassLocator, JavaClassLocator2, JavaResourceLocator
Direct Known Subclasses:
CachedDirURLClassLocator, DirURLClassLocator, JarURLClassLocator

public abstract class URLClassLocator
extends BaseClassLocator

The URLClassLocator is an abstract starting point for a JavaClassLocator implementation based out of a root URL. These implementations will attempt to locate either Java class files or Java sources files (but not both simultaneously) within a given root URL. Note that that implementations based on the URLClassLocator is intended to support only top-level classes.


Field Summary
protected  int _fileType
          The file type we are searching for, either CLASS_TYPE or SOURCE_TYPE.
protected  java.net.URL _rootURL
          The root directory that we are based out of.
static java.lang.String[] CLASS_SUFFIXES
          Default suffix for a *.class file.
static int CLASS_TYPE
          Constant indicating that this locator is for Java classes.
static java.lang.String[] SOURCE_SUFFIXES
          Default suffix for a *.java file.
static int SOURCE_TYPE
          Constant indicating that this locator is for Java sources.
 
Fields inherited from class oracle.jdeveloper.java.locator.BaseClassLocator
EMPTY_COLLECTION, EMPTY_LOCATOR, EMPTY_STRING_ARRAY
 
Constructor Summary
URLClassLocator(java.net.URL rootURL, int fileType)
          Constructs a new URLClassLocator.
 
Method Summary
 java.net.URL getClassURL(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
protected  int getFileType()
          Fetch the file type registered for this class locator.
protected  java.net.URL getRootURL()
          Fetch the root URL associated with this class locator.
 java.net.URL getSourceURL(java.lang.String fqClassName)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
protected  boolean isClassTypeLocator()
          Whether this locator is of CLASS_TYPE.
protected  boolean isMatchingFileType(java.lang.String filename)
          Utility routine which checks if the given filename matches the file type registered for this class locator instance.
protected  boolean isMatchingFileType(java.net.URL url)
          Utility routine which checks if the given URL matches the file type registered for this class locator instance.
protected  boolean isSourceTypeLocator()
          Whether this locator is of SOURCE_TYPE.
 
Methods inherited from class oracle.jdeveloper.java.locator.BaseClassLocator
addToCollection, buildFQName, buildIndexInterruptibly, checkInterrupt, ensureValid, getAllClasses, getAllClasses, getAllClasses, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllPackages, getAllPackages, getAllPackages, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getClassesByName, getClassesByNameInterruptibly, getClassesByPrefix, getClassesByPrefixInterruptibly, getClassesInPackage, getClassesInPackage, getClassesInPackageInterruptibly, getClassesInPackageInterruptibly, getClassURLInterruptibly, getNameCascades, getNameParts, getPackages, getPackages, getPackagesInterruptibly, getPackagesInterruptibly, getResourceURLs, getSourceURLInterruptibly, getStringArray, getURLInterruptibly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jdeveloper.java.JavaClassLocator
buildIndex, getURL
 
Methods inherited from interface oracle.jdeveloper.java.JavaResourceLocator
getResourceURL
 

Field Detail

_rootURL

protected java.net.URL _rootURL
The root directory that we are based out of.


_fileType

protected int _fileType
The file type we are searching for, either CLASS_TYPE or SOURCE_TYPE.


CLASS_TYPE

public static final int CLASS_TYPE
Constant indicating that this locator is for Java classes.

See Also:
Constant Field Values

SOURCE_TYPE

public static final int SOURCE_TYPE
Constant indicating that this locator is for Java sources.

See Also:
Constant Field Values

CLASS_SUFFIXES

public static final java.lang.String[] CLASS_SUFFIXES
Default suffix for a *.class file.


SOURCE_SUFFIXES

public static final java.lang.String[] SOURCE_SUFFIXES
Default suffix for a *.java file.

Constructor Detail

URLClassLocator

public URLClassLocator(java.net.URL rootURL,
                       int fileType)
Constructs a new URLClassLocator.

Parameters:
rootURL - the root URL we are working with
fileType - the file type, either CLASS_TYPE or SOURCE_TYPE
Method Detail

getRootURL

protected java.net.URL getRootURL()
Fetch the root URL associated with this class locator.

Returns:
the root URL

getFileType

protected int getFileType()
Fetch the file type registered for this class locator.


isSourceTypeLocator

protected boolean isSourceTypeLocator()
Whether this locator is of SOURCE_TYPE.


isClassTypeLocator

protected boolean isClassTypeLocator()
Whether this locator is of CLASS_TYPE.


isMatchingFileType

protected boolean isMatchingFileType(java.net.URL url)
Utility routine which checks if the given URL matches the file type registered for this class locator instance.

Parameters:
url - the URL of the file to check
Returns:
true if the file type matches

isMatchingFileType

protected boolean isMatchingFileType(java.lang.String filename)
Utility routine which checks if the given filename matches the file type registered for this class locator instance.

Parameters:
filename - the name of the file to check
Returns:
true if the file type matches

getSourceURL

public java.net.URL getSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This may return null if a source URL is not available for the given fully-qualified class name.

Parameters:
fqClassName - the fully-qualified class name in dotted notation

getClassURL

public java.net.URL getClassURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class name. This may return null if a given class URL is not available for the given fully-qualified class name.

Parameters:
fqClassName - the fully-qualified class name in dotted notation
Returns:
the Java *.class URL, or null if it is not found

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

E13403-04

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