FileDocCategorySizeDatePackage
MetaData.javaAPI DocGlassfish v2 API16582Fri May 04 22:34:42 BST 2007com.sun.enterprise.tools.common.dd.webapp

MetaData

public class MetaData extends Object
MetaData.java This class provides the static data required for editing WebApp Data Descriptors Author gaur , created on November 28 5:25 PM

Fields Summary
static final ResourceBundle
helpBundle
public static final int
CMAPNUMBCOLS
public static final int
CMAPCACHETARGET
public static final int
CMAPCACHETARGETVALUE
public static final int
CMAPHTTPMETHOD
public static final int
CMAPKEYFIELD
public static final int
CMAPFIELDCONSTRAINT
public static final int
CMAPTIMEOUT
public static final int
CMAPTIMEOUTNAME
public static final int
CMAPTIMEOUTSCOPE
public static final String
DESCRIPTION
public static final String
NAME
public static final String
VALUE
public static final String
DEFAULT_LOCALE
public static final String
LOCALE
public static final String
CHARSET
public static final String
AGENT
public static final String
PERSISTENCE_TYPE
public static final String
LESSER
public static final String
GREATER
public static final String
CLASS_NAME
public static final String[]
CACHE_SCOPE
public static final String[]
CACHE_KEY_SCOPE
public static final String
CACHE_MAX_ENTRIES
public static final String
CACHE_TIMEOUT
public static final String[]
CACHE_KEY_BOOLEAN
public static final String[]
CACHE_KEY_EXPR
public static final String
MATCH_ALL_VALUE
public static final String[]
CACHE_TARGET
public static final String
CACHE_TARGET_SERVLET
public static final String
CACHE_TARGET_URL
public static final String[]
CACHE_REF
public static final String
CACHE_HELPER_STR
public static final String
CACHE_POLICY_OBJ
public static final String
CACHE_REF_DEFAULT_VAL
public static final String[]
HTTP_METHODS
public static final int
EXTRAPARAMS
public static final int
SESSIONPARAM
public static final int
STOREPARAM
public static final int
JSPPARAM
public static final int
COOKIEPARAM
public static final int
MANAGERPARAM
public static final int
PERSISTPARAM
public static final int
HELPERCLASSPARAM
public static final int
CACHE_HELPER
public static final int
DEFAULT_HELPER
public static final int
CACHE_PROPERTY_ARRAY
public static final int
CACHE_MAP
public static final int
CACHE_MAP_HTTP_METHOD
public static final int
CACHE_MAP_KEY_FIELD
public static final int
CACHE_MAP_CONSTRAINT_FIELD
public static final int
CACHE_MAP_CONSTRAINT_FIELD_VALUE
public static final int
CACHE_HELPER_NUMB_COLS
public static final int
CACHE_HELPER_COL_NAME
public static final int
CACHE_HELPER_COL_CLASS_NAME
public static final int
CACHE_HELPER_COL_PROPERTY
public static final int
CACHE_MAP_NUMB_COLS
public static final int
CACHE_MAP_COL_TGT
public static final int
CACHE_MAP_COL_TGTVAL
public static final int
CACHE_MAP_COL_REF
public static final int
CACHE_MAP_COL_REFVAL
public static final int
CACHE_CF_NUMB_COLS
public static final int
CACHE_CF_COL_NAME
public static final int
CACHE_CF_COL_SCOPE
public static final int
CACHE_CF_COL_COM
public static final int
CACHE_CF_COL_COMF
public static final int
CACHE_CF_COL_VALUE
public static final String
WEB_PROPERTY_ARRAY_WRAPPER_STR
public static final String
CACHE_PROPERTY_ARRAY_STR
public static final String
CACHE_HELPER_ARRAY
public static final String
CACHE_MAP_ARRAY
public static final String
CACHE_MAPPING
public static final String
CACHE_HTTP_METHOD_ARRAY
public static final String
CACHE_KEY_FIELD_ARRAY
public static final String
CACHE_CONSTRAINT_FIELD_ARRAY
public static final String
CACHE_CONSTRAINT_FIELD_VALUE_ARRAY
private static final String
DELIMITER
private static final String
DATAFILE
private static Hashtable
paramContainer
private static com.sun.enterprise.tools.common.dd.ParamData
pData
public static String[]
emptyList
public static String[]
extraParamName
public static final String
extraParamHelpID
public static String[]
sessionParamName
public static final String
sessionParamHelpID
public static String[]
storeParamName
public static final String
storeParamHelpID
public static String[]
jspParamName
public static final String
jspParamHelpID
public static String[]
cookieParamName
public static final String
cookieParamHelpID
public static String[]
managerParamName
public static final String
managerParamHelpID
public static String[]
persistParamName
public static final String
persistParamHelpID
public static String[]
helperClassParamName
public static final String
helperClassParamHelpID
Constructors Summary
Methods Summary
public static java.lang.StringgetDefaultValue(int type, java.lang.String key)

        if(paramContainer == null) initialize();
        pData = (ParamData) paramContainer.get(type+DELIMITER+key);
        if(pData != null){
            return pData.getDefaultValue();
        }else{
            return "";//NOI18N
        }
    
public static java.lang.StringgetHelpID(int type, java.lang.String key)

        if(paramContainer == null) initialize();
        pData = (ParamData) paramContainer.get(type+DELIMITER+key);
        if(pData != null){
            return pData.getHelpID();
        }else{
            return "";//NOI18N
        }
    
public static java.lang.StringgetHelpID(int type)

        switch ( type ) {
            case EXTRAPARAMS:
                return extraParamHelpID;
            case SESSIONPARAM:
                return sessionParamHelpID;
            case STOREPARAM:
                return storeParamHelpID;
            case JSPPARAM:
                return jspParamHelpID;
            case COOKIEPARAM:
                return cookieParamHelpID;
            case MANAGERPARAM:
                return managerParamHelpID;
            case PERSISTPARAM:
                return persistParamHelpID;
            case HELPERCLASSPARAM:
                return helperClassParamHelpID;
        }
        return ""; // NOI18N
    
public static java.lang.String[]getParamNames(int type)

 //NOI18N
    
    
    
    
    
        
        if(paramContainer == null) initialize();
        switch ( type ) {
            case EXTRAPARAMS:
                return extraParamName;
            case SESSIONPARAM:
                return sessionParamName;
            case STOREPARAM:
                return storeParamName;
            case JSPPARAM:
                return jspParamName;
            case COOKIEPARAM:
                return cookieParamName;
            case MANAGERPARAM:
                return managerParamName;
            case PERSISTPARAM:
                return persistParamName;
	    case HELPERCLASSPARAM:
		return helperClassParamName;
        }
        return new String[] {};
    
public static java.lang.String[]getParamValues(int type, java.lang.String key)

        if(paramContainer == null) initialize();
        pData = (ParamData) paramContainer.get(type+DELIMITER+key);
        if(pData != null){
            return pData.getParamValues();
        }else{
            return emptyList;
        }
    
public static java.lang.StringgetType(int type, java.lang.String key)

        if(paramContainer == null) initialize();
        
        pData = (ParamData) paramContainer.get(type+DELIMITER+key);
        
        if(pData != null){
            return pData.getParamType();
        }else{
            return "";//NOI18N
        }
    
private static voidinitialize()

        paramContainer = new Hashtable();
        InputStream in = MetaData.class.getClassLoader().getResourceAsStream(DATAFILE);
        //System.out.println("############ getParamFromFile DATAFILE =" + DATAFILE); //NOI18N
        //System.out.println("############ getParamFromFile in =" + in); //NOI18N
	SunWebAppData data = null;
	try {
	        data = SunWebAppData.createGraph(in);
	} catch (Schema2BeansException e) {
		System.out.println("Failed to create bean graph for SunWebAppData"); //NOI18N
	}
        //System.out.println("############ " + data.dumpBeanNode()); //NOI18N
        ParamData pData = null;
        
        // initialize all param name arrays
        sessionParamName = new String[data.sizeSessionParam()];
        storeParamName = new String[data.sizeStoreParam()];
        managerParamName = new String[data.sizeManagerParam()];
        jspParamName = new String[data.sizeJspParam()];
        extraParamName = new String[data.sizeExtraParam()];
        cookieParamName = new String[data.sizeCookieParam()];
        persistParamName = new String[data.sizePersistenceParam()];
        helperClassParamName = new String[data.sizeHelperClassParam()];
        
        for(int i = 0; i < data.sizeSessionParam(); i ++){
            pData = data.getSessionParam(i);
            sessionParamName[i] = pData.getParamName();
            //System.out.println("#### putting key = " + SESSIONPARAM + DELIMITER + pData.getParamName()); //NOI18N
            paramContainer.put(SESSIONPARAM + DELIMITER + pData.getParamName() , pData);
        }
        
        for(int i = 0; i < data.sizePersistenceParam(); i ++){
            pData = data.getPersistenceParam(i);
            persistParamName[i] = pData.getParamName();
            paramContainer.put(PERSISTPARAM + DELIMITER + pData.getParamName(), pData);
        }
        
        for(int i = 0; i < data.sizeStoreParam(); i ++){
            pData = data.getStoreParam(i);
            storeParamName[i] = pData.getParamName();
            paramContainer.put(STOREPARAM + DELIMITER + pData.getParamName() , pData);
        }
        
        for(int i = 0; i < data.sizeManagerParam(); i ++){
            pData = data.getManagerParam(i);
            managerParamName[i] = pData.getParamName();
            paramContainer.put(MANAGERPARAM + DELIMITER + pData.getParamName() , pData);
        }
        
        for(int i = 0; i < data.sizeJspParam(); i ++){
            pData = data.getJspParam(i);
            jspParamName[i] = pData.getParamName();
            paramContainer.put(JSPPARAM + DELIMITER + pData.getParamName() , pData);
        }
        
        for(int i = 0; i < data.sizeExtraParam(); i ++){
            pData = data.getExtraParam(i);
            extraParamName[i] = pData.getParamName();
            paramContainer.put(EXTRAPARAMS + DELIMITER + pData.getParamName() , pData);
        }
        
        for(int i = 0; i < data.sizeCookieParam(); i ++){
            pData = data.getCookieParam(i);
            cookieParamName[i] = pData.getParamName();
            paramContainer.put(COOKIEPARAM + DELIMITER + pData.getParamName() , pData);
        }
        for(int i = 0; i < data.sizeHelperClassParam(); i ++){
            pData = data.getHelperClassParam(i);
            helperClassParamName[i] = pData.getParamName();
            paramContainer.put(HELPERCLASSPARAM + DELIMITER + pData.getParamName() , pData);
        }
    
public static booleanisValidType(int type, java.lang.String key, java.lang.String value)

       boolean valid = true;
       if ((type == EXTRAPARAMS) || (type == HELPERCLASSPARAM)) return true;
       pData = (ParamData) paramContainer.get(type+DELIMITER+key);
       String reqType = pData.getParamType();
      // System.out.println("###**** reqType = " + reqType); //NOI18N
       if(reqType != null && reqType.equalsIgnoreCase("number")){//NOI18N
           try{
               //System.out.println("###**** Trying to parse"); //NOI18N
               Integer.parseInt(value);
           }catch(Exception e){
               valid = false;
           }
       }
       return valid;