org.jboss.util.naming.Util.lookup()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.jboss.util.naming.Util.lookup()方法的一些代码示例,展示了Util.lookup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.lookup()方法的具体详情如下:
包路径:org.jboss.util.naming.Util
类名称:Util
方法名:lookup

Util.lookup介绍

[英]Lookup an object in the default initial context
[中]在默认初始上下文中查找对象

代码示例

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. /**
  2. * Get the jms provider
  3. *
  4. * @throws Exception for any error
  5. */
  6. protected void setupJMSProviderAdapter() throws Exception
  7. {
  8. String providerAdapterJNDI = spec.getProviderAdapterJNDI();
  9. if (providerAdapterJNDI.startsWith("java:") == false)
  10. providerAdapterJNDI = "java:" + providerAdapterJNDI;
  11. log.debug("Retrieving the jms provider adapter " + providerAdapterJNDI + " for " + this);
  12. adapter = (JMSProviderAdapter) Util.lookup(providerAdapterJNDI, JMSProviderAdapter.class);
  13. log.debug("Using jms provider adapter " + adapter + " for " + this);
  14. }

代码示例来源:origin: org.jboss.snowdrop/snowdrop-deployers-core

  1. /**
  2. * Do a jndi lookup for bean factory.
  3. *
  4. * @param name the jndi name
  5. * @return bean factory instance
  6. * @throws Exception for any exception
  7. */
  8. protected T lookup(String name) throws Exception {
  9. Class<T> beanFactoryClass = getExactBeanFactoryClass();
  10. T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
  11. if (log.isTraceEnabled()) {
  12. log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
  13. }
  14. return beanFactory;
  15. }

代码示例来源:origin: org.jboss/jboss-common-core

  1. /**
  2. * Lookup an object in the default initial context
  3. *
  4. * @param name the name to lookup
  5. * @param clazz the expected type
  6. * @return the object
  7. * @throws Exception for any error
  8. */
  9. public static Object lookup(String name, Class<?> clazz) throws Exception
  10. {
  11. InitialContext ctx = new InitialContext();
  12. try
  13. {
  14. return lookup(ctx, name, clazz);
  15. }
  16. finally
  17. {
  18. ctx.close();
  19. }
  20. }

代码示例来源:origin: org.jboss/jboss-common-core

  1. /**
  2. * Lookup an object in the default initial context
  3. *
  4. * @param name the name to lookup
  5. * @param clazz the expected type
  6. * @return the object
  7. * @throws Exception for any error
  8. */
  9. public static Object lookup(Name name, Class<?> clazz) throws Exception
  10. {
  11. InitialContext ctx = new InitialContext();
  12. try
  13. {
  14. return lookup(ctx, name, clazz);
  15. }
  16. finally
  17. {
  18. ctx.close();
  19. }
  20. }

代码示例来源:origin: org.jboss.jbossas/jboss-as-server

  1. providerAdapterJNDI = "java:" + providerAdapterJNDI;
  2. Context ctx = new InitialContext();
  3. JMSProviderAdapter adapter = (JMSProviderAdapter) Util.lookup(providerAdapterJNDI, JMSProviderAdapter.class);
  4. try
  5. return (XAConnectionFactory) Util.lookup(ctx, connectionFactoryRef, XAConnectionFactory.class);

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. /**
  2. * Setup the DLQ Destination
  3. *
  4. * @param ctx the naming context
  5. * @throws Exception for any error
  6. */
  7. protected void setupDLQDestination(Context ctx) throws Exception
  8. {
  9. String name = activation.getActivationSpec().getDLQJNDIName();
  10. dlq = (Queue) Util.lookup(ctx, name, Queue.class);
  11. }

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. destination = (Destination) Util.lookup(ctx, destinationName, destinationType);
  2. log.debug("Retrieving destination " + destinationName + " of type " + Destination.class.getName());
  3. destination = (Destination) Util.lookup(ctx, destinationName, Destination.class);
  4. if (destination instanceof Topic)

代码示例来源:origin: org.jboss.snowdrop/snowdrop-deployers-core

  1. String parentName = pbfm.group(1);
  2. try {
  3. this.setParentBeanFactory((BeanFactory) Util.lookup(parentName, BeanFactory.class));
  4. } catch (Exception e) {
  5. throw new BeanDefinitionStoreException("Failure during parent bean factory JNDI lookup: " + parentName, e);

代码示例来源:origin: org.jboss.snowdrop/snowdrop-deployers-core

  1. String parentName = pbfm.group(1);
  2. try {
  3. this.getBeanFactory().setParentBeanFactory((BeanFactory) Util.lookup(parentName, BeanFactory.class));
  4. } catch (Exception e) {
  5. throw new BeanDefinitionStoreException("Failure during parent bean factory JNDI lookup: " + parentName, e);

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. QueueConnectionFactory qcf = (QueueConnectionFactory) Util.lookup(ctx, queueFactoryRef, QueueConnectionFactory.class);
  2. log.debug("Got queue connection factory " + qcf + " from " + queueFactoryRef);
  3. log.debug("Attempting to create queue connection with user " + user);

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. TopicConnectionFactory tcf = (TopicConnectionFactory) Util.lookup(ctx, topicFactoryRef, TopicConnectionFactory.class);
  2. log.debug("Got topic connection factory " + tcf + " from " + topicFactoryRef);
  3. log.debug("Attempting to create topic connection with user " + user);

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. String queueFactoryRef = adapter.getQueueFactoryRef();
  2. log.debug("Attempting to lookup dlq connection factory " + queueFactoryRef);
  3. QueueConnectionFactory qcf = (QueueConnectionFactory) Util.lookup(ctx, queueFactoryRef, QueueConnectionFactory.class);
  4. log.debug("Got dlq connection factory " + qcf + " from " + queueFactoryRef);
  5. log.debug("Attempting to create queue connection with user " + user);

相关文章