@Override public CollectionRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException { if (AccessType.READ_ONLY.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new ReadOnlyAccessDelegate<HazelcastCollectionRegion>(this, props)); } if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new NonStrictReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props)); } if (AccessType.READ_WRITE.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new ReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props)); } throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast."); }
public OrmAttribute buildPluralAttribute( PersisterCreationContext creationContext, Collection collectionBinding, OrmNavigableSource source, String propertyName) { // todo : resolve cache access final CollectionRegionAccessStrategy cachingAccess = null; // need PersisterCreationContext - we should always have access to that when building persisters, through finalized initialization final CollectionPersister collectionPersister = creationContext.getPersisterFactory().createCollectionPersister( collectionBinding, (ManagedTypeImplementor) source, propertyName, cachingAccess, creationContext ); creationContext.registerCollectionPersister( collectionPersister ); return collectionPersister; }
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { switch (accessType) { case READ_ONLY: if (metadata.isMutable()) { log.warn("read-only cache configured for mutable entity [" + getName() + "]"); } return new ReadOnlyMemcachedCollectionRegionAccessStrategy(this, settings); case READ_WRITE: return new ReadWriteMemcachedCollectionRegionAccessStrategy(this, settings); case NONSTRICT_READ_WRITE: return new NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(this, settings); case TRANSACTIONAL: return new TransactionalMemcachedCollectionRegionAccessStrategy(this, settings); default: throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]"); } }
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { switch ( accessType ) { case READ_ONLY: if ( getCacheDataDescription().isMutable() ) { LOG.warnf( "read-only cache configured for mutable collection [ %s ]", getName() ); } return new ReadOnlyCollectionRegionAccessStrategy( this ); case READ_WRITE: return new ReadWriteCollectionRegionAccessStrategy( this ); case NONSTRICT_READ_WRITE: return new NonstrictReadWriteCollectionRegionAccessStrategy( this ); case TRANSACTIONAL: return new TransactionalCollectionRegionAccessStrategy( this ); // throw new UnsupportedOperationException( "doesn't support this access strategy" ); default: throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" ); } }
@Override @SuppressWarnings( {"unchecked"}) public CollectionPersister createCollectionPersister( Configuration cfg, Collection collectionMetadata, CollectionRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory) throws HibernateException { Class<? extends CollectionPersister> persisterClass = collectionMetadata.getCollectionPersisterClass(); if ( persisterClass == null ) { persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getCollectionPersisterClass( collectionMetadata ); } return create( persisterClass, COLLECTION_PERSISTER_CONSTRUCTOR_ARGS, cfg, collectionMetadata, cacheAccessStrategy, factory ); }
@Override @SuppressWarnings( {"unchecked"}) public CollectionPersister createCollectionPersister( MetadataImplementor metadata, PluralAttributeBinding collectionMetadata, CollectionRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory) throws HibernateException { Class<? extends CollectionPersister> persisterClass = collectionMetadata.getCollectionPersisterClass(); if ( persisterClass == null ) { persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getCollectionPersisterClass( collectionMetadata ); } return create( persisterClass, COLLECTION_PERSISTER_CONSTRUCTOR_ARGS_NEW, metadata, collectionMetadata, cacheAccessStrategy, factory ); }
public BasicCollectionPersister( Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException { super( collection, cacheAccessStrategy, cfg, factory ); }
public OneToManyPersister( Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException { super( collection, cacheAccessStrategy, cfg, factory ); cascadeDeleteEnabled = collection.getKey().isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete(); keyIsNullable = collection.getKey().isNullable(); keyIsUpdateable = collection.getKey().isUpdateable(); }
public CollectionRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException { if (AccessType.READ_ONLY.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new ReadOnlyAccessDelegate<HazelcastCollectionRegion>(this, props)); } if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new NonStrictReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props)); } if (AccessType.READ_WRITE.equals(accessType)) { return new CollectionRegionAccessStrategyAdapter( new ReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props)); } throw new CacheException("AccessType \"" + accessType + "\" is not currently supported by Hazelcast."); }
public static CollectionRegionAccessStrategy buildCollectionRegionAccessStrategy(TayzGridCollectionRegion region, AccessType accessType) { switch (accessType) { case READ_ONLY: return new ReadOnlyTayzGridCollectionRegionAccessStrategy(region); case NONSTRICT_READ_WRITE: return new NonStrictReadWriteTayzGridCollectionRegionAccessStrategy(region); case READ_WRITE: return new ReadWriteTayzGridCollectionRegionAccessStrategy(region); case TRANSACTIONAL: throw new IllegalArgumentException(accessType + " access strategy not supported."); default: throw new IllegalArgumentException(accessType + " is not recognized as valid access type."); } }
@Override @SuppressWarnings( {"unchecked"}) public CollectionPersister createCollectionPersister( Collection collectionBinding, ManagedTypeImplementor source, String propertyName, CollectionRegionAccessStrategy cacheAccessStrategy, PersisterCreationContext creationContext) throws HibernateException { // // If the metadata for the collection specified an explicit persister class, use it // Class<? extends CollectionPersister> persisterClass = collectionBinding.getCollectionPersisterClass(); // if ( persisterClass == null ) { // // Otherwise, use the persister class indicated by the PersisterClassResolver service // persisterClass = serviceRegistry.getService( PersisterClassResolver.class ) // .getCollectionPersisterClass( collectionBinding ); // } // return createCollectionPersister( persisterClass, collectionBinding, source, propertyName, cacheAccessStrategy, creationContext ); // todo : ^^ we need to make this fit the published ctor contract (as much as possible) // for now just create a simpl testing stub return new CollectionPersisterImpl( collectionBinding, source, propertyName, null, creationContext ); }
public CollectionPersisterImpl( Collection collectionBinding, ManagedTypeImplementor source, String localName, CollectionRegionAccessStrategy collectionCaching, PersisterCreationContext creationContext) { super( source, localName, PropertyAccess.DUMMY ); this.source = source; this.localName = localName; this.role = source.getNavigableName() + '.' + this.localName; this.collectionClassification = PersisterHelper.interpretCollectionClassification( collectionBinding ); this.foreignKeyDescriptor = new CollectionKey( this ); this.typeConfiguration = creationContext.getTypeConfiguration(); this.collectionType = new CollectionTypeImpl( role, resolveCollectionJtd( creationContext, collectionClassification ), null, null ); if ( collectionBinding instanceof IndexedCollection ) { final Value indexValueMapping = ( (IndexedCollection) collectionBinding ).getIndex(); if ( indexValueMapping instanceof SimpleValue ) { final SimpleValue simpleIndexValueMapping = (SimpleValue) indexValueMapping; // indexAttributeConverter = simpleIndexValueMapping.getAttributeConverterDescriptor().getAttributeConverter(); } } final Value elementValueMapping = collectionBinding.getElement(); if ( elementValueMapping instanceof SimpleValue ) { final SimpleValue simpleElementValueMapping = (SimpleValue) elementValueMapping; // elementAttributeConverter = simpleElementValueMapping.getAttributeConverterDescriptor().getAttributeConverter(); } }
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { if(AccessType.READ_ONLY.equals(accessType)) { return new ReadOnlyMemcachedCollectionRegionAccessStrategy(this, settings); } else if(AccessType.READ_WRITE.equals(accessType)) { return new ReadWriteMemcachedCollectionRegionAccessStrategy(this, settings); } else if(AccessType.NONSTRICT_READ_WRITE.equals(accessType)) { return new NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(this, settings); } else if(AccessType.TRANSACTIONAL.equals(accessType)) { throw new CacheException("Transactional access is not supported by Memcached region factory"); } else { throw new UnsupportedOperationException("Uknown access strategy type - " + accessType); } }
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { switch (accessType) { case READ_ONLY: return new ReadOnlyCollectionRegionAccessStrategy(this); case NONSTRICT_READ_WRITE: return new NonstrictReadWriteCollectionRegionAccessStrategy(this); default: throw new CacheException("Unsupported access strategy : " + accessType + "."); } }
@Override public CollectionRegionAccessStrategy getCacheAccessStrategy() { return cacheAccessStrategy; }
private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess) { this.cacheAccess = cacheAccess; this.cacheLock = cacheAccess.lockRegion(); cacheAccess.removeAll(); }
public CustomOneToManyPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException { super(collection, cacheAccessStrategy, cfg, factory); }
public CustomCollectionPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException { super(collection, cacheAccessStrategy, cfg, factory); }
/** {@inheritDoc} */ @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { return new AccessStrategy(createAccessStrategy(accessType)); }
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { throw new UnsupportedOperationException(); }
/** * Create a collection persister instance. * * @param collectionBinding The mapping information describing the collection * @param cacheAccessStrategy The cache access strategy for the collection region * @param creationContext Access to additional information needed to create a persister * * @return An appropriate collection persister instance. * * @throws HibernateException Indicates a problem building the persister. */ CollectionPersister createCollectionPersister( Collection collectionBinding, ManagedTypeImplementor source, String propertyName, CollectionRegionAccessStrategy cacheAccessStrategy, PersisterCreationContext creationContext) throws HibernateException;
/** * Create a collection persister instance. * * @param cfg The configuration * @param model The O/R mapping metamodel definition for the collection * @param cacheAccessStrategy The caching strategy for this collection * @param factory The session factory * * @return An appropriate collection persister instance. * * @throws HibernateException Indicates a problem building the persister. */ public CollectionPersister createCollectionPersister( Configuration cfg, Collection model, CollectionRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory) throws HibernateException;
/** * Create a collection persister instance. * * @param metadata The metadata * @param model The O/R mapping metamodel definition for the collection * @param cacheAccessStrategy The caching strategy for this collection * @param factory The session factory * * @return An appropriate collection persister instance. * * @throws HibernateException Indicates a problem building the persister. */ public CollectionPersister createCollectionPersister( MetadataImplementor metadata, PluralAttributeBinding model, CollectionRegionAccessStrategy cacheAccessStrategy, SessionFactoryImplementor factory) throws HibernateException;
/** * Get the cache */ public CollectionRegionAccessStrategy getCacheAccessStrategy();
/** * Build an access strategy for the requested access type. * * @param accessType The type of access strategy to build; never null. * @return The appropriate strategy contract for accessing this region * for the requested type of access. * @throws org.hibernate.cache.CacheException Usually indicates mis-configuration. */ public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException;
/** * Build an access strategy for the requested access type. * * @param accessType The type of access strategy to build; never null. * @return The appropriate strategy contract for accessing this region for * the requested type of access. * @throws org.hibernate.cache.CacheException Usually indicates * mis-configuration. */ @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { return TayzGridStrategyBuilder.buildCollectionRegionAccessStrategy(this, accessType); }