Currently PAX-JPA tracks PersitencProviders and DataSourceFactories through the PersistenceBundleObserver class and on changes it tries to fetch the "right" one for the unit, this has several drawbacks:
It makes it hard to detect state changes as there must be several checks and reasignments
Services are might be discovered because it seems there is a demand fro them
book-keeping must be done in a global fashion and tracked services must be saved inside PersistenceUnitInfoImpl
Currently it is required that the persitence bundle is already actively started, but the spec suggests to detect PU-Unit descriptors as soon as possible in the installed state so clasloading has not taken place yet
Even though the delcarative aproach is useful in many scenarios, here we should change this to using more basic operations (e.g. servicetracker) to get as close as possible to the OSGi-core and to fulfill the jpa-spec recommendations.