org.compass.gps.device.jpa.embedded.openjpa
Class CompassProductDerivation

java.lang.Object
  extended by org.apache.openjpa.lib.conf.AbstractProductDerivation
      extended by org.compass.gps.device.jpa.embedded.openjpa.CompassProductDerivation
All Implemented Interfaces:
org.apache.openjpa.lib.conf.ProductDerivation

public class CompassProductDerivation
extends org.apache.openjpa.lib.conf.AbstractProductDerivation

An OpenJPA Compass product derivation. Simply by adding the Compass jar to the class path this product derivation will be registered with OpenJPA. This derivation will not add Compass support to OpenJPA if no Compass setting is set. The single required setting (for example, within the persistence.xml) is Compass engine connection setting (CompassEnvironment.CONNECTION.

The embedded Open JPA support uses Compass GPS and adds an "embedded" Compass, or adds a searchable feature to Open JPA by registering a Compass instance and a JpaGpsDevice instance with OpenJPA. It registers mirroring listeners (after delete/store/persist) to automatically mirror changes done through OpenJPA to the Compass index. It also registeres transaction listeners to synchronize between Compass transactions and Open JPA transactions.

Use OpenJPAHelper in order to access the registered Compass instnace and JpaGpsDevice instance assigned to the EntityManagerFactory. Also use it to get CompassSession assigned to an EntityManager.

The Compass instnace used for mirroring can be configured by adding compass prefixed settings. Additional settings that only control the Compass instnace created for indexing should be set using gps.index.compass.. For more information on indexing and mirroring Compass please check SingleCompassGps.

Specific properties that this plugin can use:

Author:
kimchy

Field Summary
static String COMPASS_CONFIG_LOCATION
           
static String COMPASS_GPS_USER_OBJECT_KEY
           
static String COMPASS_INDEX_SETTINGS_USER_OBJECT_KEY
           
static String COMPASS_SESSION_USER_OBJECT_KEY
           
static String COMPASS_TRANSACTION_USER_OBJECT_KEY
           
static String COMPASS_USER_OBJECT_KEY
           
static String INDEX_QUERY_PREFIX
           
static String REGISTER_REMOTE_COMMIT_LISTENER
           
static String REINDEX_ON_STARTUP
           
 
Fields inherited from interface org.apache.openjpa.lib.conf.ProductDerivation
TYPE_FEATURE, TYPE_PRODUCT
 
Constructor Summary
CompassProductDerivation()
           
 
Method Summary
 void beforeConfigurationClose(org.apache.openjpa.lib.conf.Configuration configuration)
           
 boolean beforeConfigurationConstruct(org.apache.openjpa.lib.conf.ConfigurationProvider cp)
           
 boolean beforeConfigurationLoad(org.apache.openjpa.lib.conf.Configuration config)
           
 int getType()
           
static void installCompass(org.apache.openjpa.kernel.BrokerFactory factory)
          Deprecated. This is only needed for pre-1.0 versions of OpenJPA.
static boolean isReleasedVersion()
           
protected  void registerListeners(org.apache.openjpa.kernel.BrokerFactory brokerFactory)
           
 
Methods inherited from class org.apache.openjpa.lib.conf.AbstractProductDerivation
afterSpecificationSet, getAnchorsInFile, getAnchorsInResource, getConfigurationPrefix, getDefaultResourceLocation, load, load, loadDefaults, loadGlobals, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPASS_USER_OBJECT_KEY

public static final String COMPASS_USER_OBJECT_KEY

COMPASS_SESSION_USER_OBJECT_KEY

public static final String COMPASS_SESSION_USER_OBJECT_KEY

COMPASS_TRANSACTION_USER_OBJECT_KEY

public static final String COMPASS_TRANSACTION_USER_OBJECT_KEY

COMPASS_GPS_USER_OBJECT_KEY

public static final String COMPASS_GPS_USER_OBJECT_KEY

COMPASS_INDEX_SETTINGS_USER_OBJECT_KEY

public static final String COMPASS_INDEX_SETTINGS_USER_OBJECT_KEY

REINDEX_ON_STARTUP

public static final String REINDEX_ON_STARTUP
See Also:
Constant Field Values

REGISTER_REMOTE_COMMIT_LISTENER

public static final String REGISTER_REMOTE_COMMIT_LISTENER
See Also:
Constant Field Values

INDEX_QUERY_PREFIX

public static final String INDEX_QUERY_PREFIX
See Also:
Constant Field Values

COMPASS_CONFIG_LOCATION

public static final String COMPASS_CONFIG_LOCATION
See Also:
Constant Field Values
Constructor Detail

CompassProductDerivation

public CompassProductDerivation()
Method Detail

getType

public int getType()

beforeConfigurationLoad

public boolean beforeConfigurationLoad(org.apache.openjpa.lib.conf.Configuration config)
Specified by:
beforeConfigurationLoad in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
beforeConfigurationLoad in class org.apache.openjpa.lib.conf.AbstractProductDerivation

installCompass

public static void installCompass(org.apache.openjpa.kernel.BrokerFactory factory)
Deprecated. This is only needed for pre-1.0 versions of OpenJPA.


beforeConfigurationConstruct

public boolean beforeConfigurationConstruct(org.apache.openjpa.lib.conf.ConfigurationProvider cp)
Specified by:
beforeConfigurationConstruct in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
beforeConfigurationConstruct in class org.apache.openjpa.lib.conf.AbstractProductDerivation

registerListeners

protected void registerListeners(org.apache.openjpa.kernel.BrokerFactory brokerFactory)

beforeConfigurationClose

public void beforeConfigurationClose(org.apache.openjpa.lib.conf.Configuration configuration)
Specified by:
beforeConfigurationClose in interface org.apache.openjpa.lib.conf.ProductDerivation
Overrides:
beforeConfigurationClose in class org.apache.openjpa.lib.conf.AbstractProductDerivation

isReleasedVersion

public static boolean isReleasedVersion()


Copyright (c) 2004-2009 The Compass Project.