Java Doc for ClassPath.java in  » IDE-Netbeans » api » org » netbeans » api » java » classpath » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » api » org.netbeans.api.java.classpath 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.api.java.classpath.ClassPath

ClassPath
final public class ClassPath (Code)
ClassPath objects should be used to access contents of the ClassPath, searching for resources, objects reachable using the ClassPath at runtime. It is intended to replace some of the functionality of org.openide.filesystems.Repository.
ClassPath instances should be used to map from Java-style resource names to FileObject (NetBeans-style resource) and vice versa. It should be also used whenever the operation requires inspection of development or runtime project environment instead. The service supports either searching in the classpath resource space, properly hiding resources as the ClassLoader would do at runtime. It can effectively say whether a FileObject is within the reach of a ClassPath or whether it is reachable (visible to a ClassLoader). One can translate filenames to resource names and vice versa.

A client may obtain a ClassPath instance using ClassPath.getClassPath(id) static method, where the ID is an abstract name for the classpath wanted. There are some predefined classpath names predefined as symbolic constants, following individual types of services (compiler, debugger, executor). Names are not limited to the listed ones; an extension module might add its own private classpath type.


Inner Class :final public class Entry

Field Summary
final public static  StringBOOT
     Boot ClassPath of the JDK.
final public static  StringCOMPILE
     ClassPath for compiling things.
final public static  StringDEBUG
    
final public static  StringEXECUTE
     Classpath setting for executing things.
final public static  StringPROP_ENTRIES
    
final public static  StringPROP_INCLUDES
     Property to be fired when include/exclude set changes.
final public static  StringPROP_ROOTS
    
final public static  StringSOURCE
     ClassPath for project sources.


Method Summary
final public synchronized  voidaddPropertyChangeListener(PropertyChangeListener l)
     Adds a property change listener to the bean.
final public  booleancontains(FileObject f)
     Checks whether a FileObject lies on this classpath.
public  List<ClassPath.Entry>entries()
     Returns list of classpath entries from the ClassPath definition. The implementation must ensure that modifications done to the List are banned or at least not reflected in other Lists returned by this ClassPath instance.
final public  List<FileObject>findAllResources(String resourceName)
     Gives out an ordered collection containing all FileObjects, which correspond to a given ResourceName; only the first one is seen by the ClassLoader at runtime or can be linked against.
final public  FileObjectfindOwnerRoot(FileObject resource)
     Finds a root in this ClassPath, that owns the given file.
final public  FileObjectfindResource(String resourceName)
     Returns a FileObject for the specified resource.
final  voidfirePropertyChange(String what, Object oldV, Object newV, Object propagationId)
     Fires a property change event on the specified property, notifying the old and new values.
final public synchronized  ClassLoadergetClassLoader(boolean cache)
     Returns a ClassLoader for loading classes from this ClassPath.

If cache is false, then the method will always return a new class loader.

public static  ClassPathgetClassPath(FileObject f, String id)
     Find the classpath of a given type, if any, defined for a given file.

This method may return null, if:

  • the path type (id parameter) is not recognized
  • the path type is not defined for the given file object

Generally you may pass either an individual Java file, or the root of a Java package tree, interchangeably, since in most cases all files in a given tree will share a single classpath.

Typically classpaths for files are defined by the owning project, but there may be other ways classpaths are defined.

final public  StringgetResourceName(FileObject f)
     Creates a suitable resource name for the given FileObject within the classpath.
final public  StringgetResourceName(FileObject f, char dirSep, boolean includeExt)
     Computes a resource name for the FileObject, which uses `pathSep' character as a directory separator.
public  FileObject[]getRoots()
     Retrieves valid roots of ClassPath, in the proper order. If there's an entry in the ClassPath, which cannot be accessed, its root is not returned by this method.
final public  booleanisResourceVisible(FileObject resource)
     Determines if the resource is visible in the classpath, that is if the file will be reached when a process attempts to load a resource of that name.
final public  voidremovePropertyChangeListener(PropertyChangeListener l)
     Removes the listener registered by addPropertyChangeListener .
synchronized  voidresetClassLoader(ClassLoader cl)
    
public  StringtoString()
    

Field Detail
BOOT
final public static String BOOT(Code)
Boot ClassPath of the JDK. This type can be used to learn boot classpath which should be used for the file in question.

It corresponds to the -Xbootclasspath and -Xext options to java (the Java launcher): i.e. all compiled classes in the JRE that will be needed to run the program. It may also be thought of as corresponding to the classes loadable by the primordial bootstrap class loader plus the standard extension and endorsed-library class loaders; i.e. class loaders lying below the regular application startup loader and any custom loaders. Generally there ought to be a single boot classpath for the entire application.


since:
   org.netbeans.api.java/1 1.4



COMPILE
final public static String COMPILE(Code)
ClassPath for compiling things. This type can be used to learn compilation time classpath for the file in question.

It corresponds to the -classpath option to javac: i.e. already-compiled classes which some new sources need to compile against, besides what is already in the JRE.




DEBUG
final public static String DEBUG(Code)
Classpath for debugging things



EXECUTE
final public static String EXECUTE(Code)
Classpath setting for executing things. This type can be used to learn runtime time classpath for execution of the file in question.

It corresponds to the -classpath option to java (the Java launcher): i.e. all compiled classes outside the JRE that will be needed to run the program, or at least to load a certain class. It may also be thought of as corresponding to the list of URLs in a URLClassLoader (plus URLs present in parent class loaders but excluding the bootstrap and extension class loaders).




PROP_ENTRIES
final public static String PROP_ENTRIES(Code)
Name of the "entries" property



PROP_INCLUDES
final public static String PROP_INCLUDES(Code)
Property to be fired when include/exclude set changes.
See Also:   FilteringPathResourceImplementation
since:
   org.netbeans.api.java/1 1.13



PROP_ROOTS
final public static String PROP_ROOTS(Code)
Name of the "roots" property



SOURCE
final public static String SOURCE(Code)
ClassPath for project sources. This type can be used to learn package root of the file in question.

It is similar to the -sourcepath option of javac.

For typical source files, the sourcepath will consist of one element: the package root of the source file. If more than one package root is to be compiled together, all the sources should share a sourcepath with multiple roots.

Note that each source file for which editor code completion (and similar actions) should work should have a classpath of this type.


since:
   org.netbeans.api.java/1 1.4





Method Detail
addPropertyChangeListener
final public synchronized void addPropertyChangeListener(PropertyChangeListener l)(Code)
Adds a property change listener to the bean.
Parameters:
  l - a listener to add



contains
final public boolean contains(FileObject f)(Code)
Checks whether a FileObject lies on this classpath. FilteringPathResourceImplementation is considered. true, if the parameter is inside one of the classpath subtrees,false otherwise.
Parameters:
  f - the FileObject to check



entries
public List<ClassPath.Entry> entries()(Code)
Returns list of classpath entries from the ClassPath definition. The implementation must ensure that modifications done to the List are banned or at least not reflected in other Lists returned by this ClassPath instance. Clients must assume that the returned value is immutable. list of definition entries (Entry instances)



findAllResources
final public List<FileObject> findAllResources(String resourceName)(Code)
Gives out an ordered collection containing all FileObjects, which correspond to a given ResourceName; only the first one is seen by the ClassLoader at runtime or can be linked against. The resource name uses slashes ('/') as folder separator and must not start with slash. FilteringPathResourceImplementation may cause an actual file beneath a registered root to not be returned.
Parameters:
  resourceName - resource name list of resources identified by the given name.



findOwnerRoot
final public FileObject findOwnerRoot(FileObject resource)(Code)
Finds a root in this ClassPath, that owns the given file. File resources, that are not reachable (they are hidden by other resources, or FilteringPathResourceImplementation excluded) are still considered to be part of the classpath and "owned" by one of its roots.
Note: This implementation assumes that the FileSystem hosting a classpath root contains the entire classpath subtree rooted at that root folder. classpath root, which hosts the specified resouce. It can return null,if the resource is not within the ClassPath contents.
Parameters:
  resource - resource to find root for.



findResource
final public FileObject findResource(String resourceName)(Code)
Returns a FileObject for the specified resource. May return null, if the resource does not exist, or is not reachable through this ClassPath.
If the resourceName identifies a package, this method will return the FileObject for the first package fragment in the ClassPath. FilteringPathResourceImplementation may cause an actual file beneath a registered root to not be returned. Note: do not pass names starting with slash to this method.
Parameters:
  resourceName - name of the resource as it would be passedto ClassLoader.getResource FileObject for the resource, or null if the resource cannotbe found in this ClassPath.



firePropertyChange
final void firePropertyChange(String what, Object oldV, Object newV, Object propagationId)(Code)
Fires a property change event on the specified property, notifying the old and new values.
Parameters:
  what - name of the property
Parameters:
  oldV - old value
Parameters:
  newV - new value



getClassLoader
final public synchronized ClassLoader getClassLoader(boolean cache)(Code)
Returns a ClassLoader for loading classes from this ClassPath.

If cache is false, then the method will always return a new class loader. If that parameter is true, the method may return a loader which survived from a previous call to the same ClassPath.
Parameters:
  cache - true if it is permissible to cache class loaders between calls class loader which uses the roots in this class path to search for classes and resources
since:
   1.2.1




getClassPath
public static ClassPath getClassPath(FileObject f, String id)(Code)
Find the classpath of a given type, if any, defined for a given file.

This method may return null, if:

  • the path type (id parameter) is not recognized
  • the path type is not defined for the given file object

Generally you may pass either an individual Java file, or the root of a Java package tree, interchangeably, since in most cases all files in a given tree will share a single classpath.

Typically classpaths for files are defined by the owning project, but there may be other ways classpaths are defined. See ClassPathProvider for more details.


Parameters:
  f - the file, whose classpath settings should be returned (may not be null as of org.netbeans.api.java/1 1.4)
Parameters:
  id - the type of the classpath (e.g. ClassPath.COMPILE) classpath of the desired type for the given file object, or null, ifthere is no classpath available
See Also:   ClassPathProvider



getResourceName
final public String getResourceName(FileObject f)(Code)
Creates a suitable resource name for the given FileObject within the classpath. The method will return null if the fileobject is not underneath any of classpath roots.
The returned name uses uses slashes ('/') as folder separators and dot ('.') to separate file name and its extension. Note that if the file object is in the classpath subtree, but is not reachable (it is hidden by some other resource, or FilteringPathResourceImplementation excluded ), the resource name is still returned. Java-style resource name for the given file object (the empty string for the package root itself), or null if notwithin the classpath
Parameters:
  f - FileObject whose resource name is requested



getResourceName
final public String getResourceName(FileObject f, char dirSep, boolean includeExt)(Code)
Computes a resource name for the FileObject, which uses `pathSep' character as a directory separator. The resource name can be returned without the file extension, if desired. Note that parent folder names are always returned with extension, if they have some.
Parameters:
  f - FileObject whose resource name is requested.
Parameters:
  dirSep - directory separator character
Parameters:
  includeExt - whether the FileObject's extension should be included in the result resource name for the given FileObject (the empty string for the package root itself) or null



getRoots
public FileObject[] getRoots()(Code)
Retrieves valid roots of ClassPath, in the proper order. If there's an entry in the ClassPath, which cannot be accessed, its root is not returned by this method. FileObjects returned are all folders. Note that this method ignores FilteringPathResourceImplementation includes and excludes . array of roots (folders) of the classpath. Never returnsnull.



isResourceVisible
final public boolean isResourceVisible(FileObject resource)(Code)
Determines if the resource is visible in the classpath, that is if the file will be reached when a process attempts to load a resource of that name. It will return false when the resource is not contained in the classpath, or the resource is FilteringPathResourceImplementation excluded .
Parameters:
  resource - the resource whose visibility should be tested true, if the resource is contained in the classpath and visible;false otherwise.



removePropertyChangeListener
final public void removePropertyChangeListener(PropertyChangeListener l)(Code)
Removes the listener registered by addPropertyChangeListener .
Parameters:
  l - a listener to remove



resetClassLoader
synchronized void resetClassLoader(ClassLoader cl)(Code)



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.