本文整理汇总了Java中org.springframework.jndi.JndiLocatorDelegate类的典型用法代码示例。如果您正苦于以下问题:Java JndiLocatorDelegate类的具体用法?Java JndiLocatorDelegate怎么用?Java JndiLocatorDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JndiLocatorDelegate类属于org.springframework.jndi包,在下文中一共展示了JndiLocatorDelegate类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMBeanServer
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
@Override
public MBeanServer getMBeanServer() {
try {
return new JndiLocatorDelegate().lookup("java:comp/env/jmx/runtime", MBeanServer.class);
}
catch (NamingException ex) {
throw new MBeanServerNotFoundException("Failed to retrieve WebLogic MBeanServer from JNDI", ex);
}
}
示例2: lookup
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
public <T> T lookup(String jndiName, Class<T> requiredType) throws Exception {
JndiLocatorDelegate locator = new JndiLocatorDelegate();
if (jndiEnvironment instanceof JndiTemplate) {
locator.setJndiTemplate((JndiTemplate) jndiEnvironment);
}
else if (jndiEnvironment instanceof Properties) {
locator.setJndiEnvironment((Properties) jndiEnvironment);
}
else if (jndiEnvironment != null) {
throw new IllegalStateException("Illegal 'jndiEnvironment' type: " + jndiEnvironment.getClass());
}
locator.setResourceRef(resourceRef);
return locator.lookup(jndiName, requiredType);
}
示例3: getAemDataSource
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
@Bean
public DataSource getAemDataSource() {
try {
return JndiLocatorDelegate.createDefaultResourceRefLocator().lookup("jdbc/jwala-xa",
DataSource.class);
} catch (final NamingException ne) {
throw new ApplicationException(ne);
}
}
示例4: session
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public Session session() {
String jndiName = this.properties.getJndiName();
try {
return new JndiLocatorDelegate().lookup(jndiName, Session.class);
}
catch (NamingException ex) {
throw new IllegalStateException(
String.format("Unable to find Session in JNDI location %s", jndiName),
ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:JndiSessionConfiguration.java
示例5: connectionFactory
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
@Bean
public ConnectionFactory connectionFactory() throws NamingException {
if (StringUtils.hasLength(this.properties.getJndiName())) {
return new JndiLocatorDelegate().lookup(this.properties.getJndiName(),
ConnectionFactory.class);
}
return findJndiConnectionFactory();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:JndiConnectionFactoryAutoConfiguration.java
示例6: findJndiConnectionFactory
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
private ConnectionFactory findJndiConnectionFactory() {
for (String name : JNDI_LOCATIONS) {
try {
return new JndiLocatorDelegate().lookup(name, ConnectionFactory.class);
}
catch (NamingException ex) {
// Swallow and continue
}
}
throw new IllegalStateException(
"Unable to find ConnectionFactory in JNDI locations "
+ Arrays.asList(JNDI_LOCATIONS));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:JndiConnectionFactoryAutoConfiguration.java
示例7: isUsingJndi
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
private boolean isUsingJndi() {
try {
return JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable();
}
catch (Error ex) {
return false;
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:HibernateJpaAutoConfiguration.java
示例8: isJndiAvailable
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
protected boolean isJndiAvailable() {
return JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable();
}
示例9: customizePropertySources
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
/**
* Customize the set of property sources with those contributed by superclasses as
* well as those appropriate for standard servlet-based environments:
* <ul>
* <li>{@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME}
* <li>{@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}
* <li>{@value #JNDI_PROPERTY_SOURCE_NAME}
* </ul>
* <p>Properties present in {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME} will
* take precedence over those in {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}, and
* properties found in either of the above take precedence over those found in
* {@value #JNDI_PROPERTY_SOURCE_NAME}.
* <p>Properties in any of the above will take precedence over system properties and
* environment variables contributed by the {@link StandardEnvironment} superclass.
* <p>The {@code Servlet}-related property sources are added as
* {@link StubPropertySource stubs} at this stage, and will be
* {@linkplain #initPropertySources(ServletContext, ServletConfig) fully initialized}
* once the actual {@link ServletContext} object becomes available.
* @see StandardEnvironment#customizePropertySources
* @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see ServletConfigPropertySource
* @see ServletContextPropertySource
* @see org.springframework.jndi.JndiPropertySource
* @see org.springframework.context.support.AbstractApplicationContext#initPropertySources
* @see #initPropertySources(ServletContext, ServletConfig)
*/
@Override
protected void customizePropertySources(MutablePropertySources propertySources) {
propertySources.addLast(new StubPropertySource(SERVLET_CONFIG_PROPERTY_SOURCE_NAME));
propertySources.addLast(new StubPropertySource(SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
if (JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()) {
propertySources.addLast(new JndiPropertySource(JNDI_PROPERTY_SOURCE_NAME));
}
super.customizePropertySources(propertySources);
}
示例10: customizePropertySources
import org.springframework.jndi.JndiLocatorDelegate; //导入依赖的package包/类
/**
* Customize the set of property sources with those contributed by superclasses as
* well as those appropriate for standard portlet-based environments:
* <ul>
* <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME}
* <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME}
* <li>{@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
* <li>{@linkplain StandardServletEnvironment#JNDI_PROPERTY_SOURCE_NAME "jndiProperties"}
* </ul>
* <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
* take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
* which takes precedence over those in {@linkplain
* StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
* and so on.
* <p>Properties in any of the above will take precedence over system properties and
* environment variables contributed by the {@link StandardEnvironment} superclass.
* <p>The property sources are added as stubs for now, and will be
* {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully
* initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
* {@link ServletContext} objects are available.
* @see StandardEnvironment#customizePropertySources
* @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see PortletConfigPropertySource
* @see PortletContextPropertySource
* @see PortletApplicationContextUtils#initPortletPropertySources
*/
@Override
protected void customizePropertySources(MutablePropertySources propertySources) {
propertySources.addLast(new StubPropertySource(PORTLET_CONFIG_PROPERTY_SOURCE_NAME));
propertySources.addLast(new StubPropertySource(PORTLET_CONTEXT_PROPERTY_SOURCE_NAME));
propertySources.addLast(new StubPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
if (JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()) {
propertySources.addLast(new JndiPropertySource(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME));
}
super.customizePropertySources(propertySources);
}