本文整理了Java中org.jboss.util.naming.Util.rebind()
方法的一些代码示例,展示了Util.rebind()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.rebind()
方法的具体详情如下:
包路径:org.jboss.util.naming.Util
类名称: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
public void inject(InjectionContainer container)
{
try
{
Util.rebind(container.getEnc(), encName, obj);
}
catch (NamingException e)
{
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());
}
}
}
代码示例来源:origin: org.jboss.injection/jboss-injection
/**
* {@inheritDoc}
*/
public void set(final Context context, final V value)
{
try
{
log.debugf("Binding [%s] at [%s] in context [%s]", value.toString().replace('\n', ' '), jndiName, context);
Util.rebind(context, jndiName, value);
}
catch(NamingException e)
{
throw new RuntimeException("Failed to bind value [" + value + "] into context [" + context + "] with jndi name [" + jndiName + "]", e);
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void inject(InjectionContainer container)
{
try
{
Util.rebind(container.getEnc(), encName, new LinkRef(jndiName));
}
catch (NamingException e)
{
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());
}
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
/**
* @deprecated {@link EJBContainer} is no longer responsible for setting up
* ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
* will be setting it up.
*/
@Deprecated
private void bindORB()
{
try
{
Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
}
catch(NamingException e)
{
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.jboss/jboss-common-core
/** Rebind val to name in ctx, and make sure that all intermediate contexts exist
@param ctx the parent JNDI Context under which value will be bound
@param name the name relative to ctx where value will be bound
@param value the value to bind.
@throws NamingException for any error
*/
public static void rebind(Context ctx, String name, Object value) throws NamingException
{
Name n = ctx.getNameParser("").parse(name);
rebind(ctx, n, value);
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Register a internal slee component with jndi.
*
*/
public static void registerWithJndi(String prefix, String name,
Object object) {
String fullName = JVM_ENV + prefix + "/" + name;
try {
Context ctx = new InitialContext();
try {
Util.createSubcontext(ctx, fullName);
} catch (NamingException e) {
logger.warn("Context, " + fullName + " might have been bound.");
logger.warn(e);
}
ctx = (Context) ctx.lookup(JVM_ENV + prefix);
// ctx.createSubcontext(name);
// ctx = (Context) ctx.lookup(name);
// Util.rebind(JVM_ENV + prefix + "/" + name, object);
NonSerializableFactory.rebind(fullName, object);
StringRefAddr addr = new StringRefAddr("nns", fullName);
Reference ref = new Reference(object.getClass().getName(), addr,
NonSerializableFactory.class.getName(), null);
Util.rebind(ctx, name, ref);
logger.debug("registered with jndi " + fullName);
} catch (Exception ex) {
logger.warn("registerWithJndi failed for " + fullName, ex);
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
/**
* Creates a {@link LinkRef} for java:comp/TimerService to
* an internal jndi name for {@link TimerService}
* @throws NamingException
* @deprecated {@link EJBContainer} is no longer responsible for setting up
* ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
* will be setting it up.
*/
@Deprecated
private void bindTimerService() throws NamingException
{
// link to java:internal/TimerService (which is setup by
// org.jboss.ejb3.timerservice.naming.TimerServiceBinder)
LinkRef timerServiceLinkRef = new LinkRef("java:internal/TimerService");
// bind to java:comp/TimerService
Util.rebind(getEnc(), "TimerService", timerServiceLinkRef);
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
/**
* @deprecated {@link EJBContainer} is no longer responsible for setting up
* ENC. Instead, SwitchBoard http://community.jboss.org/wiki/Switchboard
* will be setting it up.
*/
@Deprecated
private void bindEJBContext()
{
try
{
// Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
// ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
// ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
// ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
// TODO: a temporary measure until jboss-injection is in place
LinkRef ref = new LinkRef("java:internal/EJBContext");
Util.rebind(getEnc(), "EJBContext", ref);
}
catch (NamingException e)
{
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void inject(InjectionContainer container)
{
try
{
Util.rebind(container.getEnc(),
name,
getEnvEntryValue(container.getClassloader()));
}
catch (Exception e)
{
throw new RuntimeException("Invalid <env-entry> name: " + name, e);
}
}
代码示例来源:origin: org.jboss.switchboard/jboss-switchboard-mc-impl
Util.rebind(ctx, relativeJndiName, jndiObject);
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
Util.rebind(initCtx, bindName, cf);
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void inject(InjectionContainer container)
{
Object factory = null;
try
{
factory = PersistenceUnitHandler.getFactory(injectionType, unitName, container);
}
catch (NameNotFoundException e)
{
throw new RuntimeException(e);
}
if (factory == null)
{
throw new RuntimeException("Failed to locate " + error + " of unit name: " + unitName + " for " + container.getIdentifier());
}
try
{
Util.rebind(container.getEnc(), encName, factory);
}
catch (Exception e)
{
throw new RuntimeException("Failed to bind " + error + " of unit name: " + unitName + " ref-name" + encName + " for container " + container.getIdentifier(), e);
}
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-ejb3
public void inject(InjectionContainer c)
{
if(!(c instanceof ExtendedInjectionContainer))
throw new UnsupportedOperationException("RemotePuEncInjector only works for ExtendedInjectionContainer");
ExtendedInjectionContainer container = (ExtendedInjectionContainer) c;
String name = container.resolvePersistenceUnitSupplier(unitName);
PersistenceUnitDeployment deployment = ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(name));
RemotelyInjectEntityManagerFactory factory = new RemotelyInjectEntityManagerFactory(deployment.getXml(), "FIXME");
try
{
Util.rebind(container.getEnc(), encName, factory);
}
catch (NamingException e)
{
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
Util.rebind(ctx, bindName, cf);
log.info("Bound ConnectionManager '" + serviceName + "' to JNDI name '" + bindName + "'");
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
log.debug(" " + encName + " --> " + jndiName);
Context enc = container.getEnc();
Util.rebind(enc, encName, new LinkRef(jndiName));
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void start() throws Exception
{
Context baseCtx = ctx;
Name name = baseCtx.getNameParser("").parse(jndiName);
baseCtx = Util.createSubcontext(baseCtx, name.getPrefix(name.size() - 1));
String atom = name.get(name.size() - 1);
RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, atom + PROXY_FACTORY_NAME);
Reference ref = new Reference("java.lang.Object", refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
try
{
Util.rebind(baseCtx, atom, ref);
} catch (NamingException e)
{
NamingException namingException = new NamingException("Could not bind producer factory into JNDI under jndiName: " + baseCtx.getNameInNamespace() + "/" + atom);
namingException.setRootCause(e);
throw namingException;
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
Util.rebind(container.getEnc(), encName, extendedPc);
Util.rebind(container.getEnc(), encName, entityManager);
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void start() throws Exception
{
Dispatcher.singleton.registerTarget(jndiName + PROXY_FACTORY_NAME, this);
Class[] interfaces = {ProxyFactory.class};
Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, ProxyRemotingUtils.getDefaultClientBinding());
try
{
Util.rebind(ctx, jndiName + PROXY_FACTORY_NAME, factoryProxy);
} catch (NamingException e)
{
NamingException namingException = new NamingException("Could not bind remote producer factory into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + jndiName + PROXY_FACTORY_NAME);
namingException.setRootCause(e);
throw namingException;
}
super.start();
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
try
Util.rebind(getEnc(), "UserTransaction", new UserTransactionImpl());
Util.rebind(getEnc(), "TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
内容来源于网络,如有侵权,请联系作者删除!