Hibernate SVN: r17304 - in core/trunk: entitymanager/src/main/java/org/hibernate/ejb and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-08-14 13:26:52 -0400 (Fri, 14 Aug 2009)
New Revision: 17304
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java
Log:
Set version number to 3.5.0.Beta1 for log display
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java 2009-08-14 17:25:13 UTC (rev 17303)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/Version.java 2009-08-14 17:26:52 UTC (rev 17304)
@@ -30,7 +30,7 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.5.0-SNAPSHOT";
+ public static final String VERSION = "3.5.0.Beta1";
private static Logger log = LoggerFactory.getLogger( Version.class );
static {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java 2009-08-14 17:25:13 UTC (rev 17303)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/Version.java 2009-08-14 17:26:52 UTC (rev 17304)
@@ -31,7 +31,7 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.5.0-SNAPSHOT";
+ public static final String VERSION = "3.5.0.Beta1";
private static final Logger log = LoggerFactory.getLogger( Version.class );
static {
15 years, 3 months
Hibernate SVN: r17303 - core/trunk/annotations.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-08-14 13:25:13 -0400 (Fri, 14 Aug 2009)
New Revision: 17303
Modified:
core/trunk/annotations/pom.xml
Log:
use BV 1.0.CR4 and HV 4.0.0.Beta3
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2009-08-14 13:10:49 UTC (rev 17302)
+++ core/trunk/annotations/pom.xml 2009-08-14 17:25:13 UTC (rev 17303)
@@ -76,13 +76,13 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR3-SNAPSHOT</version>
+ <version>1.0.CR4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>4.0.0.Beta3-SNAPSHOT</version>
+ <version>4.0.0.Beta3</version>
<scope>test</scope>
</dependency>
</dependencies>
15 years, 3 months
Hibernate SVN: r17302 - in core/branches/INFINISPAN/cache-infinispan: src/main/java/org/hibernate/cache/infinispan and 11 other directories.
by hibernate-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2009-08-14 09:10:49 -0400 (Fri, 14 Aug 2009)
New Revision: 17302
Added:
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.hbm.xml
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.java
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/AccountHolder.java
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/ClassLoaderTestDAO.java
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/SessionRefreshTestCase.java
Removed:
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanTest.java
core/branches/INFINISPAN/cache-infinispan/src/test/resources/invalid-infinispan-configs.xml
Modified:
core/branches/INFINISPAN/cache-infinispan/pom.xml
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/InfinispanCollectionRegion.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/ReadOnlyAccess.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/TransactionalAccess.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/ReadOnlyAccess.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/TransactionalAccess.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseGeneralDataRegion.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/query/InfinispanQueryResultsRegion.java
core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/InfinispanTimestampsRegion.java
core/branches/INFINISPAN/cache-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java
core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/BasicReadOnlyTestCase.java
Log:
[ISPN-6] Keep adding more unit tests. Added test dependency on Infinispan test to be able to print cache contents in test.
Modified: core/branches/INFINISPAN/cache-infinispan/pom.xml
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/pom.xml 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/pom.xml 2009-08-14 13:10:49 UTC (rev 17302)
@@ -51,6 +51,13 @@
<!-- <scope>test</scope> TODO fix this -->
</dependency>
<dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>${version.infinispan}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${version.hsqldb}</version>
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -1,5 +1,6 @@
package org.hibernate.cache.infinispan;
+import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -82,14 +83,14 @@
*/
public static final String COLLECTION_CACHE_RESOURCE_PROP = PREFIX + COLLECTION_KEY + CONFIG_SUFFIX;
- private static final String TIMESTAMP_KEY = "timestamp";
+ private static final String TIMESTAMPS_KEY = "timestamps";
/**
* Name of the configuration that should be used for timestamp caches.
*
* @see #DEF_TS_RESOURCE
*/
- public static final String TIMESTAMP_CACHE_RESOURCE_PROP = PREFIX + TIMESTAMP_KEY + CONFIG_SUFFIX;
+ public static final String TIMESTAMPS_CACHE_RESOURCE_PROP = PREFIX + TIMESTAMPS_KEY + CONFIG_SUFFIX;
private static final String QUERY_KEY = "query";
@@ -111,9 +112,9 @@
public static final String DEF_ENTITY_RESOURCE = "entity";
/**
- * Default value for {@link #TIMESTAMP_CACHE_RESOURCE_PROP}.
+ * Default value for {@link #TIMESTAMPS_CACHE_RESOURCE_PROP}.
*/
- public static final String DEF_TIMESTAMP_RESOURCE = "timestamp";
+ public static final String DEF_TIMESTAMPS_RESOURCE = "timestamps";
/**
* Default value for {@link #QUERY_CACHE_RESOURCE_PROP}.
@@ -190,7 +191,8 @@
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
throws CacheException {
log.debug("Building query results cache region [" + regionName + "]");
- return new InfinispanQueryResultsRegion(manager.getCache(regionName), regionName);
+ String cacheName = typeOverrides.get(QUERY_KEY).getCacheName();
+ return new InfinispanQueryResultsRegion(manager.getCache(cacheName), regionName);
}
/**
@@ -199,7 +201,8 @@
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
throws CacheException {
log.debug("Building timestamps cache region [" + regionName + "]");
- return new InfinispanTimestampsRegion(manager.getCache(regionName), regionName);
+ String cacheName = typeOverrides.get(TIMESTAMPS_KEY).getCacheName();
+ return new InfinispanTimestampsRegion(manager.getCache(cacheName), regionName);
}
/**
@@ -231,7 +234,7 @@
log.debug("Starting Infinispan CacheManager");
try {
String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
- manager = new DefaultCacheManager(configLoc);
+ manager = createCacheManager(configLoc);
initGenericDataTypeOverrides();
Enumeration keys = properties.propertyNames();
while (keys.hasMoreElements()) {
@@ -309,7 +312,15 @@
public Set<String> getDefinedConfigurations() {
return Collections.unmodifiableSet(definedConfigurations);
}
-
+
+ protected CacheManager createCacheManager(String configLoc) throws CacheException {
+ try {
+ return new DefaultCacheManager(configLoc);
+ } catch (IOException e) {
+ throw new CacheException("Unable to create default cache manager", e);
+ }
+ }
+
// private Configuration createCacheConfig(TypeOverrides config) {
// Configuration cacheCfg = new Configuration();
// return overrideCacheConfig(config, cacheCfg);
@@ -323,8 +334,8 @@
collectionOverrides.setCacheName(DEF_ENTITY_RESOURCE);
typeOverrides.put(COLLECTION_KEY, collectionOverrides);
TypeOverrides timestampOverrides = new TimestampTypeOverrides();
- timestampOverrides.setCacheName(DEF_TIMESTAMP_RESOURCE);
- typeOverrides.put(TIMESTAMP_KEY, timestampOverrides);
+ timestampOverrides.setCacheName(DEF_TIMESTAMPS_RESOURCE);
+ typeOverrides.put(TIMESTAMPS_KEY, timestampOverrides);
TypeOverrides queryOverrides = new TypeOverrides();
queryOverrides.setCacheName(DEF_QUERY_RESOURCE);
typeOverrides.put(QUERY_KEY, queryOverrides);
@@ -389,7 +400,7 @@
}
private void defineGenericDataTypeCacheConfigurations() throws CacheException {
- String[] defaultGenericDataTypes = new String[]{ENTITY_KEY, COLLECTION_KEY, TIMESTAMP_KEY, QUERY_KEY};
+ String[] defaultGenericDataTypes = new String[]{ENTITY_KEY, COLLECTION_KEY, TIMESTAMPS_KEY, QUERY_KEY};
for (String type : defaultGenericDataTypes) {
TypeOverrides override = typeOverrides.get(type);
String cacheName = override.getCacheName();
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/InfinispanCollectionRegion.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/InfinispanCollectionRegion.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/InfinispanCollectionRegion.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -8,6 +8,9 @@
import org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion;
import org.infinispan.Cache;
+/**
+ * @author Chris Bredesen
+ */
public class InfinispanCollectionRegion extends BaseTransactionalDataRegion implements CollectionRegion {
public InfinispanCollectionRegion(Cache<Object, Object> cache, String name, CacheDataDescription metadata) {
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/ReadOnlyAccess.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/ReadOnlyAccess.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/ReadOnlyAccess.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -5,72 +5,73 @@
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.access.SoftLock;
+/**
+ * @author Chris Bredesen
+ */
public class ReadOnlyAccess implements CollectionRegionAccessStrategy {
- private final InfinispanCollectionRegion region;
-
- public ReadOnlyAccess( InfinispanCollectionRegion region ) {
- this.region = region;
- }
+ private final InfinispanCollectionRegion region;
- public void evict( Object key ) throws CacheException {
- region.getCache().evict( key );
- }
+ public ReadOnlyAccess(InfinispanCollectionRegion region) {
+ this.region = region;
+ }
- public void evictAll() throws CacheException {
- // TODO ensure proper clustering semantics here
- region.getCache().clear();
- }
+ public void evict(Object key) throws CacheException {
+ region.getCache().evict(key);
+ }
- public Object get( Object key, long txTimestamp ) throws CacheException {
- // TODO Auto-generated method stub
- return null;
- }
+ public void evictAll() throws CacheException {
+ // TODO ensure proper clustering semantics here
+ region.getCache().clear();
+ }
- public CollectionRegion getRegion() {
- return region;
- }
+ public Object get(Object key, long txTimestamp) throws CacheException {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public SoftLock lockItem( Object key, Object version ) throws CacheException {
- // TODO Auto-generated method stub
- return null;
- }
+ public CollectionRegion getRegion() {
+ return region;
+ }
- public SoftLock lockRegion() throws CacheException {
- // TODO Auto-generated method stub
- return null;
- }
+ public SoftLock lockItem(Object key, Object version) throws CacheException {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version )
- throws CacheException {
- // TODO Auto-generated method stub
- return false;
- }
+ public SoftLock lockRegion() throws CacheException {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version,
- boolean minimalPutOverride ) throws CacheException {
- // TODO Auto-generated method stub
- return false;
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
+ // TODO Auto-generated method stub
+ return false;
+ }
- public void remove( Object key ) throws CacheException {
- // TODO Auto-generated method stub
-
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
+ throws CacheException {
+ // TODO Auto-generated method stub
+ return false;
+ }
- public void removeAll() throws CacheException {
- // TODO Auto-generated method stub
-
- }
+ public void remove(Object key) throws CacheException {
+ // TODO Auto-generated method stub
- public void unlockItem( Object key, SoftLock lock ) throws CacheException {
- // TODO Auto-generated method stub
-
- }
+ }
- public void unlockRegion( SoftLock lock ) throws CacheException {
- // TODO Auto-generated method stub
-
- }
+ public void removeAll() throws CacheException {
+ // TODO Auto-generated method stub
-
+ }
+
+ public void unlockItem(Object key, SoftLock lock) throws CacheException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void unlockRegion(SoftLock lock) throws CacheException {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/TransactionalAccess.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/TransactionalAccess.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/collection/TransactionalAccess.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -11,63 +11,62 @@
* @author Chris Bredesen
*/
public class TransactionalAccess implements CollectionRegionAccessStrategy {
- private final InfinispanCollectionRegion region;
+ private final InfinispanCollectionRegion region;
- public TransactionalAccess( InfinispanCollectionRegion region ) {
- this.region = region;
- }
+ public TransactionalAccess(InfinispanCollectionRegion region) {
+ this.region = region;
+ }
- public void evict( Object key ) throws CacheException {
- region.getCache().evict( key );
- }
+ public void evict(Object key) throws CacheException {
+ region.getCache().evict(key);
+ }
- public void evictAll() throws CacheException {
- // TODO ensure proper clustering semantics
- region.getCache().clear();
- }
+ public void evictAll() throws CacheException {
+ // TODO ensure proper clustering semantics
+ region.getCache().clear();
+ }
- public Object get( Object key, long txTimestamp ) throws CacheException {
- return region.getCache().get( key );
- }
+ public Object get(Object key, long txTimestamp) throws CacheException {
+ return region.getCache().get(key);
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version )
- throws CacheException {
- region.getCache().putForExternalRead( key, value );
- return true;
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
+ region.getCache().putForExternalRead(key, value);
+ return true;
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version,
- boolean minimalPutOverride ) throws CacheException {
- region.getCache().putForExternalRead( key, value );
- return true;
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
+ throws CacheException {
+ region.getCache().putForExternalRead(key, value);
+ return true;
+ }
- public void remove( Object key ) throws CacheException {
- region.getCache().remove( key );
- }
+ public void remove(Object key) throws CacheException {
+ region.getCache().remove(key);
+ }
- public void removeAll() throws CacheException {
- region.getCache().clear();
- }
+ public void removeAll() throws CacheException {
+ region.getCache().clear();
+ }
- public CollectionRegion getRegion() {
- return region;
- }
+ public CollectionRegion getRegion() {
+ return region;
+ }
- // following methods copied from o.h.c.jbc2.collection.TransactionalAccess
+ // following methods copied from o.h.c.jbc2.collection.TransactionalAccess
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- return null;
- }
+ public SoftLock lockItem(Object key, Object version) throws CacheException {
+ return null;
+ }
- public SoftLock lockRegion() throws CacheException {
- return null;
- }
+ public SoftLock lockRegion() throws CacheException {
+ return null;
+ }
- public void unlockItem(Object key, SoftLock lock) throws CacheException {
- }
+ public void unlockItem(Object key, SoftLock lock) throws CacheException {
+ }
- public void unlockRegion(SoftLock lock) throws CacheException {
- }
+ public void unlockRegion(SoftLock lock) throws CacheException {
+ }
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/ReadOnlyAccess.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/ReadOnlyAccess.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/ReadOnlyAccess.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -6,43 +6,42 @@
import org.slf4j.LoggerFactory;
/**
- * A specialization of {@link TransactionalAccess} that ensures we never update
- * data. Infinispan access is always transactional.
+ * A specialization of {@link TransactionalAccess} that ensures we never update data. Infinispan
+ * access is always transactional.
*
* @author Chris Bredesen
*/
class ReadOnlyAccess extends TransactionalAccess {
- private static final Logger log = LoggerFactory.getLogger( ReadOnlyAccess.class );
+ private static final Logger log = LoggerFactory.getLogger(ReadOnlyAccess.class);
- ReadOnlyAccess( InfinispanEntityRegion region ) {
- super( region );
- }
+ ReadOnlyAccess(InfinispanEntityRegion region) {
+ super(region);
+ }
- public SoftLock lockItem( Object key, Object version ) throws CacheException {
- throw new UnsupportedOperationException( "Illegal attempt to edit read only item" );
- }
+ public SoftLock lockItem(Object key, Object version) throws CacheException {
+ throw new UnsupportedOperationException("Illegal attempt to edit read only item");
+ }
- public SoftLock lockRegion() throws CacheException {
- throw new UnsupportedOperationException( "Illegal attempt to edit read only item" );
- }
+ public SoftLock lockRegion() throws CacheException {
+ throw new UnsupportedOperationException("Illegal attempt to edit read only item");
+ }
- public void unlockItem( Object key, SoftLock lock ) throws CacheException {
- log.error( "Illegal attempt to edit read only item" );
- }
+ public void unlockItem(Object key, SoftLock lock) throws CacheException {
+ log.error("Illegal attempt to edit read only item");
+ }
- public void unlockRegion( SoftLock lock ) throws CacheException {
- log.error( "Illegal attempt to edit read only item" );
- }
+ public void unlockRegion(SoftLock lock) throws CacheException {
+ log.error("Illegal attempt to edit read only item");
+ }
- @Override
- public boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
- throws CacheException {
- throw new UnsupportedOperationException("Illegal attempt to edit read only item");
- }
+ @Override
+ public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
+ throw new UnsupportedOperationException("Illegal attempt to edit read only item");
+ }
- @Override
- public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
+ @Override
+ public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
throws CacheException {
- throw new UnsupportedOperationException("Illegal attempt to edit read only item");
- }
+ throw new UnsupportedOperationException("Illegal attempt to edit read only item");
+ }
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/TransactionalAccess.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/TransactionalAccess.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/TransactionalAccess.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -13,82 +13,80 @@
* @author Chris Bredesen
*/
class TransactionalAccess implements EntityRegionAccessStrategy {
- private static final Logger log = LoggerFactory.getLogger( TransactionalAccess.class );
- private final InfinispanEntityRegion region;
+ private static final Logger log = LoggerFactory.getLogger(TransactionalAccess.class);
+ private final InfinispanEntityRegion region;
- TransactionalAccess( InfinispanEntityRegion region ) {
- this.region = region;
- }
+ TransactionalAccess(InfinispanEntityRegion region) {
+ this.region = region;
+ }
- public void evict( Object key ) throws CacheException {
- region.getCache().evict( key );
- }
+ public void evict(Object key) throws CacheException {
+ region.getCache().evict(key);
+ }
- public void evictAll() throws CacheException {
- region.getCache().clear();
- }
+ public void evictAll() throws CacheException {
+ region.getCache().clear();
+ }
- public Object get( Object key, long txTimestamp ) throws CacheException {
- return region.getCache().get( key );
- }
+ public Object get(Object key, long txTimestamp) throws CacheException {
+ return region.getCache().get(key);
+ }
- public EntityRegion getRegion() {
- return this.region;
- }
+ public EntityRegion getRegion() {
+ return this.region;
+ }
- public boolean insert( Object key, Object value, Object version ) throws CacheException {
- region.getCache().put( key, value );
- return true; // TODO this is suspect
- }
+ public boolean insert(Object key, Object value, Object version) throws CacheException {
+ region.getCache().put(key, value);
+ return true; // TODO this is suspect
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version )
- throws CacheException {
- region.getCache().putForExternalRead( key, value );
- return true;
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
+ region.getCache().putForExternalRead(key, value);
+ return true;
+ }
- public boolean putFromLoad( Object key, Object value, long txTimestamp, Object version,
- boolean minimalPutOverride ) throws CacheException {
- region.getCache().putForExternalRead( key, value );
- return true;
- }
+ public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
+ throws CacheException {
+ region.getCache().putForExternalRead(key, value);
+ return true;
+ }
- public void remove( Object key ) throws CacheException {
- region.getCache().remove( key );
- }
+ public void remove(Object key) throws CacheException {
+ region.getCache().remove(key);
+ }
- public void removeAll() throws CacheException {
- region.getCache().clear(); // TODO is this right?
- }
+ public void removeAll() throws CacheException {
+ region.getCache().clear(); // TODO is this right?
+ }
- public boolean update( Object key, Object value, Object currentVersion, Object previousVersion )
- throws CacheException {
- region.getCache().put( key, value );
- return true; // JBC2 provider does this...
- }
-
- // all remaining methods copied from the o.h.c.jbc2.entity.TransactionalAccess
+ public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
+ region.getCache().put(key, value);
+ return true; // JBC2 provider does this...
+ }
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- return null;
- }
+ // all remaining methods copied from the o.h.c.jbc2.entity.TransactionalAccess
- public SoftLock lockRegion() throws CacheException {
- return null;
- }
+ public SoftLock lockItem(Object key, Object version) throws CacheException {
+ return null;
+ }
- public void unlockItem(Object key, SoftLock lock) throws CacheException {
- }
+ public SoftLock lockRegion() throws CacheException {
+ return null;
+ }
- public void unlockRegion(SoftLock lock) throws CacheException {
- }
+ public void unlockItem(Object key, SoftLock lock) throws CacheException {
+ }
- public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
- return false;
- }
+ public void unlockRegion(SoftLock lock) throws CacheException {
+ }
- public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
+ public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
+ return false;
+ }
+
+ public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
throws CacheException {
- return false;
- }
+ return false;
+ }
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseGeneralDataRegion.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseGeneralDataRegion.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseGeneralDataRegion.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -11,24 +11,24 @@
*/
public abstract class BaseGeneralDataRegion extends BaseRegion implements GeneralDataRegion {
- public BaseGeneralDataRegion( Cache<Object, Object> cache, String name ) {
- super( cache, name );
- }
+ public BaseGeneralDataRegion(Cache<Object, Object> cache, String name) {
+ super(cache, name);
+ }
- public void evict( Object key ) throws CacheException {
- getCache().evict( key );
- }
+ public void evict(Object key) throws CacheException {
+ getCache().evict(key);
+ }
- public void evictAll() throws CacheException {
- getCache().clear();
- }
+ public void evictAll() throws CacheException {
+ getCache().clear();
+ }
- public Object get( Object key ) throws CacheException {
- return getCache().get( key );
- }
+ public Object get(Object key) throws CacheException {
+ return getCache().get(key);
+ }
- public void put( Object key, Object value ) throws CacheException {
- getCache().put( key, value );
- }
+ public void put(Object key, Object value) throws CacheException {
+ getCache().put(key, value);
+ }
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/query/InfinispanQueryResultsRegion.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/query/InfinispanQueryResultsRegion.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/query/InfinispanQueryResultsRegion.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -4,10 +4,13 @@
import org.hibernate.cache.infinispan.impl.BaseGeneralDataRegion;
import org.infinispan.Cache;
+/**
+ * @author Chris Bredesen
+ */
public class InfinispanQueryResultsRegion extends BaseGeneralDataRegion implements QueryResultsRegion {
- public InfinispanQueryResultsRegion( Cache<Object, Object> cache, String name ) {
- super( cache, name );
- }
+ public InfinispanQueryResultsRegion(Cache<Object, Object> cache, String name) {
+ super(cache, name);
+ }
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/InfinispanTimestampsRegion.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/InfinispanTimestampsRegion.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/InfinispanTimestampsRegion.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -4,10 +4,13 @@
import org.hibernate.cache.infinispan.impl.BaseGeneralDataRegion;
import org.infinispan.Cache;
+/**
+ * @author Chris Bredesen
+ */
public class InfinispanTimestampsRegion extends BaseGeneralDataRegion implements TimestampsRegion {
- public InfinispanTimestampsRegion( Cache<Object, Object> cache, String name ) {
- super( cache, name );
- }
-
+ public InfinispanTimestampsRegion(Cache<Object, Object> cache, String name) {
+ super(cache, name);
+ }
+
}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml 2009-08-14 13:10:49 UTC (rev 17302)
@@ -20,7 +20,7 @@
<!-- Default configuration is appropriate for entity/collection caching. -->
<namedCache name="entity">
- <clustering mode="INVALIDATION_SYNC">
+ <clustering mode="invalidation">
<stateRetrieval fetchInMemoryState="false" timeout="20000"/>
<sync replTimeout="20000"/>
</clustering>
@@ -30,39 +30,32 @@
repeatable-read semantic. Before choosing this config, carefully read the docs
and make sure you really need REPEATABLE_READ.
-->
- <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
- <!--
- Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
- the eviction thread will never run. A separate executor is used for eviction in each cache.
- -->
+ <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
+ <!-- Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds.
+ 0 means the eviction thread will never run. A separate executor is used for eviction in each cache. -->
<eviction wakeUpInterval="5000" maxEntries="10000" strategy="FIFO"/>
<expiration maxIdle="100000"/>
<lazyDeserialization enabled="true"/>
</namedCache>
- <!-- A config appropriate for query caching. Does not replicate
- queries. DO NOT STORE TIMESTAMPS IN THIS CACHE.
- -->
+ <!-- A config appropriate for query caching. Does not replicate queries. -->
<namedCache name="local-query">
- <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
- <!--
- Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
- the eviction thread will never run. A separate executor is used for eviction in each cache.
- -->
+ <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
+ <!--Eviction configuration. WakeupInterval defines how often the eviction thread runs, in milliseconds. 0 means
+ the eviction thread will never run. A separate executor is used for eviction in each cache. -->
<eviction wakeUpInterval="5000" maxEntries="10000" strategy="FIFO"/>
<expiration maxIdle="100000"/>
</namedCache>
<!-- Optimized for timestamp caching. A clustered timestamp cache
is required if query caching is used, even if the query cache
- itself is configured with CacheMode=LOCAL.
- -->
- <namedCache name="timestamp">
- <clustering mode="REPL_ASYNC">
+ itself is configured with CacheMode=LOCAL. -->
+ <namedCache name="timestamps">
+ <clustering mode="replication">
<stateRetrieval fetchInMemoryState="true" timeout="20000"/>
<async/>
</clustering>
- <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
+ <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
<lazyDeserialization enabled="true"/>
<!-- Don't ever evict modification timestamps -->
<eviction wakeUpInterval="0" strategy="NONE"/>
Modified: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -27,9 +27,14 @@
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.collection.InfinispanCollectionRegion;
import org.hibernate.cache.infinispan.entity.InfinispanEntityRegion;
+import org.hibernate.cache.infinispan.query.InfinispanQueryResultsRegion;
+import org.hibernate.cache.infinispan.timestamp.InfinispanTimestampsRegion;
import org.infinispan.Cache;
import org.infinispan.config.Configuration;
+import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.eviction.EvictionStrategy;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.DefaultCacheManager;
import junit.framework.TestCase;
@@ -63,7 +68,7 @@
assertEquals("entity", factory.getTypeOverrides().get("entity").getCacheName());
assertEquals("entity", factory.getTypeOverrides().get("collection").getCacheName());
- assertEquals("timestamp", factory.getTypeOverrides().get("timestamp").getCacheName());
+ assertEquals("timestamps", factory.getTypeOverrides().get("timestamps").getCacheName());
assertEquals("person-cache", factory.getTypeOverrides().get(person).getCacheName());
assertEquals(EvictionStrategy.LRU, factory.getTypeOverrides().get(person).getEvictionStrategy());
@@ -112,12 +117,22 @@
p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "25000");
InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p);
- assertNotNull(factory.getTypeOverrides().get(person));
- assertFalse(factory.getDefinedConfigurations().contains(person));
- assertNotNull(factory.getTypeOverrides().get(addresses));
- assertFalse(factory.getDefinedConfigurations().contains(addresses));
- Cache cache = null;
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
+// Configuration config = new Configuration();
+// // Set to local to avoid creating a JGroups channel
+// config.setCacheMode(CacheMode.LOCAL);
+// manager.defineConfiguration("entity", config);
+// manager.defineConfiguration("timestamps", config);
+// manager.defineConfiguration("myentity-cache", config);
+// manager.defineConfiguration("mycollection-cache", config);
try {
+ assertNotNull(factory.getTypeOverrides().get(person));
+ assertFalse(factory.getDefinedConfigurations().contains(person));
+ assertNotNull(factory.getTypeOverrides().get(addresses));
+ assertFalse(factory.getDefinedConfigurations().contains(addresses));
+ Cache cache = null;
+
InfinispanEntityRegion region = (InfinispanEntityRegion) factory.buildEntityRegion(person, p, null);
assertNotNull(factory.getTypeOverrides().get(person));
assertTrue(factory.getDefinedConfigurations().contains(person));
@@ -129,80 +144,60 @@
assertEquals(5000, cacheCfg.getEvictionMaxEntries());
assertEquals(60000, cacheCfg.getExpirationLifespan());
assertEquals(30000, cacheCfg.getExpirationMaxIdle());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanEntityRegion region = (InfinispanEntityRegion) factory.buildEntityRegion(address, p, null);
+ region = (InfinispanEntityRegion) factory.buildEntityRegion(address, p, null);
assertNotNull(factory.getTypeOverrides().get(person));
assertTrue(factory.getDefinedConfigurations().contains(person));
assertNull(factory.getTypeOverrides().get(address));
cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.FIFO, cacheCfg.getEvictionStrategy());
assertEquals(3000, cacheCfg.getEvictionWakeUpInterval());
assertEquals(20000, cacheCfg.getEvictionMaxEntries());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanEntityRegion region = (InfinispanEntityRegion) factory.buildEntityRegion(car, p, null);
+ region = (InfinispanEntityRegion) factory.buildEntityRegion(car, p, null);
assertNotNull(factory.getTypeOverrides().get(person));
assertTrue(factory.getDefinedConfigurations().contains(person));
assertNull(factory.getTypeOverrides().get(address));
cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.FIFO, cacheCfg.getEvictionStrategy());
assertEquals(3000, cacheCfg.getEvictionWakeUpInterval());
assertEquals(20000, cacheCfg.getEvictionMaxEntries());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanCollectionRegion region = (InfinispanCollectionRegion) factory.buildCollectionRegion(addresses, p, null);
+ InfinispanCollectionRegion collectionRegion = (InfinispanCollectionRegion) factory.buildCollectionRegion(addresses, p, null);
assertNotNull(factory.getTypeOverrides().get(addresses));
assertTrue(factory.getDefinedConfigurations().contains(person));
assertNull(factory.getTypeOverrides().get(parts));
- cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cache = collectionRegion .getCache();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.FIFO, cacheCfg.getEvictionStrategy());
assertEquals(2500, cacheCfg.getEvictionWakeUpInterval());
assertEquals(5500, cacheCfg.getEvictionMaxEntries());
assertEquals(65000, cacheCfg.getExpirationLifespan());
assertEquals(35000, cacheCfg.getExpirationMaxIdle());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanCollectionRegion region = (InfinispanCollectionRegion) factory.buildCollectionRegion(parts, p, null);
+ collectionRegion = (InfinispanCollectionRegion) factory.buildCollectionRegion(parts, p, null);
assertNotNull(factory.getTypeOverrides().get(addresses));
assertTrue(factory.getDefinedConfigurations().contains(addresses));
assertNull(factory.getTypeOverrides().get(parts));
- cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cache = collectionRegion.getCache();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.LRU, cacheCfg.getEvictionStrategy());
assertEquals(3500, cacheCfg.getEvictionWakeUpInterval());
assertEquals(25000, cacheCfg.getEvictionMaxEntries());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanCollectionRegion region = (InfinispanCollectionRegion) factory.buildCollectionRegion(parts, p, null);
+ collectionRegion = (InfinispanCollectionRegion) factory.buildCollectionRegion(parts, p, null);
assertNotNull(factory.getTypeOverrides().get(addresses));
assertTrue(factory.getDefinedConfigurations().contains(addresses));
assertNull(factory.getTypeOverrides().get(parts));
- cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cache = collectionRegion.getCache();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.LRU, cacheCfg.getEvictionStrategy());
assertEquals(3500, cacheCfg.getEvictionWakeUpInterval());
assertEquals(25000, cacheCfg.getEvictionMaxEntries());
} finally {
- if (cache != null) cache.stop();
+ factory.stop();
}
}
@@ -217,6 +212,8 @@
p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "35000");
InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p);
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
try {
InfinispanEntityRegion region = (InfinispanEntityRegion) factory.buildEntityRegion("com.acme.Address", p, null);
assertNull(factory.getTypeOverrides().get("com.acme.Address"));
@@ -226,20 +223,17 @@
assertEquals(3000, cacheCfg.getEvictionWakeUpInterval());
assertEquals(30000, cacheCfg.getEvictionMaxEntries());
assertEquals(100000, cacheCfg.getExpirationMaxIdle());
- } finally {
- if (cache != null) cache.stop();
- }
- try {
- InfinispanCollectionRegion region = (InfinispanCollectionRegion) factory.buildCollectionRegion("com.acme.Person.addresses", p, null);
+
+ InfinispanCollectionRegion collectionRegion = (InfinispanCollectionRegion) factory.buildCollectionRegion("com.acme.Person.addresses", p, null);
assertNull(factory.getTypeOverrides().get("com.acme.Person.addresses"));
- cache = region.getCache();
- Configuration cacheCfg = cache.getConfiguration();
+ cache = collectionRegion.getCache();
+ cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.LRU, cacheCfg.getEvictionStrategy());
assertEquals(3500, cacheCfg.getEvictionWakeUpInterval());
assertEquals(35000, cacheCfg.getEvictionMaxEntries());
assertEquals(100000, cacheCfg.getExpirationMaxIdle());
} finally {
- if (cache != null) cache.stop();
+ factory.stop();
}
}
@@ -256,14 +250,15 @@
p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p);
- assertNotNull(factory.getTypeOverrides().get(person));
- assertFalse(factory.getDefinedConfigurations().contains(person));
- Cache cache = null;
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
try {
+ assertNotNull(factory.getTypeOverrides().get(person));
+ assertFalse(factory.getDefinedConfigurations().contains(person));
InfinispanEntityRegion region = (InfinispanEntityRegion) factory.buildEntityRegion(person, p, null);
assertNotNull(factory.getTypeOverrides().get(person));
assertTrue(factory.getDefinedConfigurations().contains(person));
- cache = region.getCache();
+ Cache cache = region.getCache();
Configuration cacheCfg = cache.getConfiguration();
assertEquals(EvictionStrategy.LRU, cacheCfg.getEvictionStrategy());
assertEquals(3000, cacheCfg.getEvictionWakeUpInterval());
@@ -271,18 +266,118 @@
assertEquals(60000, cacheCfg.getExpirationLifespan());
assertEquals(30000, cacheCfg.getExpirationMaxIdle());
} finally {
- if (cache != null) cache.stop();
+ factory.stop();
}
}
- public void testTimestampNoEvictionValidation() {
+ public void testTimestampValidation() {
Properties p = new Properties();
- p.setProperty("hibernate.cache.infinispan.cfg", "invalid-infinispan-configs.xml");
- InfinispanRegionFactory factory = new InfinispanRegionFactory();
+ final DefaultCacheManager manager = new DefaultCacheManager();
+ InfinispanRegionFactory factory = new InfinispanRegionFactory() {
+ @Override
+ protected CacheManager createCacheManager(String configLoc) throws CacheException {
+ return manager;
+ }
+ };
+ Configuration config = new Configuration();
+ config.setCacheMode(CacheMode.INVALIDATION_SYNC);
+ manager.defineConfiguration("timestamps", config);
try {
factory.start(null, p);
fail("Should have failed saying that invalidation is not allowed for timestamp caches.");
} catch(CacheException ce) {
}
+
+ fail("Add more validations!");
}
+
+ public void testBuildDefaultTimestampsRegion() {
+ final String timestamps = "org.hibernate.cache.UpdateTimestampsCache";
+ Properties p = new Properties();
+ InfinispanRegionFactory factory = new InfinispanRegionFactory();
+ factory.start(null, p);
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
+ try {
+ assertTrue(factory.getDefinedConfigurations().contains("timestamps"));
+ assertTrue(factory.getTypeOverrides().get("timestamps").getCacheName().equals("timestamps"));
+ Configuration config = new Configuration();
+ config.setFetchInMemoryState(false);
+ manager.defineConfiguration("timestamps", config);
+ InfinispanTimestampsRegion region = (InfinispanTimestampsRegion) factory.buildTimestampsRegion(timestamps, p);
+ Cache cache = region.getCache();
+ Configuration cacheCfg = cache.getConfiguration();
+ assertEquals(EvictionStrategy.NONE, cacheCfg.getEvictionStrategy());
+ assertEquals(CacheMode.REPL_ASYNC, cacheCfg.getCacheMode());
+ assertTrue(cacheCfg.isUseLazyDeserialization());
+ } finally {
+ factory.stop();
+ }
+ }
+
+ public void testBuildDiffCacheNameTimestampsRegion() {
+ final String timestamps = "org.hibernate.cache.UpdateTimestampsCache";
+ Properties p = new Properties();
+ p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "unrecommended-timestamps");
+ InfinispanRegionFactory factory = new InfinispanRegionFactory();
+ factory.start(null, p);
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
+ try {
+ assertFalse(factory.getDefinedConfigurations().contains("timestamp"));
+ assertTrue(factory.getDefinedConfigurations().contains("unrecommended-timestamps"));
+ assertTrue(factory.getTypeOverrides().get("timestamps").getCacheName().equals("unrecommended-timestamps"));
+ Configuration config = new Configuration();
+ config.setFetchInMemoryState(false);
+ config.setCacheMode(CacheMode.REPL_SYNC);
+ manager.defineConfiguration("unrecommended-timestamps", config);
+ InfinispanTimestampsRegion region = (InfinispanTimestampsRegion) factory.buildTimestampsRegion(timestamps, p);
+ Cache cache = region.getCache();
+ Configuration cacheCfg = cache.getConfiguration();
+ assertEquals(EvictionStrategy.NONE, cacheCfg.getEvictionStrategy());
+ assertEquals(CacheMode.REPL_SYNC, cacheCfg.getCacheMode());
+ assertFalse(cacheCfg.isUseLazyDeserialization());
+ } finally {
+ factory.stop();
+ }
+ }
+
+ public void testBuildTimestamRegionWithOverrides() {
+ final String timestamps = "org.hibernate.cache.UpdateTimestampsCache";
+ Properties p = new Properties();
+ InfinispanRegionFactory factory = new InfinispanRegionFactory();
+ p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "mytimestamps-cache");
+ p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "FIFO");
+ p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
+ p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
+ factory.start(null, p);
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
+ try {
+ InfinispanTimestampsRegion region = (InfinispanTimestampsRegion) factory.buildTimestampsRegion(timestamps, p);
+ assertTrue(factory.getDefinedConfigurations().contains(timestamps));
+ fail("Should fail cos no eviction configurations are allowed for timestamp caches");
+ } finally {
+ factory.stop();
+ }
+ }
+
+ public void testBuildQueryRegion() {
+ final String query = "org.hibernate.cache.StandardQueryCache";
+ Properties p = new Properties();
+ InfinispanRegionFactory factory = new InfinispanRegionFactory();
+ factory.start(null, p);
+ CacheManager manager = factory.getCacheManager();
+ manager.getGlobalConfiguration().setTransportClass(null);
+ try {
+ assertTrue(factory.getDefinedConfigurations().contains("local-query"));
+ InfinispanQueryResultsRegion region = (InfinispanQueryResultsRegion) factory.buildQueryResultsRegion(query, p);
+ Cache cache = region.getCache();
+ Configuration cacheCfg = cache.getConfiguration();
+ assertEquals(CacheMode.LOCAL, cacheCfg.getCacheMode());
+ } finally {
+ factory.stop();
+ }
+ }
+
}
Deleted: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanTest.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanTest.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanTest.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -1,41 +0,0 @@
-package org.hibernate.test.cache.infinispan;
-
-import org.hibernate.cache.infinispan.InfinispanRegionFactory;
-import org.hibernate.test.cache.BaseRegionFactoryTestCase;
-
-/**
- * TODO: what is this exactly testing???
- */
-public class InfinispanTest extends BaseRegionFactoryTestCase {
-
- public InfinispanTest( String x ) {
- super( x );
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected Class getRegionFactory() {
- return InfinispanRegionFactory.class;
- }
-
- @Override
- protected String getConfigResourceKey() {
- return null;
- }
-
- @Override
- protected String getConfigResourceLocation() {
- return null;
- }
-
- @Override
- protected boolean useTransactionManager() {
- return false;
- }
-
- @Override
- public String getCacheConcurrencyStrategy() {
- return "read-only";
- }
-
-}
\ No newline at end of file
Modified: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/BasicReadOnlyTestCase.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/BasicReadOnlyTestCase.java 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/BasicReadOnlyTestCase.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -2,8 +2,8 @@
public class BasicReadOnlyTestCase extends AbstractInfinispanTestCase {
- public BasicReadOnlyTestCase( String string ) {
- super( string, "read-only" );
- }
-
+ public BasicReadOnlyTestCase(String string) {
+ super(string, "read-only");
+ }
+
}
\ No newline at end of file
Added: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.hbm.xml
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.hbm.xml (rev 0)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.hbm.xml 2009-08-14 13:10:49 UTC (rev 17302)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ ~ 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
+ -->
+<hibernate-mapping
+ package="org.hibernate.test.cache.infinispan.functional.classloader">
+
+ <class name="Account" table="Accounts">
+
+ <cache usage="transactional"/>
+
+ <id name="id">
+ <generator class="assigned"/>
+ </id>
+
+ <property name="branch" not-null="true"/>
+ <property name="balance" not-null="true"/>
+ <property name="accountHolder" type="serializable" not-null="true"/>
+
+ </class>
+
+</hibernate-mapping>
Property changes on: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.hbm.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.java (rev 0)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/Account.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -0,0 +1,123 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, 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.test.cache.infinispan.functional.classloader;
+
+import java.io.Serializable;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+public class Account implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private Integer id;
+ private AccountHolder accountHolder;
+ private Integer balance;
+ private String branch;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public AccountHolder getAccountHolder() {
+ return accountHolder;
+ }
+
+ public void setAccountHolder(AccountHolder accountHolder) {
+ this.accountHolder = accountHolder;
+ }
+
+ public Integer getBalance() {
+ return balance;
+ }
+
+ public void setBalance(Integer balance) {
+ this.balance = balance;
+ }
+
+ public String getBranch() {
+ return branch;
+ }
+
+ public void setBranch(String branch) {
+ this.branch = branch;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (!(obj instanceof Account))
+ return false;
+ Account acct = (Account) obj;
+ if (!safeEquals(id, acct.id))
+ return false;
+ if (!safeEquals(branch, acct.branch))
+ return false;
+ if (!safeEquals(balance, acct.balance))
+ return false;
+ if (!safeEquals(accountHolder, acct.accountHolder))
+ return false;
+ return true;
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = result * 31 + safeHashCode(id);
+ result = result * 31 + safeHashCode(branch);
+ result = result * 31 + safeHashCode(balance);
+ result = result * 31 + safeHashCode(accountHolder);
+ return result;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(getClass().getName());
+ sb.append("[id=");
+ sb.append(id);
+ sb.append(",branch=");
+ sb.append(branch);
+ sb.append(",balance=");
+ sb.append(balance);
+ sb.append(",accountHolder=");
+ sb.append(accountHolder);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ private static int safeHashCode(Object obj) {
+ return obj == null ? 0 : obj.hashCode();
+ }
+
+ private static boolean safeEquals(Object a, Object b) {
+ return (a == b || (a != null && a.equals(b)));
+ }
+
+}
Added: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/AccountHolder.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/AccountHolder.java (rev 0)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/AccountHolder.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -0,0 +1,97 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, 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.test.cache.infinispan.functional.classloader;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 60233 $
+ */
+public class AccountHolder implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String lastName;
+ private String ssn;
+ private transient boolean deserialized;
+
+ public AccountHolder( ) {
+ this("Stansberry", "123-456-7890");
+ }
+
+ public AccountHolder(String lastName, String ssn)
+ {
+ this.lastName = lastName;
+ this.ssn = ssn;
+ }
+
+ public String getLastName( ) { return this.lastName; }
+ public void setLastName(String lastName) { this.lastName = lastName; }
+
+ public String getSsn( ) { return ssn; }
+ public void setSsn(String ssn) { this.ssn = ssn; }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this) return true;
+ if (!(obj instanceof AccountHolder)) return false;
+ AccountHolder pk = (AccountHolder)obj;
+ if (!lastName.equals(pk.lastName)) return false;
+ if (!ssn.equals(pk.ssn)) return false;
+ return true;
+ }
+
+ public int hashCode( )
+ {
+ int result = 17;
+ result = result * 31 + lastName.hashCode();
+ result = result * 31 + ssn.hashCode();
+ return result;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(getClass().getName());
+ sb.append("[lastName=");
+ sb.append(lastName);
+ sb.append(",ssn=");
+ sb.append(ssn);
+ sb.append(",deserialized=");
+ sb.append(deserialized);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
+ {
+ ois.defaultReadObject();
+ deserialized = true;
+ }
+
+}
Added: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/ClassLoaderTestDAO.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/ClassLoaderTestDAO.java (rev 0)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/ClassLoaderTestDAO.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.test.cache.infinispan.functional.classloader;
+
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.transaction.TransactionManager;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Comment
+ *
+ * @author Brian Stansberry
+ */
+public class ClassLoaderTestDAO {
+ private static final Logger log = LoggerFactory.getLogger(ClassLoaderTestDAO.class);
+
+ private SessionFactory sessionFactory;
+ private TransactionManager tm;
+
+ private Class acctClass;
+ private Class holderClass;
+ private Method setId;
+ private Method setBalance;
+ private Method setBranch;
+ private Method setHolder;
+ private Object smith;
+ private Object jones;
+ private Object barney;
+ private Method setName;
+ private Method setSsn;
+
+ public ClassLoaderTestDAO(SessionFactory factory, TransactionManager tm) throws Exception {
+ this.sessionFactory = factory;
+ this.tm = tm;
+
+ acctClass = Thread.currentThread().getContextClassLoader().loadClass(
+ getClass().getPackage().getName() + ".Account");
+ holderClass = Thread.currentThread().getContextClassLoader().loadClass(
+ getClass().getPackage().getName() + ".AccountHolder");
+ setId = acctClass.getMethod("setId", Integer.class);
+ setBalance = acctClass.getMethod("setBalance", Integer.class);
+ setBranch = acctClass.getMethod("setBranch", String.class);
+ setHolder = acctClass.getMethod("setAccountHolder", holderClass);
+
+ setName = holderClass.getMethod("setLastName", String.class);
+ setSsn = holderClass.getMethod("setSsn", String.class);
+
+ smith = holderClass.newInstance();
+ setName.invoke(smith, "Smith");
+ setSsn.invoke(smith, "1000");
+
+ jones = holderClass.newInstance();
+ setName.invoke(jones, "Jones");
+ setSsn.invoke(jones, "2000");
+
+ barney = holderClass.newInstance();
+ setName.invoke(barney, "Barney");
+ setSsn.invoke(barney, "3000");
+ }
+
+ public Object getSmith() {
+ return smith;
+ }
+
+ public Object getJones() {
+ return jones;
+ }
+
+ public Object getBarney() {
+ return barney;
+ }
+
+ public void updateAccountBranch(Integer id, String branch) throws Exception {
+ log.debug("Updating account " + id + " to branch " + branch);
+ tm.begin();
+ try {
+ Session session = sessionFactory.getCurrentSession();
+ Object account = session.get(acctClass, id);
+ log.debug("Set branch " + branch);
+ setBranch.invoke(account, branch);
+ session.update(account);
+ tm.commit();
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+ log.debug("Updated account " + id + " to branch " + branch);
+ }
+
+ public int getCountForBranch(String branch, boolean useRegion) throws Exception {
+ tm.begin();
+ try {
+ Query query = sessionFactory.getCurrentSession().createQuery(
+ "select account from Account as account where account.branch = :branch");
+ query.setString("branch", branch);
+ if (useRegion) {
+ query.setCacheRegion("AccountRegion");
+ }
+ query.setCacheable(true);
+ int result = query.list().size();
+ tm.commit();
+ return result;
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+
+ }
+
+ public void createAccount(Object holder, Integer id, Integer openingBalance, String branch) throws Exception {
+ log.debug("Creating account " + id);
+ tm.begin();
+ try {
+ Object account = acctClass.newInstance();
+ setId.invoke(account, id);
+ setHolder.invoke(account, holder);
+ setBalance.invoke(account, openingBalance);
+ log.debug("Set branch " + branch);
+ setBranch.invoke(account, branch);
+ sessionFactory.getCurrentSession().persist(account);
+ tm.commit();
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+
+ log.debug("Created account " + id);
+ }
+
+ public Account getAccount(Integer id) throws Exception {
+ log.debug("Getting account " + id);
+ tm.begin();
+ try {
+ Session session = sessionFactory.getCurrentSession();
+ Account acct = (Account) session.get(acctClass, id);
+ tm.commit();
+ return acct;
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+ }
+
+ public Account getAccountWithRefresh(Integer id) throws Exception {
+ log.debug("Getting account " + id + " with refresh");
+ tm.begin();
+ try {
+ Session session = sessionFactory.getCurrentSession();
+ Account acct = (Account) session.get(acctClass, id);
+ session.refresh(acct);
+ acct = (Account) session.get(acctClass, id);
+ tm.commit();
+ return acct;
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+ }
+
+ public void updateAccountBalance(Integer id, Integer newBalance) throws Exception {
+ log.debug("Updating account " + id + " to balance " + newBalance);
+ tm.begin();
+ try {
+ Session session = sessionFactory.getCurrentSession();
+ Object account = session.get(acctClass, id);
+ setBalance.invoke(account, newBalance);
+ session.update(account);
+ tm.commit();
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+ log.debug("Updated account " + id + " to balance " + newBalance);
+ }
+
+ public String getBranch(Object holder, boolean useRegion) throws Exception {
+ tm.begin();
+ try {
+ Query query = sessionFactory.getCurrentSession().createQuery(
+ "select account.branch from Account as account where account.accountHolder = ?");
+ query.setParameter(0, holder);
+ if (useRegion) {
+ query.setCacheRegion("AccountRegion");
+ }
+ query.setCacheable(true);
+ String result = (String) query.list().get(0);
+ tm.commit();
+ return result;
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+ }
+
+ public int getTotalBalance(Object holder, boolean useRegion) throws Exception {
+ List results = null;
+ tm.begin();
+ try {
+ Query query = sessionFactory.getCurrentSession().createQuery(
+ "select account.balance from Account as account where account.accountHolder = ?");
+ query.setParameter(0, holder);
+ if (useRegion) {
+ query.setCacheRegion("AccountRegion");
+ }
+ query.setCacheable(true);
+ results = query.list();
+ tm.commit();
+ } catch (Exception e) {
+ log.error("rolling back", e);
+ tm.rollback();
+ throw e;
+ }
+
+ int total = 0;
+ if (results != null) {
+ for (Iterator it = results.iterator(); it.hasNext();) {
+ total += ((Integer) it.next()).intValue();
+ System.out.println("Total = " + total);
+ }
+ }
+ return total;
+ }
+
+ public void cleanup() throws Exception {
+ internalCleanup();
+ }
+
+ private void internalCleanup() throws Exception {
+ if (sessionFactory != null) {
+ tm.begin();
+ try {
+
+ Session session = sessionFactory.getCurrentSession();
+ Query query = session.createQuery("select account from Account as account");
+ List accts = query.list();
+ if (accts != null) {
+ for (Iterator it = accts.iterator(); it.hasNext();) {
+ try {
+ Object acct = it.next();
+ log.info("Removing " + acct);
+ session.delete(acct);
+ } catch (Exception ignored) {
+ }
+ }
+ }
+ tm.commit();
+ } catch (Exception e) {
+ tm.rollback();
+ throw e;
+ }
+ }
+ }
+
+ public void remove() {
+ try {
+ internalCleanup();
+ } catch (Exception e) {
+ log.error("Caught exception in remove", e);
+ }
+ }
+}
Added: core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/SessionRefreshTestCase.java
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/SessionRefreshTestCase.java (rev 0)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/SessionRefreshTestCase.java 2009-08-14 13:10:49 UTC (rev 17302)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.test.cache.infinispan.functional.cluster;
+
+import javax.transaction.TransactionManager;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.test.cache.infinispan.functional.classloader.Account;
+import org.hibernate.test.cache.infinispan.functional.classloader.ClassLoaderTestDAO;
+import org.infinispan.Cache;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.test.TestingUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * SessionRefreshTestCase.
+ *
+ * @author Galder Zamarreño
+ * @since 4.0
+ */
+public class SessionRefreshTestCase extends AbstractDualNodeTestCase {
+
+ public static final String OUR_PACKAGE = SessionRefreshTestCase.class.getPackage().getName();
+
+ protected final Logger log = LoggerFactory.getLogger(getClass());
+
+ static int test = 0;
+
+ private Cache localCache;
+
+ public SessionRefreshTestCase(String string) {
+ super(string);
+ }
+
+ protected String getEntityCacheConfigName() {
+ return "entity";
+ }
+
+ /**
+ * Disables use of the second level cache for this session factory.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ protected void configureSecondNode(Configuration cfg) {
+ super.configureSecondNode(cfg);
+ cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
+ }
+
+ @Override
+ public String[] getMappings() {
+ return new String[] { "cache/infinispan/functional/classloader/Account.hbm.xml" };
+ }
+
+ @Override
+ protected void cleanupTransactionManagement() {
+ // Don't clean up the managers, just the transactions
+ // Managers are still needed by the long-lived caches
+ DualNodeJtaTransactionManagerImpl.cleanupTransactions();
+ }
+
+ public void testRefreshAfterExternalChange() throws Exception {
+ // First session factory uses a cache
+ CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(AbstractDualNodeTestCase.LOCAL);
+ localCache = localManager.getCache(Account.class.getName());
+ TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(AbstractDualNodeTestCase.LOCAL);
+ SessionFactory localFactory = getEnvironment().getSessionFactory();
+
+ // Second session factory doesn't; just needs a transaction manager
+ TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(AbstractDualNodeTestCase.REMOTE);
+ SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();
+
+ ClassLoaderTestDAO dao0 = new ClassLoaderTestDAO(localFactory, localTM);
+ ClassLoaderTestDAO dao1 = new ClassLoaderTestDAO(remoteFactory, remoteTM);
+
+ Integer id = new Integer(1);
+ dao0.createAccount(dao0.getSmith(), id, new Integer(5), AbstractDualNodeTestCase.LOCAL);
+
+ // Basic sanity check
+ Account acct1 = dao1.getAccount(id);
+ assertNotNull(acct1);
+ assertEquals(AbstractDualNodeTestCase.LOCAL, acct1.getBranch());
+
+ // This dao's session factory isn't caching, so cache won't see this change
+ dao1.updateAccountBranch(id, AbstractDualNodeTestCase.REMOTE);
+
+ // dao1's session doesn't touch the cache,
+ // so reading from dao0 should show a stale value from the cache
+ // (we check to confirm the cache is used)
+ Account acct0 = dao0.getAccount(id);
+ assertNotNull(acct0);
+ assertEquals(AbstractDualNodeTestCase.LOCAL, acct0.getBranch());
+ log.debug("Contents when re-reading from local: " + TestingUtil.printCache(localCache));
+
+ // Now call session.refresh and confirm we get the correct value
+ acct0 = dao0.getAccountWithRefresh(id);
+ assertNotNull(acct0);
+ assertEquals(AbstractDualNodeTestCase.REMOTE, acct0.getBranch());
+ log.debug("Contents after refreshing in remote: " + TestingUtil.printCache(localCache));
+
+ // Double check with a brand new session, in case the other session
+ // for some reason bypassed the 2nd level cache
+ ClassLoaderTestDAO dao0A = new ClassLoaderTestDAO(localFactory, localTM);
+ Account acct0A = dao0A.getAccount(id);
+ assertNotNull(acct0A);
+ assertEquals(AbstractDualNodeTestCase.REMOTE, acct0A.getBranch());
+ log.debug("Contents after creating a new session: " + TestingUtil.printCache(localCache));
+ }
+}
Deleted: core/branches/INFINISPAN/cache-infinispan/src/test/resources/invalid-infinispan-configs.xml
===================================================================
--- core/branches/INFINISPAN/cache-infinispan/src/test/resources/invalid-infinispan-configs.xml 2009-08-13 20:15:08 UTC (rev 17301)
+++ core/branches/INFINISPAN/cache-infinispan/src/test/resources/invalid-infinispan-configs.xml 2009-08-14 13:10:49 UTC (rev 17302)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
- <global>
- <transport transportClass = "org.infinispan.remoting.transport.jgroups.JGroupsTransport"
- clusterName="infinispan-hibernate-cluster" distributedSyncTimeout="50000">
- <!-- Note that the JGroups transport uses sensible defaults if no configuration property is defined. -->
- <properties>
- <!-- TODO: Change to udp.xml once streaming transfer requirement has been removed. -->
- <property name="configurationFile" value="flush-udp.xml"/>
- </properties>
- <!-- See the JGroupsTransport javadocs for more flags -->
- </transport>
- <serialization marshallerClass="org.infinispan.marshall.VersionAwareMarshaller" version="4.0"/>
- </global>
-
- <default>
- <!-- Used to register JMX statistics in any available MBean server -->
- <jmxStatistics enabled="false"/>
- </default>
-
- <!-- Invalid timestamp configuration, cannot be used
- Optimized for timestamp caching. A clustered timestamp cache
- is required if query caching is used, even if the query cache
- itself is configured with CacheMode=LOCAL.
- -->
- <namedCache name="timestamp">
- <clustering mode="INVALIDATION_ASYNC">
- <stateRetrieval fetchInMemoryState="true" timeout="20000"/>
- <async/>
- </clustering>
- <locking isolationLevel="READ_COMMITTED" concurrencyLevel="1000" lockAcquisitionTimeout="15000"/>
- <lazyDeserialization enabled="true"/>
- <!-- Don't ever evict modification timestamps -->
- <eviction wakeUpInterval="0" strategy="NONE"/>
- </namedCache>
-
-</infinispan>
\ No newline at end of file
15 years, 3 months
Returned mail: Data format error
by Bounced mail
The original message was received at Fri, 14 Aug 2009 00:01:09 +0200 from lists.jboss.org [82.190.200.251]
----- The following addresses had permanent fatal errors -----
<hibernate-commits(a)lists.jboss.org>
----- Transcript of session follows -----
... while talking to 158.110.166.105:
554 5.0.0 Service unavailable; [64.225.76.228] blocked using relays.osirusoft.com
Session aborted, reason: lost connection
15 years, 3 months
Hibernate SVN: r17301 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-08-13 16:15:08 -0400 (Thu, 13 Aug 2009)
New Revision: 17301
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
Log:
add property to disable metamodel generation, just in case as it's undertested
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java 2009-08-13 19:30:57 UTC (rev 17300)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java 2009-08-13 20:15:08 UTC (rev 17301)
@@ -65,7 +65,13 @@
this.sessionInterceptorClass = sessionInterceptorClass;
@SuppressWarnings( "unchecked" )
final Iterator<PersistentClass> classes = cfg.getClassMappings();
- this.metamodel = new MetamodelImpl( classes );
+ //a safe guard till we are confident that metamodel is wll tested
+ if ( !"disabled".equalsIgnoreCase( cfg.getProperty( "hibernate.ejb.metamodel.generation" ) ) ) {
+ this.metamodel = new MetamodelImpl( classes );
+ }
+ else {
+ this.metamodel = null;
+ }
this.criteriaQueryBuilder = new QueryBuilderImpl( this );
}
15 years, 3 months
Hibernate SVN: r17300 - in core/trunk: core/src/main/antlr and 10 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-08-13 15:30:57 -0400 (Thu, 13 Aug 2009)
New Revision: 17300
Added:
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AbstractMapComponentNode.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AggregatedSelectExpression.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapEntryNode.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapKeyNode.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapValueNode.java
core/trunk/core/src/main/java/org/hibernate/sql/AliasGenerator.java
core/trunk/core/src/main/java/org/hibernate/sql/SelectExpression.java
Modified:
core/trunk/core/pom.xml
core/trunk/core/src/main/antlr/hql-sql.g
core/trunk/core/src/main/antlr/hql.g
core/trunk/core/src/main/antlr/sql-gen.g
core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlParser.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/QueryTranslatorImpl.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlGenerator.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/ConstructorNode.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/DotNode.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/SelectClause.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTPrinter.java
core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTUtil.java
core/trunk/core/src/main/java/org/hibernate/loader/hql/QueryLoader.java
core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
core/trunk/core/src/main/java/org/hibernate/persister/entity/Queryable.java
core/trunk/core/src/main/java/org/hibernate/sql/SelectFragment.java
core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java
core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java
core/trunk/core/src/main/java/org/hibernate/util/ArrayHelper.java
core/trunk/core/src/main/java/org/hibernate/util/StringHelper.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
core/trunk/testsuite/src/test/resources/log4j.properties
Log:
HHH-4081 - Support for JPA 2.0 "qualified identification variables" (KEY, VALUE and ENTRY)
Modified: core/trunk/core/pom.xml
===================================================================
--- core/trunk/core/pom.xml 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/pom.xml 2009-08-13 19:30:57 UTC (rev 17300)
@@ -76,6 +76,8 @@
<version>${antlrPluginVersion}</version>
<configuration>
<grammars>hql.g,hql-sql.g,sql-gen.g,order-by.g,order-by-render.g</grammars>
+ <traceParser>true</traceParser>
+ <traceTreeParser>true</traceTreeParser>
</configuration>
<executions>
<execution>
Modified: core/trunk/core/src/main/antlr/hql-sql.g
===================================================================
--- core/trunk/core/src/main/antlr/hql-sql.g 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/antlr/hql-sql.g 2009-08-13 19:30:57 UTC (rev 17300)
@@ -230,6 +230,10 @@
protected void prepareLogicOperator(AST operator) throws SemanticException { }
protected void prepareArithmeticOperator(AST operator) throws SemanticException { }
+
+ protected void processMapComponentReference(AST node) throws SemanticException { }
+
+ protected void validateMapPropertyExpression(AST node) throws SemanticException { }
}
// The main statement rule.
@@ -640,7 +644,11 @@
;
propertyRef!
- : #(d:DOT lhs:propertyRefLhs rhs:propertyName ) {
+ : mcr:mapComponentReference {
+ resolve( #mcr );
+ #propertyRef = #mcr;
+ }
+ | #(d:DOT lhs:propertyRefLhs rhs:propertyName ) {
// This gives lookupProperty() a chance to transform the tree to process collection properties (.elements, etc).
#propertyRef = #(#d, #lhs, #rhs);
#propertyRef = lookupProperty(#propertyRef,false,true);
@@ -672,6 +680,18 @@
}
;
+mapComponentReference
+ : #( KEY mapPropertyExpression )
+ | #( VALUE mapPropertyExpression )
+ | #( ENTRY mapPropertyExpression )
+ ;
+
+mapPropertyExpression
+ : e:expr {
+ validateMapPropertyExpression( #e );
+ }
+ ;
+
parameter!
: #(c:COLON a:identifier) {
// Create a NAMED_PARAM node instead of (COLON IDENT).
Modified: core/trunk/core/src/main/antlr/hql.g
===================================================================
--- core/trunk/core/src/main/antlr/hql.g 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/antlr/hql.g 2009-08-13 19:30:57 UTC (rev 17300)
@@ -99,6 +99,9 @@
OBJECT="object";
OF="of";
TRAILING="trailing";
+ KEY="key";
+ VALUE="value";
+ ENTRY="entry";
// -- Synthetic token types --
AGGREGATE; // One of the aggregate functions (e.g. min, max, avg)
@@ -633,7 +636,8 @@
// NOTE: handleDotIdent() is called immediately after the first IDENT is recognized because
// the method looks a head to find keywords after DOT and turns them into identifiers.
identPrimary
- : identifier { handleDotIdent(); }
+ : mapComponentReference
+ | identifier { handleDotIdent(); }
( options { greedy=true; } : DOT^ ( identifier | ELEMENTS | o:OBJECT { #o.setType(IDENT); } ) )*
( options { greedy=true; } :
( op:OPEN^ { #op.setType(METHOD_CALL);} exprList CLOSE! )
@@ -642,12 +646,10 @@
| aggregate
;
-//## aggregate:
-//## ( aggregateFunction OPEN path CLOSE ) | ( COUNT OPEN STAR CLOSE ) | ( COUNT OPEN (DISTINCT | ALL) path CLOSE );
+mapComponentReference
+ : ( KEY^ | VALUE^ | ENTRY^ ) OPEN! path CLOSE!
+ ;
-//## aggregateFunction:
-//## COUNT | 'sum' | 'avg' | 'max' | 'min';
-
aggregate
: ( SUM^ | AVG^ | MAX^ | MIN^ ) OPEN! additiveExpression CLOSE! { #aggregate.setType(AGGREGATE); }
// Special case for count - It's 'parameters' can be keywords.
Modified: core/trunk/core/src/main/antlr/sql-gen.g
===================================================================
--- core/trunk/core/src/main/antlr/sql-gen.g 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/antlr/sql-gen.g 2009-08-13 19:30:57 UTC (rev 17300)
@@ -207,6 +207,7 @@
selectExpr
: e:selectAtom { out(e); }
+ | mcr:mapComponentReference { out(mcr); }
| count
| #(CONSTRUCTOR (DOT | IDENT) ( selectColumn )+ )
| methodCall
@@ -240,6 +241,12 @@
| SELECT_EXPR
;
+mapComponentReference
+ : KEY
+ | VALUE
+ | ENTRY
+ ;
+
// The from-clause piece is all goofed up. Currently, nodes of type FROM_FRAGMENT
// and JOIN_FRAGMENT can occur at any level in the FromClause sub-tree. We really
// should come back and clean this up at some point; which I think will require
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlParser.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlParser.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlParser.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -42,6 +42,7 @@
import org.hibernate.hql.ast.util.ASTPrinter;
import org.hibernate.hql.ast.util.ASTUtil;
import org.hibernate.QueryException;
+import org.hibernate.util.StringHelper;
/**
* Implements the semantic action methods defined in the HQL base parser to keep the grammar
@@ -73,6 +74,28 @@
initialize();
}
+
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+
+ public void traceIn(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ log.trace( prefix + ruleName );
+ }
+
+ public void traceOut(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ log.trace( prefix + ruleName );
+ }
+
public void reportError(RecognitionException e) {
parseErrorHandler.reportError( e ); // Use the delegate.
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -94,6 +94,7 @@
import org.hibernate.type.DbTimestampType;
import org.hibernate.usertype.UserVersionType;
import org.hibernate.util.ArrayHelper;
+import org.hibernate.util.StringHelper;
import antlr.ASTFactory;
import antlr.RecognitionException;
@@ -169,6 +170,34 @@
}
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+ public void traceIn(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ String traceText = ruleName + " (" + buildTraceNodeName(tree) + ")";
+ log.trace( prefix + traceText );
+ }
+
+ private String buildTraceNodeName(AST tree) {
+ return tree == null
+ ? "???"
+ : tree.getText() + " [" + printer.getTokenTypeName( tree.getType() ) + "]";
+ }
+
+ public void traceOut(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ log.trace( prefix + ruleName );
+ }
+
+
protected void prepareFromClauseInputTree(AST fromClauseInput) {
if ( !isSubQuery() ) {
// // inject param specifications to account for dynamic filter param values
@@ -826,11 +855,12 @@
// This is called when it's time to fully resolve a path expression.
int type = node.getType();
switch ( type ) {
- case DOT:
+ case DOT: {
DotNode dot = ( DotNode ) node;
dot.resolveSelectExpression();
break;
- case ALIAS_REF:
+ }
+ case ALIAS_REF: {
// Notify the FROM element that it is being referenced by the select.
FromReferenceNode aliasRefNode = ( FromReferenceNode ) node;
//aliasRefNode.resolve( false, false, aliasRefNode.getText() ); //TODO: is it kosher to do it here?
@@ -839,8 +869,11 @@
if ( fromElement != null ) {
fromElement.setIncludeSubclasses( true );
}
- default:
break;
+ }
+ default: {
+ break;
+ }
}
}
@@ -1101,6 +1134,22 @@
( ( OperatorNode ) operator ).initialize();
}
+ protected void validateMapPropertyExpression(AST node) throws SemanticException {
+ try {
+ FromReferenceNode fromReferenceNode = (FromReferenceNode) node;
+ QueryableCollection collectionPersister = fromReferenceNode.getFromElement().getQueryableCollection();
+ if ( ! Map.class.isAssignableFrom( collectionPersister.getCollectionType().getReturnedClass() ) ) {
+ throw new SemanticException( "node did not reference a map" );
+ }
+ }
+ catch ( SemanticException se ) {
+ throw se;
+ }
+ catch ( Throwable t ) {
+ throw new SemanticException( "node did not reference a map" );
+ }
+ }
+
public static void panic() {
throw new QueryException( "TreeWalker: panic" );
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/QueryTranslatorImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/QueryTranslatorImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/QueryTranslatorImpl.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -288,7 +288,6 @@
void showHqlAst(AST hqlAst) {
if ( AST_LOG.isDebugEnabled() ) {
ASTPrinter printer = new ASTPrinter( HqlTokenTypes.class );
- printer.setShowClassNames( false ); // The class names aren't interesting in the first tree.
AST_LOG.debug( printer.showAsString( hqlAst, "--- HQL AST ---" ) );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlASTFactory.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -65,6 +65,9 @@
import org.hibernate.hql.ast.tree.BooleanLiteralNode;
import org.hibernate.hql.ast.tree.IsNullLogicOperatorNode;
import org.hibernate.hql.ast.tree.IsNotNullLogicOperatorNode;
+import org.hibernate.hql.ast.tree.MapKeyNode;
+import org.hibernate.hql.ast.tree.MapValueNode;
+import org.hibernate.hql.ast.tree.MapEntryNode;
import java.lang.reflect.Constructor;
@@ -187,6 +190,15 @@
return IsNotNullLogicOperatorNode.class;
case EXISTS:
return UnaryLogicOperatorNode.class;
+ case KEY: {
+ return MapKeyNode.class;
+ }
+ case VALUE: {
+ return MapValueNode.class;
+ }
+ case ENTRY: {
+ return MapEntryNode.class;
+ }
default:
return SqlNode.class;
} // switch
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlGenerator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlGenerator.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/SqlGenerator.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -32,16 +32,22 @@
import antlr.RecognitionException;
import antlr.collections.AST;
import org.hibernate.QueryException;
+import org.hibernate.util.StringHelper;
import org.hibernate.param.ParameterSpecification;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.hql.antlr.SqlGeneratorBase;
+import org.hibernate.hql.antlr.SqlTokenTypes;
import org.hibernate.hql.ast.tree.MethodNode;
import org.hibernate.hql.ast.tree.FromElement;
import org.hibernate.hql.ast.tree.Node;
import org.hibernate.hql.ast.tree.ParameterNode;
import org.hibernate.hql.ast.tree.ParameterContainer;
+import org.hibernate.hql.ast.util.ASTPrinter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Generates SQL by overriding callback methods in the base class, which does
* the actual SQL AST walking.
@@ -50,10 +56,7 @@
* @author Steve Ebersole
*/
public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
- /**
- * Handles parser errors.
- */
- private ParseErrorHandler parseErrorHandler;
+ private static final Logger log = LoggerFactory.getLogger( SqlGenerator.class );
/**
* all append invocations on the buf should go through this Output instance variable.
@@ -64,12 +67,40 @@
*/
private SqlWriter writer = new DefaultWriter();
+ private ParseErrorHandler parseErrorHandler;
private SessionFactoryImplementor sessionFactory;
-
private LinkedList outputStack = new LinkedList();
-
+ private final ASTPrinter printer = new ASTPrinter( SqlTokenTypes.class );
private List collectedParameters = new ArrayList();
+
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+ public void traceIn(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ String traceText = ruleName + " (" + buildTraceNodeName(tree) + ")";
+ log.trace( prefix + traceText );
+ }
+
+ private String buildTraceNodeName(AST tree) {
+ return tree == null
+ ? "???"
+ : tree.getText() + " [" + printer.getTokenTypeName( tree.getType() ) + "]";
+ }
+
+ public void traceOut(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ log.trace( prefix + ruleName );
+ }
+
public List getCollectedParameters() {
return collectedParameters;
}
Added: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AbstractMapComponentNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AbstractMapComponentNode.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AbstractMapComponentNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2009, 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.hql.ast.tree;
+
+import java.util.Map;
+
+import antlr.SemanticException;
+import antlr.collections.AST;
+
+import org.hibernate.hql.antlr.HqlSqlTokenTypes;
+import org.hibernate.hql.ast.util.ColumnHelper;
+import org.hibernate.type.CollectionType;
+import org.hibernate.type.Type;
+import org.hibernate.persister.collection.QueryableCollection;
+import org.hibernate.util.StringHelper;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public abstract class AbstractMapComponentNode extends FromReferenceNode implements HqlSqlTokenTypes {
+ private String[] columns;
+
+ public FromReferenceNode getMapReference() {
+ return ( FromReferenceNode ) getFirstChild();
+ }
+
+ public String[] getColumns() {
+ return columns;
+ }
+
+ public void setScalarColumnText(int i) throws SemanticException {
+ ColumnHelper.generateScalarColumns( this, getColumns(), i );
+ }
+
+ public void resolve(
+ boolean generateJoin,
+ boolean implicitJoin,
+ String classAlias,
+ AST parent) throws SemanticException {
+ if ( parent != null ) {
+ throw attemptedDereference();
+ }
+
+ FromReferenceNode mapReference = getMapReference();
+ mapReference.resolve( true, true );
+ if ( mapReference.getDataType().isCollectionType() ) {
+ CollectionType collectionType = (CollectionType) mapReference.getDataType();
+ if ( Map.class.isAssignableFrom( collectionType.getReturnedClass() ) ) {
+ FromElement sourceFromElement = mapReference.getFromElement();
+ setFromElement( sourceFromElement );
+ setDataType( resolveType( sourceFromElement.getQueryableCollection() ) );
+ this.columns = resolveColumns( sourceFromElement.getQueryableCollection() );
+ initText( this.columns );
+ setFirstChild( null );
+ return;
+ }
+ }
+
+ throw nonMap();
+ }
+
+ private void initText(String[] columns) {
+ String text = StringHelper.join( ", ", columns );
+ if ( columns.length > 1 && getWalker().isComparativeExpressionClause() ) {
+ text = "(" + text + ")";
+ }
+ setText( text );
+ }
+
+ protected abstract String expressionDescription();
+ protected abstract String[] resolveColumns(QueryableCollection collectionPersister);
+ protected abstract Type resolveType(QueryableCollection collectionPersister);
+
+ protected SemanticException attemptedDereference() {
+ return new SemanticException( expressionDescription() + " expression cannot be further de-referenced" );
+ }
+
+ protected SemanticException nonMap() {
+ return new SemanticException( expressionDescription() + " expression did not reference map property" );
+ }
+
+ public void resolveIndex(AST parent) throws SemanticException {
+ throw new UnsupportedOperationException( expressionDescription() + " expression cannot be the source for an index operation" );
+ }
+}
Added: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AggregatedSelectExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AggregatedSelectExpression.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/AggregatedSelectExpression.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2009, 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.hql.ast.tree;
+
+import java.util.List;
+
+import org.hibernate.transform.ResultTransformer;
+
+/**
+ * Contract for a select expression which aggregates other select expressions together into a single return
+ *
+ * @author Steve Ebersole
+ */
+public interface AggregatedSelectExpression extends SelectExpression {
+ /**
+ * Retrieves a list of the selection {@link org.hibernate.type.Type types} being aggregated
+ *
+ * @return The list of types.
+ */
+ public List getAggregatedSelectionTypeList();
+
+ /**
+ * Retrieve the aliases for the columns aggregated here.
+ *
+ * @return The column aliases.
+ */
+ public String[] getAggregatedAliases();
+
+ /**
+ * Retrieve the {@link ResultTransformer} responsible for building aggregated select expression results into their
+ * aggregated form.
+ *
+ * @return The appropriate transformer
+ */
+ public ResultTransformer getResultTransformer();
+}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/ConstructorNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/ConstructorNode.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/ConstructorNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -29,6 +29,10 @@
import java.util.List;
import org.hibernate.PropertyNotFoundException;
+import org.hibernate.QueryException;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.transform.AliasToBeanConstructorResultTransformer;
+import org.hibernate.transform.Transformers;
import org.hibernate.hql.ast.DetailedSemanticException;
import org.hibernate.type.Type;
import org.hibernate.util.ReflectHelper;
@@ -42,13 +46,25 @@
*
* @author josh
*/
-public class ConstructorNode extends SelectExpressionList implements SelectExpression {
-
+public class ConstructorNode extends SelectExpressionList implements AggregatedSelectExpression {
private Constructor constructor;
private Type[] constructorArgumentTypes;
private boolean isMap;
private boolean isList;
-
+
+ public ResultTransformer getResultTransformer() {
+ if ( constructor != null ) {
+ return new AliasToBeanConstructorResultTransformer( constructor );
+ }
+ else if ( isMap ) {
+ return Transformers.ALIAS_TO_ENTITY_MAP;
+ }
+ else if ( isList ) {
+ return Transformers.TO_LIST;
+ }
+ throw new QueryException( "Unable to determine proper dynamic-instantiation tranformer to use." );
+ }
+
public boolean isMap() {
return isMap;
}
@@ -56,8 +72,17 @@
public boolean isList() {
return isList;
}
-
- public String[] getAliases() {
+
+ private String[] aggregatedAliases;
+
+ public String[] getAggregatedAliases() {
+ if ( aggregatedAliases == null ) {
+ aggregatedAliases = buildAggregatedAliases();
+ }
+ return aggregatedAliases;
+ }
+
+ private String[] buildAggregatedAliases() {
SelectExpression[] selectExpressions = collectSelectExpressions();
String[] aliases = new String[selectExpressions.length] ;
for ( int i=0; i<selectExpressions.length; i++ ) {
@@ -154,6 +179,10 @@
return Arrays.asList( constructorArgumentTypes );
}
+ public List getAggregatedSelectionTypeList() {
+ return getConstructorArgumentTypeList();
+ }
+
public FromElement getFromElement() {
return null;
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/DotNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/DotNode.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/DotNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -28,7 +28,6 @@
import org.hibernate.engine.JoinSequence;
import org.hibernate.hql.CollectionProperties;
import org.hibernate.hql.antlr.SqlTokenTypes;
-import org.hibernate.hql.ast.util.ASTPrinter;
import org.hibernate.hql.ast.util.ASTUtil;
import org.hibernate.hql.ast.util.ColumnHelper;
import org.hibernate.persister.collection.QueryableCollection;
@@ -140,7 +139,7 @@
StringBuffer buf = new StringBuffer();
FromElement fromElement = getFromElement();
buf.append( "{propertyName=" ).append( propertyName );
- buf.append( ",dereferenceType=" ).append( ASTPrinter.getConstantName( getClass(), dereferenceType ) );
+ buf.append( ",dereferenceType=" ).append( getWalker().getASTPrinter().getTokenTypeName( dereferenceType ) );
buf.append( ",propertyPath=" ).append( propertyPath );
buf.append( ",path=" ).append( getPath() );
if ( fromElement != null ) {
Added: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapEntryNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapEntryNode.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapEntryNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2009, 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.hql.ast.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+
+import antlr.SemanticException;
+
+import org.hibernate.HibernateException;
+import org.hibernate.sql.SelectExpression;
+import org.hibernate.sql.AliasGenerator;
+import org.hibernate.sql.SelectFragment;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.hql.NameGenerator;
+import org.hibernate.persister.collection.QueryableCollection;
+import org.hibernate.persister.entity.Queryable;
+import org.hibernate.transform.BasicTransformerAdapter;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.type.Type;
+import org.hibernate.type.EntityType;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class MapEntryNode extends AbstractMapComponentNode implements AggregatedSelectExpression {
+ private static class LocalAliasGenerator implements AliasGenerator {
+ private final int base;
+ private int counter = 0;
+
+ private LocalAliasGenerator(int base) {
+ this.base = base;
+ }
+
+ public String generateAlias(String sqlExpression) {
+ return NameGenerator.scalarName( base, counter++ );
+ }
+ }
+
+ protected String expressionDescription() {
+ return "entry(*)";
+ }
+
+ protected Type resolveType(QueryableCollection collectionPersister) {
+ Type keyType = collectionPersister.getIndexType();
+ Type valueType = collectionPersister.getElementType();
+ types.add( keyType );
+ types.add( valueType );
+ mapEntryBuilder = new MapEntryBuilder();
+
+ // an entry (as an aggregated select expression) does not have a type...
+ return null;
+ }
+
+ protected String[] resolveColumns(QueryableCollection collectionPersister) {
+ List selections = new ArrayList();
+ determineKeySelectExpressions( collectionPersister, selections );
+ determineValueSelectExpressions( collectionPersister, selections );
+
+ String text = "";
+ String[] columns = new String[selections.size()];
+ for ( int i = 0; i < selections.size(); i++ ) {
+ SelectExpression selectExpression = (SelectExpression) selections.get(i);
+ text += ( ", " + selectExpression.getExpression() + " as " + selectExpression.getAlias() );
+ columns[i] = selectExpression.getExpression();
+ }
+
+ text = text.substring( 2 ); //strip leading ", "
+ setText( text );
+ setResolved();
+ return columns;
+ }
+
+ private void determineKeySelectExpressions(QueryableCollection collectionPersister, List selections) {
+ AliasGenerator aliasGenerator = new LocalAliasGenerator( 0 );
+ appendSelectExpressions( collectionPersister.getIndexColumnNames(), selections, aliasGenerator );
+ Type keyType = collectionPersister.getIndexType();
+ if ( keyType.isAssociationType() ) {
+ EntityType entityType = (EntityType) keyType;
+ Queryable keyEntityPersister = ( Queryable ) sfi().getEntityPersister(
+ entityType.getAssociatedEntityName( sfi() )
+ );
+ SelectFragment fragment = keyEntityPersister.propertySelectFragmentFragment(
+ collectionTableAlias(),
+ null,
+ false
+ );
+ appendSelectExpressions( fragment, selections, aliasGenerator );
+ }
+ }
+
+ private void appendSelectExpressions(String[] columnNames, List selections, AliasGenerator aliasGenerator) {
+ for ( int i = 0; i < columnNames.length; i++ ) {
+ selections.add(
+ new BasicSelectExpression(
+ collectionTableAlias() + '.' + columnNames[i],
+ aliasGenerator.generateAlias( columnNames[i] )
+ )
+ );
+ }
+ }
+
+ private void appendSelectExpressions(SelectFragment fragment, List selections, AliasGenerator aliasGenerator) {
+ Iterator itr = fragment.getColumns().iterator();
+ while ( itr.hasNext() ) {
+ final String column = (String) itr.next();
+ selections.add(
+ new BasicSelectExpression( column, aliasGenerator.generateAlias( column ) )
+ );
+ }
+ }
+
+ private void determineValueSelectExpressions(QueryableCollection collectionPersister, List selections) {
+ AliasGenerator aliasGenerator = new LocalAliasGenerator( 1 );
+ appendSelectExpressions( collectionPersister.getElementColumnNames(), selections, aliasGenerator );
+ Type valueType = collectionPersister.getElementType();
+ if ( valueType.isAssociationType() ) {
+ EntityType valueEntityType = (EntityType) valueType;
+ Queryable valueEntityPersister = ( Queryable ) sfi().getEntityPersister(
+ valueEntityType.getAssociatedEntityName( sfi() )
+ );
+ SelectFragment fragment = valueEntityPersister.propertySelectFragmentFragment(
+ elementTableAlias(),
+ null,
+ false
+ );
+ appendSelectExpressions( fragment, selections, aliasGenerator );
+ }
+ }
+
+ private String collectionTableAlias() {
+ return getFromElement().getCollectionTableAlias() != null
+ ? getFromElement().getCollectionTableAlias()
+ : getFromElement().getTableAlias();
+ }
+
+ private String elementTableAlias() {
+ return getFromElement().getTableAlias();
+ }
+
+ private static class BasicSelectExpression implements SelectExpression {
+ private final String expression;
+ private final String alias;
+
+ private BasicSelectExpression(String expression, String alias) {
+ this.expression = expression;
+ this.alias = alias;
+ }
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+ }
+
+ public SessionFactoryImplementor sfi() {
+ return getSessionFactoryHelper().getFactory();
+ }
+
+ public void setText(String s) {
+ if ( isResolved() ) {
+ return;
+ }
+ super.setText( s );
+ }
+
+ public void setScalarColumnText(int i) throws SemanticException {
+ }
+
+ public boolean isScalar() {
+ // Constructors are always considered scalar results.
+ return true;
+ }
+
+ private List types = new ArrayList(4); // size=4 to prevent resizing
+
+ public List getAggregatedSelectionTypeList() {
+ return types;
+ }
+
+ private static final String[] ALIASES = { null, null };
+
+ public String[] getAggregatedAliases() {
+ return ALIASES;
+ }
+
+ private MapEntryBuilder mapEntryBuilder;
+
+ public ResultTransformer getResultTransformer() {
+ return mapEntryBuilder;
+ }
+
+ private static class MapEntryBuilder extends BasicTransformerAdapter {
+ public Object transformTuple(Object[] tuple, String[] aliases) {
+ if ( tuple.length != 2 ) {
+ throw new HibernateException( "Expecting exactly 2 tuples to transform into Map.Entry" );
+ }
+ return new EntryAdapter( tuple[0], tuple[1] );
+ }
+ }
+
+ private static class EntryAdapter implements Map.Entry {
+ private final Object key;
+ private Object value;
+
+ private EntryAdapter(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object setValue(Object value) {
+ Object old = this.value;
+ this.value = value;
+ return old;
+ }
+
+ public boolean equals(Object o) {
+ // IMPL NOTE : nulls are considered equal for keys and values according to Map.Entry contract
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+ EntryAdapter that = ( EntryAdapter ) o;
+
+ // make sure we have the same types...
+ return ( key == null ? that.key == null : key.equals( that.key ) )
+ && ( value == null ? that.value == null : value.equals( that.value ) );
+
+ }
+
+ public int hashCode() {
+ int keyHash = key == null ? 0 : key.hashCode();
+ int valueHash = value == null ? 0 : value.hashCode();
+ return keyHash ^ valueHash;
+ }
+ }
+}
Added: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapKeyNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapKeyNode.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapKeyNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2009, 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.hql.ast.tree;
+
+import org.hibernate.type.Type;
+import org.hibernate.persister.collection.QueryableCollection;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class MapKeyNode extends AbstractMapComponentNode {
+ protected String expressionDescription() {
+ return "key(*)";
+ }
+
+ protected String[] resolveColumns(QueryableCollection collectionPersister) {
+ return collectionPersister.getIndexColumnNames();
+ }
+
+ protected Type resolveType(QueryableCollection collectionPersister) {
+ return collectionPersister.getIndexType();
+ }
+}
Added: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapValueNode.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapValueNode.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/MapValueNode.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2009, 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.hql.ast.tree;
+
+import org.hibernate.type.Type;
+import org.hibernate.persister.collection.QueryableCollection;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class MapValueNode extends AbstractMapComponentNode {
+ protected String expressionDescription() {
+ return "value(*)";
+ }
+
+ protected String[] resolveColumns(QueryableCollection collectionPersister) {
+ return collectionPersister.getElementColumnNames();
+ }
+
+ protected Type resolveType(QueryableCollection collectionPersister) {
+ return collectionPersister.getElementType();
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/SelectClause.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/SelectClause.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/SelectClause.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -24,7 +24,6 @@
*/
package org.hibernate.hql.ast.tree;
-import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -53,10 +52,12 @@
//private Type[] sqlResultTypes;
private Type[] queryReturnTypes;
private String[][] columnNames;
- private ConstructorNode constructorNode;
private List collectionFromElements;
private String[] aliases;
+ // Currently we can only have one...
+ private AggregatedSelectExpression aggregatedSelectExpression;
+
/**
* Does this SelectClause represent a scalar query
*
@@ -99,6 +100,8 @@
/**
* The HQL aliases, or generated aliases
+ *
+ * @return the aliases
*/
public String[] getQueryReturnAliases() {
return aliases;
@@ -113,29 +116,15 @@
return columnNames;
}
- /**
- * The constructor to use for dynamic instantiation queries.
- *
- * @return The appropriate Constructor reference, or null if not a
- * dynamic instantiation query.
- */
- public Constructor getConstructor() {
- return constructorNode == null ? null : constructorNode.getConstructor();
+ public AggregatedSelectExpression getAggregatedSelectExpression() {
+ return aggregatedSelectExpression;
}
-
- public boolean isMap() {
- return constructorNode == null ? false : constructorNode.isMap();
- }
-
- public boolean isList() {
- return constructorNode == null ? false : constructorNode.isList();
- }
-
+
/**
* Prepares an explicitly defined select clause.
*
* @param fromClause The from clause linked to this select clause.
- * @throws SemanticException
+ * @throws SemanticException indicates a semntic issue with the explicit select clause.
*/
public void initializeExplicitSelectClause(FromClause fromClause) throws SemanticException {
if ( prepared ) {
@@ -152,30 +141,28 @@
SelectExpression[] selectExpressions = collectSelectExpressions();
for ( int i = 0; i < selectExpressions.length; i++ ) {
- SelectExpression expr = selectExpressions[i];
+ SelectExpression selectExpression = selectExpressions[i];
- if ( expr.isConstructor() ) {
- constructorNode = ( ConstructorNode ) expr;
- List constructorArgumentTypeList = constructorNode.getConstructorArgumentTypeList();
- //sqlResultTypeList.addAll( constructorArgumentTypeList );
- queryReturnTypeList.addAll( constructorArgumentTypeList );
+ if ( AggregatedSelectExpression.class.isInstance( selectExpression ) ) {
+ aggregatedSelectExpression = (AggregatedSelectExpression) selectExpression;
+ queryReturnTypeList.addAll( aggregatedSelectExpression.getAggregatedSelectionTypeList() );
scalarSelect = true;
}
else {
- Type type = expr.getDataType();
+ Type type = selectExpression.getDataType();
if ( type == null ) {
- throw new IllegalStateException( "No data type for node: " + expr.getClass().getName() + " "
- + new ASTPrinter( SqlTokenTypes.class ).showAsString( ( AST ) expr, "" ) );
+ throw new IllegalStateException( "No data type for node: " + selectExpression.getClass().getName() + " "
+ + new ASTPrinter( SqlTokenTypes.class ).showAsString( ( AST ) selectExpression, "" ) );
}
//sqlResultTypeList.add( type );
// If the data type is not an association type, it could not have been in the FROM clause.
- if ( expr.isScalar() ) {
+ if ( selectExpression.isScalar() ) {
scalarSelect = true;
}
- if ( isReturnableEntity( expr ) ) {
- fromElementsForLoad.add( expr.getFromElement() );
+ if ( isReturnableEntity( selectExpression ) ) {
+ fromElementsForLoad.add( selectExpression.getFromElement() );
}
// Always add the type to the return type list.
@@ -253,8 +240,7 @@
finishInitialization( /*sqlResultTypeList,*/ queryReturnTypeList );
}
- private void finishInitialization(/*ArrayList sqlResultTypeList,*/ ArrayList queryReturnTypeList) {
- //sqlResultTypes = ( Type[] ) sqlResultTypeList.toArray( new Type[sqlResultTypeList.size()] );
+ private void finishInitialization(ArrayList queryReturnTypeList) {
queryReturnTypes = ( Type[] ) queryReturnTypeList.toArray( new Type[queryReturnTypeList.size()] );
initializeColumnNames();
prepared = true;
@@ -287,7 +273,6 @@
ASTAppender appender = new ASTAppender( getASTFactory(), this ); // Get ready to start adding nodes.
int size = fromElements.size();
- ArrayList sqlResultTypeList = new ArrayList( size );
ArrayList queryReturnTypeList = new ArrayList( size );
Iterator iterator = fromElements.iterator();
@@ -305,7 +290,6 @@
queryReturnTypeList.add( type );
}
fromElementsForLoad.add( fromElement );
- sqlResultTypeList.add( type );
// Generate the select expression.
String text = fromElement.renderIdentifierSelect( size, k );
SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
@@ -325,7 +309,7 @@
else {
renderNonScalarSelects( selectExpressions, fromClause );
}
- finishInitialization( /*sqlResultTypeList,*/ queryReturnTypeList );
+ finishInitialization( queryReturnTypeList );
}
public static boolean VERSION2_SQL = false;
@@ -359,7 +343,7 @@
private boolean isReturnableEntity(SelectExpression selectExpression) throws SemanticException {
FromElement fromElement = selectExpression.getFromElement();
boolean isFetchOrValueCollection = fromElement != null &&
- ( fromElement.isFetch() || fromElement.isCollectionOfValuesOrComponents() );
+ ( fromElement.isFetch() || fromElement.isCollectionOfValuesOrComponents() );
if ( isFetchOrValueCollection ) {
return false;
}
@@ -378,7 +362,7 @@
}
private void initAliases(SelectExpression[] selectExpressions) {
- if (constructorNode==null) {
+ if ( aggregatedSelectExpression == null ) {
aliases = new String[selectExpressions.length];
for ( int i=0; i<selectExpressions.length; i++ ) {
String alias = selectExpressions[i].getAlias();
@@ -386,7 +370,7 @@
}
}
else {
- aliases = constructorNode.getAliases();
+ aliases = aggregatedSelectExpression.getAggregatedAliases();
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTPrinter.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTPrinter.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTPrinter.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -27,10 +27,7 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Map;
import org.hibernate.hql.ast.tree.DisplayableNode;
@@ -39,71 +36,62 @@
import antlr.collections.AST;
/**
- * An 'ASCII art' AST printer for debugging ANTLR grammars.
+ * Utility for generating pretty "ASCII art" representations of syntax trees.
*
* @author Joshua Davis
+ * @author Steve Ebersole
*/
public class ASTPrinter {
- private Map tokenTypeNamesByTokenType;
- private Class tokenTypeConstants;
- private boolean showClassNames = true;
+ private final Map tokenTypeNameCache;
+ private final boolean showClassNames;
/**
- * Constructs an org.hibernate.hql.antlr.ASTPrinter, given the class that contains the token type
- * constants (typically the '{grammar}TokenTypes' interface generated by
- * ANTLR).
+ * Constructs a printer.
+ * <p/>
+ * Delegates to {@link #ASTPrinter(Class, boolean)} with {@link #isShowClassNames showClassNames} as <tt>true</tt>
*
- * @param tokenTypeConstants The class with token type constants in it.
+ * @param tokenTypeConstants The token types to use during printing; typically the {vocabulary}TokenTypes.java
+ * interface generated by ANTLR.
*/
public ASTPrinter(Class tokenTypeConstants) {
- this.tokenTypeConstants = tokenTypeConstants;
+ this( ASTUtil.generateTokenNameCache( tokenTypeConstants ), true );
}
- /**
- * Returns true if the node class names will be displayed.
- *
- * @return true if the node class names will be displayed.
- */
- public boolean isShowClassNames() {
- return showClassNames;
+ public ASTPrinter(boolean showClassNames) {
+ this( ( Map ) null, showClassNames );
}
/**
- * Enables or disables AST node class name display.
+ * Constructs a printer.
*
- * @param showClassNames true to enable class name display, false to disable
+ * @param tokenTypeConstants The token types to use during printing; typically the {vocabulary}TokenTypes.java
+ * interface generated by ANTLR.
+ * @param showClassNames Should the AST class names be shown.
*/
- public void setShowClassNames(boolean showClassNames) {
- this.showClassNames = showClassNames;
+ public ASTPrinter(Class tokenTypeConstants, boolean showClassNames) {
+ this( ASTUtil.generateTokenNameCache( tokenTypeConstants ), showClassNames );
}
- /**
- * Prints the AST in 'ASCII art' tree form to the specified print stream.
- *
- * @param ast The AST to print.
- * @param out The print stream.
- */
- private void showAst(AST ast, PrintStream out) {
- showAst( ast, new PrintWriter( out ) );
+ private ASTPrinter(Map tokenTypeNameCache, boolean showClassNames) {
+ this.tokenTypeNameCache = tokenTypeNameCache;
+ this.showClassNames = showClassNames;
}
/**
- * Prints the AST in 'ASCII art' tree form to the specified print writer.
+ * Getter for property 'showClassNames'.
*
- * @param ast The AST to print.
- * @param pw The print writer.
+ * @return Value for property 'showClassNames'.
*/
- public void showAst(AST ast, PrintWriter pw) {
- ArrayList parents = new ArrayList();
- showAst( parents, pw, ast );
- pw.flush();
+ public boolean isShowClassNames() {
+ return showClassNames;
}
/**
- * Prints the AST in 'ASCII art' tree form into a string.
+ * Renders the AST into 'ASCII art' form and returns that string representation.
*
- * @param ast The AST to display.
+ * @param ast The AST to display.
* @param header The header for the display.
+ *
* @return The AST in 'ASCII art' form, as a string.
*/
public String showAsString(AST ast, String header) {
@@ -116,53 +104,25 @@
}
/**
- * Get a single token type name in the specified set of token type constants (interface).
+ * Prints the AST in 'ASCII art' form to the specified print stream.
*
- * @param tokenTypeConstants Token type constants interface (e.g. HqlSqlTokenTypes.class).
- * @param type The token type ( typically from ast.getType() ).
- * @return The token type name, *or* the integer value if the name could not be found for some reason.
+ * @param ast The AST to print.
+ * @param out The print stream to which the AST should be printed.
*/
- public static String getConstantName(Class tokenTypeConstants, int type) {
- String tokenTypeName = null;
- if ( tokenTypeConstants != null ) {
- Field[] fields = tokenTypeConstants.getFields();
- for ( int i = 0; i < fields.length; i++ ) {
- Field field = fields[i];
- tokenTypeName = getTokenTypeName( field, type, true );
- if ( tokenTypeName != null ) {
- break; // Stop if found.
- }
- } // for
- } // if type constants were provided
-
- // Use the integer value if no token type name was found
- if ( tokenTypeName == null ) {
- tokenTypeName = Integer.toString( type );
- }
-
- return tokenTypeName;
+ public void showAst(AST ast, PrintStream out) {
+ showAst( ast, new PrintWriter( out ) );
}
- private static String getTokenTypeName(Field field, int type, boolean checkType) {
- if ( Modifier.isStatic( field.getModifiers() ) ) {
- try {
- Object value = field.get( null );
- if ( !checkType ) {
- return field.getName();
- }
- else if ( value instanceof Integer ) {
- Integer integer = ( Integer ) value;
- if ( integer.intValue() == type ) {
- return field.getName();
- }
- } // if value is an integer
- } // try
- catch ( IllegalArgumentException ignore ) {
- }
- catch ( IllegalAccessException ignore ) {
- }
- } // if the field is static
- return null;
+ /**
+ * Prints the AST in 'ASCII art' tree form to the specified print writer.
+ *
+ * @param ast The AST to print.
+ * @param pw The print writer to which the AST should be written.
+ */
+ public void showAst(AST ast, PrintWriter pw) {
+ ArrayList parents = new ArrayList();
+ showAst( parents, pw, ast );
+ pw.flush();
}
/**
@@ -172,33 +132,16 @@
* @return String - The token type name from the token type constant class,
* or just the integer as a string if none exists.
*/
- private String getTokenTypeName(int type) {
- // If the class with the constants in it was not supplied, just
- // use the integer token type as the token type name.
- if ( tokenTypeConstants == null ) {
- return Integer.toString( type );
+ public String getTokenTypeName(int type) {
+ final Integer typeInteger = new Integer( type );
+ String value = null;
+ if ( tokenTypeNameCache != null ) {
+ value = ( String ) tokenTypeNameCache.get( typeInteger );
}
-
- // Otherwise, create a type id -> name map from the class if it
- // hasn't already been created.
- if ( tokenTypeNamesByTokenType == null ) {
- Field[] fields = tokenTypeConstants.getFields();
- tokenTypeNamesByTokenType = new HashMap();
- String tokenTypeName = null;
- for ( int i = 0; i < fields.length; i++ ) {
- Field field = fields[i];
- tokenTypeName = getTokenTypeName( field, type, false );
- if ( tokenTypeName != null ) {
- try {
- tokenTypeNamesByTokenType.put( field.get( null ), field.getName() );
- }
- catch ( IllegalAccessException ignore ) {
- }
- }
- } // for
- } // if the map hasn't been created.
-
- return ( String ) tokenTypeNamesByTokenType.get( new Integer( type ) );
+ if ( value == null ) {
+ value = typeInteger.toString();
+ }
+ return value;
}
private void showAst(ArrayList parents, PrintWriter pw, AST ast) {
@@ -242,7 +185,7 @@
public String nodeToString(AST ast, boolean showClassName) {
if ( ast == null ) {
- return "{null}";
+ return "{node:null}";
}
StringBuffer buf = new StringBuffer();
buf.append( "[" ).append( getTokenTypeName( ast.getType() ) ).append( "] " );
@@ -252,15 +195,17 @@
buf.append( "'" );
String text = ast.getText();
- appendEscapedMultibyteChars(text, buf);
+ if ( text == null ) {
+ text = "{text:null}";
+ }
+ appendEscapedMultibyteChars(text, buf);
buf.append( "'" );
if ( ast instanceof DisplayableNode ) {
DisplayableNode displayableNode = ( DisplayableNode ) ast;
// Add a space before the display text.
buf.append( " " ).append( displayableNode.getDisplayText() );
}
- String s = buf.toString();
- return s;
+ return buf.toString();
}
public static void appendEscapedMultibyteChars(String text, StringBuffer buf) {
@@ -276,10 +221,9 @@
}
}
- public static String escapeMultibyteChars(String text)
- {
+ public static String escapeMultibyteChars(String text) {
StringBuffer buf = new StringBuffer();
appendEscapedMultibyteChars(text,buf);
return buf.toString();
}
-}
+}
\ No newline at end of file
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTUtil.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTUtil.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/util/ASTUtil.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -26,6 +26,10 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import antlr.ASTFactory;
import antlr.collections.AST;
@@ -35,46 +39,62 @@
* Provides utility methods for AST traversal and manipulation.
*
* @author Joshua Davis
+ * @author Steve Ebersole
*/
public final class ASTUtil {
/**
- * Private empty constructor.
- * (or else checkstyle says: 'warning: Utility classes should not have a public or default constructor.')
+ * Disallow instantiation.
*
- * @deprecated (tell clover to ignore this)
+ * @deprecated (tellclovertoignorethis)
*/
private ASTUtil() {
}
/**
* Creates a single node AST.
+ * <p/>
+ * TODO : this is silly, remove it...
*
* @param astFactory The factory.
- * @param type The node type.
- * @param text The node text.
+ * @param type The node type.
+ * @param text The node text.
+ *
* @return AST - A single node tree.
+ *
+ * @deprecated silly
*/
public static AST create(ASTFactory astFactory, int type, String text) {
- AST node = astFactory.create( type, text );
- return node;
+ return astFactory.create( type, text );
}
/**
- * Creates a single node AST as a sibling.
+ * Creates a single node AST as a sibling of the passed prevSibling,
+ * taking care to reorganize the tree correctly to account for this
+ * newly created node.
*
- * @param astFactory The factory.
- * @param type The node type.
- * @param text The node text.
+ * @param astFactory The factory.
+ * @param type The node type.
+ * @param text The node text.
* @param prevSibling The previous sibling.
- * @return AST - A single node tree.
+ *
+ * @return The created AST node.
*/
public static AST createSibling(ASTFactory astFactory, int type, String text, AST prevSibling) {
AST node = astFactory.create( type, text );
- node.setNextSibling( prevSibling.getNextSibling() );
- prevSibling.setNextSibling( node );
- return node;
+ return insertSibling( node, prevSibling );
}
+ /**
+ * Inserts a node into a child subtree as a particularly positioned
+ * sibling taking care to properly reorganize the tree to account for this
+ * new addition.
+ *
+ * @param node The node to insert
+ * @param prevSibling The previous node at the sibling position
+ * where we want this node inserted.
+ *
+ * @return The return is the same as the node parameter passed in.
+ */
public static AST insertSibling(AST node, AST prevSibling) {
node.setNextSibling( prevSibling.getNextSibling() );
prevSibling.setNextSibling( node );
@@ -85,11 +105,12 @@
* Creates a 'binary operator' subtree, given the information about the
* parent and the two child nodex.
*
- * @param factory The AST factory.
+ * @param factory The AST factory.
* @param parentType The type of the parent node.
* @param parentText The text of the parent node.
- * @param child1 The first child.
- * @param child2 The second child.
+ * @param child1 The first child.
+ * @param child2 The second child.
+ *
* @return AST - A new sub-tree of the form "(parent child1 child2)"
*/
public static AST createBinarySubtree(ASTFactory factory, int parentType, String parentText, AST child1, AST child2) {
@@ -102,10 +123,11 @@
* Creates a single parent of the specified child (i.e. a 'unary operator'
* subtree).
*
- * @param factory The AST factory.
+ * @param factory The AST factory.
* @param parentType The type of the parent node.
* @param parentText The text of the parent node.
- * @param child The child.
+ * @param child The child.
+ *
* @return AST - A new sub-tree of the form "(parent child)"
*/
public static AST createParent(ASTFactory factory, int parentType, String parentText, AST child) {
@@ -127,10 +149,33 @@
}
/**
+ * Determine if a given node (test) is contained anywhere in the subtree
+ * of another given node (fixture).
+ *
+ * @param fixture The node against which to testto be checked for children.
+ * @param test The node to be tested as being a subtree child of the parent.
+ * @return True if child is contained in the parent's collection of children.
+ */
+ public static boolean isSubtreeChild(AST fixture, AST test) {
+ AST n = fixture.getFirstChild();
+ while ( n != null ) {
+ if ( n == test ) {
+ return true;
+ }
+ if ( n.getFirstChild() != null && isSubtreeChild( n, test ) ) {
+ return true;
+ }
+ n = n.getNextSibling();
+ }
+ return false;
+ }
+
+ /**
* Finds the first node of the specified type in the chain of children.
*
* @param parent The parent
- * @param type The type to find.
+ * @param type The type to find.
+ *
* @return The first node of the specified type, or null if not found.
*/
public static AST findTypeInChildren(AST parent, int type) {
@@ -145,6 +190,7 @@
* Returns the last direct child of 'n'.
*
* @param n The parent
+ *
* @return The last direct child of 'n'.
*/
public static AST getLastChild(AST n) {
@@ -155,6 +201,7 @@
* Returns the last sibling of 'a'.
*
* @param a The sibling.
+ *
* @return The last sibling of 'a'.
*/
private static AST getLastSibling(AST a) {
@@ -170,6 +217,7 @@
* Returns the 'list' representation with some brackets around it for debugging.
*
* @param n The tree.
+ *
* @return The list representation of the tree.
*/
public static String getDebugString(AST n) {
@@ -184,7 +232,8 @@
* Find the previous sibling in the parent for the given child.
*
* @param parent the parent node
- * @param child the child to find the previous sibling of
+ * @param child the child to find the previous sibling of
+ *
* @return the previous sibling of the child
*/
public static AST findPreviousSibling(AST parent, AST child) {
@@ -201,52 +250,10 @@
}
/**
- * Determine if a given node (test) is a direct (throtle to one level down)
- * child of another given node (fixture).
- *
- * @param fixture The node against which to testto be checked for children.
- * @param test The node to be tested as being a child of the parent.
- * @return True if test is contained in the fixtures's direct children;
- * false otherwise.
- */
- public static boolean isDirectChild(AST fixture, AST test) {
- AST n = fixture.getFirstChild();
- while ( n != null ) {
- if ( n == test ) {
- return true;
- }
- n = n.getNextSibling();
- }
- return false;
- }
-
- /**
- * Determine if a given node (test) is contained anywhere in the subtree
- * of another given node (fixture).
- *
- * @param fixture The node against which to testto be checked for children.
- * @param test The node to be tested as being a subtree child of the parent.
- * @return True if child is contained in the parent's collection of children.
- */
- public static boolean isSubtreeChild(AST fixture, AST test) {
- AST n = fixture.getFirstChild();
- while ( n != null ) {
- if ( n == test ) {
- return true;
- }
- if ( n.getFirstChild() != null && isSubtreeChild( n, test ) ) {
- return true;
- }
- n = n.getNextSibling();
- }
- return false;
- }
-
- /**
* Makes the child node a sibling of the parent, reconnecting all siblings.
*
* @param parent the parent
- * @param child the child
+ * @param child the child
*/
public static void makeSiblingOfParent(AST parent, AST child) {
AST prev = findPreviousSibling( parent, child );
@@ -295,7 +302,7 @@
* Inserts the child as the first child of the parent, all other children are shifted over to the 'right'.
*
* @param parent the parent
- * @param child the new first child
+ * @param child the new first child
*/
public static void insertChild(AST parent, AST child) {
if ( parent.getFirstChild() == null ) {
@@ -308,6 +315,13 @@
}
}
+ private static ASTArray createAstArray(ASTFactory factory, int size, int parentType, String parentText, AST child1) {
+ ASTArray array = new ASTArray( size );
+ array.add( factory.create( parentType, parentText ) );
+ array.add( child1 );
+ return array;
+ }
+
/**
* Filters nodes out of a tree.
*/
@@ -316,6 +330,7 @@
* Returns true if the node should be filtered out.
*
* @param n The node.
+ *
* @return true if the node should be filtered out, false to keep the node.
*/
boolean exclude(AST n);
@@ -332,17 +347,7 @@
public abstract boolean include(AST node);
}
- private static ASTArray createAstArray(ASTFactory factory, int size, int parentType, String parentText, AST child1) {
- ASTArray array = new ASTArray( size );
- array.add( factory.create( parentType, parentText ) );
- array.add( child1 );
- return array;
- }
-
public static List collectChildren(AST root, FilterPredicate predicate) {
-// List children = new ArrayList();
-// collectChildren( children, root, predicate );
-// return children;
return new CollectingNodeVisitor( predicate ).collect( root );
}
@@ -371,13 +376,89 @@
}
}
- private static void collectChildren(List children, AST root, FilterPredicate predicate) {
- for ( AST n = root.getFirstChild(); n != null; n = n.getNextSibling() ) {
- if ( predicate == null || !predicate.exclude( n ) ) {
- children.add( n );
+ /**
+ * Method to generate a map of token type names, keyed by their token type values.
+ *
+ * @param tokenTypeInterface The *TokenTypes interface (or implementor of said interface).
+ * @return The generated map.
+ */
+ public static Map generateTokenNameCache(Class tokenTypeInterface) {
+ final Field[] fields = tokenTypeInterface.getFields();
+ Map cache = new HashMap( (int)( fields.length * .75 ) + 1 );
+ for ( int i = 0; i < fields.length; i++ ) {
+ final Field field = fields[i];
+ if ( Modifier.isStatic( field.getModifiers() ) ) {
+ try {
+ cache.put( field.get( null ), field.getName() );
+ }
+ catch ( Throwable ignore ) {
+ }
}
- collectChildren( children, n, predicate );
}
+ return cache;
}
+ /**
+ * Get the name of a constant defined on the given class which has the given value.
+ * <p/>
+ * Note, if multiple constants have this value, the first will be returned which is known to be different
+ * on different JVM implementations.
+ *
+ * @param owner The class which defines the constant
+ * @param value The value of the constant.
+ *
+ * @return The token type name, *or* the integer value if the name could not be found.
+ *
+ * @deprecated Use #getTokenTypeName instead
+ */
+ public static String getConstantName(Class owner, int value) {
+ return getTokenTypeName( owner, value );
+ }
+
+ /**
+ * Intended to retrieve the name of an AST token type based on the token type interface. However, this
+ * method can be used to look up the name of any constant defined on a class/interface based on the constant value.
+ * Note that if multiple constants have this value, the first will be returned which is known to be different
+ * on different JVM implementations.
+ *
+ * @param tokenTypeInterface The *TokenTypes interface (or one of its implementors).
+ * @param tokenType The token type value.
+ *
+ * @return The corresponding name.
+ */
+ public static String getTokenTypeName(Class tokenTypeInterface, int tokenType) {
+ String tokenTypeName = Integer.toString( tokenType );
+ if ( tokenTypeInterface != null ) {
+ Field[] fields = tokenTypeInterface.getFields();
+ for ( int i = 0; i < fields.length; i++ ) {
+ final Integer fieldValue = extractIntegerValue( fields[i] );
+ if ( fieldValue != null && fieldValue.intValue() == tokenType ) {
+ tokenTypeName = fields[i].getName();
+ break;
+ }
+ }
+ }
+ return tokenTypeName;
+ }
+
+ private static Integer extractIntegerValue(Field field) {
+ Integer rtn = null;
+ try {
+ Object value = field.get( null );
+ if ( value instanceof Integer ) {
+ rtn = ( Integer ) value;
+ }
+ else if ( value instanceof Short ) {
+ rtn = new Integer( ( ( Short ) value ).intValue() );
+ }
+ else if ( value instanceof Long ) {
+ if ( ( ( Long ) value ).longValue() <= Integer.MAX_VALUE ) {
+ rtn = new Integer( ( ( Long ) value ).intValue() );
+ }
+ }
+ }
+ catch ( IllegalAccessException ignore ) {
+ }
+ return rtn;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/loader/hql/QueryLoader.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/loader/hql/QueryLoader.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/loader/hql/QueryLoader.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -47,6 +47,7 @@
import org.hibernate.hql.ast.tree.FromElement;
import org.hibernate.hql.ast.tree.SelectClause;
import org.hibernate.hql.ast.tree.QueryNode;
+import org.hibernate.hql.ast.tree.AggregatedSelectExpression;
import org.hibernate.impl.IteratorImpl;
import org.hibernate.loader.BasicLoader;
import org.hibernate.param.ParameterSpecification;
@@ -96,7 +97,7 @@
private int selectLength;
- private ResultTransformer selectNewTransformer;
+ private ResultTransformer implicitResultTransformer;
private String[] queryReturnAliases;
private LockMode[] defaultLockModes;
@@ -128,10 +129,10 @@
//sqlResultTypes = selectClause.getSqlResultTypes();
queryReturnTypes = selectClause.getQueryReturnTypes();
- selectNewTransformer = HolderInstantiator.createSelectNewTransformer(
- selectClause.getConstructor(),
- selectClause.isMap(),
- selectClause.isList());
+ AggregatedSelectExpression aggregatedSelectExpression = selectClause.getAggregatedSelectExpression();
+ implicitResultTransformer = aggregatedSelectExpression == null
+ ? null
+ : aggregatedSelectExpression.getResultTransformer();
queryReturnAliases = selectClause.getQueryReturnAliases();
List collectionFromElements = selectClause.getCollectionFromElements();
@@ -341,7 +342,7 @@
}
private boolean hasSelectNew() {
- return selectNewTransformer!=null;
+ return implicitResultTransformer != null;
}
protected Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session)
@@ -374,7 +375,7 @@
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException {
// meant to handle dynamic instantiation queries...
- HolderInstantiator holderInstantiator = HolderInstantiator.getHolderInstantiator(selectNewTransformer, resultTransformer, queryReturnAliases);
+ HolderInstantiator holderInstantiator = buildHolderInstantiator( resultTransformer );
if ( holderInstantiator.isRequired() ) {
for ( int i = 0; i < results.size(); i++ ) {
Object[] row = ( Object[] ) results.get( i );
@@ -382,16 +383,25 @@
results.set( i, result );
}
- if(!hasSelectNew() && resultTransformer!=null) {
+ if ( !hasSelectNew() && resultTransformer != null ) {
return resultTransformer.transformList(results);
- } else {
+ }
+ else {
return results;
}
- } else {
+ }
+ else {
return results;
}
}
+ private HolderInstantiator buildHolderInstantiator(ResultTransformer queryLocalResultTransformer) {
+ return HolderInstantiator.getHolderInstantiator(
+ implicitResultTransformer,
+ queryLocalResultTransformer,
+ queryReturnAliases
+ );
+ }
// --- Query translator methods ---
public List list(
@@ -418,10 +428,8 @@
}
try {
-
final PreparedStatement st = prepareQueryStatement( queryParameters, false, session );
-
- if(queryParameters.isCallable()) {
+ if ( queryParameters.isCallable() ) {
throw new QueryException("iterate() not supported for callable statements");
}
final ResultSet rs = getResultSet(st, queryParameters.hasAutoDiscoverScalarTypes(), false, queryParameters.getRowSelection(), session);
@@ -431,8 +439,8 @@
session,
queryReturnTypes,
queryTranslator.getColumnNames(),
- HolderInstantiator.getHolderInstantiator(selectNewTransformer, queryParameters.getResultTransformer(), queryReturnAliases)
- );
+ buildHolderInstantiator( queryParameters.getResultTransformer() )
+ );
if ( stats ) {
session.getFactory().getStatisticsImplementor().queryExecuted(
@@ -461,7 +469,12 @@
final QueryParameters queryParameters,
final SessionImplementor session) throws HibernateException {
checkQuery( queryParameters );
- return scroll( queryParameters, queryReturnTypes, HolderInstantiator.getHolderInstantiator(selectNewTransformer, queryParameters.getResultTransformer(), queryReturnAliases), session );
+ return scroll(
+ queryParameters,
+ queryReturnTypes,
+ buildHolderInstantiator( queryParameters.getResultTransformer() ),
+ session
+ );
}
// -- Implementation private methods --
Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -99,6 +99,7 @@
import org.hibernate.sql.SimpleSelect;
import org.hibernate.sql.Template;
import org.hibernate.sql.Update;
+import org.hibernate.sql.AliasGenerator;
import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.tuple.Tuplizer;
@@ -982,8 +983,14 @@
}
- public String propertySelectFragment(String name, String suffix, boolean allProperties) {
+ public String propertySelectFragment(String tableAlias, String suffix, boolean allProperties) {
+ return propertySelectFragmentFragment( tableAlias, suffix, allProperties ).toFragmentString();
+ }
+ public SelectFragment propertySelectFragmentFragment(
+ String tableAlias,
+ String suffix,
+ boolean allProperties) {
SelectFragment select = new SelectFragment()
.setSuffix( suffix )
.setUsedAliases( getIdentifierAliases() );
@@ -996,7 +1003,7 @@
!isSubclassTableSequentialSelect( columnTableNumbers[i] ) &&
subclassColumnSelectableClosure[i];
if ( selectable ) {
- String subalias = generateTableAlias( name, columnTableNumbers[i] );
+ String subalias = generateTableAlias( tableAlias, columnTableNumbers[i] );
select.addColumn( subalias, columns[i], columnAliases[i] );
}
}
@@ -1008,20 +1015,20 @@
boolean selectable = ( allProperties || !subclassFormulaLazyClosure[i] )
&& !isSubclassTableSequentialSelect( formulaTableNumbers[i] );
if ( selectable ) {
- String subalias = generateTableAlias( name, formulaTableNumbers[i] );
+ String subalias = generateTableAlias( tableAlias, formulaTableNumbers[i] );
select.addFormula( subalias, formulaTemplates[i], formulaAliases[i] );
}
}
if ( entityMetamodel.hasSubclasses() ) {
- addDiscriminatorToSelect( select, name, suffix );
+ addDiscriminatorToSelect( select, tableAlias, suffix );
}
if ( hasRowId() ) {
- select.addColumn( name, rowIdName, ROWID_ALIAS );
+ select.addColumn( tableAlias, rowIdName, ROWID_ALIAS );
}
- return select.toFragmentString();
+ return select;
}
public Object[] getDatabaseSnapshot(Serializable id, SessionImplementor session)
Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/Queryable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/Queryable.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/Queryable.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -24,6 +24,8 @@
*/
package org.hibernate.persister.entity;
+import org.hibernate.sql.SelectFragment;
+
/**
* Extends the generic <tt>EntityPersister</tt> contract to add
* operations required by the Hibernate Query Language
@@ -60,6 +62,7 @@
*/
public String propertySelectFragment(String alias, String suffix, boolean allProperties);
+ public SelectFragment propertySelectFragmentFragment(String alias, String suffix, boolean allProperties);
/**
* Get the names of columns used to persist the identifier
*/
Added: core/trunk/core/src/main/java/org/hibernate/sql/AliasGenerator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/AliasGenerator.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/sql/AliasGenerator.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2009, 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.sql;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface AliasGenerator {
+ public String generateAlias(String sqlExpression);
+}
Added: core/trunk/core/src/main/java/org/hibernate/sql/SelectExpression.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/SelectExpression.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/sql/SelectExpression.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2009, 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.sql;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface SelectExpression {
+ public String getExpression();
+ public String getAlias();
+}
Modified: core/trunk/core/src/main/java/org/hibernate/sql/SelectFragment.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/SelectFragment.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/sql/SelectFragment.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -46,7 +46,15 @@
private String[] usedAliases;
public SelectFragment() {}
-
+
+ public List getColumns() {
+ return columns;
+ }
+
+ public String getExtraSelectList() {
+ return extraSelectList;
+ }
+
public SelectFragment setUsedAliases(String[] aliases) {
usedAliases = aliases;
return this;
Modified: core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -32,6 +32,7 @@
import org.hibernate.sql.Template;
import org.hibernate.dialect.function.SQLFunction;
+import org.hibernate.util.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,6 +53,28 @@
this.context = context;
}
+
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+
+ public void traceIn(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ log.trace( prefix + ruleName );
+ }
+
+ public void traceOut(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ log.trace( prefix + ruleName );
+ }
+
/**
* {@inheritDoc}
*/
Modified: core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -26,13 +26,50 @@
import antlr.collections.AST;
+import org.hibernate.util.StringHelper;
+import org.hibernate.hql.ast.util.ASTPrinter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
public class OrderByFragmentRenderer extends GeneratedOrderByFragmentRenderer {
+ private static final Logger log = LoggerFactory.getLogger( OrderByFragmentRenderer.class );
+ private static final ASTPrinter printer = new ASTPrinter( GeneratedOrderByFragmentRendererTokenTypes.class );
+
protected void out(AST ast) {
out( ( ( Node ) ast ).getRenderableText() );
}
+
+
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+ public void traceIn(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ String traceText = ruleName + " (" + buildTraceNodeName(tree) + ")";
+ log.trace( prefix + traceText );
+ }
+
+ private String buildTraceNodeName(AST tree) {
+ return tree == null
+ ? "???"
+ : tree.getText() + " [" + printer.getTokenTypeName( tree.getType() ) + "]";
+ }
+
+ public void traceOut(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ log.trace( prefix + ruleName );
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/util/ArrayHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/util/ArrayHelper.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/util/ArrayHelper.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -84,7 +84,7 @@
}
public static String[] toStringArray(Collection coll) {
- return (String[]) coll.toArray(EMPTY_STRING_ARRAY);
+ return (String[]) coll.toArray( new String[coll.size()] );
}
public static String[][] to2DStringArray(Collection coll) {
@@ -96,7 +96,7 @@
}
public static Type[] toTypeArray(Collection coll) {
- return (Type[]) coll.toArray(EMPTY_TYPE_ARRAY);
+ return (Type[]) coll.toArray( new Type[coll.size()] );
}
public static int[] toIntArray(Collection coll) {
@@ -136,17 +136,13 @@
public static String[] slice(String[] strings, int begin, int length) {
String[] result = new String[length];
- for ( int i=0; i<length; i++ ) {
- result[i] = strings[begin+i];
- }
+ System.arraycopy( strings, begin, result, 0, length );
return result;
}
public static Object[] slice(Object[] objects, int begin, int length) {
Object[] result = new Object[length];
- for ( int i=0; i<length; i++ ) {
- result[i] = objects[begin+i];
- }
+ System.arraycopy( objects, begin, result, 0, length );
return result;
}
@@ -160,25 +156,27 @@
public static String[] join(String[] x, String[] y) {
String[] result = new String[ x.length + y.length ];
- for ( int i=0; i<x.length; i++ ) result[i] = x[i];
- for ( int i=0; i<y.length; i++ ) result[i+x.length] = y[i];
+ System.arraycopy( x, 0, result, 0, x.length );
+ System.arraycopy( y, 0, result, x.length, y.length );
return result;
}
public static String[] join(String[] x, String[] y, boolean[] use) {
String[] result = new String[ x.length + countTrue(use) ];
- for ( int i=0; i<x.length; i++ ) result[i] = x[i];
+ System.arraycopy( x, 0, result, 0, x.length );
int k = x.length;
for ( int i=0; i<y.length; i++ ) {
- if ( use[i] ) result[k++] = y[i];
+ if ( use[i] ) {
+ result[k++] = y[i];
+ }
}
return result;
}
public static int[] join(int[] x, int[] y) {
int[] result = new int[ x.length + y.length ];
- for ( int i=0; i<x.length; i++ ) result[i] = x[i];
- for ( int i=0; i<y.length; i++ ) result[i+x.length] = y[i];
+ System.arraycopy( x, 0, result, 0, x.length );
+ System.arraycopy( y, 0, result, x.length, y.length );
return result;
}
@@ -236,9 +234,7 @@
}
public static void addAll(Collection collection, Object[] array) {
- for ( int i=0; i<array.length; i++ ) {
- collection.add( array[i] );
- }
+ collection.addAll( Arrays.asList( array ) );
}
public static final String[] EMPTY_STRING_ARRAY = {};
Modified: core/trunk/core/src/main/java/org/hibernate/util/StringHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/util/StringHelper.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/core/src/main/java/org/hibernate/util/StringHelper.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -27,6 +27,7 @@
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.ArrayList;
+import java.util.Arrays;
public final class StringHelper {
@@ -85,7 +86,13 @@
return buf.toString();
}
+ public static String repeat(char character, int times) {
+ char[] buffer = new char[times];
+ Arrays.fill( buffer, character );
+ return new String( buffer );
+ }
+
public static String replace(String template, String placeholder, String replacement) {
return replace( template, placeholder, replacement, false );
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2009-08-13 19:30:57 UTC (rev 17300)
@@ -104,6 +104,49 @@
return new FunctionalTestClassTestSuite( ASTParserLoadingTest.class );
}
+ public void testJPAQLQualifiedIdentificationVariables() {
+ Session s = openSession();
+ s.beginTransaction();
+ Human me = new Human();
+ me.setName( new Name( "Steve", null, "Ebersole" ) );
+ Human joe = new Human();
+ me.setName( new Name( "Joe", null, "Ebersole" ) );
+ me.setFamily( new HashMap() );
+ me.getFamily().put( "son", joe );
+ s.save( me );
+ s.save( joe );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ List results = s.createQuery( "select entry(h.family) from Human h" ).list();
+ assertEquals( 1, results.size() );
+ Object result = results.get(0);
+ assertTrue( Map.Entry.class.isAssignableFrom( result.getClass() ) );
+ Map.Entry entry = (Map.Entry) result;
+ assertTrue( String.class.isAssignableFrom( entry.getKey().getClass() ) );
+ assertTrue( Human.class.isAssignableFrom( entry.getValue().getClass() ) );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ results = s.createQuery( "select distinct key(h.family) from Human h" ).list();
+ assertEquals( 1, results.size() );
+ Object key = results.get(0);
+ assertTrue( String.class.isAssignableFrom( key.getClass() ) );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ s.delete( me );
+ s.delete( joe );
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testPaginationWithPolymorphicQuery() {
Session s = openSession();
s.beginTransaction();
Modified: core/trunk/testsuite/src/test/resources/log4j.properties
===================================================================
--- core/trunk/testsuite/src/test/resources/log4j.properties 2009-08-13 19:05:34 UTC (rev 17299)
+++ core/trunk/testsuite/src/test/resources/log4j.properties 2009-08-13 19:30:57 UTC (rev 17300)
@@ -8,3 +8,7 @@
log4j.logger.org.hibernate.test=info
log4j.logger.org.hibernate.tool.hbm2ddl=debug
+log4j.logger.org.hibernate.hql.ast.QueryTranslatorImpl=trace
+log4j.logger.org.hibernate.hql.ast.HqlSqlWalker=trace
+log4j.logger.org.hibernate.hql.ast.SqlGenerator=trace
+log4j.logger.org.hibernate.hql.ast.AST=trace
\ No newline at end of file
15 years, 3 months
Hibernate SVN: r17299 - in core/trunk/entitymanager/src/main/java/org/hibernate/ejb: event and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-08-13 15:05:34 -0400 (Thu, 13 Aug 2009)
New Revision: 17299
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/BeanCallback.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/Callback.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackHandlerConsumer.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackResolver.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3AutoFlushEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3DeleteEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEntityEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3MergeEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistOnFlushEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostDeleteEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostInsertEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostLoadEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostUpdateEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveOrUpdateEventListener.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EntityCallbackHandler.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/ListenerCallback.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/instrument/InterceptFieldClassFileTransformer.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/BasicTypeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EmbeddableTypeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeDelegator.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/ManagedTypeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelFactory.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/PluralAttributeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/SingularAttributeImpl.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransaction.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransactionFactory.java
Log:
copyright notice
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/connection/InjectedDataSourceConnectionProvider.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.connection;
import java.util.Properties;
@@ -13,18 +33,21 @@
import org.slf4j.Logger;
/**
- * A connection provider that uses an injected <tt>DataSource</tt>.
- * Setters has to be called before configure()
+ * A specialization of {@link DatasourceConnectionProvider} which uses the {@link DataSource} specified vi
+ * {@link #setDataSource} rather than locating it from JNDI.
+ * <p/>
+ * NOTE : {@link #setDataSource} must be called prior to {@link #configure}.
+ * <p/>
+ * TODO : could not find where #setDataSource is actually called. Can't this just be passed in to #configure???
*
* @author Emmanuel Bernard
- * @see org.hibernate.connection.ConnectionProvider
*/
public class InjectedDataSourceConnectionProvider extends DatasourceConnectionProvider {
+ private final Logger log = LoggerFactory.getLogger( InjectedDataSourceConnectionProvider.class );
+
private String user;
private String pass;
- private final Logger log = LoggerFactory.getLogger( InjectedDataSourceConnectionProvider.class );
-
public void setDataSource(DataSource ds) {
super.setDataSource( ds );
}
@@ -33,7 +56,9 @@
user = props.getProperty( Environment.USER );
pass = props.getProperty( Environment.PASS );
- if ( getDataSource() == null ) throw new HibernateException( "No datasource provided" );
+ if ( getDataSource() == null ) {
+ throw new HibernateException( "No datasource provided" );
+ }
log.info( "Using provided datasource" );
}
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/BeanCallback.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/BeanCallback.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/BeanCallback.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -11,7 +26,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public class BeanCallback extends Callback {
public BeanCallback(Method callbackMethod) {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/Callback.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/Callback.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/Callback.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -19,7 +34,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public abstract class Callback implements Serializable {
transient protected Method callbackMethod;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackHandlerConsumer.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackHandlerConsumer.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackHandlerConsumer.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackResolver.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackResolver.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/CallbackResolver.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,9 +1,23 @@
-// $Id$
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3AutoFlushEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3AutoFlushEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3AutoFlushEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import org.hibernate.engine.CascadingAction;
@@ -8,7 +28,7 @@
/**
* In EJB3, it is the create operation that is cascaded to unmanaged
- * ebtities at flush time (instead of the save-update operation in
+ * entities at flush time (instead of the save-update operation in
* Hibernate).
*
* @author Gavin King
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3DeleteEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3DeleteEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3DeleteEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import java.io.Serializable;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEntityEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEntityEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEntityEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import org.hibernate.EntityMode;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import org.hibernate.engine.CascadingAction;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3MergeEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3MergeEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3MergeEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,11 +1,30 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import java.io.Serializable;
import org.hibernate.event.EventSource;
import org.hibernate.event.def.DefaultMergeEventListener;
-import org.hibernate.persister.entity.EntityPersister;
/**
* Overrides the LifeCycle OnSave call to call the PrePersist operation
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import java.io.Serializable;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistOnFlushEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistOnFlushEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PersistOnFlushEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import org.hibernate.engine.CascadingAction;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostDeleteEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostDeleteEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostDeleteEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -11,7 +26,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public class EJB3PostDeleteEventListener implements PostDeleteEventListener, CallbackHandlerConsumer {
EntityCallbackHandler callbackHandler;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostInsertEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostInsertEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostInsertEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -11,7 +26,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public class EJB3PostInsertEventListener implements PostInsertEventListener, CallbackHandlerConsumer {
EntityCallbackHandler callbackHandler;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostLoadEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostLoadEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostLoadEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -11,7 +26,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public class EJB3PostLoadEventListener implements PostLoadEventListener, CallbackHandlerConsumer {
EntityCallbackHandler callbackHandler;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostUpdateEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostUpdateEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3PostUpdateEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,9 +1,23 @@
-// $Id$
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,11 +1,30 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import java.io.Serializable;
import org.hibernate.event.EventSource;
import org.hibernate.event.def.DefaultSaveEventListener;
-import org.hibernate.persister.entity.EntityPersister;
/**
* Overrides the LifeCycle OnSave call to call the PrePersist operation
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveOrUpdateEventListener.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveOrUpdateEventListener.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3SaveOrUpdateEventListener.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,11 +1,30 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.event;
import java.io.Serializable;
import org.hibernate.event.EventSource;
import org.hibernate.event.def.DefaultSaveOrUpdateEventListener;
-import org.hibernate.persister.entity.EntityPersister;
/**
* Overrides the LifeCycle OnSave call to call the PrePersist operation
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EntityCallbackHandler.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EntityCallbackHandler.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/EntityCallbackHandler.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,9 +1,23 @@
-// $Id:$
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/ListenerCallback.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/ListenerCallback.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/event/ListenerCallback.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,8 +1,23 @@
/*
- * JBoss, the OpenSource EJB server
+ * Copyright (c) 2009, 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.
*
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * 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.ejb.event;
@@ -16,7 +31,6 @@
/**
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
- * @version $Revision: 11282 $
*/
public class ListenerCallback extends Callback {
protected transient Object listener;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/instrument/InterceptFieldClassFileTransformer.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/instrument/InterceptFieldClassFileTransformer.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/instrument/InterceptFieldClassFileTransformer.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.instrument;
import java.lang.instrument.IllegalClassFormatException;
@@ -20,9 +40,6 @@
private org.hibernate.bytecode.ClassTransformer classTransformer;
public InterceptFieldClassFileTransformer(List<String> entities) {
-// classTransformer = Environment.getBytecodeProvider().getEntityClassTransformer(
-// null, entities.toArray( new String[ entities.size() ] )
-// );
final List<String> copyEntities = new ArrayList<String>( entities.size() );
copyEntities.addAll( entities );
classTransformer = Environment.getBytecodeProvider().getTransformer(
@@ -48,11 +65,12 @@
);
}
- public byte[]
- transform(
- ClassLoader loader, String className, Class<?> classBeingRedefined,
- ProtectionDomain protectionDomain, byte[] classfileBuffer
- ) throws IllegalClassFormatException {
+ public byte[] transform(
+ ClassLoader loader,
+ String className,
+ Class<?> classBeingRedefined,
+ ProtectionDomain protectionDomain,
+ byte[] classfileBuffer ) throws IllegalClassFormatException {
try {
return classTransformer.transform( loader, className, classBeingRedefined,
protectionDomain, classfileBuffer );
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/BasicTypeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/BasicTypeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/BasicTypeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.io.Serializable;
@@ -2,3 +23,2 @@
import javax.persistence.metamodel.BasicType;
-import javax.persistence.metamodel.Type;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EmbeddableTypeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EmbeddableTypeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EmbeddableTypeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Iterator;
@@ -3,5 +24,4 @@
import java.io.Serializable;
import javax.persistence.metamodel.EmbeddableType;
-import javax.persistence.metamodel.Type;
import org.hibernate.mapping.Property;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeDelegator.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeDelegator.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeDelegator.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Set;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/EntityTypeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Collections;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/ManagedTypeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/ManagedTypeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/ManagedTypeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Iterator;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.HashMap;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelFactory.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelFactory.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelFactory.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Iterator;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetamodelImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.util.Set;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/PluralAttributeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/PluralAttributeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/PluralAttributeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.lang.reflect.Member;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/SingularAttributeImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/SingularAttributeImpl.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/SingularAttributeImpl.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.metamodel;
import java.lang.reflect.Member;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransaction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransaction.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransaction.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.transaction;
import javax.transaction.SystemException;
@@ -28,8 +48,7 @@
public boolean isTransactionInProgress(
JDBCContext jdbcContext,
- TransactionFactory.Context transactionContext
- ) {
+ TransactionFactory.Context transactionContext) {
try {
return status == JoinStatus.JOINED && isTransactionInProgress(
transactionContext.getFactory().getTransactionManager().getTransaction()
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransactionFactory.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransactionFactory.java 2009-08-13 18:59:30 UTC (rev 17298)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/transaction/JoinableCMTTransactionFactory.java 2009-08-13 19:05:34 UTC (rev 17299)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.transaction;
import org.hibernate.HibernateException;
@@ -13,16 +33,20 @@
* @author Emmanuel Bernard
*/
public class JoinableCMTTransactionFactory extends CMTTransactionFactory {
- public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext)
- throws HibernateException {
+ public Transaction createTransaction(
+ JDBCContext jdbcContext,
+ Context transactionContext) throws HibernateException {
return new JoinableCMTTransaction( jdbcContext, transactionContext );
}
@Override
public boolean isTransactionInProgress(
- JDBCContext jdbcContext, Context transactionContext, Transaction transaction
- ) {
- if ( transaction == null ) return false; //should not happen though
+ JDBCContext jdbcContext,
+ Context transactionContext,
+ Transaction transaction) {
+ if ( transaction == null ) {
+ return false; //should not happen though
+ }
JoinableCMTTransaction joinableCMTTransaction = ( (JoinableCMTTransaction) transaction );
joinableCMTTransaction.tryJoiningTransaction();
return joinableCMTTransaction.isTransactionInProgress( jdbcContext, transactionContext );
15 years, 3 months
Hibernate SVN: r17298 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-08-13 14:59:30 -0400 (Thu, 13 Aug 2009)
New Revision: 17298
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ClassFilter.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Entry.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileFilter.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Filter.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarProtocolVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitor.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JavaElementFilter.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NamedInputStream.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NativeScanner.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PackageFilter.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceMetadata.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Scanner.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/XmlHelper.java
Log:
copyright notice
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/AbstractJarVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.DataInputStream;
@@ -3,5 +24,4 @@
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -19,12 +39,13 @@
* Parse a JAR of any form (zip file, exploded directory, ...)
* apply a set of filters (File filter, Class filter, Package filter)
* and return the appropriate matching sets of elements
- *
*
* @author Emmanuel Bernard
*/
-//TODO shortcut when filters are null or empty
public abstract class AbstractJarVisitor implements JarVisitor {
+
+ //TODO shortcut when filters are null or empty
+
private final Logger log = LoggerFactory.getLogger( AbstractJarVisitor.class );
protected String unqualifiedJarName;
protected URL jarUrl;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ClassFilter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ClassFilter.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ClassFilter.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Entry.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Entry.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Entry.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.InputStream;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/ExplodedJarVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.BufferedInputStream;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileFilter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileFilter.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileFilter.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/FileZippedJarVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,11 +1,30 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.net.URL;
import java.net.URISyntaxException;
import java.util.Enumeration;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Filter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Filter.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Filter.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/InputStreamZippedJarVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.ByteArrayInputStream;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarProtocolVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarProtocolVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarProtocolVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.IOException;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitor.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitor.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitor.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-// $Id:$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.util.Set;
@@ -10,6 +30,8 @@
public interface JarVisitor {
/**
* Get the unqualified Jar name (ie wo path and wo extension)
+ *
+ * @return the unqualified jar name.
*/
String getUnqualifiedJarName();
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.File;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JavaElementFilter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JavaElementFilter.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/JavaElementFilter.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NamedInputStream.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NamedInputStream.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NamedInputStream.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$Id$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.InputStream;
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NativeScanner.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NativeScanner.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/NativeScanner.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.io.IOException;
@@ -14,7 +35,6 @@
import org.hibernate.AssertionFailure;
import org.hibernate.util.ReflectHelper;
-
/**
* @author Emmanuel Bernard
*/
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PackageFilter.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PackageFilter.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PackageFilter.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,4 +1,24 @@
-//$
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
/**
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceMetadata.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceMetadata.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/PersistenceMetadata.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,6 +1,26 @@
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -15,7 +35,6 @@
* Object used by JBoss EJB 3 for persistence.xml parsing
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision: 11329 $
*/
public class PersistenceMetadata {
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Scanner.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Scanner.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/Scanner.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,10 +1,29 @@
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.util.Set;
-import java.util.List;
import java.net.URL;
import java.lang.annotation.Annotation;
-import java.io.InputStream;
/**
* @author Emmanuel Bernard
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/XmlHelper.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/XmlHelper.java 2009-08-13 08:49:58 UTC (rev 17297)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/packaging/XmlHelper.java 2009-08-13 18:59:30 UTC (rev 17298)
@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2009, 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.ejb.packaging;
import java.util.ArrayList;
@@ -11,7 +32,6 @@
* A utility class to cover up the rough bits of xml parsing
*
* @author <a href="mailto:chris@kimptoc.net">Chris Kimpton</a>
- * @version $Revision: 11282 $
*/
public final class XmlHelper {
private XmlHelper() {
@@ -27,8 +47,7 @@
*/
public static Iterator getChildrenByTagName(
Element element,
- String tagName
- ) {
+ String tagName) {
if ( element == null ) return null;
// getElementsByTagName gives the corresponding elements in the whole
// descendance. We want only children
@@ -101,9 +120,7 @@
public static Element getOptionalChild(
Element element,
String tagName,
- Element defaultElement
- )
- throws Exception {
+ Element defaultElement) throws Exception {
Iterator goodChildren = getChildrenByTagName( element, tagName );
if ( goodChildren != null && goodChildren.hasNext() ) {
@@ -166,9 +183,7 @@
*/
public static String getUniqueChildContent(
Element element,
- String tagName
- )
- throws Exception {
+ String tagName) throws Exception {
return getElementContent( getUniqueChild( element, tagName ) );
}
@@ -181,9 +196,7 @@
*/
public static String getOptionalChildContent(
Element element,
- String tagName
- )
- throws Exception {
+ String tagName) throws Exception {
return getElementContent( getOptionalChild( element, tagName ) );
}
15 years, 3 months