1
package com.eucalyptus.entities;
4
import javax.persistence.Embeddable;
5
import javax.persistence.Entity;
6
import javax.persistence.MappedSuperclass;
7
import javax.persistence.PersistenceContext;
8
import org.apache.log4j.Logger;
9
import com.eucalyptus.bootstrap.BootstrapException;
10
import com.eucalyptus.bootstrap.ServiceJarDiscovery;
11
import com.eucalyptus.system.Ats;
12
import com.eucalyptus.system.BaseDirectory;
13
import com.google.common.collect.Multimap;
15
public class PersistenceContextDiscovery extends ServiceJarDiscovery {
16
private static Logger LOG = Logger.getLogger( PersistenceContextDiscovery.class );
18
public PersistenceContextDiscovery( ) {}
21
public Double getPriority( ) {
26
public boolean processClass( Class candidate ) throws Throwable {
27
if ( Ats.from( candidate ).has( Entity.class ) ) {
28
if ( !Ats.from( candidate ).has( PersistenceContext.class ) ) {
29
throw BootstrapException.throwFatal( "Database entity does not have required @PersistenceContext annotation: " + candidate.getCanonicalName( ) );
31
PersistenceContexts.addEntity( candidate );
34
} else if ( Ats.from( candidate ).has( MappedSuperclass.class ) || Ats.from( candidate ).has( Embeddable.class ) ) {
35
PersistenceContexts.addSharedEntity( candidate );