org.hibernate.boot.cfgxml.spi.LoadedConfig Java Examples
The following examples show how to use
org.hibernate.boot.cfgxml.spi.LoadedConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigLoader.java From lams with GNU General Public License v2.0 | 7 votes |
public LoadedConfig loadConfigXmlResource(String cfgXmlResourceName) { final InputStream stream = bootstrapServiceRegistry.getService( ClassLoaderService.class ).locateResourceStream( cfgXmlResourceName ); if ( stream == null ) { throw new ConfigurationException( "Could not locate cfg.xml resource [" + cfgXmlResourceName + "]" ); } try { final JaxbCfgHibernateConfiguration jaxbCfg = jaxbProcessorHolder.getValue().unmarshal( stream, new Origin( SourceType.RESOURCE, cfgXmlResourceName ) ); return LoadedConfig.consume( jaxbCfg ); } finally { try { stream.close(); } catch (IOException e) { log.debug( "Unable to close cfg.xml resource stream", e ); } } }
Example #2
Source File: EntityManagerFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("unchecked") private void processConfigXml( LoadedConfig loadedConfig, MergedSettings mergedSettings, StandardServiceRegistryBuilder ssrBuilder) { if ( ! mergedSettings.configurationValues.containsKey( SESSION_FACTORY_NAME ) ) { // there is not already a SF-name in the merged settings final String sfName = loadedConfig.getSessionFactoryName(); if ( sfName != null ) { // but the cfg.xml file we are processing named one.. mergedSettings.configurationValues.put( SESSION_FACTORY_NAME, sfName ); } } mergedSettings.configurationValues.putAll( loadedConfig.getConfigurationValues() ); ssrBuilder.configure( loadedConfig ); }
Example #3
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
/** * Intended for use exclusively from JPA boot-strapping, or extensions of * this class. Consider this an SPI. * * @see #forJpa */ protected ReactiveServiceRegistryBuilder( BootstrapServiceRegistry bootstrapServiceRegistry, Map settings, LoadedConfig loadedConfig) { this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader( bootstrapServiceRegistry ); this.settings = settings; this.aggregatedCfgXml = loadedConfig; this.initiators = defaultReactiveInitiatorList(); }
Example #4
Source File: ConfigLoader.java From lams with GNU General Public License v2.0 | 5 votes |
public LoadedConfig loadConfigXmlFile(File cfgXmlFile) { try { final JaxbCfgHibernateConfiguration jaxbCfg = jaxbProcessorHolder.getValue().unmarshal( new FileInputStream( cfgXmlFile ), new Origin( SourceType.FILE, cfgXmlFile.getAbsolutePath() ) ); return LoadedConfig.consume( jaxbCfg ); } catch (FileNotFoundException e) { throw new ConfigurationException( "Specified cfg.xml file [" + cfgXmlFile.getAbsolutePath() + "] does not exist" ); } }
Example #5
Source File: StandardServiceRegistryBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings({"unchecked"}) public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) { aggregatedCfgXml.merge( loadedConfig ); settings.putAll( loadedConfig.getConfigurationValues() ); return this; }
Example #6
Source File: StandardServiceRegistryBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a builder with the specified bootstrap services. * * @param bootstrapServiceRegistry Provided bootstrap registry to use. */ public StandardServiceRegistryBuilder( BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) { this.settings = Environment.getProperties(); this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader( bootstrapServiceRegistry ); this.aggregatedCfgXml = loadedConfigBaseline; }
Example #7
Source File: MetadataBuilderImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private void applyCfgXmlValues(CfgXmlAccessService service) { final LoadedConfig aggregatedConfig = service.getAggregatedConfig(); if ( aggregatedConfig == null ) { return; } for ( CacheRegionDefinition cacheRegionDefinition : aggregatedConfig.getCacheRegionDefinitions() ) { applyCacheRegionDefinition( cacheRegionDefinition ); } }
Example #8
Source File: SessionFactoryImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private void applyCfgXmlValues(LoadedConfig aggregatedConfig, SessionFactoryServiceRegistry serviceRegistry) { final JaccService jaccService = serviceRegistry.getService( JaccService.class ); if ( jaccService.getContextId() != null ) { final JaccPermissionDeclarations permissions = aggregatedConfig.getJaccPermissions( jaccService.getContextId() ); if ( permissions != null ) { for ( GrantedPermission grantedPermission : permissions.getPermissionDeclarations() ) { jaccService.addPermission( grantedPermission ); } } } if ( aggregatedConfig.getEventListenerMap() != null ) { final ClassLoaderService cls = serviceRegistry.getService( ClassLoaderService.class ); final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class ); for ( Map.Entry<EventType, Set<String>> entry : aggregatedConfig.getEventListenerMap().entrySet() ) { final EventListenerGroup group = eventListenerRegistry.getEventListenerGroup( entry.getKey() ); for ( String listenerClassName : entry.getValue() ) { try { group.appendListener( cls.classForName( listenerClassName ).newInstance() ); } catch (Exception e) { throw new ConfigurationException( "Unable to instantiate event listener class : " + listenerClassName, e ); } } } } }
Example #9
Source File: CfgXmlAccessServiceInitiatorQuarkus.java From quarkus with Apache License 2.0 | 5 votes |
@Override public CfgXmlAccessService initiateService(Map configurationValues, ServiceRegistryImplementor registry) { return new CfgXmlAccessService() { @Override public LoadedConfig getAggregatedConfig() { return null; } }; }
Example #10
Source File: RecordableBootstrap.java From quarkus with Apache License 2.0 | 5 votes |
private RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry, Map properties, LoadedConfig loadedConfigBaseline) { super(bootstrapServiceRegistry, properties, loadedConfigBaseline, null); this.settings = properties; this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.aggregatedCfgXml = loadedConfigBaseline; this.initiators = standardInitiatorList(); }
Example #11
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
@SuppressWarnings({"unchecked"}) public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) { aggregatedCfgXml.merge( loadedConfig ); settings.putAll( loadedConfig.getConfigurationValues() ); return this; }
Example #12
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create a builder with the specified bootstrap services. * * @param bootstrapServiceRegistry Provided bootstrap registry to use. */ public ReactiveServiceRegistryBuilder( BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) { this.settings = Environment.getProperties(); this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader( bootstrapServiceRegistry ); this.aggregatedCfgXml = loadedConfigBaseline; this.initiators = defaultReactiveInitiatorList(); }
Example #13
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 5 votes |
/** * Intended for use exclusively from Quarkus boot-strapping, or extensions of * this class which need to override the standard ServiceInitiator list. * Consider this an SPI. */ protected ReactiveServiceRegistryBuilder( BootstrapServiceRegistry bootstrapServiceRegistry, Map settings, LoadedConfig loadedConfig, @SuppressWarnings("rawtypes") List<StandardServiceInitiator> initiators) { this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader( bootstrapServiceRegistry ); this.settings = settings; this.aggregatedCfgXml = loadedConfig; this.initiators = initiators; }
Example #14
Source File: RecordableBootstrap.java From quarkus with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings({ "unchecked" }) public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) { throw new UnsupportedOperationException(DISABLED_FEATURE_MSG); }
Example #15
Source File: RecordableBootstrap.java From quarkus with Apache License 2.0 | 4 votes |
/** * Intended for internal testing use only!! */ @Override public LoadedConfig getAggregatedCfgXml() { return aggregatedCfgXml; }
Example #16
Source File: RecordableBootstrap.java From quarkus with Apache License 2.0 | 4 votes |
public RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry) { this(bootstrapServiceRegistry, initialProperties(), LoadedConfig.baseline()); }
Example #17
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
/** * Intended for internal testing use only!! */ public LoadedConfig getAggregatedCfgXml() { return aggregatedCfgXml; }
Example #18
Source File: StandardServiceRegistryBuilder.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Intended for internal testing use only!! */ public LoadedConfig getAggregatedCfgXml() { return aggregatedCfgXml; }
Example #19
Source File: CfgXmlAccessServiceImpl.java From lams with GNU General Public License v2.0 | 4 votes |
public CfgXmlAccessServiceImpl(Map configurationValues) { aggregatedCfgXml = (LoadedConfig) configurationValues.get( LOADED_CONFIG_KEY ); }
Example #20
Source File: CfgXmlAccessServiceImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public LoadedConfig getAggregatedConfig() { return aggregatedCfgXml; }
Example #21
Source File: StandardServiceRegistryBuilder.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Create a builder with the specified bootstrap services. * * @param bootstrapServiceRegistry Provided bootstrap registry to use. */ public StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry) { this( bootstrapServiceRegistry, LoadedConfig.baseline() ); }
Example #22
Source File: ReactiveServiceRegistryBuilder.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 2 votes |
/** * Create a builder with the specified bootstrap services. * * @param bootstrapServiceRegistry Provided bootstrap registry to use. */ public ReactiveServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry) { this( bootstrapServiceRegistry, LoadedConfig.baseline() ); }