/// <summary>
 /// Initializes a new instance of the <see cref="GemFireSystemException"/> class.
 /// </summary>
 /// <param name="cause">The cause.</param>
 public GemFireSystemException(GemFireException cause)
     : base(cause != null ? cause.Message : null, cause)
 {
 }
        /// <summary>
        /// Converts the GemFireException into an appropriate one from the Spring.Data.Dao hierarchy.
        /// </summary>
        /// <param name="ex">The GemFire exception.</param>
        /// <returns>A Spring DataAccessException</returns>
        public static DataAccessException ConvertGemFireAccessException(GemFireException ex)
        {
            if (ex is CacheExistsException)
            {
                return(new DataIntegrityViolationException(ex.Message, ex));
            }
            if (ex is EntryExistsException)
            {
                return(new DuplicateKeyException(ex.Message, ex));
            }
            if (ex is EntryNotFoundException)
            {
                return(new DataRetrievalFailureException(ex.Message, ex));
            }
            if (ex is RegionExistsException)
            {
                return(new DataIntegrityViolationException(ex.Message, ex));
            }
            if (ex is CqClosedException)
            {
                return(new InvalidDataAccessApiUsageException(ex.Message, ex));
            }
            if (ex is DiskCorruptException)
            {
                return(new DataAccessResourceFailureException(ex.Message, ex));
            }
            if (ex is DiskFailureException)
            {
                return(new DataAccessResourceFailureException(ex.Message, ex));
            }
            if (ex is EntryDestroyedException)
            {
                return(new InvalidDataAccessApiUsageException(ex.Message, ex));
            }
            if (ex is RegionDestroyedException)
            {
                return(new InvalidDataAccessResourceUsageException(ex.Message, ex));
            }
            if (ex is RegionExistsException)
            {
                return(new InvalidDataAccessResourceUsageException(ex.Message, ex));
            }
            if (ex is EntryNotFoundException)
            {
                return(new DataRetrievalFailureException(ex.Message, ex));
            }
            if (ex is FunctionExecutionException)
            {
                return(new InvalidDataAccessApiUsageException(ex.Message, ex));
            }

            if (ex is CacheExistsException)
            {
                return(new DataIntegrityViolationException(ex.Message, ex));
            }
            if (ex is CqClosedException)
            {
                return(new InvalidDataAccessApiUsageException(ex.Message, ex));
            }
            if (ex is GemFireIOException)
            {
                return(new DataAccessResourceFailureException(ex.Message, ex));
            }
            return(new GemFireSystemException(ex));
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GemFireSystemException"/> class.
 /// </summary>
 /// <param name="cause">The cause.</param>
 public GemFireSystemException(GemFireException cause) : base(cause != null ? cause.Message : null, cause)
 {
 }
        /// <summary>
        /// Converts the GemFireException into an appropriate one from the Spring.Data.Dao hierarchy.
        /// </summary>
        /// <param name="ex">The GemFire exception.</param>
        /// <returns>A Spring DataAccessException</returns>
        public static DataAccessException ConvertGemFireAccessException(GemFireException ex)
        {
            if (ex is CacheExistsException)
            {
                return new DataIntegrityViolationException(ex.Message, ex);
            }
            if (ex is EntryExistsException)
            {
                return new DuplicateKeyException(ex.Message, ex);
            }
            if (ex is EntryNotFoundException)
            {
                return new DataRetrievalFailureException(ex.Message, ex);
            }
            if (ex is RegionExistsException)
            {
                return new DataIntegrityViolationException(ex.Message, ex);
            }
            if (ex is CqClosedException)
            {
                return new InvalidDataAccessApiUsageException(ex.Message, ex);
            }
            if (ex is DiskCorruptException)
            {
                return new DataAccessResourceFailureException(ex.Message, ex);
            }
            if (ex is DiskFailureException)
            {
                return new DataAccessResourceFailureException(ex.Message, ex);
            }
            if (ex is EntryDestroyedException)
            {
                return new InvalidDataAccessApiUsageException(ex.Message, ex);
            }
            if (ex is RegionDestroyedException)
            {
                return new InvalidDataAccessResourceUsageException(ex.Message, ex);
            }
            if (ex is RegionExistsException)
            {
                return new InvalidDataAccessResourceUsageException(ex.Message, ex);
            }
            if (ex is EntryNotFoundException)
            {
                return new DataRetrievalFailureException(ex.Message, ex);
            }
            if (ex is FunctionExecutionException)
            {
                return new InvalidDataAccessApiUsageException(ex.Message, ex);
            }

            if (ex is CacheExistsException)
            {
                return new DataIntegrityViolationException(ex.Message, ex);
            }
            if (ex is CqClosedException)
            {
                return new InvalidDataAccessApiUsageException(ex.Message, ex);
            }
            if (ex is GemFireIOException)
            {
                return new DataAccessResourceFailureException(ex.Message, ex);
            }
            return new GemFireSystemException(ex);
        }