类org.hibernate.boot.cfgxml.spi.LoadedConfig源码实例Demo

下面列出了怎么用org.hibernate.boot.cfgxml.spi.LoadedConfig的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: EntityManagerFactoryBuilderImpl.java
@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 );
}
 
源代码2 项目: lams   文件: ConfigLoader.java
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 );
		}
	}
}
 
/**
 * 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();
}
 
/**
 * 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;
}
 
/**
 * 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();
}
 
@SuppressWarnings({"unchecked"})
public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) {
    aggregatedCfgXml.merge( loadedConfig );
    settings.putAll( loadedConfig.getConfigurationValues() );

    return this;
}
 
源代码7 项目: quarkus   文件: RecordableBootstrap.java
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();
}
 
@Override
public CfgXmlAccessService initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    return new CfgXmlAccessService() {
        @Override
        public LoadedConfig getAggregatedConfig() {
            return null;
        }
    };
}
 
源代码9 项目: lams   文件: SessionFactoryImpl.java
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 );
				}
			}
		}
	}
}
 
源代码10 项目: lams   文件: MetadataBuilderImpl.java
private void applyCfgXmlValues(CfgXmlAccessService service) {
	final LoadedConfig aggregatedConfig = service.getAggregatedConfig();
	if ( aggregatedConfig == null ) {
		return;
	}

	for ( CacheRegionDefinition cacheRegionDefinition : aggregatedConfig.getCacheRegionDefinitions() ) {
		applyCacheRegionDefinition( cacheRegionDefinition );
	}
}
 
源代码11 项目: lams   文件: StandardServiceRegistryBuilder.java
/**
 * 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;
}
 
源代码12 项目: lams   文件: StandardServiceRegistryBuilder.java
@SuppressWarnings({"unchecked"})
public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) {
	aggregatedCfgXml.merge( loadedConfig );
	settings.putAll( loadedConfig.getConfigurationValues() );

	return this;
}
 
源代码13 项目: lams   文件: ConfigLoader.java
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"
		);
	}
}
 
/**
 * Intended for internal testing use only!!
 */
public LoadedConfig getAggregatedCfgXml() {
    return aggregatedCfgXml;
}
 
源代码15 项目: quarkus   文件: RecordableBootstrap.java
public RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry) {
    this(bootstrapServiceRegistry, initialProperties(), LoadedConfig.baseline());
}
 
源代码16 项目: quarkus   文件: RecordableBootstrap.java
/**
 * Intended for internal testing use only!!
 */
@Override
public LoadedConfig getAggregatedCfgXml() {
    return aggregatedCfgXml;
}
 
源代码17 项目: quarkus   文件: RecordableBootstrap.java
@Override
@SuppressWarnings({ "unchecked" })
public StandardServiceRegistryBuilder configure(LoadedConfig loadedConfig) {
    throw new UnsupportedOperationException(DISABLED_FEATURE_MSG);
}
 
源代码18 项目: lams   文件: StandardServiceRegistryBuilder.java
/**
 * Intended for internal testing use only!!
 */
public LoadedConfig getAggregatedCfgXml() {
	return aggregatedCfgXml;
}
 
源代码19 项目: lams   文件: CfgXmlAccessServiceImpl.java
public CfgXmlAccessServiceImpl(Map configurationValues) {
	aggregatedCfgXml = (LoadedConfig) configurationValues.get( LOADED_CONFIG_KEY );
}
 
源代码20 项目: lams   文件: CfgXmlAccessServiceImpl.java
@Override
public LoadedConfig getAggregatedConfig() {
	return aggregatedCfgXml;
}
 
/**
 * Create a builder with the specified bootstrap services.
 *
 * @param bootstrapServiceRegistry Provided bootstrap registry to use.
 */
public ReactiveServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry) {
    this( bootstrapServiceRegistry, LoadedConfig.baseline() );
}
 
源代码22 项目: lams   文件: StandardServiceRegistryBuilder.java
/**
 * Create a builder with the specified bootstrap services.
 *
 * @param bootstrapServiceRegistry Provided bootstrap registry to use.
 */
public StandardServiceRegistryBuilder(BootstrapServiceRegistry bootstrapServiceRegistry) {
	this( bootstrapServiceRegistry, LoadedConfig.baseline() );
}
 
 类所在包
 类方法
 同包方法