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

E13403-03

oracle.jdeveloper.java.provider
Class ProjectFileProvider

java.lang.Object
  extended by oracle.jdeveloper.java.provider.BaseFileProvider
      extended by oracle.jdeveloper.java.provider.CachedFileProvider
          extended by oracle.jdeveloper.java.provider.ProjectFileProvider
All Implemented Interfaces:
JavaProvider, JavaProvider2, CacheSupport, JavaFileProvider, ProviderConstants

public class ProjectFileProvider
extends CachedFileProvider

The ProjectFileProvider is an implementation of the JavaFileProvider interface which relies on the path information of a Project for locating Java source and class files. This implementation will respond to changes in the project paths by updating its class locator, and flushing its cache.


Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.jdeveloper.java.provider.CachedFileProvider
CachedFileProvider.SourceFileTracker
 
Nested classes/interfaces inherited from class oracle.jdeveloper.java.provider.BaseFileProvider
BaseFileProvider.BaseClass, BaseFileProvider.BasePackage
 
Field Summary
protected  oracle.jdeveloper.java.provider.ProjectFileProvider.ProjectObserver _projectObserver
          Our observer for tracking changes to the project.
 
Fields inherited from class oracle.jdeveloper.java.provider.CachedFileProvider
_arrayCacheMap, _cacheLock, _cacheRefCount, _classCacheMap, _classFileCacheMap, _defaultClassLoader, _lastCacheFlushedTime, _nullClassLoader, _packageCacheMap, _sourceFileCacheMap, CLASS_NOT_FOUND
 
Fields inherited from class oracle.jdeveloper.java.provider.BaseFileProvider
context
 
Fields inherited from interface oracle.jdeveloper.java.provider.ProviderConstants
CLASS_TYPE, EMPTY_COLLECTION, SOURCE_TYPE, UNKNOWN_TYPE
 
Constructor Summary
ProjectFileProvider(ProviderContext e, Project project)
          Constructs a new ProjectFileProvider instance using the given project to locate Java source and class files.
ProjectFileProvider(ProviderContext e, Project project, java.util.Map cache)
           
 
Method Summary
 JavaClassLocator getClassLocator()
          Fetch the class locator to use for locating files.
 JavaClassLocator getClassLocatorInterruptibly()
          Get the class locator for this provider.
static ProjectFileProvider getInstance(Project project)
          Static factory method for fetching an instance of the JavaFileProvider for the given project.
static ProjectFileProvider getInstance(Project project, java.lang.Object key)
          Static factory method for fetching an instance of the JavaFileProvider for the given project.
 SourceClass getProjectSourceClass(java.lang.String fqClassName)
          Fetch the SourceClass instance for the given fully-qualified class name.
protected  int getTargetJdkVersion()
           
protected  void handleProjectClose()
          Utility routine to handle any necessary cleanup when the project closes.
protected  void handleProjectContentsChange()
          Utility routine to handle a change in the contents of the project (i.e., class added or removed.)
protected  void handleProjectLoad()
          Utility routine to handle any necessary setup or cleanup when the project is opened or reopened (revert).
 void handleProjectPathsChange()
          Utility routine to handle a change in the paths of the project
protected  boolean isProjectSourceURL(java.net.URL sourceURL)
          Fetch whether this source URL is part of the project's source path (including project dependencies).
protected static boolean pathContainsURL(URLPath path, java.net.URL url)
          Utility to check whether the specified URL is present in one of the directories specified by URLPath.
 void reloadClassLocator()
          Force the class locator to be reloaded.
 
Methods inherited from class oracle.jdeveloper.java.provider.CachedFileProvider
beginCacheUse, clearAllData, clearArrayCache, clearClassCache, clearClassFileCache, clearClassLoader, clearCompiledInfo, clearPackageCache, clearSourceFileCache, createSourceFile, endCacheUse, expireAllSourceFiles, flushCache, flushFoundCache, getArrayTypeImpl, getClassExactImpl, getClassExactImplInterruptibly, getClassFileImpl, getClassLoader, getClassLoader, getPackageImpl, getScopeDescription, getSourceFileImpl, lastCacheFlushed, lookupCachedSourceFile, notifyOfChange, removeCachedSourceFile, removeCachedSourceFile, storeCachedSourceFile
 
Methods inherited from class oracle.jdeveloper.java.provider.BaseFileProvider
checkInterrupt, getArrayType, getClass, getClass, getClassByVMName, getClassByVMNameImpl, getClassByVMNameInterruptibly, getClassImpl, getClassImpl, getClassInterruptibly, getClassInterruptibly, getClassLeftToRight, getClassLeftToRightImpl, getClassLeftToRightInterruptibly, getConteXt, getFile, getFileType, getInnerClassByVMName, getJavaFile, getPackage, getPackage, getPrimitiveClass, getSourceClass, getSourceClassByHint, getSourceClassImpl, getSourceClassInterruptibly, getSourceFile, getSourceFile, getTextBuffer, locateClass, locateClass, locateClassByVMName, locateSourceClass, locateSourceClass, setConteXt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_projectObserver

protected final oracle.jdeveloper.java.provider.ProjectFileProvider.ProjectObserver _projectObserver
Our observer for tracking changes to the project.

Constructor Detail

ProjectFileProvider

public ProjectFileProvider(ProviderContext e,
                           Project project)
Constructs a new ProjectFileProvider instance using the given project to locate Java source and class files.

Parameters:
project - the project to use

ProjectFileProvider

public ProjectFileProvider(ProviderContext e,
                           Project project,
                           java.util.Map cache)
Method Detail

getInstance

public static ProjectFileProvider getInstance(Project project)
Static factory method for fetching an instance of the JavaFileProvider for the given project.

Parameters:
project - the project to use for locating files

getInstance

public static ProjectFileProvider getInstance(Project project,
                                              java.lang.Object key)
Static factory method for fetching an instance of the JavaFileProvider for the given project.

Parameters:
project - the project to use for locating files

handleProjectClose

protected void handleProjectClose()
Utility routine to handle any necessary cleanup when the project closes.


handleProjectLoad

protected void handleProjectLoad()
Utility routine to handle any necessary setup or cleanup when the project is opened or reopened (revert).


handleProjectPathsChange

public void handleProjectPathsChange()
Utility routine to handle a change in the paths of the project


handleProjectContentsChange

protected void handleProjectContentsChange()
Utility routine to handle a change in the contents of the project (i.e., class added or removed.)


getClassLocator

public JavaClassLocator getClassLocator()
Fetch the class locator to use for locating files.

Specified by:
getClassLocator in class BaseFileProvider

getClassLocatorInterruptibly

public JavaClassLocator getClassLocatorInterruptibly()
                                              throws java.lang.InterruptedException
Description copied from class: BaseFileProvider
Get the class locator for this provider. May be overridden by subclasses to provide support for interruption.

Overrides:
getClassLocatorInterruptibly in class BaseFileProvider
Returns:
the class locator for this provider
Throws:
java.lang.InterruptedException - if the calling thread is interrupted while the locator is being created

reloadClassLocator

public void reloadClassLocator()
Force the class locator to be reloaded. This is not meant as a public API, but as a workaround for a UI editor-specific problem.


getProjectSourceClass

public SourceClass getProjectSourceClass(java.lang.String fqClassName)
Fetch the SourceClass instance for the given fully-qualified class name. The type name specified should be a fully-qualified class (inner classes supported). This will search for sources only in the project's source path or in the source path of the project's dependencies. If there is no Project associated with this JavaManager, then this will return null.

Parameters:
fqClassName - the fully-qualified class name in dotted notation, such as "java.lang.Object" or "java.util.Map.Entry"
Returns:
the SourceClass instance for the given name, or null if the source for the given class cannot be found

isProjectSourceURL

protected boolean isProjectSourceURL(java.net.URL sourceURL)
Fetch whether this source URL is part of the project's source path (including project dependencies). Returns true if it is, false otherwise (such as for libraries or JDK).


pathContainsURL

protected static boolean pathContainsURL(URLPath path,
                                         java.net.URL url)
Utility to check whether the specified URL is present in one of the directories specified by URLPath.


getTargetJdkVersion

protected int getTargetJdkVersion()
Overrides:
getTargetJdkVersion in class BaseFileProvider
Returns:
Valid values are JavaConstants.J2SE_*.

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

E13403-03

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