001: /*
002: Copyright (C) 2007 Mobixess Inc. http://www.java-objects-database.com
003:
004: This file is part of the JODB (Java Objects Database) open source project.
005:
006: JODB is free software; you can redistribute it and/or modify it under
007: the terms of version 2 of the GNU General Public License as published
008: by the Free Software Foundation.
009:
010: JODB is distributed in the hope that it will be useful, but WITHOUT ANY
011: WARRANTY; without even the implied warranty of MERCHANTABILITY or
012: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013: for more details.
014:
015: You should have received a copy of the GNU General Public License along
016: with this program; if not, write to the Free Software Foundation, Inc.,
017: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
018: */
019: package com.mobixess.jodb.core.io;
020:
021: import com.mobixess.jodb.core.index.JODBIndexingRootAgent;
022: import com.mobixess.jodb.core.query.SortDataCache;
023: import com.mobixess.jodb.core.transaction.JODBSession;
024: import com.mobixess.jodb.core.transaction.TransactionContainer;
025: import com.mobixess.jodb.util.LongVector;
026:
027: public class JODBOperationContext {
028: private JODBSession _session;
029: private IOTicket _ioTicket;
030: private SortDataCache _sortDataCache;
031: private TransactionContainer _transactionContainer;
032: private JODBIndexingRootAgent _indexingRootAgent;
033: private LongVector _excludedObjects;
034: private boolean _serverMode;
035: private long _transactionOffset;
036:
037: /**
038: * @param session
039: * @param ioTicket
040: */
041: public JODBOperationContext(JODBSession session, IOTicket ioTicket,
042: SortDataCache sortDataCache,
043: TransactionContainer transactionContainer,
044: JODBIndexingRootAgent indexingRootAgent) {
045: this (session, ioTicket, sortDataCache, transactionContainer,
046: indexingRootAgent, null, false);
047: }
048:
049: /**
050: * @param session
051: * @param ioTicket
052: * @param excludedObjects
053: */
054: public JODBOperationContext(JODBSession session, IOTicket ioTicket,
055: SortDataCache sortDataCache,
056: TransactionContainer transactionContainer,
057: JODBIndexingRootAgent indexingRootAgent,
058: LongVector excludedObjects, boolean serverMode) {
059: super ();
060: _session = session;
061: _ioTicket = ioTicket;
062: _sortDataCache = sortDataCache;
063: _transactionContainer = transactionContainer;
064: _indexingRootAgent = indexingRootAgent;
065: _excludedObjects = excludedObjects;
066: _serverMode = serverMode;
067: }
068:
069: public IOTicket getIoTicket() {
070: return _ioTicket;
071: }
072:
073: public JODBSession getSession() {
074: return _session;
075: }
076:
077: public IOBase getBase() {
078: return _session.getBase();
079: }
080:
081: public SortDataCache getSortDataCache() {
082: return _sortDataCache;
083: }
084:
085: public TransactionContainer getTransactionContainer() {
086: return _transactionContainer;
087: }
088:
089: public JODBIndexingRootAgent getIndexingRootAgent() {
090: return _indexingRootAgent;
091: }
092:
093: public long getTransactionOffset() {
094: return _transactionOffset;
095: }
096:
097: public void setTransactionOffset(long transactionOffset) {
098: _transactionOffset = transactionOffset;
099: }
100:
101: public boolean isServerMode() {
102: return _serverMode;
103: }
104:
105: public boolean isExcludedObjectId(long objectId) {
106: if (_excludedObjects == null) {
107: return false;
108: }
109: return _excludedObjects.binarySearch(objectId) >= 0;
110: }
111: }
|