HHH-6239 - Add service for access to configuration options/settings map
This commit is contained in:
parent
335eb1c231
commit
65c2c831ca
|
@ -34,6 +34,7 @@ import org.hibernate.integrator.internal.IntegratorServiceInitiator;
|
||||||
import org.hibernate.persister.internal.PersisterClassResolverInitiator;
|
import org.hibernate.persister.internal.PersisterClassResolverInitiator;
|
||||||
import org.hibernate.persister.internal.PersisterFactoryInitiator;
|
import org.hibernate.persister.internal.PersisterFactoryInitiator;
|
||||||
import org.hibernate.service.classloading.internal.ClassLoaderServiceInitiator;
|
import org.hibernate.service.classloading.internal.ClassLoaderServiceInitiator;
|
||||||
|
import org.hibernate.service.config.internal.ConfigurationServiceInitiator;
|
||||||
import org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator;
|
import org.hibernate.service.internal.SessionFactoryServiceRegistryFactoryInitiator;
|
||||||
import org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator;
|
import org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator;
|
||||||
import org.hibernate.service.jdbc.connections.internal.MultiTenantConnectionProviderInitiator;
|
import org.hibernate.service.jdbc.connections.internal.MultiTenantConnectionProviderInitiator;
|
||||||
|
@ -53,6 +54,8 @@ public class StandardServiceInitiators {
|
||||||
private static List<BasicServiceInitiator> buildStandardServiceInitiatorList() {
|
private static List<BasicServiceInitiator> buildStandardServiceInitiatorList() {
|
||||||
final List<BasicServiceInitiator> serviceInitiators = new ArrayList<BasicServiceInitiator>();
|
final List<BasicServiceInitiator> serviceInitiators = new ArrayList<BasicServiceInitiator>();
|
||||||
|
|
||||||
|
serviceInitiators.add( ConfigurationServiceInitiator.INSTANCE );
|
||||||
|
|
||||||
serviceInitiators.add( ClassLoaderServiceInitiator.INSTANCE );
|
serviceInitiators.add( ClassLoaderServiceInitiator.INSTANCE );
|
||||||
serviceInitiators.add( JndiServiceInitiator.INSTANCE );
|
serviceInitiators.add( JndiServiceInitiator.INSTANCE );
|
||||||
serviceInitiators.add( JmxServiceInitiator.INSTANCE );
|
serviceInitiators.add( JmxServiceInitiator.INSTANCE );
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.service.config.internal;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.service.config.spi.ConfigurationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class ConfigurationServiceImpl implements ConfigurationService {
|
||||||
|
private final Map settings;
|
||||||
|
|
||||||
|
@SuppressWarnings( "unchecked" )
|
||||||
|
public ConfigurationServiceImpl(Map settings) {
|
||||||
|
this.settings = Collections.unmodifiableMap( settings );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map getSettings() {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.service.config.internal;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.service.config.spi.ConfigurationService;
|
||||||
|
import org.hibernate.service.spi.BasicServiceInitiator;
|
||||||
|
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class ConfigurationServiceInitiator implements BasicServiceInitiator<ConfigurationService> {
|
||||||
|
public static final ConfigurationServiceInitiator INSTANCE = new ConfigurationServiceInitiator();
|
||||||
|
|
||||||
|
public ConfigurationService initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
|
||||||
|
return new ConfigurationServiceImpl( configurationValues );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<ConfigurationService> getServiceInitiated() {
|
||||||
|
return ConfigurationService.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.service.config.spi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.service.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to the initial user-provided configuration values
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface ConfigurationService extends Service {
|
||||||
|
public Map getSettings();
|
||||||
|
}
|
Loading…
Reference in New Issue