org.jasig.portal.car
Class CarResources

java.lang.Object
  extended by org.jasig.portal.car.CarResources
All Implemented Interfaces:
ServletContextAware

public class CarResources
extends Object
implements ServletContextAware

Provides access to resources stored in channel archive files or CARs for short.

Version:
$Revision: 19823 $
Author:
Mark Boyd mark.boyd@engineer.com

Field Summary
static String CAR_RESOURCE_PARM
           
static String CAR_WORKER_ID
           
static String RCS_ID
           
 
Constructor Summary
CarResources()
           
 
Method Summary
 boolean containsResource(String resource)
          Returns true if the indicated resource is available, false otherwise.
 URL findResource(String entry)
          Returns a URL to the requested entry if found in one of the installed CARs or null if not found.
 ClassLoader getClassLoader()
          Return the single instance of CarClassLoader.
 String getContainingCarPath(String entry)
          Returns the path of the CAR containing the indicated resource.
static CarResources getInstance()
          Deprecated. Use the Spring managed 'carResources' bean instead
 InputStream getResourceAsStream(String resource)
          Return an input stream for reading the raw bytes making up the resource contained in one of the installed CARs.
 long getResourceSize(String resource)
          Return the size of the indicated resource or -1 if the resource is not found or its size is unknown.
 void getServices(ContentHandler contentHandler)
          Push into the passed in content handler events for any services declared in any component archive's deployment descriptor.
 void getWorkers(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.
 void initialize()
          Instantiate a CarResources object and load information about all CARs and their contained resources.
 String[] listAllResources()
          Returns an enumeration of String objects each containing the path of a resource available from the installed CARs.
 String[] listCarResources(String carPath)
          Returns a list of resources available in the car identified by the passed in relative car file path name.
 String[] listCars()
          Returns a String array of car file paths relative to the car directory specified via the property in portal.properties.
 void setServletContext(ServletContext servletContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final String RCS_ID
See Also:
Constant Field Values

CAR_WORKER_ID

public static final String CAR_WORKER_ID
See Also:
Constant Field Values

CAR_RESOURCE_PARM

public static final String CAR_RESOURCE_PARM
See Also:
Constant Field Values
Constructor Detail

CarResources

public CarResources()
Method Detail

initialize

public void initialize()
                throws Exception
Instantiate a CarResources object and load information about all CARs and their contained resources.

Throws:
Exception

setServletContext

public void setServletContext(ServletContext servletContext)
Specified by:
setServletContext in interface ServletContextAware

getInstance

@Deprecated
public static CarResources getInstance()
Deprecated. Use the Spring managed 'carResources' bean instead

Return the single instance of CarResources.


getClassLoader

public ClassLoader getClassLoader()
Return the single instance of CarClassLoader.


getWorkers

public void getWorkers(Properties workers)
Push into the passed in properties object workers defined in any component archive's deployment descriptor.


hasDescriptors

public boolean hasDescriptors()
Returns true if any archive included a deployment descriptor.


getServices

public void getServices(ContentHandler contentHandler)
                 throws SAXException
Push into the passed in content handler events for any services declared in any component archive's deployment descriptor.

Throws:
SAXException

getResourceAsStream

public InputStream getResourceAsStream(String resource)
                                throws PortalException
Return an input stream for reading the raw bytes making up the resource contained in one of the installed CARs. Returns null if the resource is not found.

Throws:
PortalException

getResourceSize

public long getResourceSize(String resource)
Return the size of the indicated resource or -1 if the resource is not found or its size is unknown.


findResource

public URL findResource(String entry)
Returns a URL to the requested entry if found in one of the installed CARs or null if not found.


getContainingCarPath

public String getContainingCarPath(String entry)
Returns the path of the CAR containing the indicated resource. This path is relative to the CAR directory configured via the property in portal.properties. If a CAR for that entry is not found it returns null.


containsResource

public boolean containsResource(String resource)
Returns true if the indicated resource is available, false otherwise. The resource is identified by its complete path within the CAR file.


listCars

public String[] listCars()
Returns a String array of car file paths relative to the car directory specified via the property in portal.properties.


listCarResources

public String[] listCarResources(String carPath)
Returns a list of resources available in the car identified by the passed in relative car file path name. This name is the path to the car file relative to the car directory. If no car file is found for the passed-in path then null is returned.


listAllResources

public String[] listAllResources()
Returns an enumeration of String objects each containing the path of a resource available from the installed CARs.



Copyright © 2010 Jasig. All Rights Reserved.