|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.car.CarResources
public class CarResources
Provides access to resources stored in channel archive files or CARs for short.
Field Summary | |
---|---|
private static java.lang.String |
CAR_DIR_PROP_NAME
|
static java.lang.String |
CAR_RESOURCE_PARM
|
static java.lang.String |
CAR_WORKER_ID
|
private java.util.Hashtable |
carContents
|
private boolean |
carDirExists
|
private java.lang.String |
carDirPath
|
private java.io.FileFilter |
carFilter
A fileFilter for obtaining a list of CARs. |
private java.util.Hashtable |
carsByJars
|
private java.util.Hashtable |
carsByPath
|
private boolean |
carsLoaded
|
(package private) static java.lang.String |
DEPLOYMENT_DESCRIPTOR
|
private java.io.FileFilter |
dirFilter
A fileFilter for obtaining a list of directories. |
private static java.util.Map.Entry[] |
ENTRY_ARRAY
|
private static CarResources |
instance
|
private java.util.Vector |
jarsWithDescriptors
|
private static CarClassLoader |
loader
|
private static org.apache.commons.logging.Log |
log
|
static java.lang.String |
RCS_ID
|
private java.util.Hashtable |
resourceJars
|
private SAX2BufferImpl |
services
|
private static java.lang.String[] |
STRING_ARRAY
|
private static java.lang.String |
WELL_KNOWN_DIR
|
private java.util.Properties |
workers
|
Constructor Summary | |
---|---|
private |
CarResources()
Instantiate a CarResources object and load information about all CARs and their contained resources. |
Method Summary | |
---|---|
boolean |
containsResource(java.lang.String resource)
Returns true if the indicated resource is available, false otherwise. |
java.net.URL |
findResource(java.lang.String entry)
Returns a URL to the requested entry if found in one of the installed CARs or null if not found. |
private java.lang.String |
getCarPath(java.io.File car)
Return the path of a car file relative to the car directory. |
java.lang.ClassLoader |
getClassLoader()
Return the single instance of CarClassLoader. |
java.lang.String |
getContainingCarPath(java.lang.String entry)
Returns the path of the CAR containing the indicated resource. |
static CarResources |
getInstance()
Return the single instance of CarResources. |
private java.io.File |
getPropertySpecifiedDir()
Return a File object representing the channel archive base directory whose fully-qualified path is specified by the 'org.jasig.portal.car.CarResources.directory' property in portal.properties. |
java.io.InputStream |
getResourceAsStream(java.lang.String resource)
Return an input stream for reading the raw bytes making up the resource contained in one of the installed CARs. |
long |
getResourceSize(java.lang.String resource)
Return the size of the indicated resource or -1 if the resource is not found or its size is unknown. |
void |
getServices(org.xml.sax.ContentHandler contentHandler)
Push into the passed in content handler events for any services declared in any component archive's deployment descriptor. |
private java.io.File |
getWellKnownDir()
Return a File object representing the well-known channel archive base directory '/WEB-INF/cars' where channel archives are located. |
void |
getWorkers(java.util.Properties workers)
Push into the passed in properties object workers defined in any component archive's deployment descriptor. |
boolean |
hasDescriptors()
Returns true if any archive included a deployment descriptor. |
java.lang.String[] |
listAllResources()
Returns an enumeration of String objects each containing the path of a resource available from the installed CARs. |
java.lang.String[] |
listCarResources(java.lang.String carPath)
Returns a list of resources available in the car identified by the passed in relative car file path name. |
java.lang.String[] |
listCars()
Returns a String array of car file paths relative to the car directory specified via the property in portal.properties. |
private void |
loadCarEntries(java.io.File car)
Load information about the passed in CAR and any contained resources. |
private void |
loadCars()
Load information about all installed CARs and their contained resources. |
private void |
processDescriptors()
Process the descriptors of the channel archives if any. |
private java.lang.String |
replace(java.lang.String entry,
java.lang.String regExpr,
java.lang.String replacement)
Home-grown version of the String replace method. |
private java.lang.String |
resolveRegExpr(java.lang.String entry)
Resolves the String entry and removes any regular expression patterns that would indicate a directory move (i.e. |
private void |
scanDir(java.io.File dir)
Scan the passed in directory loading any cars there-in and calling this method for any nested directories. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log log
private static CarResources instance
private static CarClassLoader loader
public static final java.lang.String RCS_ID
static final java.lang.String DEPLOYMENT_DESCRIPTOR
private static final java.lang.String WELL_KNOWN_DIR
private static final java.lang.String CAR_DIR_PROP_NAME
public static final java.lang.String CAR_WORKER_ID
public static final java.lang.String CAR_RESOURCE_PARM
private static final java.util.Map.Entry[] ENTRY_ARRAY
private static final java.lang.String[] STRING_ARRAY
private java.util.Hashtable resourceJars
private java.util.Hashtable carsByJars
private java.util.Hashtable carContents
private java.util.Hashtable carsByPath
private SAX2BufferImpl services
private java.util.Properties workers
private boolean carsLoaded
private java.util.Vector jarsWithDescriptors
private java.lang.String carDirPath
private boolean carDirExists
private java.io.FileFilter carFilter
private java.io.FileFilter dirFilter
Constructor Detail |
---|
private CarResources()
Method Detail |
---|
private void processDescriptors()
public static CarResources getInstance()
public java.lang.ClassLoader getClassLoader()
private java.io.File getWellKnownDir()
private java.io.File getPropertySpecifiedDir()
private void loadCars()
private void scanDir(java.io.File dir)
private void loadCarEntries(java.io.File car)
public void getWorkers(java.util.Properties workers)
public boolean hasDescriptors()
public void getServices(org.xml.sax.ContentHandler contentHandler) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public java.io.InputStream getResourceAsStream(java.lang.String resource) throws PortalException
PortalException
public long getResourceSize(java.lang.String resource)
public java.net.URL findResource(java.lang.String entry)
public java.lang.String getContainingCarPath(java.lang.String entry)
public boolean containsResource(java.lang.String resource)
public java.lang.String[] listCars()
public java.lang.String[] listCarResources(java.lang.String carPath)
private java.lang.String getCarPath(java.io.File car)
public java.lang.String[] listAllResources()
private java.lang.String replace(java.lang.String entry, java.lang.String regExpr, java.lang.String replacement)
entry
- the String to search for the regExpr.regExpr
- the regular expression to find and replacereplacement
- the String to replace the regExpr with
private java.lang.String resolveRegExpr(java.lang.String entry)
entry
- the String entry to resolve
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |