org.springframework.jndi.JndiLocatorDelegate Java Examples
The following examples show how to use
org.springframework.jndi.JndiLocatorDelegate.
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: MBeanExportConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@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); } }
Example #2
Source File: PersistenceAnnotationBeanPostProcessor.java From spring-analysis-note with MIT License | 5 votes |
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); }
Example #3
Source File: MBeanExportConfiguration.java From java-technology-stack with MIT License | 5 votes |
@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); } }
Example #4
Source File: PersistenceAnnotationBeanPostProcessor.java From java-technology-stack with MIT License | 5 votes |
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); }
Example #5
Source File: MBeanExportConfiguration.java From lams with GNU General Public License v2.0 | 5 votes |
@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); } }
Example #6
Source File: PersistenceAnnotationBeanPostProcessor.java From lams with GNU General Public License v2.0 | 5 votes |
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); }
Example #7
Source File: EntityManagerFactoryServiceImpl.java From multitenant with Apache License 2.0 | 5 votes |
private boolean isUsingJndi() { try { return JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable(); } catch (Error ex) { return false; } }
Example #8
Source File: AemJpaConfiguration.java From jwala with Apache License 2.0 | 5 votes |
@Bean public DataSource getAemDataSource() { try { return JndiLocatorDelegate.createDefaultResourceRefLocator().lookup("jdbc/jwala-xa", DataSource.class); } catch (final NamingException ne) { throw new ApplicationException(ne); } }
Example #9
Source File: MBeanExportConfiguration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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); } }
Example #10
Source File: PersistenceAnnotationBeanPostProcessor.java From spring4-understanding with Apache License 2.0 | 5 votes |
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); }
Example #11
Source File: StandardServletEnvironment.java From spring-analysis-note with MIT License | 3 votes |
/** * 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); }
Example #12
Source File: StandardServletEnvironment.java From java-technology-stack with MIT License | 3 votes |
/** * 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); }
Example #13
Source File: StandardServletEnvironment.java From lams with GNU General Public License v2.0 | 3 votes |
/** * 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); }
Example #14
Source File: StandardPortletEnvironment.java From spring4-understanding with Apache License 2.0 | 3 votes |
/** * 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); }
Example #15
Source File: StandardServletEnvironment.java From spring4-understanding with Apache License 2.0 | 3 votes |
/** * 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); }