Skip navigation links

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

E13403-06


oracle.jdeveloper.java.locator
Class ProjectClassLocator

java.lang.Object
  extended by oracle.jdeveloper.java.locator.BaseClassLocator
      extended by oracle.jdeveloper.java.locator.ProjectClassLocator

All Implemented Interfaces:
JavaClassLocator, JavaClassLocator2, JavaResourceLocator

public class ProjectClassLocator
extends BaseClassLocator

The ProjectClassLocator is an implementation of the JavaClassLocator to locate classes for a Project instance.


Field Summary
protected static boolean ALL_LIBRARIES
          Constant indicating all libraries
protected static boolean EXPORTED_LIBRARIES
          Constant indicating we want only exported libraries.

 

Fields inherited from class oracle.jdeveloper.java.locator.BaseClassLocator
EMPTY_COLLECTION, EMPTY_LOCATOR, EMPTY_STRING_ARRAY

 

Method Summary
 void buildIndex()
          Instructs this class locator to start building its index for locating files.
 void buildIndexInterruptibly()
          Instructs this class locator to start building its index for locating files.
protected static URLPath getAddedClassPathFor(Project project)
          Utility routine to fetch the added classpath for the given project.
protected  void getAllClasses(java.util.Collection<java.lang.String> out, ClassNameFilter filter)
          Fetch all of the top-level classes that are known by this locator.
protected  void getAllClassesInterruptibly(java.util.Collection<java.lang.String> out, ClassNameFilter filter)
          Get all of the top-level classes that are known by this locator.
protected  void getAllPackages(java.util.Collection<java.lang.String> out, PackageNameFilter filter)
          Fetch all of the full packges that are known by this locator.
protected  void getAllPackagesInterruptibly(java.util.Collection<java.lang.String> out, PackageNameFilter filter)
          Get all of the full packges that are known by this locator.
protected  void getClassesInPackage(java.lang.String packagePrefix, java.util.Collection<java.lang.String> out)
          Fetch the list of top-level classes within the given package, adding them to the out collection provided.
protected  void getClassesInPackageInterruptibly(java.lang.String packagePrefix, java.util.Collection<java.lang.String> out)
          Get the list of top-level classes within the package.
 java.net.URL getClassURL(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
 java.net.URL getClassURLInterruptibly(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
static java.util.Collection getDependentsFor(Project project)
          Utility routine to fetch the dependents for the given project.
protected static ProjectClassLocator getInstance(Project project)
          Get the class locator instance for a project.
protected static ProjectClassLocator getInstanceInterruptibly(Project project)
          Get the class locator instance for a project.
protected static Library getJDKFor(Project project)
          Utility routine to fetch the JDK for the given project.
protected static Library[] getLibrariesFor(Project project, boolean exportsOnly)
          Utility routine to fetch the libraries for the given project.
protected static URLPath getModuleConfigClassPathFor(Project project)
          Utility routine to fetch the module config classpath for the given project.
 java.net.URL getNonProjectSourceURL(java.lang.String fqClassName)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
 java.net.URL getNonProjectSourceURLInterruptibly(java.lang.String fqClassName)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
protected static java.net.URL getOutputURLFor(Project project)
          Utility routine to fetch the output URL for the given project.
protected  void getPackages(java.lang.String packagePrefix, java.util.Collection<java.lang.String> out)
          Fetch the list of subpackages within the given package, adding them to the out collection provided.
protected  void getPackagesInterruptibly(java.lang.String packagePrefix, java.util.Collection<java.lang.String> out)
          Get the list of subpackages within the given package.
 java.net.URL getProjectSourceURL(java.lang.String fqClassName, boolean includeDependencies)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
 java.net.URL getProjectSourceURLInterruptibly(java.lang.String fqClassName, boolean includeDependencies)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
 java.net.URL getResourceURL(java.lang.String resourceName)
          Fetch the URL for the Java resource file given the resource name.
static URLPath getSourcePathFor(Project project)
          Utility routine to fetch the source path for the given project.
 java.net.URL getSourceURL(java.lang.String fqClassName)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
 java.net.URL getSourceURLInterruptibly(java.lang.String fqClassName)
          Fetch the URL for the SourceFile for the given fully-qualified Java class name.
 java.net.URL getURL(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
 java.net.URL getURLInterruptibly(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
protected static void processDependenciesRecurse(Project project, java.util.List traversedList, java.util.List libraryList, java.util.List<oracle.jdeveloper.java.locator.DeploymentClassLocator.DeploymentPaths> deploymentList, URLPath sourcePath, URLPath classPath, boolean exportsOnly, boolean checkInterrupt)
          Utility routine which recursively processes a project's dependencies.

 

Methods inherited from class oracle.jdeveloper.java.locator.BaseClassLocator
addToCollection, buildFQName, checkInterrupt, ensureValid, getAllClasses, getAllClasses, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllPackages, getAllPackages, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getClassesByName, getClassesByNameInterruptibly, getClassesByPrefix, getClassesByPrefixInterruptibly, getClassesInPackage, getClassesInPackageInterruptibly, getNameCascades, getNameParts, getPackages, getPackagesInterruptibly, getResourceURLs, getStringArray

 

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

 

Field Detail

EXPORTED_LIBRARIES

protected static final boolean EXPORTED_LIBRARIES
Constant indicating we want only exported libraries.
See Also:
Constant Field Values

ALL_LIBRARIES

protected static final boolean ALL_LIBRARIES
Constant indicating all libraries
See Also:
Constant Field Values

Method Detail

getInstance

protected static ProjectClassLocator getInstance(Project project)
Get the class locator instance for a project.
Parameters:
project - the project
Returns:
the project class locator

getInstanceInterruptibly

protected static ProjectClassLocator getInstanceInterruptibly(Project project)
                                                       throws java.lang.InterruptedException
Get the class locator instance for a project.
Parameters:
project - the project
Returns:
the project class locator
Throws:
java.lang.InterruptedException - if the calling thread is interrupted while creating the class locator instance

processDependenciesRecurse

protected static void processDependenciesRecurse(Project project,
                                                 java.util.List traversedList,
                                                 java.util.List libraryList,
                                                 java.util.List<oracle.jdeveloper.java.locator.DeploymentClassLocator.DeploymentPaths> deploymentList,
                                                 URLPath sourcePath,
                                                 URLPath classPath,
                                                 boolean exportsOnly,
                                                 boolean checkInterrupt)
                                          throws java.lang.InterruptedException
Utility routine which recursively processes a project's dependencies. It keeps track of which projects have been traversed to avoid infinite recursion in the case of circular dependencies.
Parameters:
project - the project to process the paths and dependencies of
traversedList - the list of projects that have already been traversed
libraryList - the list of libraries that are part of the project or any of its dependents
deploymentList - the list of deployment profiles that the project depends on
sourcePath - the sourcepath of the project or any of its dependents
classPath - the classpath of the project or any of its dependents
exportsOnly - whether to include only exported libraries (vs. all libraries)
checkInterrupt - whether to check for interruption
Throws:
java.lang.InterruptedException - if the operation is interrupted

getDependentsFor

public static java.util.Collection getDependentsFor(Project project)
Utility routine to fetch the dependents for the given project.
Parameters:
project - the projects to fetch the dependents for
Returns:
the dependents of the project in a collection

getAddedClassPathFor

protected static URLPath getAddedClassPathFor(Project project)
Utility routine to fetch the added classpath for the given project.
Parameters:
project - the project to get the added classpath for
Returns:
the added url path of the project

getModuleConfigClassPathFor

protected static URLPath getModuleConfigClassPathFor(Project project)
Utility routine to fetch the module config classpath for the given project.
Parameters:
project - the project to get the module config classpath for
Returns:
the module config classpath which can be null

getOutputURLFor

protected static java.net.URL getOutputURLFor(Project project)
Utility routine to fetch the output URL for the given project.
Parameters:
project - the project to fetch the output url for
Returns:
the output url of th project

getSourcePathFor

public static URLPath getSourcePathFor(Project project)
Utility routine to fetch the source path for the given project.
Parameters:
project - the project to fetch the source path for
Returns:
the source path of the project

getJDKFor

protected static Library getJDKFor(Project project)
Utility routine to fetch the JDK for the given project.
Parameters:
project - the project to fetch the JDK for
Returns:
the JDK for the project

getLibrariesFor

protected static Library[] getLibrariesFor(Project project,
                                           boolean exportsOnly)
Utility routine to fetch the libraries for the given project.
Parameters:
project - the project to fetch the libraries for
exportsOnly - whether to include only exports, vs. all libraries
Returns:
the libraries for the given project

buildIndex

public void buildIndex()
Instructs this class locator to start building its index for locating files. This method runs on the current thread and blocks until the index build is completed. To build the index in the background, call this method on a background thread.

buildIndexInterruptibly

public void buildIndexInterruptibly()
                             throws java.lang.InterruptedException
Description copied from interface: JavaClassLocator2
Instructs this class locator to start building its index for locating files. This method runs on the current thread and blocks until the index build is completed. To build the index in the background, call this method on a background thread.
Specified by:
buildIndexInterruptibly in interface JavaClassLocator2
Overrides:
buildIndexInterruptibly in class BaseClassLocator
Throws:
java.lang.InterruptedException - if the build is interrupted

getPackages

protected void getPackages(java.lang.String packagePrefix,
                           java.util.Collection<java.lang.String> out)
Fetch the list of subpackages within the given package, adding them to the out collection provided.
Specified by:
getPackages in class BaseClassLocator
Parameters:
packagePrefix - the package prefix, i.e., "java.io"
out - the collection to add the packages

getPackagesInterruptibly

protected void getPackagesInterruptibly(java.lang.String packagePrefix,
                                        java.util.Collection<java.lang.String> out)
                                 throws java.lang.InterruptedException
Description copied from class: BaseClassLocator
Get the list of subpackages within the given package. Can be overridden by subclasses that support interruption.
Overrides:
getPackagesInterruptibly in class BaseClassLocator
Parameters:
packagePrefix - the package prefix
out - the collection where packages are added
Throws:
java.lang.InterruptedException - if the operation is interrupted

getClassesInPackage

protected void getClassesInPackage(java.lang.String packagePrefix,
                                   java.util.Collection<java.lang.String> out)
Fetch the list of top-level classes within the given package, adding them to the out collection provided.
Specified by:
getClassesInPackage in class BaseClassLocator
Parameters:
packagePrefix - the package prefix, i.e., "java.io"
out - the collection to add the class names

getClassesInPackageInterruptibly

protected void getClassesInPackageInterruptibly(java.lang.String packagePrefix,
                                                java.util.Collection<java.lang.String> out)
                                         throws java.lang.InterruptedException
Description copied from class: BaseClassLocator
Get the list of top-level classes within the package. Can be overridden by subclasses that support interruption.
Overrides:
getClassesInPackageInterruptibly in class BaseClassLocator
Parameters:
packagePrefix - the package prefix
out - the collection where packages are added
Throws:
java.lang.InterruptedException - if the operation is interrupted

getAllClasses

protected void getAllClasses(java.util.Collection<java.lang.String> out,
                             ClassNameFilter filter)
Fetch all of the top-level classes that are known by this locator. This will return fully-qualified class names, such as "java.util.List".
Specified by:
getAllClasses in class BaseClassLocator
Parameters:
out - the collection to add the fully-qualified class names
filter - the class name filter to use

getAllClassesInterruptibly

protected void getAllClassesInterruptibly(java.util.Collection<java.lang.String> out,
                                          ClassNameFilter filter)
                                   throws java.lang.InterruptedException
Description copied from class: BaseClassLocator
Get all of the top-level classes that are known by this locator. This can be overridden by subclasses that provide support for interruption.
Overrides:
getAllClassesInterruptibly in class BaseClassLocator
Parameters:
out - the collection where fully qualified class names are added
filter - the class name filter to use
Throws:
java.lang.InterruptedException - if the operation is interrupted

getAllPackages

protected void getAllPackages(java.util.Collection<java.lang.String> out,
                              PackageNameFilter filter)
Fetch all of the full packges that are known by this locator. This will return fully-qualified package names, such as "java.util" or "java.io". This collection will not include the top-level package "".
Specified by:
getAllPackages in class BaseClassLocator
Parameters:
out - the collection to add the full package names
filter - the pckage name filter to use

getAllPackagesInterruptibly

protected void getAllPackagesInterruptibly(java.util.Collection<java.lang.String> out,
                                           PackageNameFilter filter)
                                    throws java.lang.InterruptedException
Description copied from class: BaseClassLocator
Get all of the full packges that are known by this locator. Can be overridden by subclasses that support interruption.
Overrides:
getAllPackagesInterruptibly in class BaseClassLocator
Parameters:
out - the collection where package names are added
filter - the package name filter to use
Throws:
java.lang.InterruptedException - if the operation is interrupted

getURL

public java.net.URL getURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class name. The implementation may choose either a class URL or source URL. For example, an implementation may decide to return the URL that is more up-to-date, or an URL that would be faster to load. Note that if the given class is an inner class, this routine may return the URL for the Java source that contains the owning outer class.
Parameters:
fqClassName - the fully-qualified class name in dotted notation, i.e., java.util.List
Returns:
the URL for the JavaFile containing the given class

getURLInterruptibly

public java.net.URL getURLInterruptibly(java.lang.String fqClassName)
                                 throws java.lang.InterruptedException
Description copied from interface: JavaClassLocator2
Fetch the URL for the JavaFile for the given fully-qualified Java class name. The implementation may choose either a class URL or source URL. For example, an implementation may decide to return the URL that is more up-to-date, or an URL that would be faster to load. Note that if the given class is an inner class, this routine may return the URL for the Java source that contains the owning outer class.
Specified by:
getURLInterruptibly in interface JavaClassLocator2
Overrides:
getURLInterruptibly in class BaseClassLocator
Parameters:
fqClassName - the fully-qualified class name in dotted notation, i.e., java.util.List
Returns:
the URL for the JavaFile containing the given class
Throws:
java.lang.InterruptedException - if the operation is interrupted

getProjectSourceURL

public java.net.URL getProjectSourceURL(java.lang.String fqClassName,
                                        boolean includeDependencies)
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This will search the project's source path only, and skip libraries/JDK. If dependent projects are requested, this will also search the source path of projects the current project depends on.
Parameters:
fqClassName - the fully-qualified class name in dotted notation
includeDependencies - include the projects depended on by this current project

getProjectSourceURLInterruptibly

public java.net.URL getProjectSourceURLInterruptibly(java.lang.String fqClassName,
                                                     boolean includeDependencies)
                                              throws java.lang.InterruptedException
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This will search the project's source path only, and skip libraries/JDK. If dependent projects are requested, this will also search the source path of projects the current project depends on.
Parameters:
fqClassName - the fully-qualified class name in dotted notation
includeDependencies - include the projects depended on by this current project
Throws:
java.lang.InterruptedException - if the operation is interrupted

getNonProjectSourceURL

public java.net.URL getNonProjectSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This will search the project's paths besides the source path, such as searching libraries, JDK, or libraries from project dependencies.

getNonProjectSourceURLInterruptibly

public java.net.URL getNonProjectSourceURLInterruptibly(java.lang.String fqClassName)
                                                 throws java.lang.InterruptedException
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This will search the project's paths besides the source path, such as searching libraries, JDK, or libraries from project dependencies.
Throws:
java.lang.InterruptedException - if the operation is interrupted

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

getSourceURLInterruptibly

public java.net.URL getSourceURLInterruptibly(java.lang.String fqClassName)
                                       throws java.lang.InterruptedException
Description copied from interface: JavaClassLocator2
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.
Specified by:
getSourceURLInterruptibly in interface JavaClassLocator2
Overrides:
getSourceURLInterruptibly in class BaseClassLocator
Parameters:
fqClassName - the fully-qualified class name in dotted notation
Throws:
java.lang.InterruptedException - if the operation is interrupted

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

getClassURLInterruptibly

public java.net.URL getClassURLInterruptibly(java.lang.String fqClassName)
                                      throws java.lang.InterruptedException
Description copied from interface: JavaClassLocator2
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.
Specified by:
getClassURLInterruptibly in interface JavaClassLocator2
Overrides:
getClassURLInterruptibly in class BaseClassLocator
Parameters:
fqClassName - the fully-qualified class name in dotted notation
Throws:
java.lang.InterruptedException - if the operation is interrupted

getResourceURL

public java.net.URL getResourceURL(java.lang.String resourceName)
Fetch the URL for the Java resource file given the resource name. This should include the full path of the resource, minus any root directory that is part of the class path.
Parameters:
resourceName - the full name of the resource including any file extensions
Returns:
the Java resource URL, or null if it is not found

Skip navigation links

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

E13403-06


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