[ http://jira.codehaus.org/browse/OPENEJB-111?page=comments#action_58455 ] 

Andrus Adamchik commented on OPENEJB-111:
-----------------------------------------

Jacek, 

I guess regardless of whether OpenEJB plans to have its own provider (by 
writing one from scratch or bundling a third-party one, such as Cayenne when it 
is ready), the more important is the ability to act as a JPA container (thus 
making providers fully swappable). If this goal is achieved there is no need to 
expose extra APIs beyond javax.persistence to the provider writers.

As a part of  JPA container functinality OpenEJB needs:

* A mechanism to discover existing providers

 Using javax.persistence.Persistence for that is a good start

* A mechanism to load persistence.xml files and match them against available 
providers. 

This logic  can follow the code in 
JpaPersistenceProvider.createEntityManagerFactory(..) that loads 
persistence.xml converting them to PersistenceUnitInfo, but then delegating the 
actual factory creation to an external provider. 

So I am afraid here the best way is to follow copy/paste reuse as suggested by 
David on the mailing list. Specifically the following classes should be useful 
in OpenEJB container to deploy persistent objects: 
 - JpaPersistenceProvider
 - PersistenceUnitLoader
- PersistenceDescriptorParser
- JpaPersistenceUnitInfo (implements PersistenceUnitInfo)
and also probably DataSource instantiation mechanism via a JpaDataSourceFactory 
interface.



> JPA - persistence.xml parser and skeleton provider
> --------------------------------------------------
>
>          Key: OPENEJB-111
>          URL: http://jira.codehaus.org/browse/OPENEJB-111
>      Project: OpenEJB
>         Type: Task

>   Components: ejb3 simplified
>     Versions: 3.0
>     Reporter: Andrus Adamchik
>  Attachments: cayenne-jpa.zip
>
>
> This is a first cut of a Cayenne JPA provider that includes full parser for 
> persistence_1_0.xsd and a skeleton provider implementation. 
> Package structure:
> 1. 
> org.objectstyle.cayenne.jpa
> org.objectstyle.cayenne.jpa.spi
> Skeleton provider that DOES NOT depend on Cayenne core API. It includes 
> persistence.xml parser (no JAXB, sorry... but the parser is trivial - the 
> actial SAX handler code is around 100 lines). Parser can optionally be 
> configured to avlidate against the schema.
> 2. 
> org.objectstyle.cayenne.jpa.cspi 
> Concrete Cayenne-based provider that extends from generic provider.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to