org.compass.core.impl
Class DefaultCompass

java.lang.Object
  extended by org.compass.core.impl.DefaultCompass
All Implemented Interfaces:
Serializable, Referenceable, Compass, InternalCompass

public class DefaultCompass
extends Object
implements InternalCompass

Author:
kimchy
See Also:
Serialized Form

Nested Class Summary
static class DefaultCompass.TransactionalSearchEngineOptimizer
           
 
Field Summary
protected  CompassSettings settings
           
 
Constructor Summary
DefaultCompass(CompassMapping mapping, ConverterLookup converterLookup, CompassMetaData compassMetaData, PropertyNamingStrategy propertyNamingStrategy, CompassSettings settings)
           
DefaultCompass(CompassMapping mapping, ConverterLookup converterLookup, CompassMetaData compassMetaData, PropertyNamingStrategy propertyNamingStrategy, CompassSettings settings, boolean duplicate)
           
DefaultCompass(CompassMapping mapping, ConverterLookup converterLookup, CompassMetaData compassMetaData, PropertyNamingStrategy propertyNamingStrategy, CompassSettings settings, boolean duplicate, LuceneSearchEngineFactory searchEngineFactory)
           
 
Method Summary
 Compass clone(CompassSettings addedSettings)
          Clones the current Compass instance.
 void close()
          Closes Compass
 ConverterLookup getConverterLookup()
           
 CompassMapping getMapping()
           
 CompassMetaData getMetaData()
           
 String getName()
           
 PropertyNamingStrategy getPropertyNamingStrategy()
           
 Reference getReference()
           
 SearchEngineFactory getSearchEngineFactory()
           
 SearchEngineIndexManager getSearchEngineIndexManager()
          Return the search engine index manager.
 SearchEngineOptimizer getSearchEngineOptimizer()
          Retruns the search engine optimizer.
 CompassSettings getSettings()
           
 TransactionFactory getTransactionFactory()
           
 CompassSession openSession()
          If there is a transaction bound session, will return it.
 CompassSession openSession(boolean allowCreate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected CompassSettings settings
Constructor Detail

DefaultCompass

public DefaultCompass(CompassMapping mapping,
                      ConverterLookup converterLookup,
                      CompassMetaData compassMetaData,
                      PropertyNamingStrategy propertyNamingStrategy,
                      CompassSettings settings)
               throws CompassException
Throws:
CompassException

DefaultCompass

public DefaultCompass(CompassMapping mapping,
                      ConverterLookup converterLookup,
                      CompassMetaData compassMetaData,
                      PropertyNamingStrategy propertyNamingStrategy,
                      CompassSettings settings,
                      boolean duplicate)
               throws CompassException
Throws:
CompassException

DefaultCompass

public DefaultCompass(CompassMapping mapping,
                      ConverterLookup converterLookup,
                      CompassMetaData compassMetaData,
                      PropertyNamingStrategy propertyNamingStrategy,
                      CompassSettings settings,
                      boolean duplicate,
                      LuceneSearchEngineFactory searchEngineFactory)
               throws CompassException
Throws:
CompassException
Method Detail

clone

public Compass clone(CompassSettings addedSettings)
Description copied from interface: Compass
Clones the current Compass instance. The added settings will merged with the current compass settings, and control the creation of the new Compass.

Note, that the new instance will not be registered with JNDI, as well as not start the optimizer.

Specified by:
clone in interface Compass
Parameters:
addedSettings - The settings to be added.
Returns:
the cloned compass instance.

getName

public String getName()
Specified by:
getName in interface InternalCompass

getMapping

public CompassMapping getMapping()
Specified by:
getMapping in interface InternalCompass

openSession

public CompassSession openSession()
Description copied from interface: Compass
If there is a transaction bound session, will return it. Otherwise returns a new session.

A transactional bound session is bounded to the transaction when calling the CompassSession.beginTransaction() or if Compass tries to automatically join an already running transaction (see next paragraph).

If creating a new session, will try to automatically join an existing outer transaction. An outer transaction might be an already running Compass local transaction, or an external transaciton (JTA or Spring for example). In such cases, there is no need to perform any transaction managment code (begin or commit/rollback transaction) or closing the opened session. Compass will also bind the session to the same transaction if an outer transaction exists. Note, when doing so, the mentioned code will have to always be excuted within an already running transaction.

Specified by:
openSession in interface Compass
Returns:
CompassSession The compass session

openSession

public CompassSession openSession(boolean allowCreate)

close

public void close()
Description copied from interface: Compass
Closes Compass

Specified by:
close in interface Compass

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException

getSettings

public CompassSettings getSettings()
Specified by:
getSettings in interface InternalCompass

getSearchEngineOptimizer

public SearchEngineOptimizer getSearchEngineOptimizer()
Description copied from interface: Compass
Retruns the search engine optimizer. You can controll the state of the optimizer (by calling stop or start), you can check if the index need optimization, and you can optimize the index.

Specified by:
getSearchEngineOptimizer in interface Compass
Returns:
the search engine optimizer

getSearchEngineIndexManager

public SearchEngineIndexManager getSearchEngineIndexManager()
Description copied from interface: Compass
Return the search engine index manager. You can control the index using it.

Specified by:
getSearchEngineIndexManager in interface Compass
Returns:
the search engine index manager

getSearchEngineFactory

public SearchEngineFactory getSearchEngineFactory()
Specified by:
getSearchEngineFactory in interface InternalCompass

getMetaData

public CompassMetaData getMetaData()
Specified by:
getMetaData in interface InternalCompass

getTransactionFactory

public TransactionFactory getTransactionFactory()
Specified by:
getTransactionFactory in interface InternalCompass

getConverterLookup

public ConverterLookup getConverterLookup()
Specified by:
getConverterLookup in interface InternalCompass

getPropertyNamingStrategy

public PropertyNamingStrategy getPropertyNamingStrategy()
Specified by:
getPropertyNamingStrategy in interface InternalCompass


Copyright (c) 2004-2006 The Compass Project.