本文整理了Java中org.jboss.util.naming.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:org.jboss.util.naming.Util
类名称:Util
[英]A static utility class for common JNDI operations.
[中]用于常见JNDI操作的静态实用程序类。
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public void stop() throws Exception
{
Util.unbind(ctx, jndiName);
}
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-timerservice-naming
/**
* Binds the {@link TimerService} to {@link #jndiName} under {@link #context}
*
* @throws NamingException If there is any exception during the bind operation
*/
public void start() throws NamingException
{
Reference ref = new Reference(TimerService.class.getName(), TimerServiceObjectFactory.class.getName(), null);
Util.bind(this.context, jndiName, ref);
}
代码示例来源: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.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.mobicents.core/mobicents-core-jar
/**
* Register standard SLEE contexts in JNDI
*
* @throws Exception
*/
protected void initNamingContexts() throws Exception {
// Initialize the SLEE name space
/*
* The following code sets the global name for the Slee
*/
Context ctx = new InitialContext();
ctx = Util.createSubcontext(ctx, JVM_ENV + CTX_SLEE);
Util.createSubcontext(ctx, "resources");
Util.createSubcontext(ctx, "container");
Util.createSubcontext(ctx, "facilities");
Util.createSubcontext(ctx, "sbbs");
ctx = Util.createSubcontext(ctx, "nullactivity");
Util.createSubcontext(ctx, "factory");
Util.createSubcontext(ctx, "nullactivitycontextinterfacefactory");
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public static void unbind(Context ctx, String strName) throws NamingException
{
Name name = ctx.getNameParser("").parse(strName);
int size = name.size();
String atom = name.get(size - 1);
Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1));
String key = parentCtx.getNameInNamespace() + "/" + atom;
wrapperMap.remove(key);
Util.unbind(ctx, strName);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
/**
* Get the jms provider
*
* @throws Exception for any error
*/
protected void setupJMSProviderAdapter() throws Exception
{
String providerAdapterJNDI = spec.getProviderAdapterJNDI();
if (providerAdapterJNDI.startsWith("java:") == false)
providerAdapterJNDI = "java:" + providerAdapterJNDI;
log.debug("Retrieving the jms provider adapter " + providerAdapterJNDI + " for " + this);
adapter = (JMSProviderAdapter) Util.lookup(providerAdapterJNDI, JMSProviderAdapter.class);
log.debug("Using jms provider adapter " + adapter + " for " + this);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-profileservice
Util.bind(ctx, jndiName, psProxy);
log.debug("Bound ProfileService proxy under: "+jndiName);
if(mgtViewJndiName != null && mgtViewJndiName.length() > 0)
Util.bind(ctx, mgtViewJndiName, mgtViewProxy);
log.debug("Bound ManagementView proxy under: "+mgtViewJndiName);
if(deployMgrJndiName != null && deployMgrJndiName.length() > 0)
Util.bind(ctx, deployMgrJndiName, deployMgrProxy);
log.debug("Bound DeploymentManager proxy under: "+deployMgrJndiName);
Util.createLinkRef("SecureProfileService/remote", this.jndiName);
Util.createLinkRef("SecureManagementView/remote", mgtViewJndiName);
Util.createLinkRef("SecureDeploymentManager/remote", deployMgrJndiName);
log.debug("Bound links back to secure ejb names");
代码示例来源:origin: org.jboss/jboss-common-core
/**
* Create a link
*
* @param fromName the from name
* @param toName the to name
* @throws NamingException for any error
*/
public static void createLinkRef(String fromName, String toName) throws NamingException
{
InitialContext ctx = new InitialContext();
createLinkRef(ctx, fromName, toName);
}
代码示例来源:origin: org.jboss.reloaded/jboss-reloaded-naming-deployers
@Override
public void start() throws Exception
{
parentContext = (application != null ? application.getContext() : nameSpaces.getGlobalContext());
context = Util.createSubcontext(parentContext, name);
// JavaEE 6 5.15
context.bind("ModuleName", name);
log.debug("Installed context " + context + " for JavaEE module " + name + ", application = " + application + ", parentContext = " + parentContext);
}
代码示例来源: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.snowdrop/snowdrop-deployers-core
/**
* Do a jndi lookup for bean factory.
*
* @param name the jndi name
* @return bean factory instance
* @throws Exception for any exception
*/
protected T lookup(String name) throws Exception {
Class<T> beanFactoryClass = getExactBeanFactoryClass();
T beanFactory = beanFactoryClass.cast(Util.lookup(name, beanFactoryClass));
if (log.isTraceEnabled()) {
log.trace("Found Spring bean factory [" + name + "]: " + beanFactory);
}
return beanFactory;
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-timerservice-naming
/**
* Unbinds {@link TimerService} from {@link #jndiName} under {@link #context}
* @throws NamingException If there is any exception during the bind operation
*/
public void stop() throws NamingException
{
Util.unbind(this.context, jndiName);
}
}
代码示例来源: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/jboss-common-core
/** Create a subcontext including any intermediate contexts.
@param ctx the parent JNDI Context under which value will be bound
@param name the name relative to ctx of the subcontext.
@return The new or existing JNDI subcontext
@throws javax.naming.NamingException on any JNDI failure
*/
public static Context createSubcontext(Context ctx, String name) throws NamingException
{
Name n = ctx.getNameParser("").parse(name);
return createSubcontext(ctx, n);
}
代码示例来源:origin: org.jboss.ejb3.jndi/jboss-ejb3-jndi-binder
@SuppressWarnings({"deprecation"})
protected void bind(Context ctx, String name, Object obj) throws NamingException
{
if(log.isDebugEnabled())
log.debug("Binding " + obj + " at " + name + " under " + ctx);
Util.bind(ctx, name, obj);
}
代码示例来源:origin: org.jboss/jboss-common-core
/**
* Lookup an object in the default initial context
*
* @param name the name to lookup
* @param clazz the expected type
* @return the object
* @throws Exception for any error
*/
public static Object lookup(String name, Class<?> clazz) throws Exception
{
InitialContext ctx = new InitialContext();
try
{
return lookup(ctx, name, clazz);
}
finally
{
ctx.close();
}
}
代码示例来源:origin: org.jboss.reloaded/jboss-reloaded-naming-deployers
@Override
public void stop() throws Exception
{
Util.unbind(parentContext, name);
context = null;
parentContext = null;
}
代码示例来源: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
public static void rebind(Context ctx, String strName, Object value) throws javax.naming.NamingException
{
Name name = ctx.getNameParser("").parse(strName);
int size = name.size();
String atom = name.get(size - 1);
Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1));
String key = parentCtx.getNameInNamespace() + "/" + atom;
wrapperMap.put(key, value);
String className = value.getClass().getName();
String factory = NonSerializableFactory.class.getName();
StringRefAddr addr = new StringRefAddr("nns", key);
Reference memoryRef = new Reference(className, addr, factory, null);
parentCtx.rebind(atom, memoryRef);
}
内容来源于网络,如有侵权,请联系作者删除!