Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/371950"

Line 2: Line 2:
  
 
*[http://bugs.eclipse.org/371950 Enhancement Request 371950]
 
*[http://bugs.eclipse.org/371950 Enhancement Request 371950]
== Purpose ==
+
 
 +
== Purpose ==
  
 
This feature is to look at caching the metadata project so that the setup can avoid costs associated with reading in multiple orm.xml and annotation processing on entities within a persistence unit to rebuild it unnecessarily.  
 
This feature is to look at caching the metadata project so that the setup can avoid costs associated with reading in multiple orm.xml and annotation processing on entities within a persistence unit to rebuild it unnecessarily.  
  
== Requirements ==
+
== Requirements ==
  
# EntityManagerFactory and EntityManager instance creation use properties that allow overriding metadata settings/properties the same as it would if project caching was not used
+
#EntityManagerFactory and EntityManager instance creation use properties that allow overriding metadata settings/properties the same as it would if project caching was not used  
# Project caching must allow weaving to happen
+
#Project caching must allow weaving to happen  
# It must be configurable to allow alternate implementations to cache the project differently
+
#It must be configurable to allow alternate implementations to cache the project differently  
# The project will be read from/writen to the cache prior to login, prior to converting String ClassNames into Classes.
+
#The project will be read from/writen to the cache prior to login, prior to converting String ClassNames into Classes.
  
== Design ==
+
== Design ==
  
 +
=== PersistenceUnitProperties  ===
  
=== PersistenceUnitProperties ===
+
public static final String PROJECT_CACHE_ACCESSOR = "eclipselink.project-cache-accessor"; will be the base property to configure this feature, and will take a string value representing shipped implementations or the a <package.class> name of a subclass implementation of the ProjectCache interface. By default a project cache accessor will not be used.
  
public static final String PROJECT_CACHE_ACCESSOR = "eclipselink.project-cache-accessor";
+
The "eclipselink.project-cache-accessor.<implementationShortName>" subset of properties will be used for implementation specific properties.  
will be the base property to configure this feature, and will take a string value representing shipped implementations or the a <package.class> name of a subclass implementation of the ProjectCache interface.  By default a project cache accessor will not be used.
+
  
The "eclipselink.project-cache-accessor.<implementationShortName>" subset of properties will be used for implementation specific properties.
+
=== Interface ===
=== Interface ===
+
  
 +
<source lang="java">
 
public interface ProjectCacheAccessor {
 
public interface ProjectCacheAccessor {
 
   public Project retrieveProject(Properties properties, Classloader loader);
 
   public Project retrieveProject(Properties properties, Classloader loader);
 
   public void storeProject(Project project, Properties properties);
 
   public void storeProject(Project project, Properties properties);
 
}
 
}
 +
</source>
  
=== Included Implementation ===
+
=== Included Implementation ===
  
This feature will include a ProjectCacheAccessor implementation that uses java serialization to read to/write from a file which can be used by specifying the PROJECT_CACHE_ACCESSOR property with a value of "java-serialization"
+
This feature will include a ProjectCacheAccessor implementation that uses java serialization to read to/write from a file which can be used by specifying the PROJECT_CACHE_ACCESSOR property with a value of "java-serialization" This implementation will also require the file location be specified, and will rely on a "eclipselink.project-cache-accessor.java-serialization.file" property being defined.
This implementation will also require the file location be specified, and will rely on a "eclipselink.project-cache-accessor.java-serialization.file" property being defined.
+

Revision as of 17:03, 23 May 2012

EclipseLink Metadata Cache

Purpose

This feature is to look at caching the metadata project so that the setup can avoid costs associated with reading in multiple orm.xml and annotation processing on entities within a persistence unit to rebuild it unnecessarily.

Requirements

  1. EntityManagerFactory and EntityManager instance creation use properties that allow overriding metadata settings/properties the same as it would if project caching was not used
  2. Project caching must allow weaving to happen
  3. It must be configurable to allow alternate implementations to cache the project differently
  4. The project will be read from/writen to the cache prior to login, prior to converting String ClassNames into Classes.

Design

PersistenceUnitProperties

public static final String PROJECT_CACHE_ACCESSOR = "eclipselink.project-cache-accessor"; will be the base property to configure this feature, and will take a string value representing shipped implementations or the a <package.class> name of a subclass implementation of the ProjectCache interface. By default a project cache accessor will not be used.

The "eclipselink.project-cache-accessor.<implementationShortName>" subset of properties will be used for implementation specific properties.

Interface

public interface ProjectCacheAccessor {
  public Project retrieveProject(Properties properties, Classloader loader);
  public void storeProject(Project project, Properties properties);
}

Included Implementation

This feature will include a ProjectCacheAccessor implementation that uses java serialization to read to/write from a file which can be used by specifying the PROJECT_CACHE_ACCESSOR property with a value of "java-serialization" This implementation will also require the file location be specified, and will rely on a "eclipselink.project-cache-accessor.java-serialization.file" property being defined.

Back to the top