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

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

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

Util.rebind介绍

[英]Rebind val to name in ctx, and make sure that all intermediate contexts exist
[中]在ctx中将val重新绑定到name,并确保所有中间上下文都存在

代码示例

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

  1. public void inject(InjectionContainer container)
  2. {
  3. try
  4. {
  5. Util.rebind(container.getEnc(), encName, obj);
  6. }
  7. catch (NamingException e)
  8. {
  9. throw new RuntimeException(new StringBuilder().append("could not bind enc name '").append(encName).append("' for ").append(error).append(" for container ").append(container.getIdentifier()).append(e.getMessage()).toString());
  10. }
  11. }
  12. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void set(final Context context, final V value)
  5. {
  6. try
  7. {
  8. log.debugf("Binding [%s] at [%s] in context [%s]", value.toString().replace('\n', ' '), jndiName, context);
  9. Util.rebind(context, jndiName, value);
  10. }
  11. catch(NamingException e)
  12. {
  13. throw new RuntimeException("Failed to bind value [" + value + "] into context [" + context + "] with jndi name [" + jndiName + "]", e);
  14. }
  15. }

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

  1. public void inject(InjectionContainer container)
  2. {
  3. try
  4. {
  5. Util.rebind(container.getEnc(), encName, new LinkRef(jndiName));
  6. }
  7. catch (NamingException e)
  8. {
  9. throw new RuntimeException(new StringBuilder().append("could not bind enc name '").append(encName).append("' for ").append(error).append(" for container ").append(container.getIdentifier()).append(e.getMessage()).toString());
  10. }
  11. }
  12. }

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

  1. /**
  2. * @deprecated {@link EJBContainer} is no longer responsible for setting up
  3. * ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
  4. * will be setting it up.
  5. */
  6. @Deprecated
  7. private void bindORB()
  8. {
  9. try
  10. {
  11. Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
  12. }
  13. catch(NamingException e)
  14. {
  15. throw new RuntimeException(e);
  16. }
  17. }

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

  1. /** Rebind val to name in ctx, and make sure that all intermediate contexts exist
  2. @param ctx the parent JNDI Context under which value will be bound
  3. @param name the name relative to ctx where value will be bound
  4. @param value the value to bind.
  5. @throws NamingException for any error
  6. */
  7. public static void rebind(Context ctx, String name, Object value) throws NamingException
  8. {
  9. Name n = ctx.getNameParser("").parse(name);
  10. rebind(ctx, n, value);
  11. }

代码示例来源:origin: org.mobicents.core/mobicents-core-jar

  1. /**
  2. * Register a internal slee component with jndi.
  3. *
  4. */
  5. public static void registerWithJndi(String prefix, String name,
  6. Object object) {
  7. String fullName = JVM_ENV + prefix + "/" + name;
  8. try {
  9. Context ctx = new InitialContext();
  10. try {
  11. Util.createSubcontext(ctx, fullName);
  12. } catch (NamingException e) {
  13. logger.warn("Context, " + fullName + " might have been bound.");
  14. logger.warn(e);
  15. }
  16. ctx = (Context) ctx.lookup(JVM_ENV + prefix);
  17. // ctx.createSubcontext(name);
  18. // ctx = (Context) ctx.lookup(name);
  19. // Util.rebind(JVM_ENV + prefix + "/" + name, object);
  20. NonSerializableFactory.rebind(fullName, object);
  21. StringRefAddr addr = new StringRefAddr("nns", fullName);
  22. Reference ref = new Reference(object.getClass().getName(), addr,
  23. NonSerializableFactory.class.getName(), null);
  24. Util.rebind(ctx, name, ref);
  25. logger.debug("registered with jndi " + fullName);
  26. } catch (Exception ex) {
  27. logger.warn("registerWithJndi failed for " + fullName, ex);
  28. }
  29. }

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

  1. /**
  2. * Creates a {@link LinkRef} for java:comp/TimerService to
  3. * an internal jndi name for {@link TimerService}
  4. * @throws NamingException
  5. * @deprecated {@link EJBContainer} is no longer responsible for setting up
  6. * ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
  7. * will be setting it up.
  8. */
  9. @Deprecated
  10. private void bindTimerService() throws NamingException
  11. {
  12. // link to java:internal/TimerService (which is setup by
  13. // org.jboss.ejb3.timerservice.naming.TimerServiceBinder)
  14. LinkRef timerServiceLinkRef = new LinkRef("java:internal/TimerService");
  15. // bind to java:comp/TimerService
  16. Util.rebind(getEnc(), "TimerService", timerServiceLinkRef);
  17. }

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

  1. /**
  2. * @deprecated {@link EJBContainer} is no longer responsible for setting up
  3. * ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
  4. * will be setting it up.
  5. */
  6. @Deprecated
  7. private void bindEJBContext()
  8. {
  9. try
  10. {
  11. // Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
  12. // ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
  13. // ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
  14. // ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
  15. // TODO: a temporary measure until jboss-injection is in place
  16. LinkRef ref = new LinkRef("java:internal/EJBContext");
  17. Util.rebind(getEnc(), "EJBContext", ref);
  18. }
  19. catch (NamingException e)
  20. {
  21. throw new RuntimeException(e);
  22. }
  23. }

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

  1. public void inject(InjectionContainer container)
  2. {
  3. try
  4. {
  5. Util.rebind(container.getEnc(),
  6. name,
  7. getEnvEntryValue(container.getClassloader()));
  8. }
  9. catch (Exception e)
  10. {
  11. throw new RuntimeException("Invalid <env-entry> name: " + name, e);
  12. }
  13. }

代码示例来源:origin: org.jboss.switchboard/jboss-switchboard-mc-impl

  1. Util.rebind(ctx, relativeJndiName, jndiObject);

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

  1. Util.rebind(initCtx, bindName, cf);

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

  1. public void inject(InjectionContainer container)
  2. {
  3. Object factory = null;
  4. try
  5. {
  6. factory = PersistenceUnitHandler.getFactory(injectionType, unitName, container);
  7. }
  8. catch (NameNotFoundException e)
  9. {
  10. throw new RuntimeException(e);
  11. }
  12. if (factory == null)
  13. {
  14. throw new RuntimeException("Failed to locate " + error + " of unit name: " + unitName + " for " + container.getIdentifier());
  15. }
  16. try
  17. {
  18. Util.rebind(container.getEnc(), encName, factory);
  19. }
  20. catch (Exception e)
  21. {
  22. throw new RuntimeException("Failed to bind " + error + " of unit name: " + unitName + " ref-name" + encName + " for container " + container.getIdentifier(), e);
  23. }
  24. }
  25. }

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

  1. public void inject(InjectionContainer c)
  2. {
  3. if(!(c instanceof ExtendedInjectionContainer))
  4. throw new UnsupportedOperationException("RemotePuEncInjector only works for ExtendedInjectionContainer");
  5. ExtendedInjectionContainer container = (ExtendedInjectionContainer) c;
  6. String name = container.resolvePersistenceUnitSupplier(unitName);
  7. PersistenceUnitDeployment deployment = ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(name));
  8. RemotelyInjectEntityManagerFactory factory = new RemotelyInjectEntityManagerFactory(deployment.getXml(), "FIXME");
  9. try
  10. {
  11. Util.rebind(container.getEnc(), encName, factory);
  12. }
  13. catch (NamingException e)
  14. {
  15. throw new RuntimeException(e);
  16. }
  17. }
  18. }

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

  1. Util.rebind(ctx, bindName, cf);
  2. log.info("Bound ConnectionManager '" + serviceName + "' to JNDI name '" + bindName + "'");

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

  1. log.debug(" " + encName + " --> " + jndiName);
  2. Context enc = container.getEnc();
  3. Util.rebind(enc, encName, new LinkRef(jndiName));

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

  1. public void start() throws Exception
  2. {
  3. Context baseCtx = ctx;
  4. Name name = baseCtx.getNameParser("").parse(jndiName);
  5. baseCtx = Util.createSubcontext(baseCtx, name.getPrefix(name.size() - 1));
  6. String atom = name.get(name.size() - 1);
  7. RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, atom + PROXY_FACTORY_NAME);
  8. Reference ref = new Reference("java.lang.Object", refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
  9. try
  10. {
  11. Util.rebind(baseCtx, atom, ref);
  12. } catch (NamingException e)
  13. {
  14. NamingException namingException = new NamingException("Could not bind producer factory into JNDI under jndiName: " + baseCtx.getNameInNamespace() + "/" + atom);
  15. namingException.setRootCause(e);
  16. throw namingException;
  17. }
  18. }

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

  1. Util.rebind(container.getEnc(), encName, extendedPc);
  2. Util.rebind(container.getEnc(), encName, entityManager);

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

  1. public void start() throws Exception
  2. {
  3. Dispatcher.singleton.registerTarget(jndiName + PROXY_FACTORY_NAME, this);
  4. Class[] interfaces = {ProxyFactory.class};
  5. Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, ProxyRemotingUtils.getDefaultClientBinding());
  6. try
  7. {
  8. Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy);
  9. } catch (NamingException e)
  10. {
  11. NamingException namingException = new NamingException("Could not bind remote producer factory into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
  12. namingException.setRootCause(e);
  13. throw namingException;
  14. }
  15. super.start();
  16. }

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

  1. try
  2. Util.rebind(getEnc(), "UserTransaction", new UserTransactionImpl());
  3. Util.rebind(getEnc(), "TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
  4. log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");

相关文章