org.apache.sling.jcr.classloader.internal
Class ClassPathEntry

java.lang.Object
  extended by org.apache.sling.jcr.classloader.internal.ClassPathEntry

public final class ClassPathEntry
extends Object

The ClassPathEntry class encapsulates entries in the class path of the DynamicRepositoryClassLoader. The main task is to retrieve ClassLoaderResource instances for classes or resources to load from it.

This implementation is not currently integrated with Java security. That is protection domains and security managers are not supported yet.

This class is not intended to be subclassed or instantiated by clients.


Field Summary
protected  URL baseURL
          The base URL for the class path entry to later construct resource URLs
protected  String path
          The path to the item of this class path entry
protected  javax.jcr.Session session
          The session assigned to this class path entry
 
Constructor Summary
protected ClassPathEntry(ClassPathEntry base)
          Clones this instance of the ClassPathEntry setting the path and session to the same value as the base instance.
protected ClassPathEntry(javax.jcr.Session session, String path)
          Creates an instance of the ClassPathEntry assigning the session and path.
 
Method Summary
 String getPath()
          Returns the path on which this ClassPathEntry is based.
 org.apache.sling.jcr.classloader.internal.ClassLoaderResource getResource(String name)
          Returns a ClassLoaderResource for the named resource if it can befound below this directory root identified by the path given at construction time.
 String toString()
           
 URL toURL()
          Returns this ClassPathEntry represented as an URL to be used in a list of URLs to further work on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

session

protected final javax.jcr.Session session
The session assigned to this class path entry


path

protected final String path
The path to the item of this class path entry


baseURL

protected URL baseURL
The base URL for the class path entry to later construct resource URLs

Constructor Detail

ClassPathEntry

protected ClassPathEntry(javax.jcr.Session session,
                         String path)
Creates an instance of the ClassPathEntry assigning the session and path.

Parameters:
session - The Session to access the Repository.
path - The path of the class path entry, this is either the path of a node containing a jar archive or is the path of the root of a hierarchy to look up resources in.

ClassPathEntry

protected ClassPathEntry(ClassPathEntry base)
Clones this instance of the ClassPathEntry setting the path and session to the same value as the base instance.

Note that this constructor does not duplicate the session from the base instance.

Parameters:
base - The ClassPathEntry from which to copy the path and the session.
Method Detail

getPath

public String getPath()
Returns the path on which this ClassPathEntry is based.


toURL

public URL toURL()
Returns this ClassPathEntry represented as an URL to be used in a list of URLs to further work on. If there is a problem creating the URL for this instance, null is returned instead.


getResource

public org.apache.sling.jcr.classloader.internal.ClassLoaderResource getResource(String name)
Returns a ClassLoaderResource for the named resource if it can befound below this directory root identified by the path given at construction time. Note that if the page would exist but does either not contain content or is not readable by the current session, no resource is returned.

Parameters:
name - The name of the resource to return. If the resource would be a class the name must already be modified to denote a valid path, that is dots replaced by dashes and the .class extension attached.
Returns:
The ClassLoaderResource identified by the name or null if no resource is found for that name.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.