01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.gps.device.jpa.entities;
18:
19: import javax.persistence.EntityManagerFactory;
20:
21: import org.compass.gps.device.jpa.JpaGpsDevice;
22: import org.compass.gps.device.jpa.JpaGpsDeviceException;
23:
24: /**
25: * Resposible for locating entities for the index process. Most of the times the {@link DefaultJpaEntitiesLocator}
26: * should suffice, but it only works with JPA annotations. For JPA implementations that uses a combination of
27: * both annotations and other means of configuration (like xml), an implementaiton of this locator is required.
28: * <p/>
29: * Assume that the <code>EntityManagerFactory</code> is the native one, since the
30: * {@link org.compass.gps.device.jpa.NativeJpaExtractor} of the
31: * {@link JpaGpsDevice} was used to extract it.
32: *
33: * @author kimchy
34: * @see JpaEntitiesLocatorDetector
35: * @see org.compass.gps.device.jpa.entities.HibernateJpaEntitiesLocator
36: */
37: public interface JpaEntitiesLocator {
38:
39: /**
40: * Locates the entities used for the index operation.
41: *
42: * @param entityManagerFactory The <code>EntityManagerFactory<code> to be optionally used for locating the entities.
43: * @param device The Jpa device that called this locator.
44: * @return An array of the enteties that need to be indexed during the index operation.
45: * @throws JpaGpsDeviceException
46: */
47: EntityInformation[] locate(
48: EntityManagerFactory entityManagerFactory,
49: JpaGpsDevice device) throws JpaGpsDeviceException;
50: }
|