Java 类org.hibernate.cache.spi.access.CollectionRegionAccessStrategy 实例源码

项目:hazelcast-hibernate5    文件:HazelcastCollectionRegion.java   
@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.");
}
项目:hibernate-semantic-query    文件:PersisterHelper.java   
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;
}
项目:hibernate-l2-memcached    文件:MemcachedCollectionRegion.java   
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 + "]");
        }
    }
项目:hibernate4-memcached    文件:CollectionRegionImpl.java   
@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 + "]" );
        }
    }
项目:lams    文件:PersisterFactoryImpl.java   
@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 );
}
项目:lams    文件:PersisterFactoryImpl.java   
@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 );
}
项目:lams    文件:BasicCollectionPersister.java   
public BasicCollectionPersister(
        Collection collection,
        CollectionRegionAccessStrategy cacheAccessStrategy,
        Configuration cfg,
        SessionFactoryImplementor factory) throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
}
项目:lams    文件:OneToManyPersister.java   
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();
}
项目:hazelcast-hibernate    文件:HazelcastCollectionRegion.java   
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.");
}
项目:TayzGrid    文件:TayzGridStrategyBuilder.java   
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.");
    }
}
项目:hibernate-semantic-query    文件:PersisterFactoryImpl.java   
@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
        );
    }
项目:hibernate-semantic-query    文件:CollectionPersisterImpl.java   
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();
        }
    }
项目:hibernate-memcached    文件:MemcachedCollectionRegion.java   
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);
    }
}
项目:hibernate4-memcached    文件:CollectionMemcachedRegion.java   
@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 + ".");
    }
}
项目:lams    文件:AbstractCollectionPersister.java   
@Override
public CollectionRegionAccessStrategy getCacheAccessStrategy() {
    return cacheAccessStrategy;
}
项目:lams    文件:BulkOperationCleanupAction.java   
private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess) {
    this.cacheAccess = cacheAccess;
    this.cacheLock = cacheAccess.lockRegion();
    cacheAccess.removeAll();
}
项目:try-hibernate    文件:CustomOneToManyPersister.java   
public CustomOneToManyPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException {
    super(collection, cacheAccessStrategy, cfg, factory);
}
项目:try-hibernate    文件:CustomCollectionPersister.java   
public CustomCollectionPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException {
    super(collection, cacheAccessStrategy, cfg, factory);
}
项目:ignite    文件:HibernateCollectionRegion.java   
/** {@inheritDoc} */
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
项目:ignite    文件:HibernateCollectionRegion.java   
/** {@inheritDoc} */
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
项目:appengine-hibernate    文件:MemcacheCollectionRegion.java   
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    throw new UnsupportedOperationException();
}
项目:hibernate-semantic-query    文件:PersisterFactory.java   
/**
 * 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;
项目:lams    文件:PersisterFactory.java   
/**
 * 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;
项目:lams    文件:PersisterFactory.java   
/**
 * 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;
项目:lams    文件:CollectionPersister.java   
/**
 * Get the cache
 */
public CollectionRegionAccessStrategy getCacheAccessStrategy();
项目:lams    文件:CollectionRegion.java   
/**
 * 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;
项目:TayzGrid    文件:TayzGridCollectionRegion.java   
/**
 * 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);
}