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.
Difference between revisions of "EclipseLink/DesignDocs/384399"
(→Design Specification: MOXy Footprint Reduction) |
(→Open Issues) |
||
Line 360: | Line 360: | ||
! Description / Notes | ! Description / Notes | ||
|- | |- | ||
− | | | + | | 1 |
− | | | + | | Doug/Peter |
− | | | + | | Does the implementation of this feature require us to bump the version number to 3.0? |
+ | |- | ||
+ | | | ||
+ | | | ||
|} | |} | ||
Revision as of 14:30, 13 September 2012
Contents
- 1 Design Specification: MOXy Footprint Reduction
- 1.1 Document History
- 1.2 Project overview
- 1.3 Concepts
- 1.4 Requirements
- 1.5 Design / Functionality
- 1.6 Development Plan
- 1.6.1 Phase #1 - Introduce XMLSession and Supporting Classes
- 1.6.2 Phase #2 - Move MOXy Specific Classes Out of Core Bundle
- 1.6.3 Phase #3 - Create the Common Bundle
- 1.6.4 Phase #4 - Have Core Classes Extend Corresponding Common Classes
- 1.6.5 Phase #5 - Introduce XMLProject Class
- 1.6.6 Phase #6 - Change OXM Classes to Extend Common Classes
- 1.6.7 Phase #7 - Move ORM Specific Classes Out of Core Bundle
- 1.6.8 Phase #8 - Move Common Classes to Core Bundle
- 1.7 Testing
- 1.8 API
- 1.9 Documentation
- 1.10 Open Issues
- 1.11 Decisions
- 1.12 Future Considerations
Design Specification: MOXy Footprint Reduction
Document History
Date | Author | Version Description & Notes |
---|---|---|
2012/07/05 | Blaise Doughan | Initial draft |
2012/08/20 | Blaise Doughan | Pre-review Draft |
2012/09/13 | Blaise Doughan | Rewrite |
Project overview
Problem
The install footprint is currently preventing MOXy from being bundled with other software and used on mobile platforms.
XML Binding Install Footprint (EclipseLink 2.4)
Bundle | Size |
---|---|
org.eclipse.persistence.moxy_2.4.0.v20120608-r11652.jar | 455 KB |
org.eclipse.persistence.asm_3.3.1.v201206041142.jar | 271 KB |
org.eclipse.persistence.core_2.4.0.v20120608-r11652.jar | 4711 KB |
5437 KB |
JSON Binding Install Footprint (EclipseLink 2.4)
Bundle | Size |
---|---|
org.eclipse.persistence.moxy_2.4.0.v20120608-r11652.jar | 455 KB |
org.eclipse.persistence.asm_3.3.1.v201206041142.jar | 271 KB |
org.eclipse.persistence.core_2.4.0.v20120608-r11652.jar | 4711 KB |
org.eclipse.persistence.antlr_3.2.0.v201206041011.jar | 190 KB |
5627 KB |
Primary Goals
Reduce the size of X so that is no more that 600 KB.
Bundle | Size |
---|---|
org.eclipse.persistence.moxy_2.4.0.v20120608-r11652.jar | 455 KB |
org.eclipse.persistence.asm_3.3.1.v201206041142.jar | 271 KB |
org.eclipse.persistence.oxm_2.4.0.v20120608-r11652.jar | X KB |
org.eclipse.persistence.antlr_3.2.0.v201206041011.jar | 190 KB |
(726 + X) KB (XML) / (916 + X) KB (JSON) |
Secondary Goals
Memory Improvement
Many of the current "core" classes contains information that is only required for object-relational mapping. This type of metadata needlessly increases the amount of memory MOXy requires to run. This refactor will reduce the amount of memory MOXy requires to run.
Concepts
Package Splitting
This is when classes from the same package are distributed among different bundles. This is not compatible with OSGi, and therefore is something that we can not do.
Requirements
- Existing bundles must remain binary compatible, except the JAXB impl classes. This means if you only use the java.xml.bind.* classes you will be find, but if you cast down to the org.eclipse.persistence.jaxb.* classes then you may need to make code changes or recompile.
Design / Functionality
High Level
Bundle Changes
- Have the org.eclipse.persistence.common bundle contain things that are only common to both OXM and ORM.
- Move MOXy specific items into MOXy bundle.
- MOXy ORM specific items into JPA bundle (or a new ORM bundle).
Common Abstractions
The common bundle will include abstractions that are common to both MOXy and ORM. Below is an example of the current and proposed architectures.
- AbstractProject, AbstractDescriptor, and AbstractMapping would be part of the new common bundle.
- Project, ClassDescriptor, and DatabaseMapping would be changed to extend their counterparts from the core bundle. This would be done in such a way as to maintain binary compatibility.
- New MOXy classes would be added (i.e. XMLProject and XMLMapping) and others modified (i.e. XMLDescriptor). This would introduce a binary incompatibility in the native MOXy APIs.
Current (edit) | Proposed (edit) | |
---|---|---|
Medium Level
Required Abstractions
Initial prototyping indicates that abstractions would be required for the following classes:
- org.eclipse.persistence.config
- DescriptorCustomizer
- org.eclipse.persistence.descriptors
- ClassDescriptor
- ClassExtractor
- DescriptorEvent
- DescriptorEventAdapter
- DescriptorEventAdapter
- DescriptorEventManager
- InheritancePolicy
- InstatiationPolicy
- org.eclipse.persistence.exceptions
- ExceptionHandler
- IntegrityChecker
- org.eclipse.persistence.internal.databaseaccess
- DatasourcePlatform
- org.eclipse.persistence.internal.descriptors
- ObjectBuilder
- org.eclipse.persistence.internal.helper
- ConversionManager
- DatabaseField
- DatabaseTable
- org.eclipse.persistence.internal.identitymaps
- CacheKey
- org.eclipse.persistence.internal.queries
- ContainerPolicy
- org.eclipse.persistence.internal.sessions
- AbstractRecord
- AbstractSession
- IdentityMapAccessor
- org.eclipse.persistence.mappings
- AttributeAccessor
- DatabaseMapping
- org.eclipse.persistence.mappings.converters
- Converter
- org.eclipse.persistence.mappings.sessions
- DatasourceLogin
- org.eclipse.persistence.queries
- ObjectBuildingQuery
- org.eclipse.persistence.sessions
- Project
- SessionEvent
- SessionEventAdapter
- SessionEventListener
- SessionEventManager
- SesssionLog
Low Level
Inheritance Hierarchies
To Do
Development Plan
Phase #1 - Introduce XMLSession and Supporting Classes
The following items will be done during this phase:
- Add org.eclipse.persistence.oxm.sessions.XMLSession and supporting classes
- Have XMLSession extend DatabaseSession
- Modify OXM layer to use instance of XMLSession (no public API changes yet)
- Override all inherited methods to throw UnsupportedOperationException
- Add back minimum functionality to get OXM/JAXB/SDO tests passing.
Phase #2 - Move MOXy Specific Classes Out of Core Bundle
The following items will be done during this phase:
- Move the MOXy specific classes from the org.eclipse.persistence.core bundle into the org.eclipse.persistence.moxy bundle or intro a new org.eclipse.persistence.oxm bundle (see Open Issue #2).
- Update relevant project/build/maven dependencies to reflect this change.
Phase #3 - Create the Common Bundle
The following items will be done during this phase:
- Create the org.eclipse.persistence.common bundle as a new foundation bundle. This bundle will later become the org.eclipse.persistence.common bundle.
- Add skeleton abstractions into common bundle
- Update relevant dependencies
Phase #4 - Have Core Classes Extend Corresponding Common Classes
- Modify classes in the core bundle with counterparts in the common bundle to subclass from them.
- Move common functionality up to super class.
- ORM subclasses will need methods that simply call the super method to maintain binary compatibility.
Phase #5 - Introduce XMLProject Class
The following items will be done during this phase:
- Add org.eclipse.persistence.oxm.XMLProject as a subclass of org.eclipse.persistence.sessions.Project.
- Modify OXM test cases to use the new XMLProject class.
Phase #6 - Change OXM Classes to Extend Common Classes
- Change the OXM Classes to Extend Common Classes
Phase #7 - Move ORM Specific Classes Out of Core Bundle
The following items will be done during this phase:
- Move the ORM specific classes from the org.eclipse.persistence.core bundle into the org.eclipse.persistence.jpa bundle or intro a new org.eclipse.persistence.orm bundle (see Open Issue #3).
- Update relevant project/build/maven dependencies to reflect this change.
Phase #8 - Move Common Classes to Core Bundle
The following items will be done during this phase:
- Move the Core classes from the org.eclipse.persistence.common bundle into the org.eclipse.persistence.core bundle.
- Delete the common bundle.
- Update relevant project/build/maven dependencies to reflect this change.
Testing
Binary Compatible Testing
Testing would be required to ensure that binary compatibility is kept, for the areas we plan on maintaining binary compatibility.
API
Core Packages
The following would be the proposed package structure for the core bundle.
- org.eclipse.persistence.core
- org.eclipse.persistence.core.config
- org.eclipse.persistence.core.descriptors
- org.eclipse.persistence.core.exceptions
- org.eclipse.persistence.core.mappings
- org.eclipse.persistence.core.mappings.converters
- org.eclipse.persistence.core.queries
- org.eclipse.persistence.core.sessions
- org.eclipse.persistence.internal.core
- org.eclipse.persistence.internal.core.databaseaccess
- org.eclipse.persistence.internal.core.descriptors
- org.eclipse.persistence.internal.core.helper
- org.eclipse.persistence.internal.core.identitymaps
- org.eclipse.persistence.internal.core.queries
- org.eclipse.persistence.internal.core.sessions
Proposed Class Structure
New Abstractions (i.e. Descriptor)
A set of interfaces will be created to represent the core functionality that is common to both object-to-XML and object-to-relational mapping. Type variables will be leveraged so that the OXM and ORM implementations can be further specialized.
package org.eclipse.persistence.internal.core; public interface Descriptor< OBJECT_BUILDER extends ObjectBuilder, INHERITANCE_POLICY extends InheritancePolicy, INSTANTIATION_POLICY extends InstantiationPolicy> { OBJECT_BUILDER getObjectBuilder(); INHERITANCE_POLICY getInheritancePolicy(); INSTANTIATION_POLICY getInstantiationPolicy(); }
New OXM Classes
The new light weight MOXy will provide a new implementation of these core interfaces (the class names below are for demonstration purposes only). The existing core OXM classes will continue to work (see below).
public class SmallXMLDescriptor implements Descriptor<SmallObjectBuilder, SmallInheritancePolicy, SmallInstantiationPolicy>, Cloneable, Serializable {
Existing Core Classes (i.e. ClassDescriptor)
The existing core classes will be modified to implement these interfaces supplying the appropriate type variables. Everything else about the core classes will stay the same ensuring backwards compatibility.
public class ClassDescriptor implements Descriptor<ObjectBuilder, InheritancePolicy, InstantiationPolicy>, Cloneable, Serializable {
Documentation
The following items will need to be documented:
- What the binary incompatibilities are (if any).
Open Issues
This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.
Issue # | Owner | Description / Notes |
---|---|---|
1 | Doug/Peter | Does the implementation of this feature require us to bump the version number to 3.0? |
Decisions
This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.
Issue # | Description / Notes | Decision |
---|---|---|
Future Considerations
During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.
Project Jigsaw
Is a standard module system being designed for the Java SE platform. It is being applied to the JDK itself. While this feature is not dependent on Jigsaw, care will be taken as to what modules we will need to depend on.