[hibernate-commits] Hibernate SVN: r12730 - in shards/trunk/src: java/org/hibernate/shards/session and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Jul 5 17:51:47 EDT 2007


Author: max.ross
Date: 2007-07-05 17:51:47 -0400 (Thu, 05 Jul 2007)
New Revision: 12730

Modified:
   shards/trunk/src/java/org/hibernate/shards/id/ShardedUUIDGenerator.java
   shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java
   shards/trunk/src/test/org/hibernate/shards/defaultmock/SessionDefaultMock.java
   shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java
Log:
Clean up a few warnings

Modified: shards/trunk/src/java/org/hibernate/shards/id/ShardedUUIDGenerator.java
===================================================================
--- shards/trunk/src/java/org/hibernate/shards/id/ShardedUUIDGenerator.java	2007-07-05 21:50:54 UTC (rev 12729)
+++ shards/trunk/src/java/org/hibernate/shards/id/ShardedUUIDGenerator.java	2007-07-05 21:51:47 UTC (rev 12730)
@@ -18,13 +18,12 @@
 
 package org.hibernate.shards.id;
 
-import org.hibernate.shards.ShardId;
-import org.hibernate.shards.util.Preconditions;
-import org.hibernate.shards.session.ShardedSessionImpl;
-
 import org.hibernate.dialect.Dialect;
 import org.hibernate.engine.SessionImplementor;
 import org.hibernate.id.UUIDHexGenerator;
+import org.hibernate.shards.ShardId;
+import org.hibernate.shards.session.ShardedSessionImpl;
+import org.hibernate.shards.util.Preconditions;
 import org.hibernate.type.Type;
 import org.hibernate.util.PropertiesHelper;
 
@@ -41,7 +40,6 @@
 public class ShardedUUIDGenerator extends UUIDHexGenerator implements ShardEncodingIdentifierGenerator {
 
   private IdType idType;
-  private int shardId;
 
   private static String ZERO_STRING = "00000000000000000000000000000000";
   private static String ID_TYPE_PROPERTY = "sharded-uuid-type";

Modified: shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java
===================================================================
--- shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java	2007-07-05 21:50:54 UTC (rev 12729)
+++ shards/trunk/src/java/org/hibernate/shards/session/ShardedSessionImpl.java	2007-07-05 21:51:47 UTC (rev 12730)
@@ -20,33 +20,66 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hibernate.*;
+import org.hibernate.CacheMode;
+import org.hibernate.Criteria;
+import org.hibernate.EntityMode;
+import org.hibernate.Filter;
+import org.hibernate.FlushMode;
+import org.hibernate.HibernateException;
+import org.hibernate.Interceptor;
+import org.hibernate.LockMode;
+import org.hibernate.Query;
+import org.hibernate.ReplicationMode;
+import org.hibernate.SQLQuery;
+import org.hibernate.SessionException;
+import org.hibernate.Transaction;
+import org.hibernate.TransientObjectException;
+import org.hibernate.UnresolvableObjectException;
 import org.hibernate.classic.Session;
 import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.id.IdentifierGenerator;
 import org.hibernate.metadata.ClassMetadata;
 import org.hibernate.proxy.HibernateProxy;
-import org.hibernate.shards.*;
+import org.hibernate.shards.CrossShardAssociationException;
+import org.hibernate.shards.Shard;
+import org.hibernate.shards.ShardId;
+import org.hibernate.shards.ShardImpl;
+import org.hibernate.shards.ShardOperation;
+import org.hibernate.shards.ShardedTransaction;
 import org.hibernate.shards.criteria.CriteriaFactoryImpl;
 import org.hibernate.shards.criteria.CriteriaId;
 import org.hibernate.shards.criteria.ShardedCriteriaImpl;
 import org.hibernate.shards.engine.ShardedSessionFactoryImplementor;
 import org.hibernate.shards.engine.ShardedSessionImplementor;
 import org.hibernate.shards.id.ShardEncodingIdentifierGenerator;
-import org.hibernate.shards.query.*;
+import org.hibernate.shards.query.AdHocQueryFactoryImpl;
+import org.hibernate.shards.query.ExitOperationsQueryCollector;
+import org.hibernate.shards.query.NamedQueryFactoryImpl;
+import org.hibernate.shards.query.QueryId;
+import org.hibernate.shards.query.ShardedQueryImpl;
 import org.hibernate.shards.stat.ShardedSessionStatistics;
 import org.hibernate.shards.strategy.ShardStrategy;
 import org.hibernate.shards.strategy.exit.FirstNonNullResultExitStrategy;
 import org.hibernate.shards.strategy.selection.ShardResolutionStrategyData;
 import org.hibernate.shards.strategy.selection.ShardResolutionStrategyDataImpl;
 import org.hibernate.shards.transaction.ShardedTransactionImpl;
-import org.hibernate.shards.util.*;
+import org.hibernate.shards.util.Iterables;
+import org.hibernate.shards.util.Lists;
+import org.hibernate.shards.util.Maps;
+import org.hibernate.shards.util.Pair;
+import org.hibernate.shards.util.Preconditions;
+import org.hibernate.shards.util.Sets;
 import org.hibernate.stat.SessionStatistics;
 import org.hibernate.type.Type;
 
 import java.io.Serializable;
 import java.sql.Connection;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Concrete implementation of a ShardedSession, and also the central component of
@@ -374,8 +407,7 @@
   }
 
   /**
-   * We do not have sharded Connections as that would mean pushing sharding to
-   * connection-level.
+   * @deprecated
    */
   public Connection connection() throws HibernateException {
     throw new UnsupportedOperationException();

Modified: shards/trunk/src/test/org/hibernate/shards/defaultmock/SessionDefaultMock.java
===================================================================
--- shards/trunk/src/test/org/hibernate/shards/defaultmock/SessionDefaultMock.java	2007-07-05 21:50:54 UTC (rev 12729)
+++ shards/trunk/src/test/org/hibernate/shards/defaultmock/SessionDefaultMock.java	2007-07-05 21:51:47 UTC (rev 12730)
@@ -18,7 +18,18 @@
 
 package org.hibernate.shards.defaultmock;
 
-import org.hibernate.*;
+import org.hibernate.CacheMode;
+import org.hibernate.Criteria;
+import org.hibernate.EntityMode;
+import org.hibernate.Filter;
+import org.hibernate.FlushMode;
+import org.hibernate.HibernateException;
+import org.hibernate.LockMode;
+import org.hibernate.Query;
+import org.hibernate.ReplicationMode;
+import org.hibernate.SQLQuery;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
 import org.hibernate.classic.Session;
 import org.hibernate.stat.SessionStatistics;
 import org.hibernate.type.Type;
@@ -34,105 +45,171 @@
  */
 public class SessionDefaultMock implements Session {
 
+  /**
+   * @deprecated
+   */
   public Object saveOrUpdateCopy(Object object) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Object saveOrUpdateCopy(Object object, Serializable id)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Object saveOrUpdateCopy(String entityName, Object object)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Object saveOrUpdateCopy(String entityName, Object object,
       Serializable id) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public List find(String query) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public List find(String query, Object value, Type type)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public List find(String query, Object[] values, Type[] types)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Iterator iterate(String query) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Iterator iterate(String query, Object value, Type type)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Iterator iterate(String query, Object[] values, Type[] types)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Collection filter(Object collection, String filter)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Collection filter(Object collection, String filter, Object value,
       Type type) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Collection filter(Object collection, String filter, Object[] values,
       Type[] types) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public int delete(String query) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public int delete(String query, Object value, Type type)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public int delete(String query, Object[] values, Type[] types)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Query createSQLQuery(String sql, String returnAlias,
       Class returnClass) {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Query createSQLQuery(String sql, String[] returnAliases,
       Class[] returnClasses) {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public void save(Object object, Serializable id) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public void save(String entityName, Object object, Serializable id)
       throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public void update(Object object, Serializable id) throws HibernateException {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public void update(String entityName, Object object, Serializable id)
       throws HibernateException {
     throw new UnsupportedOperationException();
@@ -170,6 +247,9 @@
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public Connection connection() throws HibernateException {
     throw new UnsupportedOperationException();
   }
@@ -408,6 +488,9 @@
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * @deprecated
+   */
   public void reconnect() throws HibernateException {
     throw new UnsupportedOperationException();
   }

Modified: shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java
===================================================================
--- shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java	2007-07-05 21:50:54 UTC (rev 12729)
+++ shards/trunk/src/test/org/hibernate/shards/integration/BaseShardingIntegrationTestCase.java	2007-07-05 21:51:47 UTC (rev 12730)
@@ -19,6 +19,7 @@
 package org.hibernate.shards.integration;
 
 import junit.framework.TestCase;
+
 import org.hibernate.Session;
 import org.hibernate.cfg.Configuration;
 import org.hibernate.shards.ShardId;
@@ -53,7 +54,11 @@
 import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Base class for all sharding integration tests.
@@ -132,12 +137,20 @@
     DatabasePlatform dbPlatform = DatabasePlatformFactory.FACTORY.getDatabasePlatform();
     String dbPlatformConfigDirectory = "platform/" + dbPlatform.getName().toLowerCase() +"/config/";
     IdGenType idGenType = getIdGenType();
-    Configuration config = new Configuration();
+    Configuration config = createPrototypeConfiguration();
     config.configure(BaseShardingIntegrationTestCase.class.getResource(dbPlatformConfigDirectory + "shard0.hibernate.cfg.xml"));
     config.addURL(BaseShardingIntegrationTestCase.class.getResource(dbPlatformConfigDirectory + idGenType.getMappingFile()));
     return config;
   }
 
+  /**
+   * You can override this if you want to return your own subclass of Configuration.
+   * @return The {@link Configuration} to use as the prototype
+   */
+  protected Configuration createPrototypeConfiguration() {
+    return new Configuration();
+  }
+
   protected List<ShardConfiguration> buildConfigurations() {
     DatabasePlatform dbPlatform = DatabasePlatformFactory.FACTORY.getDatabasePlatform();
     String dbPlatformConfigDirectory = "platform/" + dbPlatform.getName().toLowerCase() +"/config/";
@@ -238,7 +251,7 @@
   /**
    * Override if you want additional tables in your schema
    */
-  protected void createDatabaseHook(Connection conn) {
+  protected void createDatabaseHook(Connection conn) throws SQLException {
   }
 
   /**




More information about the hibernate-commits mailing list