org.compass.gps.device.jpa.entities
Class EclipseLinkJpaEntitiesLocator

java.lang.Object
  extended by org.compass.gps.device.jpa.entities.EclipseLinkJpaEntitiesLocator
All Implemented Interfaces:
JpaEntitiesLocator

public class EclipseLinkJpaEntitiesLocator
extends Object
implements JpaEntitiesLocator

A specilized version that works with Eclipse Persistence. This class should be used instead of DefaultJpaEntitiesLocator since it works with both xml files and annotatios.

Author:
kimchy

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
EclipseLinkJpaEntitiesLocator()
           
 
Method Summary
 EntityInformation[] locate(javax.persistence.EntityManagerFactory entityManagerFactory, JpaGpsDevice device)
          Locates the entities used for the index operation.
protected  boolean shouldFilter(String entityname, org.eclipse.persistence.descriptors.ClassDescriptor classDescriptor, JpaGpsDevice device)
          Returns true if the entity name needs to be filtered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
Constructor Detail

EclipseLinkJpaEntitiesLocator

public EclipseLinkJpaEntitiesLocator()
Method Detail

locate

public EntityInformation[] locate(javax.persistence.EntityManagerFactory entityManagerFactory,
                                  JpaGpsDevice device)
                           throws JpaGpsDeviceException
Description copied from interface: JpaEntitiesLocator
Locates the entities used for the index operation.

Specified by:
locate in interface JpaEntitiesLocator
Parameters:
entityManagerFactory - The EntityManagerFactory to be optionally used for locating the entities.
device - The Jpa device that called this locator.
Returns:
An array of the enteties that need to be indexed during the index operation.
Throws:
JpaGpsDeviceException

shouldFilter

protected boolean shouldFilter(String entityname,
                               org.eclipse.persistence.descriptors.ClassDescriptor classDescriptor,
                               JpaGpsDevice device)
Returns true if the entity name needs to be filtered.

Implementation filteres out inherited Eclipse mappings, since the select query for the base class will cover any inherited classes as well.

Note, that this method is called after it has been verified that the class has Compass mappings (either directly, or indirectly by an interface or a super class).

Parameters:
entityname - The name of the entity
classDescriptor - The Eclipse class descriptor
device - The Jpa Gps device
Returns:
true if the entity should be filtered out, false if not.


Copyright (c) 2004-2009 The Compass Project.