diff --git a/domain/.cvsignore b/domain/.cvsignore
deleted file mode 100644
index e6165555be..0000000000
--- a/domain/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-target
-.settings
-.classpath
-.project
-.wtpmodules
diff --git a/domain/maven.xml b/domain/maven.xml
deleted file mode 100644
index ce023bd4cd..0000000000
--- a/domain/maven.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
diff --git a/domain/pom.xml b/domain/pom.xml
deleted file mode 100644
index 6b25e039e9..0000000000
--- a/domain/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
- 4.0.0
-
- org.acegisecurity
- acegi-security-parent
- 1.1-SNAPSHOT
-
- acegi-security-domain
- Acegi Security System for Spring - Domain Object Support
-
-
- org.acegisecurity
- acegi-security
- ${project.version}
-
-
- org.hibernate
- hibernate
- 3.0.3
-
-
- org.springframework
- spring-hibernate3
- 2.0-m2
-
-
- commons-beanutils
- commons-beanutils
- 1.6.1
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
-
\ No newline at end of file
diff --git a/domain/project.properties b/domain/project.properties
deleted file mode 100644
index 17760d73e0..0000000000
--- a/domain/project.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id$
-
-# Values in this file will be overriden by any values with the same name
-# in the user-created build.properties file.
-
-# Compile settings
-#
-# Java 1.5 is required because we use enums extensively in this subproject
-# (main Acegi Security project / parent) is Java 1.3 compatible
-#
-maven.compile.target=1.5
-maven.compile.source=1.5
diff --git a/domain/project.xml b/domain/project.xml
deleted file mode 100644
index 21d83303c9..0000000000
--- a/domain/project.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
- ${basedir}/../project.xml
- 3
- acegi-security-domain
- Acegi Security System for Spring - Domain Object Support
- /home/groups/a/ac/acegisecurity/htdocs/multiproject/acegi-security-domain
-
- scm:svn:https://svn.sourceforge.net/svnroot/acegisecurity/trunk/acegisecurity
- scm:svn:https://svn.sourceforge.net/svnroot/acegisecurity/trunk/acegisecurity
- http://svn.sourceforge.net/viewcvs.cgi/acegisecurity/trunk/acegisecurity/domain/
-
-
-
- hibernate
- hibernate
- 3.0.3
- jar
- http://www.hibernate.org
-
-
- commons-lang
- commons-lang
- 2.0
- jar
-
-
- commons-beanutils
- commons-beanutils
- 1.6.1
- jar
-
-
- org.acegisecurity
- acegi-security
- 1.0.3-SNAPSHOT
- jar
-
-
- org.springframework
- spring-hibernate3
- 2.0-m2
- jar
- http://www.springframework.org
-
-
-
-
-
- ${basedir}/../
- META-INF
-
- notice.txt
-
- false
-
-
-
-
-
diff --git a/domain/src/main/java/org/acegisecurity/domain/DomainException.java b/domain/src/main/java/org/acegisecurity/domain/DomainException.java
deleted file mode 100644
index 9e1bbfceaa..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/DomainException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain;
-
-import org.acegisecurity.AcegiSecurityException;
-
-
-/**
- * Abstract superclass for all exceptions related to domain object support subproject.
- *
- * @author Ben Alex
- * @version $Id$
- */
-public abstract class DomainException extends AcegiSecurityException {
- //~ Constructors ===================================================================================================
-
-/**
- * Constructs a DomainException with the specified message and
- * root cause.
- *
- * @param msg the detail message
- * @param t the root cause
- */
- public DomainException(String msg, Throwable t) {
- super(msg, t);
- }
-
-/**
- * Constructs a DomainException with the specified message and
- * no root cause.
- *
- * @param msg the detail message
- */
- public DomainException(String msg) {
- super(msg);
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/PersistableEntity.java b/domain/src/main/java/org/acegisecurity/domain/PersistableEntity.java
deleted file mode 100644
index b2d3f7b637..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/PersistableEntity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain;
-
-import java.io.Serializable;
-
-
-/**
- * An interface that indicates an object is a persistable entity.
- *
- *
- * A persistable entity is any object that is capable of being persisted,
- * typically via a {@link org.acegisecurity.domain.dao.Dao} implementation.
- *
- *
- * @author Ben Alex
- * @version $Id$
- */
-public interface PersistableEntity {
- //~ Methods ========================================================================================================
-
- /**
- * Provides a common getter for the persistence layer to obtain an identity, irrespective of the actual
- * type of identity used.
Typically a subclass will delegate to a public SomePrimitiveWrapper
- * getId() method. The necessity for the getInternalId() abstract method is solely because
- * the persistence layer needs a way of obtaining the identity irrespective of the actual identity implementation
- * choice.
- *
Returning null from this method will indicate the object has never been saved. This
- * will likely be relied on by some Dao implementations.
- *
- * @return the persistence identity of this instance
- */
- public abstract Serializable getInternalId();
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/Dao.java b/domain/src/main/java/org/acegisecurity/domain/dao/Dao.java
deleted file mode 100644
index 439caf8204..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/Dao.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-import org.acegisecurity.domain.PersistableEntity;
-
-import org.springframework.dao.DataAccessException;
-
-import java.io.Serializable;
-
-import java.util.Collection;
-import java.util.List;
-
-
-/**
- * Provides fundamental DAO capabilities for a single concrete {@link
- * PersistableEntity}, using JDK 1.5 generics.
- *
- *
- * This interface provides a portable approach to Data Access Object (DAO)
- * functionality across various object relational persistance solutions.
- *
- *
- *
- * It is not envisioned that this interface will provide all data access
- * requirements for applications, however it should provide all of the
- * standard create, read, update, delete (CRUD) and finder functions that are
- * routinely needed. Specialized subclasses (that provide finer-grained
- * functionality) of the Dao interface are encouraged.
- *
- *
- *
- * A Dao implementation (or a subclass of Dao) should
- * be the sole entry point into the persistance layer of an application. The
- * persistence layer should only respond to requests from the services layer.
- * The services layer is where all transaction demarcation, security
- * authorization, workflow and business logic should take place.
- *
- *
- *
- * Each Dao implementation will support one
- * PersistableEntity classes only. The supported
- * PersistableEntity class must be indicated via the {@link
- * #supports(Class)} method.
- *
- *
- * @author Ben Alex
- * @version $Id$
- */
-public interface Dao {
- //~ Methods ========================================================================================================
-
- /**
- * Create a new object, with the current {@link PersistableEntity#getInternalId()} value being ignored.
- *
- * @param value (without the identity property initialized)
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public void create(E value) throws DataAccessException;
-
- /**
- * Delete an object.
- *
- * @param value the value to delete
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public void delete(E value) throws DataAccessException;
-
- /**
- * Return all persistent instances, including subclasses.
- *
- * @return all persistence instances (an empty List will be returned if no matches are found)
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public List findAll() throws DataAccessException;
-
- /**
- * Find a List of PersistableEntitys, searched by their identifiers.
- *
- * @param ids collection of identifiers to locate
- *
- * @return the values with those identifiers (an empty List will be returned if no matches are found)
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public List findId(Collection ids)
- throws DataAccessException;
-
- /**
- * Load a persistent instance by its identifier, although some properties may be lazy loaded depending on
- * the underlying DAO implementation and/or persistence engine mapping document.
- *
- * @param id the identifier of the persistent instance desired to be retrieved
- *
- * @return the request item, or null if not found
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public E readId(Serializable id) throws DataAccessException;
-
- /**
- * Find persistent instances with properties matching those of the passed PersistableEntity.
Persistent
- * instances are matched on the basis of query by example. Properties whose value is null, empty
- * Strings, and any Collections are ignored in the query by example evaluation.
- *
- * @param value parameters to filter on (the class of this object will be added to the filter)
- * @param firstElement the first result (start at zero to obtain all results)
- * @param maxElements the maximum number of results desired for this page of the result set
- * @param orderByAsc the property name of the PersistableEntity that should be used to order the
- * results
- *
- * @return the requested page of the result list (a properly formed PaginatedList is returned if no
- * results match)
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public PaginatedList scroll(E value, int firstElement, int maxElements, String orderByAsc)
- throws DataAccessException;
-
- /**
- * Find persistent instances with properties matching those of the passed PersistableEntity,
- * ignoring the class of the passed PersistableEntity (useful if you pass a superclass, as you want
- * to find all subclass instances which match).
- *
- * @param value parameters to filter on (the class of this object will NOT be added to the filter)
- * @param firstElement the first result (start at zero to obtain all results)
- * @param maxElements the maximum number of results desired for this page of the result set
- * @param orderByAsc the property name of the PersistableEntity that should be used to order the
- * results
- *
- * @return the requested page of the result list (a properly formed PaginatedList is returned if no
- * results match)
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public PaginatedList scrollWithSubclasses(E value, int firstElement, int maxElements, String orderByAsc)
- throws DataAccessException;
-
- /**
- * Indicates whether the DAO instance provides persistence services for the specified class.
- *
- * @param clazz to test, which should be an implementation of PersistableEntity
- *
- * @return true or false, indicating whether or not the passed class is supported by this
- * DAO instance
- */
- public boolean supports(Class clazz);
-
- /**
- * Update an object.
- *
- * @param value to update, with the PersistableEntity having a non-null identifier
- *
- * @throws DataAccessException DOCUMENT ME!
- */
- public void update(E value) throws DataAccessException;
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/DetachmentContextHolder.java b/domain/src/main/java/org/acegisecurity/domain/dao/DetachmentContextHolder.java
deleted file mode 100644
index c5df4a286a..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/DetachmentContextHolder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-/**
- * InheritableThreadLocal which indicates whether a {@link Dao} implementation should be forced to
- * return a detached instance.
A detached instance is one which is no longer associated with the ORM mapper and
- * changes will therefore not be transparently persisted to the database.
- *
Not all Dao implementations support the concept of detached instances.
- *
- * @author Ben Alex
- * @version $Id$
- *
- * @see java.lang.InheritableThreadLocal
- */
-public class DetachmentContextHolder {
- //~ Static fields/initializers =====================================================================================
-
- private static InheritableThreadLocal contextHolder = new InheritableThreadLocal();
-
- //~ Methods ========================================================================================================
-
- /**
- * Returns the boolean value detachment policy which has been set for the current thread (defaults to
- * false).
- *
- * @return DOCUMENT ME!
- */
- public static boolean isForceReturnOfDetachedInstances() {
- if (contextHolder.get() == null) {
- contextHolder.set(Boolean.FALSE);
- }
-
- return contextHolder.get().booleanValue();
- }
-
- /**
- * Sets whether or not detached domain object instances should be returned within the current thread of
- * execution.
- *
- * @param alwaysReturnDetached if true then detached instances should be returned.
- */
- public static void setForceReturnOfDetachedInstances(boolean alwaysReturnDetached) {
- contextHolder.set(new Boolean(alwaysReturnDetached));
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionCapable.java b/domain/src/main/java/org/acegisecurity/domain/dao/EvictionCapable.java
deleted file mode 100644
index 00de8ed32a..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionCapable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-import org.acegisecurity.domain.PersistableEntity;
-
-
-/**
- * Indicates an implementation capable of evicting {@link
- * org.acegisecurity.domain.PersistableEntity}s.
- *
- *
- * Structured as a separate interface (rather than a subclass of
- * Dao), as it is not required for all persistence strategies.
- *
- *
- * @author Ben Alex
- * @version $Id$
- */
-public interface EvictionCapable {
- //~ Methods ========================================================================================================
-
- /**
- * Removes the indicated persistent instance from the DAO's internal map/session.
If the passed object
- * does not exist in the internal map/session, the invocation has no effect.
- *
May throw an exception if the implementation so desires.
- *
- * @param entity to remove from the internal map/session
- */
- public void evict(PersistableEntity entity);
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java b/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java
deleted file mode 100644
index 5791acc13b..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-import org.acegisecurity.domain.PersistableEntity;
-
-import org.springframework.util.Assert;
-
-import java.lang.reflect.Method;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-
-/**
- * Convenience methods that support eviction of PersistableEntitys from those objects that implement
- * {@link EvictionCapable}.
- *
- * @author Ben Alex
- * @version $Id$
- */
-public class EvictionUtils {
- //~ Methods ========================================================================================================
-
- /**
- * Evicts the PersistableEntity using the passed Object (provided that the passed
- * Object implements EvictionCapable).
- *
- * @param daoOrServices the potential source for EvictionCapable services (never null)
- * @param entity to evict (can be null)
- */
- public static void evictIfRequired(Object daoOrServices, PersistableEntity entity) {
- EvictionCapable evictor = getEvictionCapable(daoOrServices);
-
- if ((evictor != null) && (entity != null)) {
- evictor.evict(entity);
- }
- }
-
- /**
- * Evicts each PersistableEntity element of the passed Collection using the
- * passed Object (provided that the passed Object implements
- * EvictionCapable).
- *
- * @param daoOrServices the potential source for EvictionCapable services (never null)
- * @param collection whose members to evict (never null)
- */
- public static void evictIfRequired(Object daoOrServices, Collection collection) {
- Assert.notNull(collection, "Cannot evict a null Collection");
-
- if (getEvictionCapable(daoOrServices) == null) {
- // save expense of iterating collection
- return;
- }
-
- Iterator iter = collection.iterator();
-
- while (iter.hasNext()) {
- Object obj = iter.next();
-
- if (obj instanceof PersistableEntity) {
- evictIfRequired(daoOrServices, (PersistableEntity) obj);
- }
- }
- }
-
- /**
- * Evicts the PersistableEntity using the passed Object (provided that the passed
- * Object implements EvictionCapable), along with expressly evicting every
- * PersistableEntity returned by the PersistableEntity's getters.
- *
- * @param daoOrServices the potential source for EvictionCapable services (never null)
- * @param entity to evict includnig its getter results (can be null)
- */
- public static void evictPopulatedIfRequired(Object daoOrServices, PersistableEntity entity) {
- EvictionCapable evictor = getEvictionCapable(daoOrServices);
-
- if ((evictor != null) && (entity != null)) {
- evictor.evict(entity);
-
- Method[] methods = entity.getClass().getMethods();
-
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().startsWith("get") && (methods[i].getParameterTypes().length == 0)) {
- try {
- Object result = methods[i].invoke(entity, new Object[] {});
-
- if (result instanceof PersistableEntity) {
- evictor.evict((PersistableEntity) result);
- }
- } catch (Exception ignored) {}
- }
- }
- }
- }
-
- /**
- * Obtain the EvictionCapable from the passed argument, or null.
- *
- * @param daoOrServices to check if provides eviction services
- *
- * @return the EvictionCapable object or null if the object does not provide eviction
- * services
- */
- private static EvictionCapable getEvictionCapable(Object daoOrServices) {
- Assert.notNull(daoOrServices, "Cannot evict if the object that may provide EvictionCapable is null");
-
- if (daoOrServices instanceof EvictionCapable) {
- return (EvictionCapable) daoOrServices;
- } else {
- return null;
- }
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/InitializationCapable.java b/domain/src/main/java/org/acegisecurity/domain/dao/InitializationCapable.java
deleted file mode 100644
index 7e4536b55c..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/InitializationCapable.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-/**
- * Indicates an implementation capable of initializing an object, such that
- * any lazy loading is guaranteed to have been completed.
- *
- *
- * Structured as a separate interface (rather than a subclass of
- * Dao), as it is not required for all persistence strategies.
- *
- *
- *
In general the recommended approach to lazy initialization is as follows:
- *
- *
- *
- *
Do not use OpenSessionInView. You can use it if you like, but you'll have
- * less difficulty in the long-run if you plan your use cases and adopt the other
- * recommendations below.
- *
- *
Set your mapping documents to use lazy initialization where possible. Only
- * mark an association as eager loaded if every single use case requires it
- * and you are happy with this eager loading being reflected in a mapping document
- * instead of Java code.
- *
- *
Subclass the Dao implementation and add use case specific finder/read
- * methods that will use the persistence engine's eager loading capabilities. Generally
- * this approach will deliver the best overall application performance, as you will
- * (i) only be eager loading if and when required and (ii) you are directly using the
- * persistence engine capabilities to do so. It also places the eager loading management
- * in the Dao, which is an ideal location to standardise it.
- *
- *
If you would prefer to achieve persistence engine independence and/or reduce
- * the number of Dao subclasses that exist in your application, you may
- * prefer to modify your services layer so that it uses the InitializationCapable
- * interface. However, this interface should be used judiciously given that it does
- * not allow the persistence engine to optimise eager loading for given use cases
- * and (probably) will lead to a mixture of places where fetching logic can be obtained.
- *
- *
Generally your best strategy is subclassing the Dao. It means the
- * most code, but it's also by far the most efficient and offers flexibility to further
- * fine-tune specific use cases. Whichever way you go, try to be consistent throughout
- * your application (this will ease your future migration and troubleshooting needs).
- *
- * @author Ben Alex
- * @version $Id$
- */
-public interface InitializationCapable {
- //~ Methods ========================================================================================================
-
- /**
- * Initializes the indicated object.
May throw an exception if the implementation so desires.
- *
- * @param entity to initialize
- */
- public void initialize(Object entity);
-
- /**
- * Indicaets whether the passed object is initialized or not.
- *
- * @param entity to determine if initialized
- *
- * @return true if initialized, false is uninitialized or the initialization status is
- * unknown
- */
- public boolean isInitialized(Object entity);
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/InitializationUtils.java b/domain/src/main/java/org/acegisecurity/domain/dao/InitializationUtils.java
deleted file mode 100644
index 1d2ca782f1..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/InitializationUtils.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-import org.springframework.util.Assert;
-
-
-/**
- * Convenience methods that support initialization of lazily loaded collections and associations using DAOs and
- * other objects that implement {@link org.acegisecurity.domain.dao.InitializationCapable}.
- *
- * @author Ben Alex
- * @version $Id$
- */
-public class InitializationUtils {
- //~ Methods ========================================================================================================
-
- /**
- * Initializes the passed entity using the passed DAO or services layer Object (provided that
- * the passed Object implements InitializationCapable).
- *
- * @param daoOrServices the potential source for InitializationCapable services (never
- * null)
- * @param entity to evict (can be null)
- */
- public static void initializeIfRequired(Object daoOrServices, Object entity) {
- Assert.notNull(daoOrServices);
-
- if (daoOrServices instanceof InitializationCapable) {
- ((InitializationCapable) daoOrServices).initialize(entity);
- }
- }
-
- /**
- * Indicates whether the passed entity has been initialized, by delegating to the passed daoOrServices
- * (provided that the passed daoOrServices implements InitializationCapable.
- *
- * @param daoOrServices DOCUMENT ME!
- * @param entity to determine whether initialized or not
- *
- * @return true if initialized, false if it is uninitialized or the passed daoOrServices
- * does not provide initialization querying support
- */
- public static boolean isInitialized(Object daoOrServices, Object entity) {
- Assert.notNull(daoOrServices);
-
- if (daoOrServices instanceof InitializationCapable) {
- return ((InitializationCapable) daoOrServices).isInitialized(entity);
- }
-
- return false;
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/PaginatedList.java b/domain/src/main/java/org/acegisecurity/domain/dao/PaginatedList.java
deleted file mode 100644
index 3fbe6c4755..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/PaginatedList.java
+++ /dev/null
@@ -1,519 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.dao;
-
-import org.acegisecurity.domain.PersistableEntity;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.NoSuchElementException;
-import java.util.Vector;
-
-
-/**
- *
JDK1.5 compatible paginated List.
- *
Elements in the internal List (see {@link #getList()} represent only part of a larger
- * resultset.
- *
Note that firstElement starts at zero. Any attempt to access other than the current page will cause an
- * error.
- *
This is a read only implementation and many of the List methods are not implemented.
- *
- * @author Carlos Sanchez
- * @author Ben Alex
- * @version $Id$
- *
- * @param DOCUMENT ME!
- */
-public class PaginatedList implements List {
- //~ Instance fields ================================================================================================
-
- private List list;
- protected final transient Log logger = LogFactory.getLog(getClass());
- private int firstElement;
- private int maxElements;
- private int size;
-
- //~ Constructors ===================================================================================================
-
- // TODO: Consider removing this constructor
- public PaginatedList() {}
-
-/**
- * Used to construct a PaginatedList which contains only the
- * given entity.
- *
- * @param entity the entity to include (can be null, which
- * indicates an empty PaginatedList should be created)
- */
- public PaginatedList(E entity) {
- if (entity == null) {
- this.list = new Vector();
- this.firstElement = 0;
- this.maxElements = Integer.MAX_VALUE;
- this.size = 0;
- } else {
- List myList = new Vector();
- myList.add(entity);
- this.list = myList;
- this.firstElement = 0;
- this.maxElements = Integer.MAX_VALUE;
- this.size = 1;
- }
- }
-
- public PaginatedList(List list, int firstElement, int maxElements, int size) {
- this.list = list;
- this.firstElement = firstElement;
- this.maxElements = maxElements;
- this.size = size;
- }
-
- //~ Methods ========================================================================================================
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- * @param arg1 DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#add(int, java.lang.Object)
- */
- public void add(int arg0, E arg1) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#add(java.lang.Object)
- */
- public boolean add(E arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#addAll(java.util.Collection)
- */
- public boolean addAll(Collection arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- * @param arg1 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#addAll(int, java.util.Collection)
- */
- public boolean addAll(int arg0, Collection arg1) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#clear()
- */
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#contains(java.lang.Object)
- */
- public boolean contains(Object arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#containsAll(java.util.Collection)
- */
- public boolean containsAll(Collection> arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @see java.util.List#get(int)
- */
- public E get(int arg0) {
- return list.get(arg0);
- }
-
- /**
- * First element of this page, starting at zero.
- *
- * @return
- */
- public int getFirstElement() {
- return firstElement;
- }
-
- /**
- * Calculate the last page number, starting at 0
- *
- * @return
- */
- public int getLastPageNumber() {
- return (size() - 1) / getMaxElements();
- }
-
- /**
- * Get list with the elements of this page.
- *
- * @return this page of the results
- */
- public List getList() {
- return list;
- }
-
- /**
- * Max number of elements in the page
- *
- * @return
- */
- public int getMaxElements() {
- return maxElements;
- }
-
- /**
- * Calculate the page number, starting at 0
- *
- * @return
- */
- public int getPageNumber() {
- return getFirstElement() / getMaxElements();
- }
-
- /**
- * Number of elements in this page
- *
- * @return
- */
- public int getPageSize() {
- return list.size();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#indexOf(java.lang.Object)
- */
- public int indexOf(Object arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#isEmpty()
- */
- public boolean isEmpty() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator iterator() {
- return new PaginatedListIterator();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#lastIndexOf(java.lang.Object)
- */
- public int lastIndexOf(Object arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#listIterator()
- */
- public ListIterator listIterator() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#listIterator(int)
- */
- public ListIterator listIterator(int arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#remove(int)
- */
- public E remove(int arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#remove(java.lang.Object)
- */
- public boolean remove(Object arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#removeAll(java.util.Collection)
- */
- public boolean removeAll(Collection arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Collection#retainAll(java.util.Collection)
- */
- public boolean retainAll(Collection> arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- * @param arg1 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#set(int, java.lang.Object)
- */
- public E set(int arg0, E arg1) {
- throw new UnsupportedOperationException();
- }
-
- public void setFirstElement(int firstElement) {
- this.firstElement = firstElement;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
- public void setMaxElements(int maxElements) {
- this.maxElements = maxElements;
- }
-
- /**
- * Set the number of elements in all the pages
- *
- * @param size DOCUMENT ME!
- */
- public void setSize(int size) {
- this.size = size;
- }
-
- /**
- * Number of elements in all the pages
- *
- * @see java.util.Collection#size()
- */
- public int size() {
- return size;
- }
-
- /**
- * Unsupported operation
- *
- * @param arg0 DOCUMENT ME!
- * @param arg1 DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.List#subList(int, int)
- */
- public List subList(int arg0, int arg1) {
- throw new UnsupportedOperationException();
- }
-
- public Object[] toArray() {
- return list.toArray();
- }
-
- public T[] toArray(T[] arg0) {
- if (logger.isDebugEnabled()) {
- logger.debug("List size when convert to array " + list.toArray().length);
- }
-
- return list.toArray(arg0);
- }
-
- //~ Inner Classes ==================================================================================================
-
- private class PaginatedListIterator implements Iterator {
- private Iterator iterator;
- private int i = 0;
-
- /**
- *
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return i < size();
- }
-
- /**
- * This method follows the rules of Iterator.next() except that it returns null when requesting an
- * element that it's not in the current page.
- *
- * @see java.util.Iterator#next()
- */
- public E next() {
- if (i == getFirstElement()) {
- iterator = getList().iterator();
- }
-
- if ((i >= getFirstElement()) && (i < (getFirstElement() + getMaxElements()))) {
- i++;
-
- return iterator.next();
- }
-
- if (hasNext()) {
- i++;
-
- return null;
- } else {
- throw new NoSuchElementException();
- }
- }
-
- /**
- * Unsupported operation
- *
- * @throws UnsupportedOperationException
- *
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/package.html b/domain/src/main/java/org/acegisecurity/domain/dao/package.html
deleted file mode 100644
index 3d973c529b..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/dao/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
Provides the base of a data access object (DAO) persistence layer.
-
-
-
diff --git a/domain/src/main/java/org/acegisecurity/domain/hibernate/DaoHibernate.java b/domain/src/main/java/org/acegisecurity/domain/hibernate/DaoHibernate.java
deleted file mode 100644
index 5f79d19def..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/hibernate/DaoHibernate.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.hibernate;
-
-import org.acegisecurity.domain.PersistableEntity;
-import org.acegisecurity.domain.dao.Dao;
-import org.acegisecurity.domain.dao.PaginatedList;
-import org.acegisecurity.domain.util.GenericsUtils;
-
-import org.hibernate.Criteria;
-import org.hibernate.EntityMode;
-import org.hibernate.Hibernate;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-import org.hibernate.criterion.Expression;
-import org.hibernate.criterion.Order;
-
-import org.hibernate.metadata.ClassMetadata;
-
-import org.hibernate.type.Type;
-
-import org.springframework.orm.hibernate3.HibernateCallback;
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-import org.springframework.util.Assert;
-
-import java.io.Serializable;
-
-import java.util.Collection;
-import java.util.List;
-
-
-/**
- * Generics supporting {@link Dao} implementation that uses Hibernate 3 for persistence.
- *
- * @author Ben Alex
- * @author Matthew Porter
- * @version $Id$
- *
- * @param DOCUMENT ME!
- */
-public class DaoHibernate extends HibernateDaoSupport implements Dao {
- //~ Instance fields ================================================================================================
-
- /** The class that this instance provides services for */
- private Class supportsClass;
-
- //~ Constructors ===================================================================================================
-
- public DaoHibernate(SessionFactory sessionFactory) {
- Assert.notNull(sessionFactory, "Non-null Hibernate SessionFactory must be expressed as a constructor argument");
- super.setSessionFactory(sessionFactory);
- this.supportsClass = GenericsUtils.getGeneric(getClass());
- Assert.notNull(this.supportsClass, "Could not determine the generics type");
- }
-
- //~ Methods ========================================================================================================
-
- public void create(E value) {
- Assert.notNull(value);
- super.getHibernateTemplate().save(value);
- }
-
- public void delete(E value) {
- Assert.notNull(value);
- super.getHibernateTemplate().delete(value);
- }
-
- @SuppressWarnings("unchecked")
- public List findAll() {
- return super.getHibernateTemplate().loadAll(supportsClass);
- }
-
- @SuppressWarnings("unchecked")
- public List findId(Collection ids) {
- Assert.notNull(ids, "Collection of IDs cannot be null");
- Assert.notEmpty(ids, "There must be some values in the Collection list");
-
- return (List) super.getHibernateTemplate().execute(getFindByIdCallback(ids));
- }
-
- /**
- * Provides a HibernateCallback that will load a list of objects by a Collection
- * of identities.
- *
- * @param ids collection of identities to be loaded
- *
- * @return a List containing the matching objects
- */
- private HibernateCallback getFindByIdCallback(final Collection ids) {
- return new HibernateCallback() {
- public Object doInHibernate(Session session)
- throws HibernateException {
- Criteria criteria = session.createCriteria(supportsClass);
-
- ClassMetadata classMetadata = getSessionFactory().getClassMetadata(supportsClass);
-
- String idPropertyName = classMetadata.getIdentifierPropertyName();
- criteria.add(Expression.in(idPropertyName, ids));
-
- return criteria.list();
- }
- };
- }
-
- /**
- * Get a new HibernateCallback for finding objects by a bean property values, paginating the
- * results. Properties with null values and collections and empty Strings are ignored, as is any property with the
- * "version" name. If the property is mapped as String find a partial match, otherwise find by exact match.
- *
- * @param whichClass the class (and subclasses) which results will be limited to including
- * @param bean bean with the values of the parameters
- * @param firstElement the first result, numbered from 0
- * @param count the maximum number of results
- * @param order DOCUMENT ME!
- *
- * @return a PaginatedList containing the requested objects
- */
- private HibernateCallback getFindByValueCallback(final Class whichClass, final Object bean, final int firstElement,
- final int count, final Order order) {
- return new HibernateCallback() {
- @SuppressWarnings("unchecked")
- public Object doInHibernate(Session session)
- throws HibernateException {
- int paramCount = 0;
-
- StringBuffer queryString = new StringBuffer("from ").append(bean.getClass().getName())
- .append(" as queryTarget");
-
- ClassMetadata classMetadata = getSessionFactory().getClassMetadata(bean.getClass());
-
- Assert.notNull(classMetadata,
- "ClassMetadata for " + bean.getClass()
- + " unavailable from Hibernate - have you mapped this class against the SessionFactory?");
-
- /* get persistent properties */
- Type[] propertyTypes = classMetadata.getPropertyTypes();
- String[] propertyNames = classMetadata.getPropertyNames();
-
- /* for each persistent property of the bean */
- for (int i = 0; i < propertyNames.length; i++) {
- String name = propertyNames[i];
-
- // TODO: Check if EntityMode.POJO appropriate
- Object value = classMetadata.getPropertyValue(bean, name, EntityMode.POJO);
-
- if (value == null) {
- continue;
- }
-
- // ignore empty Strings
- if (value instanceof String) {
- String string = (String) value;
-
- if ("".equals(string)) {
- continue;
- }
- }
-
- // ignore any collections
- if (propertyTypes[i].isCollectionType()) {
- continue;
- }
-
- if (name.equals("version")) {
- continue;
- }
-
- Type type = classMetadata.getPropertyType(name);
-
- if (type.equals(Hibernate.STRING)) {
- // if the property is mapped as String, find partial match
- if (paramCount == 0) {
- queryString.append(" where ");
- } else {
- queryString.append(" and ");
- }
-
- paramCount++;
- queryString.append("lower(queryTarget.").append(name)
- .append(") like '%" + value.toString().toLowerCase() + "%'");
- } else {
- // find exact match
- if (paramCount == 0) {
- queryString.append(" where ");
- } else {
- queryString.append(" and ");
- }
-
- paramCount++;
- queryString.append("queryTarget.").append(name).append(" = " + value);
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug(queryString.toString());
- }
-
- // Determine number of rows
- org.hibernate.Query countQuery = session.createQuery("select count(*) " + queryString.toString());
- int size = ((Integer) countQuery.iterate().next()).intValue();
-
- // Obtain requested page of query
- org.hibernate.Query query = session.createQuery(queryString.toString());
- query.setMaxResults(count);
- query.setFirstResult(firstElement);
-
- return new PaginatedList(query.list(), firstElement, count, size);
- }
- };
- }
-
- @SuppressWarnings("unchecked")
- public E readId(Serializable id) {
- Assert.notNull(id);
-
- return (E) getHibernateTemplate().load(supportsClass, id);
- }
-
- @SuppressWarnings("unchecked")
- public PaginatedList scroll(E value, int firstElement, int maxElements, String orderByAsc) {
- validateScrollMethod(value, firstElement, maxElements, orderByAsc);
-
- return (PaginatedList) super.getHibernateTemplate()
- .execute(getFindByValueCallback(value.getClass(), value, firstElement, maxElements,
- Order.asc(orderByAsc)));
- }
-
- @SuppressWarnings("unchecked")
- public PaginatedList scrollWithSubclasses(E value, int firstElement, int maxElements, String orderByAsc) {
- validateScrollMethod(value, firstElement, maxElements, orderByAsc);
-
- return (PaginatedList) super.getHibernateTemplate()
- .execute(getFindByValueCallback(this.supportsClass, value, firstElement,
- maxElements, Order.asc(orderByAsc)));
- }
-
- public boolean supports(Class clazz) {
- Assert.notNull(clazz);
-
- return this.supportsClass.equals(clazz);
- }
-
- public void update(E value) {
- Assert.notNull(value);
- super.getHibernateTemplate().update(value);
- }
-
- private void validateScrollMethod(E value, int firstElement, int MaxElements, String orderByAsc) {
- Assert.notNull(value);
- Assert.hasText(orderByAsc, "An orderByAsc is required (why not use your identity property?)");
- Assert.isInstanceOf(this.supportsClass, value, "Can only scroll with values this DAO supports");
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/hibernate/EnumUserType.java b/domain/src/main/java/org/acegisecurity/domain/hibernate/EnumUserType.java
deleted file mode 100644
index e48f09c17e..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/hibernate/EnumUserType.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.hibernate;
-
-import org.acegisecurity.domain.util.GenericsUtils;
-
-import org.hibernate.HibernateException;
-
-import org.hibernate.usertype.UserType;
-
-import java.io.Serializable;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-
-
-/**
- * Java 1.5 enumeration compatible Hibernate 3 UserType.
- *
- * @author Ben Alex
- * @version $Id$
- *
- * @param DOCUMENT ME!
- */
-public class EnumUserType> implements UserType {
- //~ Static fields/initializers =====================================================================================
-
- private static final int[] SQL_TYPES = {Types.VARCHAR};
-
- //~ Instance fields ================================================================================================
-
- private Class clazz = null;
-
- //~ Constructors ===================================================================================================
-
- @SuppressWarnings("unchecked")
- protected EnumUserType() {
- this.clazz = GenericsUtils.getGeneric(getClass());
- }
-
- //~ Methods ========================================================================================================
-
- public Object assemble(Serializable cached, Object owner)
- throws HibernateException {
- return cached;
- }
-
- public Object deepCopy(Object value) throws HibernateException {
- return value;
- }
-
- public Serializable disassemble(Object value) throws HibernateException {
- return (Serializable) value;
- }
-
- public boolean equals(Object x, Object y) throws HibernateException {
- if (x == y) {
- return true;
- }
-
- if ((null == x) || (null == y)) {
- return false;
- }
-
- return x.equals(y);
- }
-
- public int hashCode(Object x) throws HibernateException {
- return x.hashCode();
- }
-
- public boolean isMutable() {
- return false;
- }
-
- public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner)
- throws HibernateException, SQLException {
- String name = resultSet.getString(names[0]);
- E result = null;
-
- if (!resultSet.wasNull()) {
- result = Enum.valueOf(clazz, name);
- }
-
- return result;
- }
-
- public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index)
- throws HibernateException, SQLException {
- if (null == value) {
- preparedStatement.setNull(index, Types.VARCHAR);
- } else {
- preparedStatement.setString(index, ((Enum) value).name());
- }
- }
-
- public Object replace(Object original, Object target, Object owner)
- throws HibernateException {
- return original;
- }
-
- public Class returnedClass() {
- return clazz;
- }
-
- public int[] sqlTypes() {
- return SQL_TYPES;
- }
-}
diff --git a/domain/src/main/java/org/acegisecurity/domain/hibernate/IntrospectionManagerHibernate.java b/domain/src/main/java/org/acegisecurity/domain/hibernate/IntrospectionManagerHibernate.java
deleted file mode 100644
index a29ce8bf30..0000000000
--- a/domain/src/main/java/org/acegisecurity/domain/hibernate/IntrospectionManagerHibernate.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.acegisecurity.domain.hibernate;
-
-import org.acegisecurity.domain.validation.IntrospectionManager;
-import org.acegisecurity.domain.validation.ValidationRegistryManager;
-
-import org.hibernate.EntityMode;
-import org.hibernate.Hibernate;
-import org.hibernate.HibernateException;
-import org.hibernate.SessionFactory;
-
-import org.hibernate.metadata.ClassMetadata;
-
-import org.hibernate.type.Type;
-
-import org.springframework.beans.factory.InitializingBean;
-
-import org.springframework.orm.hibernate3.HibernateSystemException;
-
-import org.springframework.util.Assert;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * {@link IntrospectionManager} that uses Hibernate metadata to locate children.
Add children objects are added
- * to the List of children objects to validate, irrespective of whether a save/update/delete operation
- * will cascade to them. This is not a perfect solution, but addresses most real-world validation requirements (you
- * can always implement your own IntrospectionManager if you prefer).
- *
This implementation only adds properties of a parent object that have a Hibernate {@link
- * net.sf.hibernate.type.Type} that indicates it is an object type (ie {@link
- * net.sf.hibernate.type.Type#isObjectType()}).
- *
- * @author Matthew Porter
- * @author Ben Alex
- */
-public class IntrospectionManagerHibernate implements IntrospectionManager, InitializingBean {
- //~ Instance fields ================================================================================================
-
- private ValidationRegistryManager validationRegistryManager;
- private SessionFactory[] sessionFactories;
-
- //~ Methods ========================================================================================================
-
- public void afterPropertiesSet() throws Exception {
- Assert.notNull(validationRegistryManager, "ValidationRegistryManager is required");
- Assert.notNull(sessionFactories, "SessionFactories are required");
- Assert.notEmpty(sessionFactories, "SessionFactories are required");
-
- // Eagerly pre-register Validators for all Hibernate metadata-defined classes
- for (int i = 0; i < sessionFactories.length; i++) {
- Map metadataMap = this.sessionFactories[i].getAllClassMetadata();
- Collection mappedClasses = metadataMap.keySet();
-
- for (Iterator iter = mappedClasses.iterator(); iter.hasNext();) {
- String className = iter.next();
- this.validationRegistryManager.findValidator(Class.forName(className));
- }
- }
- }
-
- private ClassMetadata findMetadata(Class clazz) throws HibernateSystemException {
- for (int i = 0; i < sessionFactories.length; i++) {
- ClassMetadata result = sessionFactories[i].getClassMetadata(clazz);
-
- if (result != null) {
- return result;
- }
- }
-
- return null;
- }
-
- public SessionFactory[] getSessionFactories() {
- return this.sessionFactories;
- }
-
- public ValidationRegistryManager getValidationRegistryManager() {
- return validationRegistryManager;
- }
-
- public void obtainImmediateChildren(Object parentObject, List