Java 类org.hibernate.service.spi.SessionFactoryServiceRegistry 实例源码
项目:ipf-flow-manager
文件:CustomEventRegistration.java
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
EventListenerRegistry service = serviceRegistry.getService(org.hibernate.event.service.spi.EventListenerRegistry.class);
StandardPBEStringEncryptor encrypt = new StandardPBEStringEncryptor();
encrypt.setPassword("test_password");
RenderedMessageEncryptEventListener encryptListener = new RenderedMessageEncryptEventListener();
encryptListener.setStringEncryptor(encrypt);
RenderedMessageDecryptEventListener decryptListener = new RenderedMessageDecryptEventListener();
decryptListener.setStringEncryptor(encrypt);
FullTextIndexEventListener fullTextListener = new FullTextIndexEventListener();
service.appendListeners(EventType.PRE_UPDATE, encryptListener);
service.prependListeners(EventType.POST_UPDATE, decryptListener);
service.appendListeners(EventType.PRE_INSERT, encryptListener);
service.prependListeners(EventType.POST_INSERT, decryptListener);
service.appendListeners(EventType.POST_LOAD, decryptListener);
}
项目:Audit4j-Hibernate
文件:Audit4jIntegrator.java
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrating......");
//final AuditService auditService = serviceRegistry.getService(AuditService.class);
final AuditService auditService = new AuditServiceImpl();
auditService.init();
if (!auditService.isInitialized()) {
throw new InitializationException(
"Audit4j hibernate integration can not be initialized..");
}
// Register listeners..
final EventListenerRegistry listenerRegistry = serviceRegistry
.getService(EventListenerRegistry.class);
listenerRegistry.appendListeners(EventType.POST_INSERT,
new AuditPostInsertEventListenerImpl(auditService));
listenerRegistry.appendListeners(EventType.POST_UPDATE,
new AuditPostUpdateEventListenerImpl(auditService));
listenerRegistry.appendListeners(EventType.POST_DELETE,
new AuditPostDeleteEventListenerImpl(auditService));
}
项目:lams
文件:JaccIntegrator.java
@Override
public void integrate(
Configuration configuration,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
doIntegration( configuration.getProperties(), configuration.getJaccPermissionDeclarations(), serviceRegistry );
}
项目:lams
文件:JaccIntegrator.java
private void doIntegration(
Map properties,
JaccPermissionDeclarations permissionDeclarations,
SessionFactoryServiceRegistry serviceRegistry) {
boolean isSecurityEnabled = properties.containsKey( AvailableSettings.JACC_ENABLED );
if ( ! isSecurityEnabled ) {
log.debug( "Skipping JACC integration as it was not enabled" );
return;
}
final String contextId = (String) properties.get( AvailableSettings.JACC_CONTEXT_ID );
if ( contextId == null ) {
throw new IntegrationException( "JACC context id must be specified" );
}
final JaccService jaccService = serviceRegistry.getService( JaccService.class );
if ( jaccService == null ) {
throw new IntegrationException( "JaccService was not set up" );
}
if ( permissionDeclarations != null ) {
for ( GrantedPermission declaration : permissionDeclarations.getPermissionDeclarations() ) {
jaccService.addPermission( declaration );
}
}
final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.addDuplicationStrategy( DUPLICATION_STRATEGY );
eventListenerRegistry.prependListeners( EventType.PRE_DELETE, new JaccPreDeleteEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_INSERT, new JaccPreInsertEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_UPDATE, new JaccPreUpdateEventListener() );
eventListenerRegistry.prependListeners( EventType.PRE_LOAD, new JaccPreLoadEventListener() );
}
项目:lams
文件:JaccIntegrator.java
@Override
public void integrate(
MetadataImplementor metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
doIntegration( sessionFactory.getProperties(), null, serviceRegistry );
}
项目:lams
文件:CollectionCacheInvalidator.java
private void integrate(SessionFactoryServiceRegistry serviceRegistry, SessionFactoryImplementor sessionFactory) {
if ( !sessionFactory.getSettings().isAutoEvictCollectionCache() ) {
// feature is disabled
return;
}
if ( !sessionFactory.getSettings().isSecondLevelCacheEnabled() ) {
// Nothing to do, if caching is disabled
return;
}
EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.appendListeners( EventType.POST_INSERT, this );
eventListenerRegistry.appendListeners( EventType.POST_DELETE, this );
eventListenerRegistry.appendListeners( EventType.POST_UPDATE, this );
}
项目:cibet
文件:CibetIntegrator.java
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
log.info("start CibetIntegrator");
final boolean autoRegister = ConfigurationHelper.getBoolean(AUTO_REGISTER, configuration.getProperties(), true);
if (autoRegister) {
log.debug("Skipping Cibet Envers listener auto registration");
return;
}
log.info("CibetIntegrator registers Cibet Envers listeners");
EventListenerRegistry listenerRegistry = serviceRegistry.getService(EventListenerRegistry.class);
listenerRegistry.addDuplicationStrategy(EnversListenerDuplicationStrategy.INSTANCE);
enversConfiguration = AuditConfiguration.getFor(configuration,
serviceRegistry.getService(ClassLoaderService.class));
if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
listenerRegistry.appendListeners(EventType.POST_DELETE, new CibetPostDeleteEventListener(enversConfiguration));
listenerRegistry.appendListeners(EventType.POST_INSERT, new CibetPostInsertEventListener(enversConfiguration));
listenerRegistry.appendListeners(EventType.POST_UPDATE, new CibetPostUpdateEventListener(enversConfiguration));
listenerRegistry.appendListeners(EventType.POST_COLLECTION_RECREATE,
new CibetPostCollectionRecreateEventListener(enversConfiguration));
listenerRegistry.appendListeners(EventType.PRE_COLLECTION_REMOVE,
new CibetPreCollectionRemoveEventListener(enversConfiguration));
listenerRegistry.appendListeners(EventType.PRE_COLLECTION_UPDATE,
new CibetPreCollectionUpdateEventListener(enversConfiguration));
}
}
项目:dhis2-core
文件:DeletedObjectIntegrator.java
@Override
public void integrate( Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry )
{
final EventListenerRegistry registry = serviceRegistry.getService( EventListenerRegistry.class );
DeletedObjectPostDeleteEventListener listener = new DeletedObjectPostDeleteEventListener();
registry.appendListeners( EventType.POST_DELETE, listener );
}
项目:UMLS-Terminology-Server
文件:TermServerEnversIntegrator.java
@Override
public void integrate(Configuration configuration,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
// Avoid custom behavior is autoregister is true
try {
if (!"true".equals(ConfigUtility.getConfigProperties()
.getProperty("hibernate.listeners.envers.autoRegister"))) {
super.integrate(configuration, sessionFactory, serviceRegistry);
final AuditConfiguration enversConfiguration =
AuditConfiguration.getFor(configuration,
serviceRegistry.getService(ClassLoaderService.class));
EventListenerRegistry listenerRegistry =
serviceRegistry.getService(EventListenerRegistry.class);
listenerRegistry
.addDuplicationStrategy(EnversListenerDuplicationStrategy.INSTANCE);
if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
listenerRegistry.appendListeners(EventType.POST_INSERT,
new EmptyEnversPostInsertEventListenerImpl(enversConfiguration));
listenerRegistry.appendListeners(EventType.POST_DELETE,
new CustomEnversPostDeleteEventListenerImpl(enversConfiguration));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:high-performance-java-persistence
文件:OptimisticLockingChildUpdatesRootVersionTest.java
@Override
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
final EventListenerRegistry eventListenerRegistry =
serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.appendListeners(EventType.PERSIST, RootAwareInsertEventListener.INSTANCE);
eventListenerRegistry.appendListeners(EventType.FLUSH_ENTITY, RootAwareUpdateAndDeleteEventListener.INSTANCE);
}
项目:high-performance-java-persistence
文件:OptimisticLockingBidirectionalChildUpdatesRootVersionTest.java
@Override
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
final EventListenerRegistry eventListenerRegistry =
serviceRegistry.getService( EventListenerRegistry.class );
eventListenerRegistry.appendListeners( EventType.PERSIST, RootAwareInsertEventListener.INSTANCE);
eventListenerRegistry.appendListeners( EventType.FLUSH_ENTITY, RootAwareUpdateAndDeleteEventListener.INSTANCE);
}
项目:high-performance-java-persistence
文件:MetadataExtractorIntegrator.java
@Override
public void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
this.database = metadata.getDatabase();
this.metadata = metadata;
}
项目:jspresso-ce
文件:JspressoHibernateIntegrator.java
/**
* Appends the {@link LifecyclePostLoadEventListener}.
* <p>
* {@inheritDoc}
*/
@Override
public void integrate(Configuration configuration,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
serviceRegistry.getService(EventListenerRegistry.class)
.getEventListenerGroup(EventType.POST_LOAD)
.appendListener(postLoadListener);
}
项目:jspresso-ce
文件:JspressoHibernateIntegrator.java
/**
* Appends the {@link LifecyclePostLoadEventListener}.
* <p>
* {@inheritDoc}
*/
@Override
public void integrate(MetadataImplementor metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
serviceRegistry.getService(EventListenerRegistry.class)
.getEventListenerGroup(EventType.POST_LOAD)
.appendListener(postLoadListener);
}
项目:jspresso-ce
文件:JspressoHibernateIntegrator.java
/**
* Do nothing.
* <p>
* {@inheritDoc}
*/
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
// Cannot un-register listener
// serviceRegistry.getService(EventListenerRegistry.class)
// .getEventListenerGroup(EventType.POST_LOAD)
// .removeListener(postLoadListener);
}
项目:hibernate-conventions
文件:ConventionsIntegrator.java
public void integrate(
Configuration configuration,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
ConfigConventions configConventions = ConfigConventions.create(configuration);
configConventions.validate();
MappingConventions mappingConventions = MappingConventions.create(configuration);
mappingConventions.normalize();
mappingConventions.validate();
}
项目:jadira
文件:AbstractUserTypeHibernateIntegrator.java
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
try {
ConfigurationHelper.setCurrentSessionFactory(sessionFactory);
String isEnabled = configuration.getProperty(REGISTER_USERTYPES_KEY);
String javaZone = configuration.getProperty(DEFAULT_JAVAZONE_KEY);
String databaseZone = configuration.getProperty(DEFAULT_DATABASEZONE_KEY);
String seed = configuration.getProperty(DEFAULT_SEED_KEY);
String currencyCode = configuration.getProperty(DEFAULT_CURRENCYCODE_KEY);
String jdbc42Apis = configuration.getProperty(JDBC42_API_KEY);
configureDefaultProperties(sessionFactory, javaZone, databaseZone, seed, currencyCode, jdbc42Apis);
if (isEnabled != null && Boolean.valueOf(isEnabled)) {
autoRegisterUsertypes(configuration);
}
final boolean use42Api = use42Api(configuration.getProperty(JDBC42_API_KEY), sessionFactory);
ConfigurationHelper.setUse42Api(sessionFactory, use42Api);
// doIntegrate(configuration, sessionFactory, serviceRegistry);
} finally {
ConfigurationHelper.setCurrentSessionFactory(null);
}
}
项目:lams
文件:BeanValidationIntegrator.java
@Override
public void integrate(
MetadataImplementor metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry ) {
}
项目:lams
文件:BeanValidationIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
// nothing to do here afaik
}
项目:lams
文件:JaccIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
// nothing to do
}
项目:lams
文件:CollectionCacheInvalidator.java
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
integrate( serviceRegistry, sessionFactory );
}
项目:lams
文件:CollectionCacheInvalidator.java
@Override
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
integrate( serviceRegistry, sessionFactory );
}
项目:lams
文件:CollectionCacheInvalidator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
项目:Audit4j-Hibernate
文件:Audit4jIntegrator.java
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:cibet
文件:CibetIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor arg0, SessionFactoryServiceRegistry arg1) {
super.disintegrate(arg0, arg1);
}
项目:cibet
文件:CibetIntegrator.java
@Override
public void integrate(MetadataImplementor arg0, SessionFactoryImplementor arg1, SessionFactoryServiceRegistry arg2) {
if (enversConfiguration != null) {
enversConfiguration.destroy();
}
}
项目:gorm-hibernate5
文件:EventListenerIntegrator.java
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
// nothing to do
}
项目:dhis2-core
文件:DeletedObjectIntegrator.java
@Override
public void disintegrate( SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry )
{
}
项目:owsi-core-parent
文件:MetadataRegistryIntegrator.java
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
METADATA = metadata;
}
项目:owsi-core-parent
文件:MetadataRegistryIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
项目:high-performance-java-persistence
文件:OptimisticLockingChildUpdatesRootVersionTest.java
@Override
public void disintegrate(
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:high-performance-java-persistence
文件:OptimisticLockingBidirectionalChildUpdatesRootVersionTest.java
@Override
public void disintegrate(
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:high-performance-java-persistence
文件:MetadataExtractorIntegrator.java
@Override
public void disintegrate(
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:hibernate-conventions
文件:ConventionsIntegrator.java
public void disintegrate(
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:hibernate-conventions
文件:ConventionsIntegrator.java
public void integrate(
MetadataImplementor metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
}
项目:ix3
文件:IntegratorImplRuleEngine.java
@Override
public void disintegrate(SessionFactoryImplementor sfi, SessionFactoryServiceRegistry sfsr) {
}
项目:hibernate-demos
文件:TestIntegrator.java
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
项目:hibernate-demos
文件:TestIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}
项目:hibernate-demos
文件:TestIntegrator.java
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#integrate");
}
项目:hibernate-demos
文件:TestIntegrator.java
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
System.out.println("Integrator#disintegrate");
}