Moved from ldap.support.transaction to ldap.transaction and ldap.transaction.core

This commit is contained in:
Mattias Arthursson
2007-01-21 18:23:34 +00:00
parent 8cc86d61ef
commit fdbb158d64
50 changed files with 119 additions and 74 deletions

View File

@@ -32,7 +32,7 @@
-->
<bean id="contextSource"
class="org.springframework.ldap.support.transaction.TransactionAwareContextSourceProxy">
class="org.springframework.ldap.transaction.core.TransactionAwareContextSourceProxy">
<constructor-arg ref="contextSourceTarget" />
</bean>
@@ -48,7 +48,7 @@
</bean>
-->
<bean id="ldapTransactionManager"
class="org.springframework.ldap.support.transaction.ContextSourceTransactionManager">
class="org.springframework.ldap.transaction.core.ContextSourceTransactionManager">
<property name="contextSource" ref="contextSourceTarget" />
</bean>
<!--
@@ -59,7 +59,7 @@
-->
<bean name="dummyDaoTarget"
class="org.springframework.ldap.support.transaction.DummyDaoImpl">
class="org.springframework.ldap.transaction.core.DummyDaoImpl">
<property name="ldapTemplate" ref="ldapTemplate" />
<!--
<property name="jdbcTemplate" ref="jdbcTemplate" />

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
public interface DummyDao {
void createWithException(String country, String company, String fullname,

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.ldap.core.DirContextAdapter;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
public class DummyException extends RuntimeException {
public DummyException(String message) {

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
public class DummyServiceImpl {
private DummyDao dummyDaoImpl;

View File

@@ -1,20 +0,0 @@
RollbackOperations are stored before the actual operation has succeeded - Fixed.
------------------------------------------------------------------------
The recording of operations take place before the actual operation is carried out.
While this is needed (as we need the state as it was before the operation), this may cause
problems if the operation in question fails, causing a rollback to be performed.
The LdapCompensatingTransactionDataManager will then have a RollbackOperation to rollback
the failing operation. Example:
A rebind operation is recorded and the actual operation fails because the fromDn does not exist.
If toDn is already bound, the rollback will rename toDn to fromDn, messing things up.
We need to make sure that the RollbackOperation is not registered until the actual operation has
succeeded.
Invisible Attributes and rollback
---------------------------------
When recording an unbind operation the attributes of the unbound DN is retrieved. It is however
possible that some Attributes are not returned by that lookup, e.g. if they are operational
attributes (in which case they will need to be asked for explicitly.
This means that we might end up with inconsistent data after the rollback
(i.e. the Attributes after the rollback won't contain the invisible Attributes).

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
/**
* Responsible for executing a single recorded operation as well as committing

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
public interface CompensatingTransactionOperationFactory {
public CompensatingTransactionOperationRecorder createRecordingOperation(

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
/**
* A CompensatingTransactionOperationManager implementation records and performs

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
/**
* An implementation of this interface is responsible for recording data and

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
import java.util.Stack;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.Attributes;
@@ -21,6 +21,7 @@ import javax.naming.directory.Attributes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} to manage a bind

View File

@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.Attributes;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
/**
* A {@link CompensatingTransactionOperationRecorder} to manage LDAP bind

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;

View File

@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package org.springframework.ldap.support.transaction;
*/package org.springframework.ldap.transaction.core;
/**
* Transaction object for ContextSourceTransactionManager. Keeps a reference to

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.util.List;

View File

@@ -13,10 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.DirContext;
import org.springframework.ldap.transaction.CompensatingTransactionOperationFactory;
import org.springframework.ldap.transaction.CompensatingTransactionOperationManager;
import org.springframework.ldap.transaction.DefaultCompensatingTransactionOperationManager;
import org.springframework.transaction.support.ResourceHolderSupport;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.DirContext;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -14,6 +14,8 @@ import org.springframework.dao.DataAccessException;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.transaction.CompensatingTransactionOperationFactory;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
public class LdapCompensatingTransactionOperationFactory implements
CompensatingTransactionOperationFactory {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.transaction.CompensatingTransactionOperationManager;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.ModificationItem;
@@ -21,6 +21,7 @@ import javax.naming.directory.ModificationItem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} to manage a

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.util.HashSet;
import java.util.Set;
@@ -28,6 +28,8 @@ import javax.naming.directory.ModificationItem;
import org.springframework.ldap.core.AttributesMapper;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
import org.springframework.util.Assert;
/**

View File

@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} that performs nothing.

View File

@@ -13,7 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationManager;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
/**
* A {@link CompensatingTransactionOperationRecorder} performing nothing,

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.Attributes;
@@ -21,6 +21,7 @@ import javax.naming.directory.Attributes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} to manage a rebind

View File

@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.Attributes;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
/**
* A {@link CompensatingTransactionOperationRecorder} keeping track of a rebind

View File

@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} to manage a rename

View File

@@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
import org.springframework.util.Assert;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.lang.reflect.Proxy;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;

View File

@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
/**
* A {@link CompensatingTransactionOperationExecutor} to manage an unbind

View File

@@ -13,11 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
/**
* {@link CompensatingTransactionOperationRecorder} to keep track of unbind

View File

@@ -1,10 +1,14 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction;
import java.util.Stack;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.CompensatingTransactionOperationFactory;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
import org.springframework.ldap.transaction.DefaultCompensatingTransactionOperationManager;
public class DefaultCompensatingTransactionOperationManagerTest extends
TestCase {

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.BasicAttributes;
@@ -7,6 +7,7 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.core.BindOperationExecutor;
public class BindOperationExecutorTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.BasicAttributes;
@@ -7,6 +7,9 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.core.BindOperationExecutor;
import org.springframework.ldap.transaction.core.BindOperationRecorder;
public class BindOperationRecorderTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.DirContext;
@@ -6,8 +6,12 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.support.transaction.ContextSourceTransactionManager;
import org.springframework.ldap.support.transaction.DirContextHolder;
import org.springframework.ldap.transaction.CompensatingTransactionOperationManager;
import org.springframework.ldap.transaction.core.ContextSourceTransactionManager;
import org.springframework.ldap.transaction.core.ContextSourceTransactionObject;
import org.springframework.ldap.transaction.core.DirContextHolder;
import org.springframework.ldap.transaction.core.TempEntryRenamingStrategy;
import org.springframework.ldap.transaction.core.TransactionAwareContextSourceProxy;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.DefaultTransactionStatus;
import org.springframework.transaction.support.TransactionSynchronizationManager;

View File

@@ -1,8 +1,9 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.transaction.core.DefaultTempEntryRenamingStrategy;
import junit.framework.TestCase;

View File

@@ -1,8 +1,9 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.transaction.core.DifferentSubtreeTempEntryRenamingStrategy;
import junit.framework.TestCase;

View File

@@ -1,9 +1,17 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationRecorder;
import org.springframework.ldap.transaction.core.BindOperationRecorder;
import org.springframework.ldap.transaction.core.LdapCompensatingTransactionOperationFactory;
import org.springframework.ldap.transaction.core.ModifyAttributesOperationRecorder;
import org.springframework.ldap.transaction.core.RebindOperationRecorder;
import org.springframework.ldap.transaction.core.RenameOperationRecorder;
import org.springframework.ldap.transaction.core.TempEntryRenamingStrategy;
import org.springframework.ldap.transaction.core.UnbindOperationRecorder;
public class LdapCompensatingTransactionOperationFactoryTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.Name;
import javax.naming.directory.ModificationItem;
@@ -6,6 +6,7 @@ import javax.naming.directory.ModificationItem;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.core.ModifyAttributesOperationExecutor;
import junit.framework.TestCase;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -14,6 +14,9 @@ import org.easymock.MockControl;
import org.springframework.ldap.core.AttributesMapper;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.core.ModifyAttributesOperationExecutor;
import org.springframework.ldap.transaction.core.ModifyAttributesOperationRecorder;
public class ModifyAttributesOperationRecorderTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.BasicAttributes;
@@ -7,6 +7,7 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.core.RebindOperationExecutor;
public class RebindOperationExecutorTest extends TestCase {

View File

@@ -1,4 +1,4 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import javax.naming.directory.BasicAttributes;
@@ -7,6 +7,10 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.core.RebindOperationExecutor;
import org.springframework.ldap.transaction.core.RebindOperationRecorder;
import org.springframework.ldap.transaction.core.TempEntryRenamingStrategy;
public class RebindOperationRecorderTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,8 +1,9 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.core.RenameOperationExecutor;
import junit.framework.TestCase;

View File

@@ -1,9 +1,12 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.core.RenameOperationExecutor;
import org.springframework.ldap.transaction.core.RenameOperationRecorder;
public class RenameOperationRecorderTest extends TestCase {

View File

@@ -1,10 +1,11 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.core.UnbindOperationExecutor;
public class UnbindOperationExecutorTest extends TestCase {
private MockControl ldapOperationsControl;

View File

@@ -1,10 +1,14 @@
package org.springframework.ldap.support.transaction;
package org.springframework.ldap.transaction.core;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapOperations;
import org.springframework.ldap.transaction.CompensatingTransactionOperationExecutor;
import org.springframework.ldap.transaction.core.TempEntryRenamingStrategy;
import org.springframework.ldap.transaction.core.UnbindOperationExecutor;
import org.springframework.ldap.transaction.core.UnbindOperationRecorder;
public class UnbindOperationRecorderTest extends TestCase {
private MockControl ldapOperationsControl;