本文整理汇总了Java中org.hibernate.service.spi.SessionFactoryServiceRegistry.getService方法的典型用法代码示例。如果您正苦于以下问题:Java SessionFactoryServiceRegistry.getService方法的具体用法?Java SessionFactoryServiceRegistry.getService怎么用?Java SessionFactoryServiceRegistry.getService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.service.spi.SessionFactoryServiceRegistry
的用法示例。
在下文中一共展示了SessionFactoryServiceRegistry.getService方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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);
}
示例2: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
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));
}
示例3: doIntegration
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
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() );
}
示例4: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
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 );
}
示例5: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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));
}
}
示例6: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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 );
}
示例7: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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);
}
}
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:34,代码来源:TermServerEnversIntegrator.java
示例8: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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);
}
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:13,代码来源:OptimisticLockingChildUpdatesRootVersionTest.java
示例9: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@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);
}
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:13,代码来源:OptimisticLockingBidirectionalChildUpdatesRootVersionTest.java
示例10: integrate
import org.hibernate.service.spi.SessionFactoryServiceRegistry; //导入方法依赖的package包/类
@Override
public void integrate(Configuration c, SessionFactoryImplementor sfi, SessionFactoryServiceRegistry sfsr) {
final EventListenerRegistry eventListenerRegistry = sfsr.getService(EventListenerRegistry.class);
prependListeners(eventListenerRegistry);
}