Java Doc for ClassPathEntry.java in  » J2EE » Enhydra-Application-Framework » com » lutris » classloader » 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 » J2EE » Enhydra Application Framework » com.lutris.classloader 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.lutris.classloader.ClassPathEntry

ClassPathEntry
public class ClassPathEntry (Code)

Summary:

A class path entry which is a URL representing either a local or a remote directory or zip file. Manages all the details for zip file support. For example, local zip files (once opened) are kept open for the lifetime of the entry for increased performance.

Features:

  • Supports absolute and relative file names
  • Creates URL entry from given String, File, or URL
  • Adds "/" to end of URL for directories if necessary
  • Knows if URL is zip local or remote
  • Knows if URL is a zip file or directory
  • Keeps ZipFile open if the zip file is local

Note: "zip files" are files with ".zip" or ".jar" extensions.

Class Path Entries:

Example valid class path entries are:

 Files and directories on the local file system
 ../../java/classes
 /users/kristen/java/classes
 /users/kristen/java/classes/
 /users/kristen/java/zipfiles/MyClasses.zip
 /users/kristen/java/jarfiles/MyClasses.jar
 file:///users/kristen/java/classes
 file://localhost/users/kristen/java/classes
 
Files and directories on a remote file system (must be in URL format) ftp://www.foo.com/pub/java/classes file://www.foo.com/pub/java/classes/ http://www.foo.com/web/java/classes/ file://www.foo.com:8080/pub/java/zipfiles/MyClasses.zip http://www.foo.com:8080/web/java/jarfiles/MyClasses.jar

Note that the location of the entry includes the protocol, the host name, and the port while the file name is everything else. For example,

 http://www.foo.com:8080/web/java/jarfiles/MyClasses.jar
 
has the form [location][name] or
 [http://www.foo.com:8080/][/web/java/jarfiles/MyClasses.jar]
 
so the location is "http://www.foo.com:8080/" and the name is "/web/java/jarfiles/MyClasses.jar".

Note that the two references

 /users/kristen/java/classes/
 file:///users/kristen/java/classes/
 
represent the same directory on a Unix machine, and
 C|/windows/java/classes/
 file:///C|/windows/java/classes/
 
are equivalent directories on a Windows box.

But the two references

 /users/kristen/java/classes/
 file://monet.lutris.com/users/kristen/java/classes/
 
are not equivalent even if the directory /users/kristen/java/classes/ lives on the machine named monet.lutris.com and all development is on this machine. Why? Because the web (browser?) protocol is different for URLs with host information and those without. If no host is specified, the file is assumed to be on the local machine and the path is determined from the ROOT of the machine. If the host is specified, then the ftp protocol is used and the path is determined from the ftp ROOT (e.g. /users/ftp/) rather than the machine's ROOT. Thus, on a machine that support's anonymous ftp, the following two directories are the same:
 /users/ftp/pub/classes/
 file://picasso.lutris.com/pub/classes/
 
assuming the development is being done on picasso.lutris.com.

System Class Path Entries

The system class path is the system-dependent path of directories and files (e.g. CLASSPATH on Unix and Windows) used by the system class loader to load classes. Valid system class path entries are directories and zip files, specified by absolute path or relative path on the system. Any valid system class path entry is also valid to create a ClassPathEntry.

Example

Here is an example of how to use a ClassPathEntry:

 ClassPathEntry entry = new ClassPathEntry("/home/java/Test.jar");
 System.out.println("My entry URL is " + entry.get());
 System.out.println("My entry string is " + entry.toString());
 System.out.println("My entry name " + entry.getName());
 System.out.println("My entry location " + entry.getLocation());
 System.out.println("My entry is a zip file? " + entry.isZipFile());
 Resource resource = entry.getResource("foo.gif");
 

author:
   Kristen Pol, Lutris Technologies
version:
   $Revision : 1.0 $
See Also:   com.lutris.classloader.Resource
See Also:   java.net.URL



Constructor Summary
public  ClassPathEntry(String entry, LogChannel loadLogChannel)
     Constructs class path entry with specified String.
public  ClassPathEntry(File entry, LogChannel loadLogChannel)
     Constructs class path entry with specified File.
public  ClassPathEntry(URL entry, LogChannel loadLogChannel)
     Constructs class path entry with specified URL.

Method Summary
public  booleanequals(Object o)
     Determines if specified class path entry is equal to this entry. The entries are considered equal if the URLs are the same.
Parameters:
  cpe - The class path entry to check for equality.
public  StringgetLocation()
     Gets location of class path entry.
public  StringgetName()
     Gets file name of class path entry.
public  ResourcegetResource(String name)
     Gets resource with the specified name from class path entry. The result will be null if the resource can not be found.
Parameters:
  name - The file name associated with the resource.
public  URLgetURL()
     Gets class path entry set previously by constructor.
public  ZipFilegetZipFile()
     Gets zip file associated with class path entry if appropriate.
public  booleanisDirectory()
     Determines if class path entry is a directory.
public  booleanisLocal()
     Determines if class path entry is local.
public  booleanisRemote()
     Determines if class path entry is remote.
public  booleanisZipFile()
     Determines if class path entry is a zip file.
public  StringtoString()
     Stringifies class path entry set previously by constructor.


Constructor Detail
ClassPathEntry
public ClassPathEntry(String entry, LogChannel loadLogChannel)(Code)
Constructs class path entry with specified String. The String is assumed to be either a directory or zip file on the local machine or a remote machine, which can be represented by the absolute file name, the relative file name, or a URL.

Examples:

 ClassPathEntry("../../java/classes");
 ClassPathEntry("/users/kristen/java/classes");
 ClassPathEntry("/users/kristen/java/classes/");
 ClassPathEntry("/users/kristen/java/MyClasses.zip");
 ClassPathEntry("/users/kristen/java/MyClasses.jar");
 ClassPathEntry("ftp://www.foo.com/pub/classes/");
 ClassPathEntry("file://www.foo.com/web/classes/");
 ClassPathEntry("http://www.foo.com/web/classes/");
 ClassPathEntry("http://www.foo.com:8080/web/classes/");
 ClassPathEntry("http://www.foo.com/web/classes/MyClasses.jar");
 

Parameters:
  entry - The class path entry.
Parameters:
  loadLogChannel - The log channel.



ClassPathEntry
public ClassPathEntry(File entry, LogChannel loadLogChannel)(Code)
Constructs class path entry with specified File. The File can represent a directory or zip file on the local machine.

Examples:

 ClassPathEntry(new File("../../java/classes"));
 ClassPathEntry(new File("/users/kristen/java/classes"));
 ClassPathEntry(new File("/users/kristen/java/classes/"));
 ClassPathEntry(new File("/users/kristen/java/MyClasses.zip"));
 ClassPathEntry(new File("/users/kristen/java/MyClasses.jar"));
 

Parameters:
  entry - The class path entry.
Parameters:
  loadLogChannel - The log channel.



ClassPathEntry
public ClassPathEntry(URL entry, LogChannel loadLogChannel)(Code)
Constructs class path entry with specified URL. The URL can represent a directory or zip file on the local machine or a remote machine.

Examples:

 ClassPathEntry(new URL("ftp://www.foo.com/pub/classes/"));
 ClassPathEntry(new URL("file://www.foo.com/web/classes/"));
 ClassPathEntry(new URL("http://www.foo.com/web/classes/"));
 ClassPathEntry(new URL("http://www.foo.com:8080/web/classes/"));
 ClassPathEntry(new URL("http://www.foo.com/web/MyClasses.jar"));
 

Parameters:
  entry - The class path entry.
Parameters:
  loadLogChannel - The log channel.




Method Detail
equals
public boolean equals(Object o)(Code)
Determines if specified class path entry is equal to this entry. The entries are considered equal if the URLs are the same.
Parameters:
  cpe - The class path entry to check for equality. true if the class path entry is equal, false if it is not.



getLocation
public String getLocation()(Code)
Gets location of class path entry. For example, if the entry is "http://www.foo.com:8080/java/classes/MyClasses.jar", the location is "http://www.foo.com:8080/". the file name for the class path entry.



getName
public String getName()(Code)
Gets file name of class path entry. For example, if the entry is "http://www.foo.com:8080/java/classes/MyClasses.jar", the name is "/java/classes/MyClasses.jar". The beginning slash does not mean that its an absolute file name on its host machine. The file name is always relative to the location. the file name of the class path entry.



getResource
public Resource getResource(String name)(Code)
Gets resource with the specified name from class path entry. The result will be null if the resource can not be found.
Parameters:
  name - The file name associated with the resource. the resource from the class path entry, or null if it isnot found.
See Also:   Resource



getURL
public URL getURL()(Code)
Gets class path entry set previously by constructor. the class path entry represented by a URL.



getZipFile
public ZipFile getZipFile()(Code)
Gets zip file associated with class path entry if appropriate. If a zip file is not found, null will be returned. the zip file associated with this class path entry iffound, null if not.



isDirectory
public boolean isDirectory()(Code)
Determines if class path entry is a directory. Anything that is not a zip file is considered a directory. true if the class path entry is a directory, false if it is not.
See Also:   ClassPathEntry.isZipFile



isLocal
public boolean isLocal()(Code)
Determines if class path entry is local. Anything that has no host name or a host name of "localhost" is considered local. true if the class path entry is remote, false if it is not.



isRemote
public boolean isRemote()(Code)
Determines if class path entry is remote. Anything that is not local is considered remote. true if the class path entry is remote, false if it is not.
See Also:   ClassPathEntry.isLocal



isZipFile
public boolean isZipFile()(Code)
Determines if class path entry is a zip file. Anything ending in ".zip" or ".jar" is considered a zip file. true if the class path entry is a zip file, false if it is not.



toString
public String toString()(Code)
Stringifies class path entry set previously by constructor. the class path entry represented by a stringified URL.



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.