org.neo4j.kernel.impl.nioneo.xa
Class NeoStoreXaDataSource

java.lang.Object
  extended by org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
      extended by org.neo4j.kernel.impl.transaction.xaframework.LogBackedXaDataSource
          extended by org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource

public class NeoStoreXaDataSource
extends LogBackedXaDataSource

A NeoStoreXaDataSource is a factory for NeoStoreXaConnections.

The NioNeoDbPersistenceSource will create a NeoStoreXaDataSoruce and then Neo4j kernel will use it to create XaConnections and XaResources when running transactions and performing operations on the node space.


Field Summary
static byte[] BRANCH_ID
           
static String LOGICAL_LOG_DEFAULT_NAME
           
 
Constructor Summary
NeoStoreXaDataSource(Map<Object,Object> config)
          Creates a NeoStoreXaDataSource using configuration from params.
 
Method Summary
 void close()
          Closes this data source.
 long getCreationTime()
          Returns a timestamp when this data source was created.
 long getCurrentLogVersion()
          Returns the current version of this data source.
 long getHighestPossibleIdInUse(Class<?> clazz)
           
 long getLastCommittedTxId()
           
 StringLogger getMsgLog()
           
 NeoStore getNeoStore()
          Creates a data source with minimum (no memory mapped) configuration.
 long getNumberOfIdsInUse(Class<?> clazz)
           
 long getRandomIdentifier()
          Returns a random identifier that gets generated when the data source is created.
 String getStoreDir()
           
 StoreId getStoreId()
           
 List<WindowPoolStats> getWindowPoolStats()
           
 XaConnection getXaConnection()
          Creates a XA connection to the resource this data source represents.
 XaContainer getXaContainer()
           
 long incrementAndGetLogVersion()
           
 boolean isReadOnly()
           
 ClosableIterable<File> listStoreFiles(boolean includeLogicalLogs)
           
 void logIdUsage()
           
 void logStoreVersions()
           
 long nextId(Class<?> clazz)
           
 void setCurrentLogVersion(long version)
           
 void setLastCommittedTxId(long txId)
           
 boolean setRecovered(boolean recovered)
          Returns previous value
 
Methods inherited from class org.neo4j.kernel.impl.transaction.xaframework.LogBackedXaDataSource
deleteLogicalLog, getFileName, getLogExtractor, getLogicalLog, getLogicalLogLength, getMasterForCommittedTx, getPreparedTransaction, getPreparedTransaction, hasLogicalLog, isLogicalLogKept, keepLogicalLogs, rotateLogicalLog, setAutoRotate, setKeepLogicalLogsIfSpecified, setLogicalLogAtCreationTime, setLogicalLogTargetSize
 
Methods inherited from class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
applyCommittedTransaction, applyPreparedTransaction, getBranchId, getName, setBranchId, setName, shouldKeepLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRANCH_ID

public static final byte[] BRANCH_ID

LOGICAL_LOG_DEFAULT_NAME

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

NeoStoreXaDataSource

public NeoStoreXaDataSource(Map<Object,Object> config)
                     throws IOException,
                            InstantiationException
Creates a NeoStoreXaDataSource using configuration from params. First the map is checked for the parameter config. If that parameter exists a config file with that value is loaded (via Properties.load(java.io.Reader)). Any parameter that exist in the config file and in the map passed into this constructor will take the value from the map.

If config parameter is set but file doesn't exist an IOException is thrown. If any problem is found with that configuration file or Neo4j store can't be loaded an IOException is thrown.

Parameters:
params - A map containing configuration parameters and/or configuration file.
Throws:
IOException - If unable to create data source
InstantiationException
Method Detail

getNeoStore

public NeoStore getNeoStore()
Creates a data source with minimum (no memory mapped) configuration.

Parameters:
neoStoreFileName - The file name of the store
logicalLogPath - The file name of the logical log
Throws:
IOException - If unable to open store

close

public void close()
Description copied from class: XaDataSource
Closes this data source. Calling getXaConnection after this method has been invoked is illegal.

Specified by:
close in class XaDataSource

getStoreId

public StoreId getStoreId()

getXaConnection

public XaConnection getXaConnection()
Description copied from class: XaDataSource
Creates a XA connection to the resource this data source represents.

Specified by:
getXaConnection in class XaDataSource
Returns:
A connection to an XA resource

nextId

public long nextId(Class<?> clazz)

getHighestPossibleIdInUse

public long getHighestPossibleIdInUse(Class<?> clazz)

getNumberOfIdsInUse

public long getNumberOfIdsInUse(Class<?> clazz)

getStoreDir

public String getStoreDir()

getCreationTime

public long getCreationTime()
Description copied from class: XaDataSource
Returns a timestamp when this data source was created. Note this is not the timestamp for the creation of the data source object instance, if the data source is for example a database timestamp is meant to be when the database was created.

Creation time together with random identifier can be used to uniqley identify a data source (since it is possible to have multiple sources of same type).

Overrides:
getCreationTime in class XaDataSource
Returns:
timestamp when this datasource was created

getRandomIdentifier

public long getRandomIdentifier()
Description copied from class: XaDataSource
Returns a random identifier that gets generated when the data source is created. Note with "created" we mean first time data source is created and not object creation.

Creation time together with the random identifier can be used to uniquely identify a data source (since it is possible to have multiple sources of the same type).

Overrides:
getRandomIdentifier in class XaDataSource
Returns:
random identifier for this data source

getCurrentLogVersion

public long getCurrentLogVersion()
Description copied from class: XaDataSource
Returns the current version of this data source. A invoke to the XaDataSource.rotateLogicalLog() when XaDataSource.keepLogicalLogs(boolean) is set to true will result in a log with that version created.

Overrides:
getCurrentLogVersion in class XaDataSource
Returns:
the current version of the logical log

incrementAndGetLogVersion

public long incrementAndGetLogVersion()

setCurrentLogVersion

public void setCurrentLogVersion(long version)

setLastCommittedTxId

public void setLastCommittedTxId(long txId)
Overrides:
setLastCommittedTxId in class XaDataSource

isReadOnly

public boolean isReadOnly()

getWindowPoolStats

public List<WindowPoolStats> getWindowPoolStats()

getLastCommittedTxId

public long getLastCommittedTxId()
Overrides:
getLastCommittedTxId in class XaDataSource

getXaContainer

public XaContainer getXaContainer()
Overrides:
getXaContainer in class XaDataSource

setRecovered

public boolean setRecovered(boolean recovered)
Description copied from class: XaDataSource
Returns previous value

Overrides:
setRecovered in class XaDataSource

listStoreFiles

public ClosableIterable<File> listStoreFiles(boolean includeLogicalLogs)
Overrides:
listStoreFiles in class XaDataSource

getMsgLog

public StringLogger getMsgLog()

logStoreVersions

public void logStoreVersions()

logIdUsage

public void logIdUsage()


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.