Search in sources :

Example 1 with PrivilegedAccessHelper

use of org.eclipse.persistence.internal.security.PrivilegedAccessHelper in project eclipselink by eclipse-ee4j.

the class InheritancePolicy method convertClassNamesToClasses.

/**
 * INTERNAL:
 * Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings.
 * This method is used when converting a project that has been built with class names to a project with classes.
 * It will also convert referenced classes to the versions of the classes from the classLoader.
 */
public void convertClassNamesToClasses(ClassLoader classLoader) {
    Iterator keysEnum = getClassNameIndicatorMapping().keySet().iterator();
    Iterator valuesEnum = getClassNameIndicatorMapping().values().iterator();
    // Clear old classes (after class names have been lazy initialized).
    classIndicatorMapping = new HashMap();
    while (keysEnum.hasNext()) {
        Object key = keysEnum.next();
        Object value = valuesEnum.next();
        Class<?> theClass = convertClassNameToClass((String) key, classLoader);
        classIndicatorMapping.put(theClass, value);
        classIndicatorMapping.put(value, theClass);
    }
    // Initialize the parent class name.
    if (getParentClassName() != null) {
        setParentClass(convertClassNameToClass(getParentClassName(), classLoader));
    }
    // Initialize the class extractor name.
    if (classExtractorName != null) {
        Class<ClassExtractor> classExtractorClass = convertClassNameToClass(classExtractorName, classLoader);
        setClassExtractor(PrivilegedAccessHelper.callDoPrivilegedWithException(() -> PrivilegedAccessHelper.<ClassExtractor>newInstanceFromClass(classExtractorClass), (ex) -> ValidationException.reflectiveExceptionWhileCreatingClassInstance(classExtractorName, ex)));
    }
}
Also used : HashMap(java.util.HashMap) DatabaseTable(org.eclipse.persistence.internal.helper.DatabaseTable) ArrayList(java.util.ArrayList) ExpressionQueryMechanism(org.eclipse.persistence.internal.queries.ExpressionQueryMechanism) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession) HashSet(java.util.HashSet) Vector(java.util.Vector) DatabaseException(org.eclipse.persistence.exceptions.DatabaseException) Map(java.util.Map) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException) CacheInvalidationPolicy(org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy) ValidationException(org.eclipse.persistence.exceptions.ValidationException) Method(java.lang.reflect.Method) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) Association(org.eclipse.persistence.mappings.Association) ObjectLevelReadQuery(org.eclipse.persistence.queries.ObjectLevelReadQuery) DistributedSession(org.eclipse.persistence.sessions.remote.DistributedSession) CoreInheritancePolicy(org.eclipse.persistence.core.descriptors.CoreInheritancePolicy) IdentityHashMap(java.util.IdentityHashMap) Iterator(java.util.Iterator) OptimisticLockingPolicy(org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy) ClassConstants(org.eclipse.persistence.internal.helper.ClassConstants) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) Set(java.util.Set) AbstractRecord(org.eclipse.persistence.internal.sessions.AbstractRecord) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery) QueryException(org.eclipse.persistence.exceptions.QueryException) Serializable(java.io.Serializable) List(java.util.List) Expression(org.eclipse.persistence.expressions.Expression) DatabaseField(org.eclipse.persistence.internal.helper.DatabaseField) SQLSelectStatement(org.eclipse.persistence.internal.expressions.SQLSelectStatement) Helper(org.eclipse.persistence.internal.helper.Helper) PrivilegedAccessHelper(org.eclipse.persistence.internal.security.PrivilegedAccessHelper) ConversionManager(org.eclipse.persistence.internal.helper.ConversionManager) TypedAssociation(org.eclipse.persistence.mappings.TypedAssociation) HashMap(java.util.HashMap) IdentityHashMap(java.util.IdentityHashMap) Iterator(java.util.Iterator)

Aggregations

Serializable (java.io.Serializable)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 IdentityHashMap (java.util.IdentityHashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Vector (java.util.Vector)1 CoreInheritancePolicy (org.eclipse.persistence.core.descriptors.CoreInheritancePolicy)1 CacheInvalidationPolicy (org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy)1 DatabaseException (org.eclipse.persistence.exceptions.DatabaseException)1 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)1 QueryException (org.eclipse.persistence.exceptions.QueryException)1 ValidationException (org.eclipse.persistence.exceptions.ValidationException)1 Expression (org.eclipse.persistence.expressions.Expression)1 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)1 OptimisticLockingPolicy (org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy)1