FileDocCategorySizeDatePackage
BeanRepository.javaAPI DocGlassfish v2 API4344Fri May 04 22:32:52 BST 2007org.apache.jasper.compiler

BeanRepository

public class BeanRepository extends Object
Repository of {page, request, session, application}-scoped beans
author
Mandar Raje

Fields Summary
private Vector
sessionBeans
private Vector
pageBeans
private Vector
appBeans
private Vector
requestBeans
private Hashtable
beanTypes
private ClassLoader
loader
private ErrorDispatcher
errDispatcher
Constructors Summary
public BeanRepository(ClassLoader loader, ErrorDispatcher err)


        this.loader = loader;
	this.errDispatcher = err;

	sessionBeans = new Vector(11);
	pageBeans = new Vector(11);
	appBeans = new Vector(11);
	requestBeans = new Vector(11);
	beanTypes = new Hashtable();
    
Methods Summary
public voidaddBean(Node.UseBean n, java.lang.String s, java.lang.String type, java.lang.String scope)


	if (scope == null || scope.equals("page")) {
	    pageBeans.addElement(s);	
	} else if (scope.equals("request")) {
	    requestBeans.addElement(s);
	} else if (scope.equals("session")) {
	    sessionBeans.addElement(s);
	} else if (scope.equals("application")) {
	    appBeans.addElement(s);
	} else {
	    errDispatcher.jspError(n, "jsp.error.invalid.scope", scope);
	}
	
	putBeanType(s, type);
    
private booleancheckApplicationBean(java.lang.String s)

	return appBeans.contains (s);
    
private booleancheckPageBean(java.lang.String s)

	return pageBeans.contains (s);
    
private booleancheckRequestBean(java.lang.String s)

	return requestBeans.contains (s);
    
private booleancheckSessionBean(java.lang.String s)

	return sessionBeans.contains (s);
    
public booleancheckVariable(java.lang.String bean)

	// XXX Not sure if this is the correct way.
	// After pageContext is finalised this will change.
	return (checkPageBean(bean) || checkSessionBean(bean) ||
		checkRequestBean(bean) || checkApplicationBean(bean));
    
public java.lang.ClassgetBeanType(java.lang.String bean)

	Class clazz = null;
	try {
	    clazz = loader.loadClass ((String)beanTypes.get(bean));
	} catch (ClassNotFoundException ex) {
	    throw new JasperException (ex);
	}
	return clazz;
    
private voidputBeanType(java.lang.String bean, java.lang.String type)

	beanTypes.put (bean, type);