FileDocCategorySizeDatePackage
EJBMetaDataModelImpl.javaAPI DocGlassfish v2 API9540Fri May 04 22:34:52 BST 2007com.sun.jdo.spi.persistence.support.ejb.enhancer.meta

EJBMetaDataModelImpl

public class EJBMetaDataModelImpl extends com.sun.jdo.api.persistence.enhancer.meta.JDOMetaDataModelImpl implements com.sun.jdo.api.persistence.enhancer.meta.ExtendedJDOMetaData
Provide MetaDataModel Class used by CMP code generation during EJB deployment. Note that classPath is used for I/O of MetaData and className is used for I/O of Model.
author
Shing Wai Chan

Fields Summary
Constructors Summary
public EJBMetaDataModelImpl(com.sun.jdo.api.persistence.model.Model model)

        super(model);
    
Methods Summary
public intgetClassModifiers(java.lang.String classPath)

        return Modifier.PUBLIC;
    
public intgetFieldFlags(java.lang.String classPath, java.lang.String fieldName)

        if (!isManagedField(classPath, fieldName)) {
            affirm(!isTransactionalField(classPath, fieldName));
            affirm(!isPersistentField(classPath, fieldName));
            affirm(!isKeyField(classPath, fieldName));
            affirm(!isDefaultFetchGroupField(classPath, fieldName));
            return 0;
        }
        //affirm(isManagedField(classPath, fieldName));

        if (isTransactionalField(classPath, fieldName)) {
            affirm(!isPersistentField(classPath, fieldName));
            affirm(!isKeyField(classPath, fieldName));
            // ignore any dfg membership of transactional fields
            //affirm(!isDefaultFetchGroupField(classPath, fieldName));
            return CHECK_WRITE;
        }
        //affirm(!isTransactionalField(classPath, fieldName));
        affirm(isPersistentField(classPath, fieldName));

        if (isKeyField(classPath, fieldName)) {
            // ignore any dfg membership of key fields
            //affirm(!isDefaultFetchGroupField(classPath, fieldName));
            return MEDIATE_WRITE;
        }
        //affirm(!isKeyField(classPath, fieldName));

        if (isDefaultFetchGroupField(classPath, fieldName)) {
            if (Boolean.getBoolean("AllowMediatedWriteInDefaultFetchGroup")) {
                 return CHECK_READ | MEDIATE_WRITE;
            }
            return CHECK_READ | CHECK_WRITE;
        }
        //affirm(!isDefaultFetchGroupField(classPath, fieldName));

        return MEDIATE_READ | MEDIATE_WRITE;
    
public int[]getFieldFlags(java.lang.String classPath, java.lang.String[] fieldNames)

        final int n = (fieldNames != null ? fieldNames.length : 0);
        final int[] flags = new int[n];
        for (int i = 0; i < n; i++) {
            flags[i] = getFieldFlags(classPath, fieldNames[i]);
        }
        return flags;
    
public intgetFieldModifiers(java.lang.String classPath, java.lang.String fieldName)

        final String className = pathToName(classPath);
        return model.getModifiers(model.getField(className, fieldName));
    
public int[]getFieldNo(java.lang.String classPath, java.lang.String[] fieldNames)

        final int n = (fieldNames != null ? fieldNames.length : 0);
        final int[] flags = new int[n];
        for (int i = 0; i < n; i++) {
            flags[i] = getFieldNo(classPath, fieldNames[i]);
        }
        return flags;
    
public java.lang.String[]getFieldType(java.lang.String className, java.lang.String[] fieldNames)

        final int n = (fieldNames != null ? fieldNames.length : 0);
        final String[] types = new String[n];
        for (int i = 0; i < n; i++) {
            types[i] = getFieldType(className, fieldNames[i]);
        }
        return types;
    
public java.lang.StringgetFieldType(java.lang.String classPath, java.lang.String fieldName)

        final String className = pathToName(classPath);
        String ftype = model.getFieldType(className, fieldName);

        return nameToPath(ftype);
    
public java.lang.StringgetKeyClass(java.lang.String classPath)

        final String className = pathToName(classPath);
        String keyClass = model.getPersistenceClass(className).getKeyClass();
        if (keyClass.toLowerCase().endsWith(".oid")) {
            int ind = keyClass.lastIndexOf('.");
            keyClass = keyClass.substring(0, ind) + "$Oid";
        }
        return nameToPath(keyClass);
    
public java.lang.String[]getKeyFields(java.lang.String classPath)

        final List keys = new ArrayList();
        final String[] fieldNames = getManagedFields(classPath);
        final int n = fieldNames.length;
        for (int i = 0; i < n; i++) {
            if (isKeyField(classPath, fieldNames[i])) {
                keys.add(fieldNames[i]);
            }
        }
        return (String[])keys.toArray(new String[keys.size()]);
    
public java.lang.String[]getKnownClasses()

        throw new UnsupportedOperationException();
    
public java.lang.String[]getKnownFields(java.lang.String classPath)

        return getManagedFields(classPath);
    
public java.lang.StringgetPersistenceCapableSuperClass(java.lang.String classPath)

        return null;
    
public java.lang.StringgetSuperKeyClass(java.lang.String classPath)

        return null;
    
public booleanisKeyField(java.lang.String classPath, java.lang.String fieldName)

        return isPrimaryKeyField(classPath, fieldName);
    
public booleanisKnownNonManagedField(java.lang.String classPath, java.lang.String fieldName, java.lang.String fieldSig)

        return !isPersistentField(classPath, fieldName);
    
public booleanisManagedField(java.lang.String classPath, java.lang.String fieldName)

        return (isPersistentField(classPath, fieldName)
                || isTransactionalField(classPath, fieldName));
    
public booleanisPrimaryKeyField(java.lang.String classPath, java.lang.String fieldName)

        final String className = pathToName(classPath);
        final PersistenceFieldElement pfe
            = model.getPersistenceField(className, fieldName);
        if (pfe != null) {
            return pfe.isKey();
        } else {
            return false;
        }