HHH-6191 - repackage org.hibernate.cache per api/spi/internal split

This commit is contained in:
Steve Ebersole 2011-05-04 14:43:03 -05:00
parent b9d002778b
commit c930ebcd7d
182 changed files with 2509 additions and 2421 deletions

View File

@ -283,7 +283,7 @@ http://opensource.atlassian.com/projects/hibernate/browse/HHH/fixforversion/1114
* [HHH-5512] - JndiInfinispanRegionFactory shouldn't try to stop CacheManager * [HHH-5512] - JndiInfinispanRegionFactory shouldn't try to stop CacheManager
* [HHH-5517] - Switch uuid generation in SessionFactory to org.hibernate.id.UUIDGenerator instead * [HHH-5517] - Switch uuid generation in SessionFactory to org.hibernate.id.UUIDGenerator instead
* [HHH-5519] - VersionedItem should not extend Item, otherwise query cache results are confusing * [HHH-5519] - VersionedItem should not extend Item, otherwise query cache results are confusing
* [HHH-5520] - Per org.hibernate.cache.RegionFactory javadocs, implementors should be allowed to use no-arg constructor * [HHH-5520] - Per org.hibernate.cache.spi.RegionFactory javadocs, implementors should be allowed to use no-arg constructor
** Deprecation ** Deprecation
* [HHH-5489] - Deprecate jbosscache as a second level cache provider, in favor of infinispan * [HHH-5489] - Deprecate jbosscache as a second level cache provider, in favor of infinispan

View File

@ -29,12 +29,12 @@
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
<code>org.hibernate.cache.StandardQueryCache</code> holds the cached query results. <code>org.hibernate.cache.internal.StandardQueryCache</code> holds the cached query results.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<code>org.hibernate.cache.UpdateTimestampsCache</code> holds timestamps of the most recent updates to <code>org.hibernate.cache.spi.UpdateTimestampsCache</code> holds timestamps of the most recent updates to
queryable tables. These timestamps validate results served from the query cache. queryable tables. These timestamps validate results served from the query cache.
</para> </para>
</listitem> </listitem>

View File

@ -21,7 +21,7 @@
<property name="current_session_context_class">thread</property> <property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache --> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout --> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <property name="show_sql">true</property>

View File

@ -712,7 +712,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
<para revision="1">You have the option to tell Hibernate which caching <para revision="1">You have the option to tell Hibernate which caching
implementation to use by specifying the name of a class that implements implementation to use by specifying the name of a class that implements
<literal>org.hibernate.cache.CacheProvider</literal> using the property <literal>org.hibernate.cache.spi.CacheProvider</literal> using the property
<literal>hibernate.cache.provider_class</literal>. Hibernate is bundled <literal>hibernate.cache.provider_class</literal>. Hibernate is bundled
with a number of built-in integrations with the open-source cache with a number of built-in integrations with the open-source cache
providers that are listed in <xref linkend="cacheproviders" />. You can providers that are listed in <xref linkend="cacheproviders" />. You can
@ -752,7 +752,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
<row> <row>
<entry>Hashtable (not intended for production use)</entry> <entry>Hashtable (not intended for production use)</entry>
<entry><literal>org.hibernate.cache.HashtableCacheProvider</literal></entry> <entry><literal>org.hibernate.cache.internal.HashtableCacheProvider</literal></entry>
<entry>memory</entry> <entry>memory</entry>
@ -1316,12 +1316,12 @@ hibernate.cache.use_structured_entries true</programlisting>
<para>This setting creates two new cache regions: <itemizedlist> <para>This setting creates two new cache regions: <itemizedlist>
<listitem> <listitem>
<para><classname>org.hibernate.cache.StandardQueryCache</classname>, <para><classname>org.hibernate.cache.internal.StandardQueryCache</classname>,
holding the cached query results</para> holding the cached query results</para>
</listitem> </listitem>
<listitem> <listitem>
<para><classname>org.hibernate.cache.UpdateTimestampsCache</classname>, <para><classname>org.hibernate.cache.spi.UpdateTimestampsCache</classname>,
holding timestamps of the most recent updates to queryable tables. holding timestamps of the most recent updates to queryable tables.
These are used to validate the results as they are served from the These are used to validate the results as they are served from the
query cache.</para> query cache.</para>

View File

@ -493,7 +493,7 @@ public class Event {
<property name="current_session_context_class">thread</property> <property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache --> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout --> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <property name="show_sql">true</property>

View File

@ -43,7 +43,7 @@
<property name="dialect">org.hibernate.dialect.H2Dialect</property> <property name="dialect">org.hibernate.dialect.H2Dialect</property>
<!-- Disable the second-level cache --> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout --> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <property name="show_sql">true</property>

View File

@ -43,7 +43,7 @@
<property name="dialect">org.hibernate.dialect.H2Dialect</property> <property name="dialect">org.hibernate.dialect.H2Dialect</property>
<!-- Disable the second-level cache --> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout --> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <property name="show_sql">true</property>

View File

@ -494,7 +494,7 @@ hibernate.cache.region_prefix hibernate.test
#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider #hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider #hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider hibernate.cache.provider_class org.hibernate.cache.internal.HashtableCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider #hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider #hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider #hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider

View File

@ -34,9 +34,9 @@ import org.hibernate.HibernateException;
import org.hibernate.action.spi.AfterTransactionCompletionProcess; import org.hibernate.action.spi.AfterTransactionCompletionProcess;
import org.hibernate.action.spi.BeforeTransactionCompletionProcess; import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.action.spi.Executable; import org.hibernate.action.spi.Executable;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -29,8 +29,8 @@ import org.hibernate.action.spi.AfterTransactionCompletionProcess;
import org.hibernate.action.spi.BeforeTransactionCompletionProcess; import org.hibernate.action.spi.BeforeTransactionCompletionProcess;
import org.hibernate.action.spi.Executable; import org.hibernate.action.spi.Executable;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.event.EventSource; import org.hibernate.event.EventSource;

View File

@ -27,8 +27,8 @@ import java.io.Serializable;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.PersistenceContext; import org.hibernate.engine.PersistenceContext;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;

View File

@ -27,8 +27,8 @@ import java.io.Serializable;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.entry.CacheEntry; import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;

View File

@ -28,9 +28,9 @@ import java.io.Serializable;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cache.entry.CacheEntry; import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;

View File

@ -22,7 +22,8 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.annotations; package org.hibernate.annotations;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.spi.access.AccessType;
/** /**
* Cache concurrency strategy * Cache concurrency strategy
@ -43,35 +44,36 @@ public enum CacheConcurrencyStrategy {
} }
public static CacheConcurrencyStrategy fromAccessType(AccessType accessType) { public static CacheConcurrencyStrategy fromAccessType(AccessType accessType) {
final String name = accessType == null ? null : accessType.getName(); switch ( accessType ) {
if ( AccessType.READ_ONLY.getName().equals( name ) ) { case READ_ONLY: {
return READ_ONLY; return READ_ONLY;
} }
else if ( AccessType.READ_WRITE.getName().equals( name ) ) { case READ_WRITE: {
return READ_WRITE; return READ_WRITE;
} }
else if ( AccessType.NONSTRICT_READ_WRITE.getName().equals( name ) ) { case NONSTRICT_READ_WRITE: {
return NONSTRICT_READ_WRITE; return NONSTRICT_READ_WRITE;
} }
else if ( AccessType.TRANSACTIONAL.getName().equals( name ) ) { case TRANSACTIONAL: {
return TRANSACTIONAL; return TRANSACTIONAL;
} }
else { default: {
return NONE; return NONE;
}
} }
} }
public static CacheConcurrencyStrategy parse(String name) { public static CacheConcurrencyStrategy parse(String name) {
if ( READ_ONLY.accessType.getName().equalsIgnoreCase( name ) ) { if ( READ_ONLY.accessType.getExternalName().equalsIgnoreCase( name ) ) {
return READ_ONLY; return READ_ONLY;
} }
else if ( READ_WRITE.accessType.getName().equalsIgnoreCase( name ) ) { else if ( READ_WRITE.accessType.getExternalName().equalsIgnoreCase( name ) ) {
return READ_WRITE; return READ_WRITE;
} }
else if ( NONSTRICT_READ_WRITE.accessType.getName().equalsIgnoreCase( name ) ) { else if ( NONSTRICT_READ_WRITE.accessType.getExternalName().equalsIgnoreCase( name ) ) {
return NONSTRICT_READ_WRITE; return NONSTRICT_READ_WRITE;
} }
else if ( TRANSACTIONAL.accessType.getName().equalsIgnoreCase( name ) ) { else if ( TRANSACTIONAL.accessType.getExternalName().equalsIgnoreCase( name ) ) {
return TRANSACTIONAL; return TRANSACTIONAL;
} }
else if ( "none".equalsIgnoreCase( name ) ) { else if ( "none".equalsIgnoreCase( name ) ) {

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,118 +20,14 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache;
import java.util.Properties;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cfg.Settings;
/** /**
* Contract for building second level cache regions.
* <p/>
* Implementors should define a constructor in one of two forms:<ul>
* <li>MyRegionFactoryImpl({@link java.util.Properties})</li>
* <li>MyRegionFactoryImpl()</li>
* </ul>
* Use the first when we need to read config properties prior to
* {@link #start} being called. For an example, have a look at
* {@link org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge}
* where we need the properties in order to determine which legacy
* {@link CacheProvider} to use so that we can answer the
* {@link #isMinimalPutsEnabledByDefault()} question for the
* {@link org.hibernate.cfg.SettingsFactory}.
*
* @author Steve Ebersole * @author Steve Ebersole
*
* @deprecated Moved, but still need this definition for ehcache
*/ */
public interface RegionFactory { @Deprecated
public interface RegionFactory extends org.hibernate.cache.spi.RegionFactory {
/**
* Lifecycle callback to perform any necessary initialization of the
* underlying cache implementation(s). Called exactly once during the
* construction of a {@link org.hibernate.internal.SessionFactoryImpl}.
*
* @param settings The settings in effect.
* @param properties The defined cfg properties
* @throws CacheException Indicates problems starting the L2 cache impl;
* considered as a sign to stop {@link org.hibernate.SessionFactory}
* building.
*/
public void start(Settings settings, Properties properties) throws CacheException;
/**
* Lifecycle callback to perform any necessary cleanup of the underlying
* cache implementation(s). Called exactly once during
* {@link org.hibernate.SessionFactory#close}.
*/
public void stop();
/**
* By default should we perform "minimal puts" when using this second
* level cache implementation?
*
* @return True if "minimal puts" should be performed by default; false
* otherwise.
*/
public boolean isMinimalPutsEnabledByDefault();
/**
* Get the default access type for {@link EntityRegion entity} and
* {@link CollectionRegion collection} regions.
*
* @return This factory's default access type.
*/
public AccessType getDefaultAccessType();
/**
* Generate a timestamp.
* <p/>
* This is generally used for cache content locking/unlocking purposes
* depending upon the access-strategy being used.
*
* @return The generated timestamp.
*/
public long nextTimestamp();
/**
* Build a cache region specialized for storing entity data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @param metadata Information regarding the type of data to be cached
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
/**
* Build a cache region specialized for storing collection data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @param metadata Information regarding the type of data to be cached
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
/**
* Build a cache region specialized for storing query results
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException;
/**
* Build a cache region specialized for storing update-timestamps data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException;
} }

View File

@ -1,85 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.cache.access;
import java.io.Serializable;
/**
* The types of access strategies available.
*
* @author Steve Ebersole
*/
public class AccessType implements Serializable {
public static final AccessType READ_ONLY = new AccessType( "read-only" );
public static final AccessType READ_WRITE = new AccessType( "read-write" );
public static final AccessType NONSTRICT_READ_WRITE = new AccessType( "nonstrict-read-write" );
public static final AccessType TRANSACTIONAL = new AccessType( "transactional" );
private final String name;
private AccessType(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String toString() {
return "AccessType[" + name + "]";
}
private static AccessType resolve(String name) {
if ( READ_ONLY.name.equals( name ) ) {
return READ_ONLY;
}
else if ( READ_WRITE.name.equals( name ) ) {
return READ_WRITE;
}
else if ( NONSTRICT_READ_WRITE.name.equals( name ) ) {
return NONSTRICT_READ_WRITE;
}
else if ( TRANSACTIONAL.name.equals( name ) ) {
return TRANSACTIONAL;
}
else {
return null;
}
}
public static AccessType parse(String name) {
return resolve( name );
}
private Object readResolve() {
return resolve( name );
}
public static String getValidUsageString() {
return "cache usage attribute should be " + READ_ONLY.name +
", " + READ_WRITE.name +
", " + NONSTRICT_READ_WRITE.name +
", or " + TRANSACTIONAL.name;
}
}

View File

@ -1,75 +1,76 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal;
package org.hibernate.cache.impl;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.mapping.Collection; import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Collection;
import org.hibernate.type.VersionType; import org.hibernate.mapping.PersistentClass;
import org.hibernate.type.VersionType;
/**
* {@inheritDoc} /**
* * {@inheritDoc}
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public class CacheDataDescriptionImpl implements CacheDataDescription { */
private final boolean mutable; public class CacheDataDescriptionImpl implements CacheDataDescription {
private final boolean versioned; private final boolean mutable;
private final Comparator versionComparator; private final boolean versioned;
private final Comparator versionComparator;
public CacheDataDescriptionImpl(boolean mutable, boolean versioned, Comparator versionComparator) {
this.mutable = mutable; public CacheDataDescriptionImpl(boolean mutable, boolean versioned, Comparator versionComparator) {
this.versioned = versioned; this.mutable = mutable;
this.versionComparator = versionComparator; this.versioned = versioned;
} this.versionComparator = versionComparator;
}
public boolean isMutable() {
return mutable; public boolean isMutable() {
} return mutable;
}
public boolean isVersioned() {
return versioned; public boolean isVersioned() {
} return versioned;
}
public Comparator getVersionComparator() {
return versionComparator; public Comparator getVersionComparator() {
} return versionComparator;
}
public static CacheDataDescriptionImpl decode(PersistentClass model) {
return new CacheDataDescriptionImpl( public static CacheDataDescriptionImpl decode(PersistentClass model) {
model.isMutable(), return new CacheDataDescriptionImpl(
model.isVersioned(), model.isMutable(),
model.isVersioned() ? ( ( VersionType ) model.getVersion().getType() ).getComparator() : null model.isVersioned(),
); model.isVersioned() ? ( ( VersionType ) model.getVersion().getType() ).getComparator() : null
} );
}
public static CacheDataDescriptionImpl decode(Collection model) {
return new CacheDataDescriptionImpl( public static CacheDataDescriptionImpl decode(Collection model) {
model.isMutable(), return new CacheDataDescriptionImpl(
model.getOwner().isVersioned(), model.isMutable(),
model.getOwner().isVersioned() ? ( ( VersionType ) model.getOwner().getVersion().getType() ).getComparator() : null model.getOwner().isVersioned(),
); model.getOwner().isVersioned() ? ( ( VersionType ) model.getOwner().getVersion().getType() ).getComparator() : null
} );
} }
}

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,13 +20,16 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
import java.util.Collections; import java.util.Collections;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map; import java.util.Map;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.Cache;
/** /**
* A lightweight implementation of the <tt>Cache</tt> interface * A lightweight implementation of the <tt>Cache</tt> interface
* @author Gavin King * @author Gavin King

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,15 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
import java.util.Properties; import java.util.Properties;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.spi.CacheProvider;
/** /**
* A simple in-memory Hashtable-based cache impl. * A simple in-memory Hashtable-based cache impl.
* *

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,16 +20,22 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
import java.util.Properties; import java.util.Properties;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.NoCachingEnabledException;
import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.spi.CacheProvider;
/** /**
* Implementation of NoCacheProvider. * Implementation of NoCacheProvider.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Deprecated
public class NoCacheProvider implements CacheProvider { public class NoCacheProvider implements CacheProvider {
/** /**
* Configure the cache * Configure the cache
@ -37,7 +43,7 @@ public class NoCacheProvider implements CacheProvider {
* @param regionName the name of the cache region * @param regionName the name of the cache region
* @param properties configuration settings * @param properties configuration settings
* *
* @throws CacheException * @throws org.hibernate.cache.CacheException
*/ */
public Cache buildCache(String regionName, Properties properties) throws CacheException { public Cache buildCache(String regionName, Properties properties) throws CacheException {
throw new NoCachingEnabledException(); throw new NoCachingEnabledException();

View File

@ -1,83 +1,85 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache.impl; package org.hibernate.cache.internal;
import java.util.Properties;
import org.hibernate.cache.CacheDataDescription; import java.util.Properties;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CollectionRegion; import org.hibernate.cache.CacheException;
import org.hibernate.cache.EntityRegion; import org.hibernate.cache.NoCachingEnabledException;
import org.hibernate.cache.NoCachingEnabledException; import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.QueryResultsRegion; import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.RegionFactory; import org.hibernate.cache.spi.EntityRegion;
import org.hibernate.cache.TimestampsRegion; import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cfg.Settings; import org.hibernate.cache.spi.TimestampsRegion;
import org.hibernate.cache.spi.access.AccessType;
/** import org.hibernate.cfg.Settings;
* Factory used if no caching enabled in config...
* /**
* @author Steve Ebersole * Factory used if no caching enabled in config...
*/ *
public class NoCachingRegionFactory implements RegionFactory { * @author Steve Ebersole
*/
public class NoCachingRegionFactory implements RegionFactory {
public NoCachingRegionFactory(Properties properties) {
}
public NoCachingRegionFactory(Properties properties) {
public void start(Settings settings, Properties properties) throws CacheException { }
}
public void start(Settings settings, Properties properties) throws CacheException {
public void stop() { }
}
public void stop() {
public boolean isMinimalPutsEnabledByDefault() { }
return false;
} public boolean isMinimalPutsEnabledByDefault() {
return false;
public AccessType getDefaultAccessType() { }
return null;
} public AccessType getDefaultAccessType() {
return null;
public long nextTimestamp() { }
return System.currentTimeMillis() / 100;
} public long nextTimestamp() {
return System.currentTimeMillis() / 100;
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) }
throws CacheException {
throw new NoCachingEnabledException(); public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
} throws CacheException {
throw new NoCachingEnabledException();
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) }
throws CacheException {
throw new NoCachingEnabledException(); public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata)
} throws CacheException {
throw new NoCachingEnabledException();
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException { }
throw new NoCachingEnabledException();
} public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException {
throw new NoCachingEnabledException();
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException { }
throw new NoCachingEnabledException();
} public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException {
} throw new NoCachingEnabledException();
}
}

View File

@ -21,21 +21,29 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
import javax.persistence.EntityNotFoundException;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import javax.persistence.EntityNotFoundException;
import org.jboss.logging.Logger;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.UnresolvableObjectException; import org.hibernate.UnresolvableObjectException;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.spi.QueryKey;
import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.cache.spi.UpdateTimestampsCache;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.type.Type; import org.hibernate.type.Type;
import org.hibernate.type.TypeHelper; import org.hibernate.type.TypeHelper;
import org.jboss.logging.Logger;
/** /**
* The standard implementation of the Hibernate QueryCache interface. This * The standard implementation of the Hibernate QueryCache interface. This

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,26 +20,28 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
import java.util.Properties; import java.util.Properties;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.spi.QueryCacheFactory;
import org.hibernate.cache.spi.UpdateTimestampsCache;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* Standard Hibernate implementation of the QueryCacheFactory interface. Returns * Standard Hibernate implementation of the QueryCacheFactory interface. Returns instances of
* instances of {@link StandardQueryCache}. * {@link StandardQueryCache}.
*/ */
public class StandardQueryCacheFactory implements QueryCacheFactory { public class StandardQueryCacheFactory implements QueryCacheFactory {
@Override
public QueryCache getQueryCache( public QueryCache getQueryCache(
final String regionName, final String regionName,
final UpdateTimestampsCache updateTimestampsCache, final UpdateTimestampsCache updateTimestampsCache,
final Settings settings, final Settings settings,
final Properties props) final Properties props) throws HibernateException {
throws HibernateException {
return new StandardQueryCache(settings, props, updateTimestampsCache, regionName); return new StandardQueryCache(settings, props, updateTimestampsCache, regionName);
} }
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,15 +20,12 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.internal;
/** /**
* Generates increasing identifiers (in a single VM only). * Generates increasing identifiers (in a single VM only). Not valid across multiple VMs. Identifiers are not
* Not valid across multiple VMs. Identifiers are not necessarily * necessarily strictly increasing, but usually are.
* strictly increasing, but usually are.
*/ */
public final class Timestamper { public final class Timestamper {
private static short counter = 0; private static short counter = 0;
@ -51,7 +48,8 @@ public final class Timestamper {
} }
} }
private Timestamper() {} private Timestamper() {
}
} }

View File

@ -1,57 +1,57 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.Cache; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.GeneralDataRegion; import org.hibernate.cache.spi.GeneralDataRegion;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public abstract class BaseGeneralDataRegionAdapter extends BaseRegionAdapter implements GeneralDataRegion { public abstract class BaseGeneralDataRegionAdapter extends BaseRegionAdapter implements GeneralDataRegion {
protected BaseGeneralDataRegionAdapter(Cache underlyingCache, Settings settings) { protected BaseGeneralDataRegionAdapter(Cache underlyingCache, Settings settings) {
super( underlyingCache, settings ); super( underlyingCache, settings );
} }
public Object get(Object key) throws CacheException { public Object get(Object key) throws CacheException {
return underlyingCache.get( key ); return underlyingCache.get( key );
} }
public void put(Object key, Object value) throws CacheException { public void put(Object key, Object value) throws CacheException {
underlyingCache.put( key, value ); underlyingCache.put( key, value );
} }
public void evict(Object key) throws CacheException { public void evict(Object key) throws CacheException {
underlyingCache.remove( key ); underlyingCache.remove( key );
} }
public void evictAll() throws CacheException { public void evictAll() throws CacheException {
underlyingCache.clear(); underlyingCache.clear();
} }
} }

View File

@ -1,86 +1,87 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import java.util.Map; import java.util.Map;
import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.Region; import org.hibernate.cache.spi.Cache;
import org.hibernate.cfg.Settings; import org.hibernate.cache.spi.Region;
import org.hibernate.cfg.Settings;
/**
* Basic adapter bridging between {@link Region} and {@link Cache}. /**
* * Basic adapter bridging between {@link Region} and {@link Cache}.
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public abstract class BaseRegionAdapter implements Region { */
protected final Cache underlyingCache; public abstract class BaseRegionAdapter implements Region {
protected final Settings settings; protected final Cache underlyingCache;
protected final Settings settings;
protected BaseRegionAdapter(Cache underlyingCache, Settings settings) {
this.underlyingCache = underlyingCache; protected BaseRegionAdapter(Cache underlyingCache, Settings settings) {
this.settings = settings; this.underlyingCache = underlyingCache;
} this.settings = settings;
}
public String getName() {
return underlyingCache.getRegionName(); public String getName() {
} return underlyingCache.getRegionName();
}
public void clear() throws CacheException {
underlyingCache.clear(); public void clear() throws CacheException {
} underlyingCache.clear();
}
public void destroy() throws CacheException {
underlyingCache.destroy(); public void destroy() throws CacheException {
} underlyingCache.destroy();
}
public boolean contains(Object key) {
// safer to utilize the toMap() as oposed to say get(key) != null public boolean contains(Object key) {
return underlyingCache.toMap().containsKey( key ); // safer to utilize the toMap() as oposed to say get(key) != null
} return underlyingCache.toMap().containsKey( key );
}
public long getSizeInMemory() {
return underlyingCache.getSizeInMemory(); public long getSizeInMemory() {
} return underlyingCache.getSizeInMemory();
}
public long getElementCountInMemory() {
return underlyingCache.getElementCountInMemory(); public long getElementCountInMemory() {
} return underlyingCache.getElementCountInMemory();
}
public long getElementCountOnDisk() {
return underlyingCache.getElementCountOnDisk(); public long getElementCountOnDisk() {
} return underlyingCache.getElementCountOnDisk();
}
public Map toMap() {
return underlyingCache.toMap(); public Map toMap() {
} return underlyingCache.toMap();
}
public long nextTimestamp() {
return underlyingCache.nextTimestamp(); public long nextTimestamp() {
} return underlyingCache.nextTimestamp();
}
public int getTimeout() {
return underlyingCache.getTimeout(); public int getTimeout() {
} return underlyingCache.getTimeout();
} }
}

View File

@ -1,54 +1,55 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.Cache; import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.CacheDataDescription; import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.TransactionalDataRegion; import org.hibernate.cache.spi.TransactionAwareCache;
import org.hibernate.cfg.Settings; import org.hibernate.cache.spi.TransactionalDataRegion;
import org.hibernate.cfg.Settings;
/**
* {@inheritDoc} /**
* * {@inheritDoc}
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public abstract class BaseTransactionalDataRegionAdapter */
extends BaseRegionAdapter public abstract class BaseTransactionalDataRegionAdapter
implements TransactionalDataRegion { extends BaseRegionAdapter
implements TransactionalDataRegion {
protected final CacheDataDescription metadata;
protected final CacheDataDescription metadata;
protected BaseTransactionalDataRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
super( underlyingCache, settings ); protected BaseTransactionalDataRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
this.metadata = metadata; super( underlyingCache, settings );
} this.metadata = metadata;
}
public boolean isTransactionAware() {
return underlyingCache instanceof org.hibernate.cache.TransactionAwareCache; public boolean isTransactionAware() {
} return underlyingCache instanceof TransactionAwareCache;
}
public CacheDataDescription getCacheDataDescription() {
return metadata; public CacheDataDescription getCacheDataDescription() {
} return metadata;
} }
}

View File

@ -1,114 +1,114 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.CacheConcurrencyStrategy; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.spi.CacheConcurrencyStrategy;
import org.hibernate.cache.CollectionRegion; import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* Adapter specifically bridging {@link CollectionRegionAccessStrategy} to {@link CacheConcurrencyStrategy}. * Adapter specifically bridging {@link CollectionRegionAccessStrategy} to {@link CacheConcurrencyStrategy}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class CollectionAccessStrategyAdapter implements CollectionRegionAccessStrategy { public class CollectionAccessStrategyAdapter implements CollectionRegionAccessStrategy {
private final CollectionRegion region; private final CollectionRegion region;
private final CacheConcurrencyStrategy ccs; private final CacheConcurrencyStrategy ccs;
private final Settings settings; private final Settings settings;
public CollectionAccessStrategyAdapter(CollectionRegion region, CacheConcurrencyStrategy ccs, Settings settings) { public CollectionAccessStrategyAdapter(CollectionRegion region, CacheConcurrencyStrategy ccs, Settings settings) {
this.region = region; this.region = region;
this.ccs = ccs; this.ccs = ccs;
this.settings = settings; this.settings = settings;
} }
public CollectionRegion getRegion() { public CollectionRegion getRegion() {
return region; return region;
} }
public Object get(Object key, long txTimestamp) throws CacheException { public Object get(Object key, long txTimestamp) throws CacheException {
return ccs.get( key, txTimestamp ); return ccs.get( key, txTimestamp );
} }
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException { public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
return putFromLoad( key, value, txTimestamp, version, settings.isMinimalPutsEnabled() ); return putFromLoad( key, value, txTimestamp, version, settings.isMinimalPutsEnabled() );
} }
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version, Object version,
boolean minimalPutOverride) throws CacheException { boolean minimalPutOverride) throws CacheException {
return ccs.put( key, value, txTimestamp, version, region.getCacheDataDescription().getVersionComparator(), minimalPutOverride ); return ccs.put( key, value, txTimestamp, version, region.getCacheDataDescription().getVersionComparator(), minimalPutOverride );
} }
public SoftLock lockItem(Object key, Object version) throws CacheException { public SoftLock lockItem(Object key, Object version) throws CacheException {
return ccs.lock( key, version ); return ccs.lock( key, version );
} }
public SoftLock lockRegion() throws CacheException { public SoftLock lockRegion() throws CacheException {
// no-op; CCS did not have such a concept // no-op; CCS did not have such a concept
return null; return null;
} }
public void unlockItem(Object key, SoftLock lock) throws CacheException { public void unlockItem(Object key, SoftLock lock) throws CacheException {
ccs.release( key, lock ); ccs.release( key, lock );
} }
public void unlockRegion(SoftLock lock) throws CacheException { public void unlockRegion(SoftLock lock) throws CacheException {
// again, CCS did not have such a concept; but a reasonable // again, CCS did not have such a concept; but a reasonable
// proximity is to clear the cache after transaction *as long as* // proximity is to clear the cache after transaction *as long as*
// the underlying cache is not JTA aware. // the underlying cache is not JTA aware.
if ( !region.isTransactionAware() ) { if ( !region.isTransactionAware() ) {
ccs.clear(); ccs.clear();
} }
} }
public void remove(Object key) throws CacheException { public void remove(Object key) throws CacheException {
ccs.evict( key ); ccs.evict( key );
} }
public void removeAll() throws CacheException { public void removeAll() throws CacheException {
// again, CCS did not have such a concept; however a reasonable // again, CCS did not have such a concept; however a reasonable
// proximity is to clear the cache. For non-transaction aware // proximity is to clear the cache. For non-transaction aware
// caches, we will also do a clear at the end of the transaction // caches, we will also do a clear at the end of the transaction
ccs.clear(); ccs.clear();
} }
public void evict(Object key) throws CacheException { public void evict(Object key) throws CacheException {
ccs.remove( key ); ccs.remove( key );
} }
public void evictAll() throws CacheException { public void evictAll() throws CacheException {
ccs.clear(); ccs.clear();
} }
public void destroy() { public void destroy() {
ccs.destroy(); ccs.destroy();
} }
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,26 +20,26 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.impl.bridge; package org.hibernate.cache.internal.bridge;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheConcurrencyStrategy;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CollectionRegion;
import org.hibernate.cache.NonstrictReadWriteCache;
import org.hibernate.cache.OptimisticCache;
import org.hibernate.cache.ReadOnlyCache;
import org.hibernate.cache.ReadWriteCache;
import org.hibernate.cache.TransactionalCache;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
import org.hibernate.cfg.Settings;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.spi.CacheConcurrencyStrategy;
import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.spi.NonstrictReadWriteCache;
import org.hibernate.cache.spi.OptimisticCache;
import org.hibernate.cache.spi.ReadOnlyCache;
import org.hibernate.cache.spi.ReadWriteCache;
import org.hibernate.cache.spi.TransactionalCache;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cfg.Settings;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Adapter specifically bridging {@link CollectionRegion} to {@link Cache}. * Adapter specifically bridging {@link CollectionRegion} to {@link Cache}.
* *

View File

@ -1,132 +1,132 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.CacheConcurrencyStrategy; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.spi.CacheConcurrencyStrategy;
import org.hibernate.cache.EntityRegion; import org.hibernate.cache.spi.EntityRegion;
import org.hibernate.cache.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* Adapter specifically bridging {@link EntityRegionAccessStrategy} to {@link CacheConcurrencyStrategy}. * Adapter specifically bridging {@link EntityRegionAccessStrategy} to {@link CacheConcurrencyStrategy}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class EntityAccessStrategyAdapter implements EntityRegionAccessStrategy { public class EntityAccessStrategyAdapter implements EntityRegionAccessStrategy {
private final EntityRegion region; private final EntityRegion region;
private final CacheConcurrencyStrategy ccs; private final CacheConcurrencyStrategy ccs;
private final Settings settings; private final Settings settings;
public EntityAccessStrategyAdapter(EntityRegion region, CacheConcurrencyStrategy ccs, Settings settings) { public EntityAccessStrategyAdapter(EntityRegion region, CacheConcurrencyStrategy ccs, Settings settings) {
this.region = region; this.region = region;
this.ccs = ccs; this.ccs = ccs;
this.settings = settings; this.settings = settings;
} }
public EntityRegion getRegion() { public EntityRegion getRegion() {
return region; return region;
} }
public Object get(Object key, long txTimestamp) throws CacheException { public Object get(Object key, long txTimestamp) throws CacheException {
return ccs.get( key, txTimestamp ); return ccs.get( key, txTimestamp );
} }
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException { public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
return putFromLoad( key, value, txTimestamp, version, settings.isMinimalPutsEnabled() ); return putFromLoad( key, value, txTimestamp, version, settings.isMinimalPutsEnabled() );
} }
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version, Object version,
boolean minimalPutOverride) throws CacheException { boolean minimalPutOverride) throws CacheException {
return ccs.put( key, value, txTimestamp, version, region.getCacheDataDescription().getVersionComparator(), minimalPutOverride ); return ccs.put( key, value, txTimestamp, version, region.getCacheDataDescription().getVersionComparator(), minimalPutOverride );
} }
public SoftLock lockItem(Object key, Object version) throws CacheException { public SoftLock lockItem(Object key, Object version) throws CacheException {
return ccs.lock( key, version ); return ccs.lock( key, version );
} }
public SoftLock lockRegion() throws CacheException { public SoftLock lockRegion() throws CacheException {
// no-op; CCS did not have such a concept // no-op; CCS did not have such a concept
return null; return null;
} }
public void unlockItem(Object key, SoftLock lock) throws CacheException { public void unlockItem(Object key, SoftLock lock) throws CacheException {
ccs.release( key, lock ); ccs.release( key, lock );
} }
public void unlockRegion(SoftLock lock) throws CacheException { public void unlockRegion(SoftLock lock) throws CacheException {
// again, CCS did not have such a concept; but a reasonable // again, CCS did not have such a concept; but a reasonable
// proximity is to clear the cache after transaction *as long as* // proximity is to clear the cache after transaction *as long as*
// the underlying cache is not JTA aware. // the underlying cache is not JTA aware.
if ( !region.isTransactionAware() ) { if ( !region.isTransactionAware() ) {
ccs.clear(); ccs.clear();
} }
} }
public boolean insert(Object key, Object value, Object version) throws CacheException { public boolean insert(Object key, Object value, Object version) throws CacheException {
return ccs.insert( key, value, version ); return ccs.insert( key, value, version );
} }
public boolean afterInsert(Object key, Object value, Object version) throws CacheException { public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
return ccs.afterInsert( key, value, version ); return ccs.afterInsert( key, value, version );
} }
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) public boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
throws CacheException { throws CacheException {
return ccs.update( key, value, currentVersion, previousVersion ); return ccs.update( key, value, currentVersion, previousVersion );
} }
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
throws CacheException { throws CacheException {
return ccs.afterUpdate( key, value, currentVersion, lock ); return ccs.afterUpdate( key, value, currentVersion, lock );
} }
public void remove(Object key) throws CacheException { public void remove(Object key) throws CacheException {
ccs.evict( key ); ccs.evict( key );
} }
public void removeAll() throws CacheException { public void removeAll() throws CacheException {
// again, CCS did not have such a concept; however a reasonable // again, CCS did not have such a concept; however a reasonable
// proximity is to clear the cache. For non-transaction aware // proximity is to clear the cache. For non-transaction aware
// caches, we will also do a clear at the end of the transaction // caches, we will also do a clear at the end of the transaction
ccs.clear(); ccs.clear();
} }
public void evict(Object key) throws CacheException { public void evict(Object key) throws CacheException {
ccs.remove( key ); ccs.remove( key );
} }
public void evictAll() throws CacheException { public void evictAll() throws CacheException {
ccs.clear(); ccs.clear();
} }
public void destroy() { public void destroy() {
ccs.destroy(); ccs.destroy();
} }
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,28 +20,28 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.impl.bridge; package org.hibernate.cache.internal.bridge;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheConcurrencyStrategy;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.EntityRegion;
import org.hibernate.cache.NonstrictReadWriteCache;
import org.hibernate.cache.OptimisticCache;
import org.hibernate.cache.ReadOnlyCache;
import org.hibernate.cache.ReadWriteCache;
import org.hibernate.cache.TransactionalCache;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.access.EntityRegionAccessStrategy;
import org.hibernate.cfg.Settings;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.spi.CacheConcurrencyStrategy;
import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.spi.EntityRegion;
import org.hibernate.cache.spi.NonstrictReadWriteCache;
import org.hibernate.cache.spi.OptimisticCache;
import org.hibernate.cache.spi.ReadOnlyCache;
import org.hibernate.cache.spi.ReadWriteCache;
import org.hibernate.cache.spi.TransactionalCache;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cfg.Settings;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Adapter specifically bridging {@link EntityRegion} to {@link Cache}. * Adapter specifically bridging {@link EntityRegion} to {@link org.hibernate.cache.spi.Cache}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@ -52,7 +52,7 @@ public class EntityRegionAdapter extends BaseTransactionalDataRegionAdapter impl
public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) { public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
super( underlyingCache, settings, metadata ); super( underlyingCache, settings, metadata );
if ( underlyingCache instanceof OptimisticCache ) { if ( underlyingCache instanceof OptimisticCache ) {
( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) ); ( (OptimisticCache) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
} }
} }

View File

@ -1,49 +1,50 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.OptimisticCacheSource; import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.spi.OptimisticCacheSource;
/**
* {@inheritDoc} /**
* * {@inheritDoc}
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public class OptimisticCacheSourceAdapter implements OptimisticCacheSource { */
private final CacheDataDescription dataDescription; public class OptimisticCacheSourceAdapter implements OptimisticCacheSource {
private final CacheDataDescription dataDescription;
public OptimisticCacheSourceAdapter(CacheDataDescription dataDescription) {
this.dataDescription = dataDescription; public OptimisticCacheSourceAdapter(CacheDataDescription dataDescription) {
} this.dataDescription = dataDescription;
}
public boolean isVersioned() {
return dataDescription.isVersioned(); public boolean isVersioned() {
} return dataDescription.isVersioned();
}
public Comparator getVersionComparator() {
return dataDescription.getVersionComparator(); public Comparator getVersionComparator() {
} return dataDescription.getVersionComparator();
} }
}

View File

@ -1,39 +1,39 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.Cache; import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.QueryResultsRegion; import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* Adapter specifically briding {@link QueryResultsRegion} to {@link Cache}. * Adapter specifically briding {@link org.hibernate.cache.spi.QueryResultsRegion} to {@link Cache}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class QueryResultsRegionAdapter extends BaseGeneralDataRegionAdapter implements QueryResultsRegion { public class QueryResultsRegionAdapter extends BaseGeneralDataRegionAdapter implements QueryResultsRegion {
protected QueryResultsRegionAdapter(Cache underlyingCache, Settings settings) { protected QueryResultsRegionAdapter(Cache underlyingCache, Settings settings) {
super( underlyingCache, settings ); super( underlyingCache, settings );
} }
} }

View File

@ -21,26 +21,27 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache.impl.bridge; package org.hibernate.cache.internal.bridge;
import java.util.Properties; import java.util.Properties;
import org.hibernate.internal.CoreMessageLogger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheProvider; import org.hibernate.cache.internal.NoCacheProvider;
import org.hibernate.cache.CollectionRegion; import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.EntityRegion; import org.hibernate.cache.spi.CacheProvider;
import org.hibernate.cache.NoCacheProvider; import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.QueryResultsRegion; import org.hibernate.cache.spi.EntityRegion;
import org.hibernate.cache.RegionFactory; import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.cache.TimestampsRegion; import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.spi.TimestampsRegion;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.ReflectHelper; import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger;
/** /**
* Acts as a bridge between the {@link RegionFactory} contract and the older * Acts as a bridge between the {@link RegionFactory} contract and the older

View File

@ -1,39 +1,39 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.internal.bridge;
package org.hibernate.cache.impl.bridge;
import org.hibernate.cache.Cache; import org.hibernate.cache.spi.Cache;
import org.hibernate.cache.TimestampsRegion; import org.hibernate.cache.spi.TimestampsRegion;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
/** /**
* Adapter specifically briding {@link TimestampsRegion} to {@link Cache}. * Adapter specifically bridging {@link TimestampsRegion} to {@link org.hibernate.cache.spi.Cache}.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class TimestampsRegionAdapter extends BaseGeneralDataRegionAdapter implements TimestampsRegion { public class TimestampsRegionAdapter extends BaseGeneralDataRegionAdapter implements TimestampsRegion {
protected TimestampsRegionAdapter(Cache underlyingCache, Settings settings) { protected TimestampsRegionAdapter(Cache underlyingCache, Settings settings) {
super( underlyingCache, settings ); super( underlyingCache, settings );
} }
} }

View File

@ -29,7 +29,8 @@
<body> <body>
<p> <p>
This package defines APIs/SPIs and implementations for the Hibernate second-level cache. This package defines Hibernate second level cache service. {@link org.hibernate.cache.spi} defines the
SPI used to integrate with Hibernate internals.
</p> </p>
<p> <p>
The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,15 +20,15 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Properties; import java.util.Properties;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.naming.NamingException; import javax.naming.NamingException;
import org.hibernate.cache.CacheException;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.StringHelper;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,13 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Map; import java.util.Map;
import org.hibernate.cache.CacheException;
/** /**
* Implementors define a caching algorithm. All implementors * Implementors define a caching algorithm. All implementors
* <b>must</b> be threadsafe. * <b>must</b> be threadsafe.
@ -36,7 +38,7 @@ public interface Cache {
* Get an item from the cache * Get an item from the cache
* @param key * @param key
* @return the cached object or <tt>null</tt> * @return the cached object or <tt>null</tt>
* @throws CacheException * @throws org.hibernate.cache.CacheException
*/ */
public Object read(Object key) throws CacheException; public Object read(Object key) throws CacheException;
/** /**

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,13 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.cache.access.SoftLock;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
/** /**
* Implementors manage transactional access to cached data. Transactions * Implementors manage transactional access to cached data. Transactions
@ -71,7 +73,7 @@ public interface CacheConcurrencyStrategy {
* @param key * @param key
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @return the cached object or <tt>null</tt> * @return the cached object or <tt>null</tt>
* @throws CacheException * @throws org.hibernate.cache.CacheException
*/ */
public Object get(Object key, long txTimestamp) throws CacheException; public Object get(Object key, long txTimestamp) throws CacheException;

View File

@ -1,58 +1,58 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
import java.util.Comparator; import java.util.Comparator;
/** /**
* Describes attributes regarding the type of data to be cached. * Describes attributes regarding the type of data to be cached.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface CacheDataDescription { public interface CacheDataDescription {
/** /**
* Is the data marked as being mutable? * Is the data marked as being mutable?
* *
* @return True if the data is mutable; false otherwise. * @return True if the data is mutable; false otherwise.
*/ */
public boolean isMutable(); public boolean isMutable();
/** /**
* Is the data to be cached considered versioned? * Is the data to be cached considered versioned?
* <p/> * <p/>
* If true, it is illegal for {@link #getVersionComparator} to return * If true, it is illegal for {@link #getVersionComparator} to return
* null. * null.
* *
* @return True if the data is versioned; false otherwise. * @return True if the data is versioned; false otherwise.
*/ */
public boolean isVersioned(); public boolean isVersioned();
/** /**
* Get the comparator used to compare two different version values. * Get the comparator used to compare two different version values.
* <p/> * <p/>
* May return null <b>if</b> {@link #isVersioned()} returns false. * May return null <b>if</b> {@link #isVersioned()} returns false.
* @return * @return
*/ */
public Comparator getVersionComparator(); public Comparator getVersionComparator();
} }

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,13 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Properties; import java.util.Properties;
import org.hibernate.cache.CacheException;
/** /**
* Support for pluggable caches. * Support for pluggable caches.
* *
@ -38,7 +40,7 @@ public interface CacheProvider {
* *
* @param regionName the name of the cache region * @param regionName the name of the cache region
* @param properties configuration settings * @param properties configuration settings
* @throws CacheException * @throws org.hibernate.cache.CacheException
*/ */
public Cache buildCache(String regionName, Properties properties) throws CacheException; public Cache buildCache(String regionName, Properties properties) throws CacheException;

View File

@ -1,51 +1,52 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
/**
* Defines the contract for a cache region which will specifically be used to /**
* store collection data. * Defines the contract for a cache region which will specifically be used to
* <p/> * store collection data.
* Impl note: Hibernate always deals with changes to collections which * <p/>
* (potentially) has its data in the L2 cache by removing that collection * Impl note: Hibernate always deals with changes to collections which
* data; in other words it never tries to update the cached state, thereby * (potentially) has its data in the L2 cache by removing that collection
* allowing it to avoid a bunch of concurrency problems. * data; in other words it never tries to update the cached state, thereby
* * allowing it to avoid a bunch of concurrency problems.
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public interface CollectionRegion extends TransactionalDataRegion { */
public interface CollectionRegion extends TransactionalDataRegion {
/**
* Build an access strategy for the requested access type. /**
* * Build an access strategy for the requested access type.
* @param accessType The type of access strategy to build; never null. *
* @return The appropriate strategy contract for accessing this region * @param accessType The type of access strategy to build; never null.
* for the requested type of access. * @return The appropriate strategy contract for accessing this region
* @throws CacheException Usually indicates mis-configuration. * for the requested type of access.
*/ * @throws org.hibernate.cache.CacheException Usually indicates mis-configuration.
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException; */
} public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException;
}

View File

@ -1,46 +1,47 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
/**
* Defines the contract for a cache region which will specifically be used to /**
* store entity data. * Defines the contract for a cache region which will specifically be used to
* * store entity data.
* @author Steve Ebersole *
*/ * @author Steve Ebersole
public interface EntityRegion extends TransactionalDataRegion { */
public interface EntityRegion extends TransactionalDataRegion {
/**
* Build an access strategy for the requested access type. /**
* * Build an access strategy for the requested access type.
* @param accessType The type of access strategy to build; never null. *
* @return The appropriate strategy contract for accessing this region * @param accessType The type of access strategy to build; never null.
* for the requested type of access. * @return The appropriate strategy contract for accessing this region
* @throws CacheException Usually indicates mis-configuration. * for the requested type of access.
*/ * @throws org.hibernate.cache.CacheException Usually indicates mis-configuration.
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException; */
} public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException;
}

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,15 +20,16 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.engine.TypedValue; import org.hibernate.engine.TypedValue;
import org.hibernate.internal.FilterImpl; import org.hibernate.internal.FilterImpl;

View File

@ -1,69 +1,69 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
import org.hibernate.cache.CacheException;
/** /**
* Contract for general-purpose cache regions. * Contract for general-purpose cache regions.
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface GeneralDataRegion extends Region { public interface GeneralDataRegion extends Region {
/** /**
* Get an item from the cache. * Get an item from the cache.
* *
* @param key The key of the item to be retrieved. * @param key The key of the item to be retrieved.
* @return the cached object or <tt>null</tt> * @return the cached object or <tt>null</tt>
* @throws CacheException Indicates a problem accessing the item or region. * @throws org.hibernate.cache.CacheException Indicates a problem accessing the item or region.
*/ */
public Object get(Object key) throws CacheException; public Object get(Object key) throws CacheException;
/** /**
* Put an item into the cache. * Put an item into the cache.
* *
* @param key The key under which to cache the item. * @param key The key under which to cache the item.
* @param value The item to cache. * @param value The item to cache.
* @throws CacheException Indicates a problem accessing the region. * @throws CacheException Indicates a problem accessing the region.
*/ */
public void put(Object key, Object value) throws CacheException; public void put(Object key, Object value) throws CacheException;
/** /**
* Evict an item from the cache immediately (without regard for transaction * Evict an item from the cache immediately (without regard for transaction
* isolation). * isolation).
* *
* @param key The key of the item to remove * @param key The key of the item to remove
* @throws CacheException Indicates a problem accessing the item or region. * @throws CacheException Indicates a problem accessing the item or region.
*/ */
public void evict(Object key) throws CacheException; public void evict(Object key) throws CacheException;
/** /**
* Evict all contents of this particular cache region (without regard for transaction * Evict all contents of this particular cache region (without regard for transaction
* isolation). * isolation).
* *
* @throws CacheException Indicates problem accessing the region. * @throws CacheException Indicates problem accessing the region.
*/ */
public void evictAll() throws CacheException; public void evictAll() throws CacheException;
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,16 +20,17 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.access.SoftLock;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Caches data that is sometimes updated without ever locking the cache. * Caches data that is sometimes updated without ever locking the cache.
* If concurrent access to an item is possible, this concurrency strategy * If concurrent access to an item is possible, this concurrency strategy
@ -40,6 +41,7 @@ import org.jboss.logging.Logger;
* @author Gavin King * @author Gavin King
* @see ReadWriteCache for a much stricter algorithm * @see ReadWriteCache for a much stricter algorithm
*/ */
@Deprecated
public class NonstrictReadWriteCache implements CacheConcurrencyStrategy { public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,21 +20,19 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
/** /**
* A contract for transactional cache implementations which support * A contract for transactional cache implementations which support
* optimistic locking of items within the cache. * optimistic locking of items within the cache.
* <p/> * <p/>
* The optimisitic locking capabilities are only utilized for * The optimistic locking capabilities are only utilized for
* the entity cache regions. * the entity cache regions.
* <p/> * <p/>
* Unlike the methods on the {@link Cache} interface, all the methods * Unlike the methods on the {@link Cache} interface, all the methods
* here will only ever be called from access scenarios where versioned * here will only ever be called from access scenarios where versioned
* data is actually a possiblity (i.e., entity data). Be sure to consult * data is actually a possibility (i.e., entity data). Be sure to consult
* with {@link OptimisticCacheSource#isVersioned()} to determine whether * with {@link OptimisticCacheSource#isVersioned()} to determine whether
* versioning is actually in effect. * versioning is actually in effect.
* *

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,9 +20,9 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Comparator; import java.util.Comparator;
/** /**

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,12 +20,14 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.CacheException;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.type.Type; import org.hibernate.type.Type;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,10 +20,11 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Properties; import java.util.Properties;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
@ -34,12 +35,9 @@ import org.hibernate.cfg.Settings;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface QueryCacheFactory { public interface QueryCacheFactory {
public QueryCache getQueryCache( public QueryCache getQueryCache(
String regionName, String regionName,
UpdateTimestampsCache updateTimestampsCache, UpdateTimestampsCache updateTimestampsCache,
Settings settings, Settings settings,
Properties props) Properties props) throws HibernateException;
throws HibernateException;
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -21,13 +21,14 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.engine.QueryParameters; import org.hibernate.engine.QueryParameters;
import org.hibernate.engine.RowSelection; import org.hibernate.engine.RowSelection;

View File

@ -1,35 +1,33 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
/**
* Defines the contract for a cache region which will specifically be used to
/** * store query results.
* Defines the contract for a cache region which will specifically be used to *
* store query results. * @author Steve Ebersole
* */
* @author Steve Ebersole public interface QueryResultsRegion extends GeneralDataRegion {
*/ }
public interface QueryResultsRegion extends GeneralDataRegion {
}

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,19 +20,22 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.access.SoftLock;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Caches data that is never updated. * Caches data that is never updated.
* @see CacheConcurrencyStrategy * @see org.hibernate.cache.spi.CacheConcurrencyStrategy
*/ */
@Deprecated
public class ReadOnlyCache implements CacheConcurrencyStrategy { public class ReadOnlyCache implements CacheConcurrencyStrategy {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadOnlyCache.class.getName()); private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadOnlyCache.class.getName());

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,17 +20,18 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.io.Serializable; import java.io.Serializable;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.access.SoftLock;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Caches data that is sometimes updated while maintaining the semantics of * Caches data that is sometimes updated while maintaining the semantics of
* "read committed" isolation level. If the database is set to "repeatable * "read committed" isolation level. If the database is set to "repeatable
@ -45,8 +46,9 @@ import org.jboss.logging.Logger;
* as the lock is released. * as the lock is released.
* *
* @see NonstrictReadWriteCache for a faster algorithm * @see NonstrictReadWriteCache for a faster algorithm
* @see CacheConcurrencyStrategy * @see org.hibernate.cache.spi.CacheConcurrencyStrategy
*/ */
@Deprecated
public class ReadWriteCache implements CacheConcurrencyStrategy { public class ReadWriteCache implements CacheConcurrencyStrategy {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadWriteCache.class.getName()); private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadWriteCache.class.getName());

View File

@ -1,99 +1,101 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
import java.util.Map; import java.util.Map;
/** import org.hibernate.cache.CacheException;
* Defines a contract for accessing a particular named region within the
* underlying cache implementation. /**
* * Defines a contract for accessing a particular named region within the
* @author Steve Ebersole * underlying cache implementation.
*/ *
public interface Region { * @author Steve Ebersole
/** */
* Retrieve the name of this region. public interface Region {
* /**
* @return The region name * Retrieve the name of this region.
*/ *
public String getName(); * @return The region name
*/
/** public String getName();
* The "end state" contract of the region's lifecycle. Called
* during {@link org.hibernate.SessionFactory#close()} to give /**
* the region a chance to cleanup. * The "end state" contract of the region's lifecycle. Called
* * during {@link org.hibernate.SessionFactory#close()} to give
* @throws CacheException Indicates problem shutting down * the region a chance to cleanup.
*/ *
public void destroy() throws CacheException; * @throws org.hibernate.cache.CacheException Indicates problem shutting down
*/
/** public void destroy() throws CacheException;
* Determine whether this region contains data for the given key.
* <p/> /**
* The semantic here is whether the cache contains data visible for the * Determine whether this region contains data for the given key.
* current call context. This should be viewed as a "best effort", meaning * <p/>
* blocking should be avoid if possible. * The semantic here is whether the cache contains data visible for the
* * current call context. This should be viewed as a "best effort", meaning
* @param key The cache key * blocking should be avoid if possible.
* *
* @return True if the underlying cache contains corresponding data; false * @param key The cache key
* otherwise. *
*/ * @return True if the underlying cache contains corresponding data; false
public boolean contains(Object key); * otherwise.
*/
/** public boolean contains(Object key);
* The number of bytes is this cache region currently consuming in memory.
* /**
* @return The number of bytes consumed by this region; -1 if unknown or * The number of bytes is this cache region currently consuming in memory.
* unsupported. *
*/ * @return The number of bytes consumed by this region; -1 if unknown or
public long getSizeInMemory(); * unsupported.
*/
/** public long getSizeInMemory();
* The count of entries currently contained in the regions in-memory store.
* /**
* @return The count of entries in memory; -1 if unknown or unsupported. * The count of entries currently contained in the regions in-memory store.
*/ *
public long getElementCountInMemory(); * @return The count of entries in memory; -1 if unknown or unsupported.
*/
/** public long getElementCountInMemory();
* The count of entries currently contained in the regions disk store.
* /**
* @return The count of entries on disk; -1 if unknown or unsupported. * The count of entries currently contained in the regions disk store.
*/ *
public long getElementCountOnDisk(); * @return The count of entries on disk; -1 if unknown or unsupported.
*/
/** public long getElementCountOnDisk();
* Get the contents of this region as a map.
* <p/> /**
* Implementors which do not support this notion * Get the contents of this region as a map.
* should simply return an empty map. * <p/>
* * Implementors which do not support this notion
* @return The content map. * should simply return an empty map.
*/ *
public Map toMap(); * @return The content map.
*/
public long nextTimestamp(); public Map toMap();
public int getTimeout();
} public long nextTimestamp();
public int getTimeout();
}

View File

@ -0,0 +1,139 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache.spi;
import java.util.Properties;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Settings;
/**
* Contract for building second level cache regions.
* <p/>
* Implementors should define a constructor in one of two forms:<ul>
* <li>MyRegionFactoryImpl({@link java.util.Properties})</li>
* <li>MyRegionFactoryImpl()</li>
* </ul>
* Use the first when we need to read config properties prior to
* {@link #start} being called. For an example, have a look at
* {@link org.hibernate.cache.internal.bridge.RegionFactoryCacheProviderBridge}
* where we need the properties in order to determine which legacy
* {@link CacheProvider} to use so that we can answer the
* {@link #isMinimalPutsEnabledByDefault()} question for the
* {@link org.hibernate.cfg.SettingsFactory}.
*
* @author Steve Ebersole
*/
public interface RegionFactory {
/**
* Lifecycle callback to perform any necessary initialization of the
* underlying cache implementation(s). Called exactly once during the
* construction of a {@link org.hibernate.internal.SessionFactoryImpl}.
*
* @param settings The settings in effect.
* @param properties The defined cfg properties
* @throws org.hibernate.cache.CacheException Indicates problems starting the L2 cache impl;
* considered as a sign to stop {@link org.hibernate.SessionFactory}
* building.
*/
public void start(Settings settings, Properties properties) throws CacheException;
/**
* Lifecycle callback to perform any necessary cleanup of the underlying
* cache implementation(s). Called exactly once during
* {@link org.hibernate.SessionFactory#close}.
*/
public void stop();
/**
* By default should we perform "minimal puts" when using this second
* level cache implementation?
*
* @return True if "minimal puts" should be performed by default; false
* otherwise.
*/
public boolean isMinimalPutsEnabledByDefault();
/**
* Get the default access type for {@link EntityRegion entity} and
* {@link CollectionRegion collection} regions.
*
* @return This factory's default access type.
*/
public AccessType getDefaultAccessType();
/**
* Generate a timestamp.
* <p/>
* This is generally used for cache content locking/unlocking purposes
* depending upon the access-strategy being used.
*
* @return The generated timestamp.
*/
public long nextTimestamp();
/**
* Build a cache region specialized for storing entity data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @param metadata Information regarding the type of data to be cached
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
/**
* Build a cache region specialized for storing collection data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @param metadata Information regarding the type of data to be cached
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
/**
* Build a cache region specialized for storing query results
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException;
/**
* Build a cache region specialized for storing update-timestamps data.
*
* @param regionName The name of the region.
* @param properties Configuration properties.
* @return The built region
* @throws CacheException Indicates problems building the region.
*/
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException;
}

View File

@ -1,35 +1,33 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
/**
* Defines the contract for a cache region which will specifically be used to
/** * store entity "update timestamps".
* Defines the contract for a cache region which will specifically be used to *
* store entity "update timestamps". * @author Steve Ebersole
* */
* @author Steve Ebersole public interface TimestampsRegion extends GeneralDataRegion {
*/ }
public interface TimestampsRegion extends GeneralDataRegion {
}

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,14 +20,11 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
/** /**
* Marker interface for identifying cache impls which are aware of * Marker interface for identifying {@link Cache} implementations which are aware of JTA transactions
* JTA transactions
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,16 +20,17 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.util.Comparator; import java.util.Comparator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.access.SoftLock;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Support for fully transactional cache implementations like * Support for fully transactional cache implementations like
* JBoss TreeCache. Note that this might be a less scalable * JBoss TreeCache. Note that this might be a less scalable
@ -38,6 +39,7 @@ import org.jboss.logging.Logger;
* *
* @author Gavin King * @author Gavin King
*/ */
@Deprecated
public class TransactionalCache implements CacheConcurrencyStrategy { public class TransactionalCache implements CacheConcurrencyStrategy {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TransactionalCache.class.getName()); private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TransactionalCache.class.getName());

View File

@ -1,56 +1,54 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi;
package org.hibernate.cache;
/**
* Defines contract for regions which hold transactionally-managed data.
/** * <p/>
* Defines contract for regions which hold transactionally-managed data. * The data is not transactionally managed within the region; merely it is
* <p/> * transactionally-managed in relation to its association with a particular
* The data is not transactionally managed within the region; merely it is * {@link org.hibernate.Session}.
* transactionally-managed in relation to its association with a particular *
* {@link org.hibernate.Session}. * @author Steve Ebersole
* */
* @author Steve Ebersole public interface TransactionalDataRegion extends Region {
*/ /**
public interface TransactionalDataRegion extends Region { * Is the underlying cache implementation aware of (and "participating in")
/** * ongoing JTA transactions?
* Is the underlying cache implementation aware of (and "participating in") * <p/>
* ongoing JTA transactions? * Regions which report that they are transaction-aware are considered
* <p/> * "synchronous", in that we assume we can immediately (i.e. synchronously)
* Regions which report that they are transaction-aware are considered * write the changes to the cache and that the cache will properly manage
* "synchronous", in that we assume we can immediately (i.e. synchronously) * application of the written changes within the bounds of ongoing JTA
* write the changes to the cache and that the cache will properly manage * transactions. Conversely, regions reporting false are considered
* application of the written changes within the bounds of ongoing JTA * "asynchronous", where it is assumed that changes must be manually
* transactions. Conversely, regions reporting false are considered * delayed by Hibernate until we are certain that the current transaction
* "asynchronous", where it is assumed that changes must be manually * is successful (i.e. maintaining READ_COMMITTED isolation).
* delayed by Hibernate until we are certain that the current transaction *
* is successful (i.e. maintaining READ_COMMITTED isolation). * @return True if transaction aware; false otherwise.
* */
* @return True if transaction aware; false otherwise. public boolean isTransactionAware();
*/
public boolean isTransactionAware(); public CacheDataDescription getCacheDataDescription();
}
public CacheDataDescription getCacheDataDescription();
}

View File

@ -21,17 +21,20 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache; package org.hibernate.cache.spi;
import java.io.Serializable; import java.io.Serializable;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.hibernate.HibernateException;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cfg.Settings;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.HibernateException;
import org.hibernate.cache.CacheException;
import org.hibernate.cfg.Settings;
import org.hibernate.internal.CoreMessageLogger;
/** /**
* Tracks the timestamps of the most recent updates to particular tables. It is * Tracks the timestamps of the most recent updates to particular tables. It is
* important that the cache timeout of the underlying cache implementation be set * important that the cache timeout of the underlying cache implementation be set

View File

@ -0,0 +1,62 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache.spi.access;
/**
* The types of access strategies available.
*
* @author Steve Ebersole
*/
public enum AccessType {
READ_ONLY( "read-only" ),
READ_WRITE( "read-write" ),
NONSTRICT_READ_WRITE( "nonstrict-read-write" ),
TRANSACTIONAL( "transactional" );
private final String externalName;
private AccessType(String externalName) {
this.externalName = externalName;
}
public String getExternalName() {
return externalName;
}
public String toString() {
return "AccessType[" + externalName + "]";
}
public static AccessType fromExternalName(String externalName) {
if ( externalName == null ) {
return null;
}
for ( AccessType accessType : AccessType.values() ) {
if ( accessType.getExternalName().equals( externalName ) ) {
return accessType;
}
}
throw new UnknownAccessTypeException( externalName );
}
}

View File

@ -1,172 +1,172 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi.access;
package org.hibernate.cache.access;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.CollectionRegion; import org.hibernate.cache.spi.CollectionRegion;
/** /**
* Contract for managing transactional and concurrent access to cached collection * Contract for managing transactional and concurrent access to cached collection
* data. For cached collection data, all modification actions actually just * data. For cached collection data, all modification actions actually just
* invalidate the entry(s). The call sequence here is: * invalidate the entry(s). The call sequence here is:
* {@link #lockItem} -> {@link #remove} -> {@link #unlockItem} * {@link #lockItem} -> {@link #remove} -> {@link #unlockItem}
* <p/> * <p/>
* There is another usage pattern that is used to invalidate entries * There is another usage pattern that is used to invalidate entries
* after performing "bulk" HQL/SQL operations: * after performing "bulk" HQL/SQL operations:
* {@link #lockRegion} -> {@link #removeAll} -> {@link #unlockRegion} * {@link #lockRegion} -> {@link #removeAll} -> {@link #unlockRegion}
* *
* @author Gavin King * @author Gavin King
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface CollectionRegionAccessStrategy { public interface CollectionRegionAccessStrategy {
/** /**
* Get the wrapped collection cache region * Get the wrapped collection cache region
* *
* @return The underlying region * @return The underlying region
*/ */
public CollectionRegion getRegion(); public CollectionRegion getRegion();
/** /**
* Attempt to retrieve an object from the cache. Mainly used in attempting * Attempt to retrieve an object from the cache. Mainly used in attempting
* to resolve entities/collections from the second level cache. * to resolve entities/collections from the second level cache.
* *
* @param key The key of the item to be retrieved. * @param key The key of the item to be retrieved.
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @return the cached object or <tt>null</tt> * @return the cached object or <tt>null</tt>
* @throws org.hibernate.cache.CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws org.hibernate.cache.CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public Object get(Object key, long txTimestamp) throws CacheException; public Object get(Object key, long txTimestamp) throws CacheException;
/** /**
* Attempt to cache an object, after loading from the database. * Attempt to cache an object, after loading from the database.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @param version the item version number * @param version the item version number
* @return <tt>true</tt> if the object was successfully cached * @return <tt>true</tt> if the object was successfully cached
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version) throws CacheException; Object version) throws CacheException;
/** /**
* Attempt to cache an object, after loading from the database, explicitly * Attempt to cache an object, after loading from the database, explicitly
* specifying the minimalPut behavior. * specifying the minimalPut behavior.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @param version the item version number * @param version the item version number
* @param minimalPutOverride Explicit minimalPut flag * @param minimalPutOverride Explicit minimalPut flag
* @return <tt>true</tt> if the object was successfully cached * @return <tt>true</tt> if the object was successfully cached
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version, Object version,
boolean minimalPutOverride) throws CacheException; boolean minimalPutOverride) throws CacheException;
/** /**
* We are going to attempt to update/delete the keyed object. This * We are going to attempt to update/delete the keyed object. This
* method is used by "asynchronous" concurrency strategies. * method is used by "asynchronous" concurrency strategies.
* <p/> * <p/>
* The returned object must be passed back to release(), to release the * The returned object must be passed back to release(), to release the
* lock. Concurrency strategies which do not support client-visible * lock. Concurrency strategies which do not support client-visible
* locks may silently return null. * locks may silently return null.
* *
* @param key The key of the item to lock * @param key The key of the item to lock
* @param version The item's current version value * @param version The item's current version value
* @return A representation of our lock on the item; or null. * @return A representation of our lock on the item; or null.
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public SoftLock lockItem(Object key, Object version) throws CacheException; public SoftLock lockItem(Object key, Object version) throws CacheException;
/** /**
* Lock the entire region * Lock the entire region
* *
* @return A representation of our lock on the item; or null. * @return A representation of our lock on the item; or null.
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public SoftLock lockRegion() throws CacheException; public SoftLock lockRegion() throws CacheException;
/** /**
* Called when we have finished the attempted update/delete (which may or * Called when we have finished the attempted update/delete (which may or
* may not have been successful), after transaction completion. This method * may not have been successful), after transaction completion. This method
* is used by "asynchronous" concurrency strategies. * is used by "asynchronous" concurrency strategies.
* *
* @param key The item key * @param key The item key
* @param lock The lock previously obtained from {@link #lockItem} * @param lock The lock previously obtained from {@link #lockItem}
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void unlockItem(Object key, SoftLock lock) throws CacheException; public void unlockItem(Object key, SoftLock lock) throws CacheException;
/** /**
* Called after we have finished the attempted invalidation of the entire * Called after we have finished the attempted invalidation of the entire
* region * region
* *
* @param lock The lock previously obtained from {@link #lockRegion} * @param lock The lock previously obtained from {@link #lockRegion}
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void unlockRegion(SoftLock lock) throws CacheException; public void unlockRegion(SoftLock lock) throws CacheException;
/** /**
* Called after an item has become stale (before the transaction completes). * Called after an item has become stale (before the transaction completes).
* This method is used by "synchronous" concurrency strategies. * This method is used by "synchronous" concurrency strategies.
* *
* @param key The key of the item to remove * @param key The key of the item to remove
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void remove(Object key) throws CacheException; public void remove(Object key) throws CacheException;
/** /**
* Called to evict data from the entire region * Called to evict data from the entire region
* *
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void removeAll() throws CacheException; public void removeAll() throws CacheException;
/** /**
* Forcibly evict an item from the cache immediately without regard for transaction * Forcibly evict an item from the cache immediately without regard for transaction
* isolation. * isolation.
* *
* @param key The key of the item to remove * @param key The key of the item to remove
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void evict(Object key) throws CacheException; public void evict(Object key) throws CacheException;
/** /**
* Forcibly evict all items from the cache immediately without regard for transaction * Forcibly evict all items from the cache immediately without regard for transaction
* isolation. * isolation.
* *
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void evictAll() throws CacheException; public void evictAll() throws CacheException;
} }

View File

@ -1,229 +1,229 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi.access;
package org.hibernate.cache.access;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.EntityRegion; import org.hibernate.cache.spi.EntityRegion;
/** /**
* Contract for managing transactional and concurrent access to cached entity * Contract for managing transactional and concurrent access to cached entity
* data. The expected call sequences related to various operations are:<ul> * data. The expected call sequences related to various operations are:<ul>
* <li><b>INSERTS</b> : {@link #insert} -> {@link #afterInsert}</li> * <li><b>INSERTS</b> : {@link #insert} -> {@link #afterInsert}</li>
* <li><b>UPDATES</b> : {@link #lockItem} -> {@link #update} -> {@link #afterUpdate}</li> * <li><b>UPDATES</b> : {@link #lockItem} -> {@link #update} -> {@link #afterUpdate}</li>
* <li><b>DELETES</b> : {@link #lockItem} -> {@link #remove} -> {@link #unlockItem}</li> * <li><b>DELETES</b> : {@link #lockItem} -> {@link #remove} -> {@link #unlockItem}</li>
* </ul> * </ul>
* <p/> * <p/>
* There is another usage pattern that is used to invalidate entries * There is another usage pattern that is used to invalidate entries
* after performing "bulk" HQL/SQL operations: * after performing "bulk" HQL/SQL operations:
* {@link #lockRegion} -> {@link #removeAll} -> {@link #unlockRegion} * {@link #lockRegion} -> {@link #removeAll} -> {@link #unlockRegion}
* *
* @author Gavin King * @author Gavin King
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface EntityRegionAccessStrategy { public interface EntityRegionAccessStrategy {
/** /**
* Get the wrapped entity cache region * Get the wrapped entity cache region
* *
* @return The underlying region * @return The underlying region
*/ */
public EntityRegion getRegion(); public EntityRegion getRegion();
/** /**
* Attempt to retrieve an object from the cache. Mainly used in attempting * Attempt to retrieve an object from the cache. Mainly used in attempting
* to resolve entities/collections from the second level cache. * to resolve entities/collections from the second level cache.
* *
* @param key The key of the item to be retrieved. * @param key The key of the item to be retrieved.
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @return the cached object or <tt>null</tt> * @return the cached object or <tt>null</tt>
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public Object get(Object key, long txTimestamp) throws CacheException; public Object get(Object key, long txTimestamp) throws CacheException;
/** /**
* Attempt to cache an object, after loading from the database. * Attempt to cache an object, after loading from the database.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @param version the item version number * @param version the item version number
* @return <tt>true</tt> if the object was successfully cached * @return <tt>true</tt> if the object was successfully cached
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version) throws CacheException; Object version) throws CacheException;
/** /**
* Attempt to cache an object, after loading from the database, explicitly * Attempt to cache an object, after loading from the database, explicitly
* specifying the minimalPut behavior. * specifying the minimalPut behavior.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param txTimestamp a timestamp prior to the transaction start time * @param txTimestamp a timestamp prior to the transaction start time
* @param version the item version number * @param version the item version number
* @param minimalPutOverride Explicit minimalPut flag * @param minimalPutOverride Explicit minimalPut flag
* @return <tt>true</tt> if the object was successfully cached * @return <tt>true</tt> if the object was successfully cached
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean putFromLoad( public boolean putFromLoad(
Object key, Object key,
Object value, Object value,
long txTimestamp, long txTimestamp,
Object version, Object version,
boolean minimalPutOverride) throws CacheException; boolean minimalPutOverride) throws CacheException;
/** /**
* We are going to attempt to update/delete the keyed object. This * We are going to attempt to update/delete the keyed object. This
* method is used by "asynchronous" concurrency strategies. * method is used by "asynchronous" concurrency strategies.
* <p/> * <p/>
* The returned object must be passed back to release(), to release the * The returned object must be passed back to release(), to release the
* lock. Concurrency strategies which do not support client-visible * lock. Concurrency strategies which do not support client-visible
* locks may silently return null. * locks may silently return null.
* *
* @param key The key of the item to lock * @param key The key of the item to lock
* @param version The item's current version value * @param version The item's current version value
* @return A representation of our lock on the item; or null. * @return A representation of our lock on the item; or null.
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public SoftLock lockItem(Object key, Object version) throws CacheException; public SoftLock lockItem(Object key, Object version) throws CacheException;
/** /**
* Lock the entire region * Lock the entire region
* *
* @return A representation of our lock on the item; or null. * @return A representation of our lock on the item; or null.
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public SoftLock lockRegion() throws CacheException; public SoftLock lockRegion() throws CacheException;
/** /**
* Called when we have finished the attempted update/delete (which may or * Called when we have finished the attempted update/delete (which may or
* may not have been successful), after transaction completion. This method * may not have been successful), after transaction completion. This method
* is used by "asynchronous" concurrency strategies. * is used by "asynchronous" concurrency strategies.
* *
* @param key The item key * @param key The item key
* @param lock The lock previously obtained from {@link #lockItem} * @param lock The lock previously obtained from {@link #lockItem}
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void unlockItem(Object key, SoftLock lock) throws CacheException; public void unlockItem(Object key, SoftLock lock) throws CacheException;
/** /**
* Called after we have finished the attempted invalidation of the entire * Called after we have finished the attempted invalidation of the entire
* region * region
* *
* @param lock The lock previously obtained from {@link #lockRegion} * @param lock The lock previously obtained from {@link #lockRegion}
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void unlockRegion(SoftLock lock) throws CacheException; public void unlockRegion(SoftLock lock) throws CacheException;
/** /**
* Called after an item has been inserted (before the transaction completes), * Called after an item has been inserted (before the transaction completes),
* instead of calling evict(). * instead of calling evict().
* This method is used by "synchronous" concurrency strategies. * This method is used by "synchronous" concurrency strategies.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param version The item's version value * @param version The item's version value
* @return Were the contents of the cache actual changed by this operation? * @return Were the contents of the cache actual changed by this operation?
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean insert(Object key, Object value, Object version) throws CacheException; public boolean insert(Object key, Object value, Object version) throws CacheException;
/** /**
* Called after an item has been inserted (after the transaction completes), * Called after an item has been inserted (after the transaction completes),
* instead of calling release(). * instead of calling release().
* This method is used by "asynchronous" concurrency strategies. * This method is used by "asynchronous" concurrency strategies.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param version The item's version value * @param version The item's version value
* @return Were the contents of the cache actual changed by this operation? * @return Were the contents of the cache actual changed by this operation?
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean afterInsert(Object key, Object value, Object version) throws CacheException; public boolean afterInsert(Object key, Object value, Object version) throws CacheException;
/** /**
* Called after an item has been updated (before the transaction completes), * Called after an item has been updated (before the transaction completes),
* instead of calling evict(). This method is used by "synchronous" concurrency * instead of calling evict(). This method is used by "synchronous" concurrency
* strategies. * strategies.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param currentVersion The item's current version value * @param currentVersion The item's current version value
* @param previousVersion The item's previous version value * @param previousVersion The item's previous version value
* @return Were the contents of the cache actual changed by this operation? * @return Were the contents of the cache actual changed by this operation?
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException; public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException;
/** /**
* Called after an item has been updated (after the transaction completes), * Called after an item has been updated (after the transaction completes),
* instead of calling release(). This method is used by "asynchronous" * instead of calling release(). This method is used by "asynchronous"
* concurrency strategies. * concurrency strategies.
* *
* @param key The item key * @param key The item key
* @param value The item * @param value The item
* @param currentVersion The item's current version value * @param currentVersion The item's current version value
* @param previousVersion The item's previous version value * @param previousVersion The item's previous version value
* @param lock The lock previously obtained from {@link #lockItem} * @param lock The lock previously obtained from {@link #lockItem}
* @return Were the contents of the cache actual changed by this operation? * @return Were the contents of the cache actual changed by this operation?
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException; public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException;
/** /**
* Called after an item has become stale (before the transaction completes). * Called after an item has become stale (before the transaction completes).
* This method is used by "synchronous" concurrency strategies. * This method is used by "synchronous" concurrency strategies.
* *
* @param key The key of the item to remove * @param key The key of the item to remove
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void remove(Object key) throws CacheException; public void remove(Object key) throws CacheException;
/** /**
* Called to evict data from the entire region * Called to evict data from the entire region
* *
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void removeAll() throws CacheException; public void removeAll() throws CacheException;
/** /**
* Forcibly evict an item from the cache immediately without regard for transaction * Forcibly evict an item from the cache immediately without regard for transaction
* isolation. * isolation.
* *
* @param key The key of the item to remove * @param key The key of the item to remove
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void evict(Object key) throws CacheException; public void evict(Object key) throws CacheException;
/** /**
* Forcibly evict all items from the cache immediately without regard for transaction * Forcibly evict all items from the cache immediately without regard for transaction
* isolation. * isolation.
* *
* @throws CacheException Propogated from underlying {@link org.hibernate.cache.Region} * @throws CacheException Propogated from underlying {@link org.hibernate.cache.spi.Region}
*/ */
public void evictAll() throws CacheException; public void evictAll() throws CacheException;
} }

View File

@ -1,35 +1,33 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation. * Lesser General Public License, as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to: * along with this distribution; if not, write to:
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
* */
*/ package org.hibernate.cache.spi.access;
package org.hibernate.cache.access;
/**
* Moved up from inner definition on the now deprecated
/** * {@link org.hibernate.cache.spi.CacheConcurrencyStrategy}.
* Moved up from inner definition on the now deprecated *
* {@link org.hibernate.cache.CacheConcurrencyStrategy}. * @author Steve Ebersole
* */
* @author Steve Ebersole public interface SoftLock {
*/ }
public interface SoftLock {
}

View File

@ -0,0 +1,35 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.cache.spi.access;
import org.hibernate.HibernateException;
/**
* @author Steve Ebersole
*/
public class UnknownAccessTypeException extends HibernateException {
public UnknownAccessTypeException(String accessTypeName) {
super( "Unknown access type [" + accessTypeName + "]" );
}
}

View File

@ -1,66 +1,66 @@
<!-- <!--
~ Hibernate, Relational Persistence for Idiomatic Java ~ Hibernate, Relational Persistence for Idiomatic Java
~ ~
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
~ indicated by the @author tags or express copyright attribution ~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are ~ statements applied by the authors. All third-party contributions are
~ distributed under license by Red Hat Middleware LLC. ~ distributed under license by Red Hat Middleware LLC.
~ ~
~ This copyrighted material is made available to anyone wishing to use, modify, ~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU ~ copy, or redistribute it subject to the terms and conditions of the GNU
~ Lesser General Public License, as published by the Free Software Foundation. ~ Lesser General Public License, as published by the Free Software Foundation.
~ ~
~ This program is distributed in the hope that it will be useful, ~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
~ for more details. ~ for more details.
~ ~
~ You should have received a copy of the GNU Lesser General Public License ~ You should have received a copy of the GNU Lesser General Public License
~ along with this distribution; if not, write to: ~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc. ~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor ~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA ~ Boston, MA 02110-1301 USA
~ ~
--> -->
<html> <html>
<head></head> <head></head>
<body> <body>
<p> <p>
Defines contracts for transactional and concurrent access to cached Defines contracts for transactional and concurrent access to cached
{@link org.hibernate.cache.access.EntityRegionAccessStrategy entity} and {@link org.hibernate.cache.access.EntityRegionAccessStrategy entity} and
{@link org.hibernate.cache.access.CollectionRegionAccessStrategy collection} data. Transactions pass in a {@link org.hibernate.cache.access.CollectionRegionAccessStrategy collection} data. Transactions pass in a
timestamp indicating transaction start time which is then used to protect against concurrent access (exactly how timestamp indicating transaction start time which is then used to protect against concurrent access (exactly how
that occurs is based on the actual access-strategy impl used). Two different implementation patterns are provided that occurs is based on the actual access-strategy impl used). Two different implementation patterns are provided
for. for.
<ul> <ul>
<li> <li>
A transaction-aware cache implementation might be wrapped by a <i>synchronous</i> access strategy, A transaction-aware cache implementation might be wrapped by a <i>synchronous</i> access strategy,
where updates to the cache are written to the cache inside the transaction. where updates to the cache are written to the cache inside the transaction.
</li> </li>
<li> <li>
A non-transaction-aware cache would be wrapped by an <i>asynchronous</i> access strategy, where items A non-transaction-aware cache would be wrapped by an <i>asynchronous</i> access strategy, where items
are merely "soft locked" during the transaction and then updated during the "after transaction completion" are merely "soft locked" during the transaction and then updated during the "after transaction completion"
phase; the soft lock is not an actual lock on the database row - only upon the cached representation of the phase; the soft lock is not an actual lock on the database row - only upon the cached representation of the
item. item.
</li> </li>
</ul> </ul>
The <i>asynchronous</i> access strategies are: {@link org.hibernate.cache.access.AccessType.READ_ONLY read-only}, The <i>asynchronous</i> access strategies are: {@link org.hibernate.cache.access.AccessType.READ_ONLY read-only},
{@link org.hibernate.cache.access.AccessType.READ_WRITE read-write} and {@link org.hibernate.cache.access.AccessType.READ_WRITE read-write} and
{@link org.hibernate.cache.access.AccessType.NONSTRICT_READ_WRITE nonstrict-read-write}. The only {@link org.hibernate.cache.access.AccessType.NONSTRICT_READ_WRITE nonstrict-read-write}. The only
<i>synchronous</i> access strategy is {@link org.hibernate.cache.access.AccessType.TRANSACTIONAL transactional}. <i>synchronous</i> access strategy is {@link org.hibernate.cache.access.AccessType.TRANSACTIONAL transactional}.
</p> </p>
<p> <p>
Note that, for an <i>asynchronous</i> cache, cache invalidation must be a two step process (lock->unlock or Note that, for an <i>asynchronous</i> cache, cache invalidation must be a two step process (lock->unlock or
lock->afterUpdate), since this is the only way to guarantee consistency with the database for a nontransactional lock->afterUpdate), since this is the only way to guarantee consistency with the database for a nontransactional
cache implementation. For a <i>synchronous</i> cache, cache invalidation is a single step process (evict or update). cache implementation. For a <i>synchronous</i> cache, cache invalidation is a single step process (evict or update).
Hence, these contracts ({@link org.hibernate.cache.access.EntityRegionAcessStrategy} and Hence, these contracts ({@link org.hibernate.cache.access.EntityRegionAcessStrategy} and
{@link org.hibernate.cache.access.CollectionRegionAccessStrategy}) define a three step process to cater for both {@link org.hibernate.cache.access.CollectionRegionAccessStrategy}) define a three step process to cater for both
models (see the individual contracts for details). models (see the individual contracts for details).
</p> </p>
<p> <p>
Note that query result caching does not go through an access strategy; those caches are managed directly against Note that query result caching does not go through an access strategy; those caches are managed directly against
the underlying {@link org.hibernate.cache.QueryResultsRegion}. the underlying {@link org.hibernate.cache.QueryResultsRegion}.
</p> </p>
</body> </body>
</html> </html>

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,10 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionFactoryImplementor;
/** /**
* @author Gavin King * @author Gavin King

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,10 +20,11 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import java.io.Serializable; import java.io.Serializable;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,12 +20,13 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,12 +20,13 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
/** /**

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,13 +20,14 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
/** /**

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution * indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are * statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC. * distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,10 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.cache.entry; package org.hibernate.cache.spi.entry;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionFactoryImplementor;
/** /**
* @author Gavin King * @author Gavin King

View File

@ -82,6 +82,7 @@ import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.FetchMode; import org.hibernate.FetchMode;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.annotations.BatchSize; import org.hibernate.annotations.BatchSize;
@ -134,7 +135,6 @@ import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMethod; import org.hibernate.annotations.common.reflection.XMethod;
import org.hibernate.annotations.common.reflection.XPackage; import org.hibernate.annotations.common.reflection.XPackage;
import org.hibernate.annotations.common.reflection.XProperty; import org.hibernate.annotations.common.reflection.XProperty;
import org.hibernate.cache.RegionFactory;
import org.hibernate.cfg.annotations.CollectionBinder; import org.hibernate.cfg.annotations.CollectionBinder;
import org.hibernate.cfg.annotations.EntityBinder; import org.hibernate.cfg.annotations.EntityBinder;
import org.hibernate.cfg.annotations.MapKeyColumnDelegator; import org.hibernate.cfg.annotations.MapKeyColumnDelegator;

View File

@ -296,7 +296,7 @@ public interface AvailableSettings {
public static final String CACHE_PROVIDER = "hibernate.cache.provider_class"; public static final String CACHE_PROVIDER = "hibernate.cache.provider_class";
/** /**
* The {@link org.hibernate.cache.RegionFactory} implementation class * The {@link org.hibernate.cache.spi.RegionFactory} implementation class
*/ */
public static final String CACHE_REGION_FACTORY = "hibernate.cache.region.factory_class"; public static final String CACHE_REGION_FACTORY = "hibernate.cache.region.factory_class";

View File

@ -76,7 +76,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
* </tr> * </tr>
* <tr> * <tr>
* <td><tt>hibernate.cache.provider_class</tt></td> * <td><tt>hibernate.cache.provider_class</tt></td>
* <td>classname of <tt>org.hibernate.cache.CacheProvider</tt> * <td>classname of <tt>org.hibernate.cache.spi.CacheProvider</tt>
* subclass (if not specified EHCache is used)</td> * subclass (if not specified EHCache is used)</td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -27,8 +27,8 @@ import java.util.Map;
import org.hibernate.ConnectionReleaseMode; import org.hibernate.ConnectionReleaseMode;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.MultiTenancyStrategy; import org.hibernate.MultiTenancyStrategy;
import org.hibernate.cache.QueryCacheFactory; import org.hibernate.cache.spi.QueryCacheFactory;
import org.hibernate.cache.RegionFactory; import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.hql.QueryTranslatorFactory; import org.hibernate.hql.QueryTranslatorFactory;
import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.jta.platform.spi.JtaPlatform;
import org.hibernate.tuple.entity.EntityTuplizerFactory; import org.hibernate.tuple.entity.EntityTuplizerFactory;

View File

@ -33,10 +33,10 @@ import org.hibernate.ConnectionReleaseMode;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.MultiTenancyStrategy; import org.hibernate.MultiTenancyStrategy;
import org.hibernate.cache.QueryCacheFactory; import org.hibernate.cache.internal.NoCachingRegionFactory;
import org.hibernate.cache.RegionFactory; import org.hibernate.cache.spi.QueryCacheFactory;
import org.hibernate.cache.impl.NoCachingRegionFactory; import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge; import org.hibernate.cache.internal.bridge.RegionFactoryCacheProviderBridge;
import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.transaction.spi.TransactionFactory; import org.hibernate.engine.transaction.spi.TransactionFactory;
@ -305,7 +305,7 @@ public class SettingsFactory implements Serializable {
protected QueryCacheFactory createQueryCacheFactory(Properties properties, ServiceRegistry serviceRegistry) { protected QueryCacheFactory createQueryCacheFactory(Properties properties, ServiceRegistry serviceRegistry) {
String queryCacheFactoryClassName = ConfigurationHelper.getString( String queryCacheFactoryClassName = ConfigurationHelper.getString(
Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory" Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.internal.StandardQueryCacheFactory"
); );
LOG.debugf( "Query cache factory: %s", queryCacheFactoryClassName ); LOG.debugf( "Query cache factory: %s", queryCacheFactoryClassName );
try { try {

View File

@ -816,8 +816,8 @@ public class EntityBinder {
} }
public static String getCacheConcurrencyStrategy(CacheConcurrencyStrategy strategy) { public static String getCacheConcurrencyStrategy(CacheConcurrencyStrategy strategy) {
org.hibernate.cache.access.AccessType accessType = strategy.toAccessType(); org.hibernate.cache.spi.access.AccessType accessType = strategy.toAccessType();
return accessType == null ? null : accessType.getName(); return accessType == null ? null : accessType.getExternalName();
} }
public void addFilter(String name, String condition) { public void addFilter(String name, String condition) {

View File

@ -30,7 +30,7 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.internal.util.MarkerObject; import org.hibernate.internal.util.MarkerObject;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -34,9 +34,9 @@ import org.hibernate.MappingException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.SessionFactoryObserver; import org.hibernate.SessionFactoryObserver;
import org.hibernate.cache.QueryCache; import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.Region; import org.hibernate.cache.spi.Region;
import org.hibernate.cache.UpdateTimestampsCache; import org.hibernate.cache.spi.UpdateTimestampsCache;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionRegistry; import org.hibernate.dialect.function.SQLFunctionRegistry;

View File

@ -36,7 +36,7 @@ import org.hibernate.Interceptor;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.ScrollMode; import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults; import org.hibernate.ScrollableResults;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.jdbc.LobCreationContext; import org.hibernate.engine.jdbc.LobCreationContext;
import org.hibernate.engine.jdbc.spi.JdbcConnectionAccess; import org.hibernate.engine.jdbc.spi.JdbcConnectionAccess;

View File

@ -30,11 +30,11 @@ import org.jboss.logging.Logger;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer; import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.cache.entry.CacheEntry;
import org.hibernate.event.EventType; import org.hibernate.event.EventType;
import org.hibernate.event.PostLoadEvent; import org.hibernate.event.PostLoadEvent;
import org.hibernate.event.PostLoadEventListener; import org.hibernate.event.PostLoadEventListener;

View File

@ -36,9 +36,9 @@ import org.jboss.logging.Logger;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.entry.CollectionCacheEntry;
import org.hibernate.cache.entry.CollectionCacheEntry;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.CollectionEntry; import org.hibernate.engine.CollectionEntry;
import org.hibernate.engine.CollectionKey; import org.hibernate.engine.CollectionKey;

View File

@ -25,12 +25,12 @@ package org.hibernate.event.def;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.ObjectDeletedException; import org.hibernate.ObjectDeletedException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cache.access.SoftLock;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.Status; import org.hibernate.engine.Status;
import org.hibernate.event.EventSource; import org.hibernate.event.EventSource;

View File

@ -28,9 +28,9 @@ import java.io.Serializable;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.entry.CollectionCacheEntry;
import org.hibernate.cache.entry.CollectionCacheEntry;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.CollectionEntry; import org.hibernate.engine.CollectionEntry;
import org.hibernate.engine.PersistenceContext; import org.hibernate.engine.PersistenceContext;

View File

@ -29,14 +29,14 @@ import org.jboss.logging.Logger;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.CacheKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.NonUniqueObjectException; import org.hibernate.NonUniqueObjectException;
import org.hibernate.PersistentObjectException; import org.hibernate.PersistentObjectException;
import org.hibernate.TypeMismatchException; import org.hibernate.TypeMismatchException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cache.access.SoftLock; import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.cache.entry.CacheEntry;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.EntityKey; import org.hibernate.engine.EntityKey;
import org.hibernate.engine.PersistenceContext; import org.hibernate.engine.PersistenceContext;

View File

@ -32,7 +32,7 @@ import org.hibernate.HibernateException;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.PersistentObjectException; import org.hibernate.PersistentObjectException;
import org.hibernate.UnresolvableObjectException; import org.hibernate.UnresolvableObjectException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.engine.Cascade; import org.hibernate.engine.Cascade;
import org.hibernate.engine.CascadingAction; import org.hibernate.engine.CascadingAction;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;

View File

@ -36,7 +36,7 @@ import org.hibernate.SQLQuery;
import org.hibernate.ScrollableResults; import org.hibernate.ScrollableResults;
import org.hibernate.SessionException; import org.hibernate.SessionException;
import org.hibernate.SharedSessionContract; import org.hibernate.SharedSessionContract;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.engine.EntityKey; import org.hibernate.engine.EntityKey;
import org.hibernate.engine.NamedQueryDefinition; import org.hibernate.engine.NamedQueryDefinition;
import org.hibernate.engine.NamedSQLQueryDefinition; import org.hibernate.engine.NamedSQLQueryDefinition;

View File

@ -65,16 +65,16 @@ import org.hibernate.SessionFactoryObserver;
import org.hibernate.StatelessSession; import org.hibernate.StatelessSession;
import org.hibernate.StatelessSessionBuilder; import org.hibernate.StatelessSessionBuilder;
import org.hibernate.TypeHelper; import org.hibernate.TypeHelper;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.internal.CacheDataDescriptionImpl;
import org.hibernate.cache.CollectionRegion; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.EntityRegion; import org.hibernate.cache.spi.CollectionRegion;
import org.hibernate.cache.QueryCache; import org.hibernate.cache.spi.EntityRegion;
import org.hibernate.cache.Region; import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.UpdateTimestampsCache; import org.hibernate.cache.spi.Region;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.spi.UpdateTimestampsCache;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.impl.CacheDataDescriptionImpl; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
@ -299,7 +299,7 @@ public final class SessionFactoryImpl
// cache region is defined by the root-class in the hierarchy... // cache region is defined by the root-class in the hierarchy...
EntityRegionAccessStrategy accessStrategy = ( EntityRegionAccessStrategy ) entityAccessStrategies.get( cacheRegionName ); EntityRegionAccessStrategy accessStrategy = ( EntityRegionAccessStrategy ) entityAccessStrategies.get( cacheRegionName );
if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) { if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
final AccessType accessType = AccessType.parse( model.getCacheConcurrencyStrategy() ); final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
if ( accessType != null ) { if ( accessType != null ) {
LOG.trace("Building cache for entity data [" + model.getEntityName() + "]"); LOG.trace("Building cache for entity data [" + model.getEntityName() + "]");
EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
@ -325,11 +325,12 @@ public final class SessionFactoryImpl
while ( collections.hasNext() ) { while ( collections.hasNext() ) {
Collection model = (Collection) collections.next(); Collection model = (Collection) collections.next();
final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName(); final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
final AccessType accessType = AccessType.parse( model.getCacheConcurrencyStrategy() ); final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
CollectionRegionAccessStrategy accessStrategy = null; CollectionRegionAccessStrategy accessStrategy = null;
if ( accessType != null && settings.isSecondLevelCacheEnabled() ) { if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
LOG.trace("Building cache for collection data [" + model.getRole() + "]"); LOG.trace("Building cache for collection data [" + model.getRole() + "]");
CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl
.decode( model ) );
accessStrategy = collectionRegion.buildAccessStrategy( accessType ); accessStrategy = collectionRegion.buildAccessStrategy( accessType );
entityAccessStrategies.put( cacheRegionName, accessStrategy ); entityAccessStrategies.put( cacheRegionName, accessStrategy );
allCacheRegions.put( cacheRegionName, collectionRegion ); allCacheRegions.put( cacheRegionName, collectionRegion );

View File

@ -49,7 +49,7 @@ import org.hibernate.SessionException;
import org.hibernate.StatelessSession; import org.hibernate.StatelessSession;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.UnresolvableObjectException; import org.hibernate.UnresolvableObjectException;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.EntityKey; import org.hibernate.engine.EntityKey;
import org.hibernate.engine.LoadQueryInfluencers; import org.hibernate.engine.LoadQueryInfluencers;

View File

@ -41,6 +41,8 @@ import org.jboss.logging.Logger;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.cache.spi.QueryCache;
import org.hibernate.cache.spi.QueryKey;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
@ -49,9 +51,7 @@ import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults; import org.hibernate.ScrollableResults;
import org.hibernate.StaleObjectStateException; import org.hibernate.StaleObjectStateException;
import org.hibernate.WrongClassException; import org.hibernate.WrongClassException;
import org.hibernate.cache.FilterKey; import org.hibernate.cache.spi.FilterKey;
import org.hibernate.cache.QueryCache;
import org.hibernate.cache.QueryKey;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.engine.EntityKey; import org.hibernate.engine.EntityKey;

View File

@ -42,11 +42,11 @@ import org.hibernate.MappingException;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.TransientObjectException; import org.hibernate.TransientObjectException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.entry.CacheEntryStructure; import org.hibernate.cache.spi.entry.CacheEntryStructure;
import org.hibernate.cache.entry.StructuredCollectionCacheEntry; import org.hibernate.cache.spi.entry.StructuredCollectionCacheEntry;
import org.hibernate.cache.entry.StructuredMapCacheEntry; import org.hibernate.cache.spi.entry.StructuredMapCacheEntry;
import org.hibernate.cache.entry.UnstructuredCacheEntry; import org.hibernate.cache.spi.entry.UnstructuredCacheEntry;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;

View File

@ -30,7 +30,7 @@ import java.util.Iterator;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.LoadQueryInfluencers; import org.hibernate.engine.LoadQueryInfluencers;

View File

@ -29,8 +29,8 @@ import java.sql.SQLException;
import java.util.Map; import java.util.Map;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.entry.CacheEntryStructure; import org.hibernate.cache.spi.entry.CacheEntryStructure;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;

View File

@ -30,7 +30,7 @@ import java.sql.SQLException;
import java.util.Iterator; import java.util.Iterator;
import org.hibernate.MappingException; import org.hibernate.MappingException;
import org.hibernate.cache.CacheException; import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.collection.PersistentCollection; import org.hibernate.collection.PersistentCollection;
import org.hibernate.engine.LoadQueryInfluencers; import org.hibernate.engine.LoadQueryInfluencers;

View File

@ -52,12 +52,12 @@ import org.hibernate.StaleStateException;
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper; import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor; import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer; import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
import org.hibernate.cache.CacheKey; import org.hibernate.cache.spi.CacheKey;
import org.hibernate.cache.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.entry.CacheEntry; import org.hibernate.cache.spi.entry.CacheEntry;
import org.hibernate.cache.entry.CacheEntryStructure; import org.hibernate.cache.spi.entry.CacheEntryStructure;
import org.hibernate.cache.entry.StructuredCacheEntry; import org.hibernate.cache.spi.entry.StructuredCacheEntry;
import org.hibernate.cache.entry.UnstructuredCacheEntry; import org.hibernate.cache.spi.entry.UnstructuredCacheEntry;
import org.hibernate.dialect.lock.LockingStrategy; import org.hibernate.dialect.lock.LockingStrategy;
import org.hibernate.engine.CascadeStyle; import org.hibernate.engine.CascadeStyle;
import org.hibernate.engine.CascadingAction; import org.hibernate.engine.CascadingAction;

Some files were not shown because too many files have changed in this diff Show More