/** * Sets this FeatureStore transaction. * * <p>If transaction is not auto commit, initiates an {@link ArcTransactionState} with the * dataStore's connection pool as key. * * @see FeatureStore#setTransaction(Transaction) */ public synchronized void setTransaction(final Transaction transaction) { // System.err.println(">>setTransaction called at " + // Thread.currentThread().getName()); if (transaction == null) { throw new NullPointerException("mean Transaction.AUTO_COMMIT?"); } // this is hacky as a simple reference check should be enough but // there // seem to be some class loader issues with udig so it does not work boolean isAutoCommit = Transaction.AUTO_COMMIT.equals(transaction); if (!isAutoCommit) { try { transaction.getState(new Object()); } catch (UnsupportedOperationException e) { isAutoCommit = true; } } this.transaction = transaction; }
private ArcTransactionState getState(final Transaction transaction) { if (Transaction.AUTO_COMMIT.equals(transaction)) { return null; } ArcTransactionState state = (ArcTransactionState) transaction.getState(this); if (state == null) { state = new ArcTransactionState(this, listenerManager); transaction.putState(this, state); } return state; }
JDBCTransactionState tstate = (JDBCTransactionState) t.getState(this); if (tstate != null) { return tstate.cx;
/** * Creates the right sort of In-Process Lock. * * @param transaction * @param featureLock * @return In-Process Lock * @throws FeatureLockException When a Transaction lock is requested against * Transaction.AUTO_COMMIT */ protected synchronized Lock createLock(Transaction transaction, FeatureLock featureLock) throws FeatureLockException { if (featureLock == FeatureLock.TRANSACTION) { // we need a Transacstion Lock if (transaction == Transaction.AUTO_COMMIT) { throw new FeatureLockException( "We cannot issue a Transaction lock against AUTO_COMMIT"); } TransactionLock lock = (TransactionLock) transaction.getState(this); if (lock == null) { lock = new TransactionLock(); transaction.putState(this, lock); return lock; } else { return lock; } } else { return new MemoryLock(featureLock); } }
state = (SessionTransactionState) transaction.getState(pool); if (state == null) {
@Override protected WFSFeatureWriter getWriterInternal(Query query, final int flags) throws IOException { query = joinQuery(query); query = resolvePropertyNames(query); final boolean autoCommit; WFSLocalTransactionState localState; if (Transaction.AUTO_COMMIT.equals(getTransaction())) { localState = getState().getLocalTransactionState(); autoCommit = true; } else { autoCommit = false; State state = transaction.getState(getEntry()); localState = (WFSLocalTransactionState) state; } final FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(query); final WFSFeatureWriter writer = new WFSFeatureWriter(this, localState, reader, autoCommit); return writer; }
(DiffTransactionState) getTransaction().getState(getEntry()); Diff diff = state.getDiff();
/** Sets the transaction associated with the state. */ @Override public void setTransaction(Transaction tx) { super.setTransaction(tx); if (tx != Transaction.AUTO_COMMIT) { synchronized (WFSRemoteTransactionState.class) { WFSDataStore dataStore = (WFSDataStore) entry.getDataStore(); WFSRemoteTransactionState remoteStateKeeper; remoteStateKeeper = (WFSRemoteTransactionState) tx.getState(dataStore); if (remoteStateKeeper == null) { remoteStateKeeper = new WFSRemoteTransactionState(dataStore); tx.putState(dataStore, remoteStateKeeper); } WFSLocalTransactionState localTransactionState = getLocalTransactionState(); remoteStateKeeper.watch(localTransactionState.getState()); } } } }
(DiffTransactionState) getTransaction().getState(getEntry()); Diff diff = state.getDiff(); synchronized (diff) {
(DiffTransactionState) getTransaction().getState(getEntry()); reader = new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(
if (!Transaction.AUTO_COMMIT.equals(transaction)) { ContentEntry entry = getEntry(); State state = transaction.getState(entry); WFSLocalTransactionState wfsState = (WFSLocalTransactionState) state; if (wfsState != null) {
localState = (WFSLocalTransactionState) transaction.getState(getEntry()); WFSDiff diff = localState.getDiff();
private ArcTransactionState getState(final Transaction transaction) { if (Transaction.AUTO_COMMIT.equals(transaction)) { return null; } ArcTransactionState state = (ArcTransactionState) transaction.getState(this); if (state == null) { state = new ArcTransactionState(this, listenerManager); transaction.putState(this, state); } return state; }
@Override public boolean release(String authID, Transaction transaction) throws IOException { AuthorizedLock lock = transaction == Transaction.AUTO_COMMIT ? null : (AuthorizedLock) transaction.getState(this); if (lock == null) lock = new AuthorizedLock(this, authID, 1 /* minutes */); releaseAll(lock); return true; }
@Override public boolean refresh(String authID, Transaction transaction) throws IOException { AuthorizedLock lock = transaction == Transaction.AUTO_COMMIT ? null : (AuthorizedLock) transaction.getState(this); if (lock == null) lock = new AuthorizedLock(this, authID, 1 /* minutes */); resetAll(lock); return true; }
TransactionStateDiff state(Transaction transaction) { synchronized (transaction) { TransactionStateDiff state = (TransactionStateDiff) transaction .getState(this); if (state == null) { state = new TransactionStateDiff(this); transaction.putState(this, state); } return state; } }
TypeDiffState state(Transaction transaction) { synchronized (transaction) { TypeDiffState state = (TypeDiffState) transaction.getState(this); if (state == null) { state = new TypeDiffState(this); transaction.putState(this, state); } return state; } } public void fireAdded( Feature newFeature, Transaction transaction ){
private TransactionStateDiff state(Transaction transaction) { synchronized (transaction) { TransactionStateDiff state = (TransactionStateDiff) transaction .getState(this); if (state == null) { state = new TransactionStateDiff(this); transaction.putState(this, state); } return state; } }
/** * This method is identical to the super class WHY? */ protected TransactionStateDiff state(Transaction transaction) { synchronized (transaction) { TransactionStateDiff state = (TransactionStateDiff) transaction .getState(this); if (state == null) { state = new TransactionStateDiff(this); transaction.putState(this, state); } return state; } }
(DiffTransactionState) getTransaction().getState(getEntry());