本文整理汇总了Java中javax.naming.Binding.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Binding.getName方法的具体用法?Java Binding.getName怎么用?Java Binding.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.Binding
的用法示例。
在下文中一共展示了Binding.getName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listCollectionPaths
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* List resource paths (recursively), and store all of them in the given
* Set.
*/
private static void listCollectionPaths(Set<String> set,
DirContext resources, String path) throws NamingException {
Enumeration<Binding> childPaths = resources.listBindings(path);
while (childPaths.hasMoreElements()) {
Binding binding = childPaths.nextElement();
String name = binding.getName();
StringBuilder childPath = new StringBuilder(path);
if (!"/".equals(path) && !path.endsWith("/"))
childPath.append("/");
childPath.append(name);
Object object = binding.getObject();
if (object instanceof DirContext) {
childPath.append("/");
}
set.add(childPath.toString());
}
}
示例2: while
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* List resource paths (recursively), and store all of them in the given
* Set.
*/
private static void listCollectionPaths
(Set set, DirContext resources, String path)
throws NamingException {
Enumeration childPaths = resources.listBindings(path);
while (childPaths.hasMoreElements()) {
Binding binding = (Binding) childPaths.nextElement();
String name = binding.getName();
StringBuffer childPath = new StringBuffer(path);
if (!"/".equals(path) && !path.endsWith("/"))
childPath.append("/");
childPath.append(name);
Object object = binding.getObject();
if (object instanceof DirContext) {
childPath.append("/");
}
set.add(childPath.toString());
}
}
示例3: listPaths
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* List resource paths (recursively), and store all of them in the given
* Set.
*/
private static void listPaths(Set set, DirContext resources, String path)
throws NamingException {
Enumeration childPaths = resources.listBindings(path);
while (childPaths.hasMoreElements()) {
Binding binding = (Binding) childPaths.nextElement();
String name = binding.getName();
String childPath = path + "/" + name;
set.add(childPath);
Object object = binding.getObject();
if (object instanceof DirContext) {
listPaths(set, resources, childPath);
}
}
}
示例4: listCollectionPaths
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* List resource paths (recursively), and store all of them in the given
* Set.
*/
private static void listCollectionPaths(Set<String> set, DirContext resources, String path) throws NamingException {
Enumeration<Binding> childPaths = resources.listBindings(path);
while (childPaths.hasMoreElements()) {
Binding binding = childPaths.nextElement();
String name = binding.getName();
StringBuilder childPath = new StringBuilder(path);
if (!"/".equals(path) && !path.endsWith("/"))
childPath.append("/");
childPath.append(name);
Object object = binding.getObject();
if (object instanceof DirContext) {
childPath.append("/");
}
set.add(childPath.toString());
}
}
示例5: listContext
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* Recursively exhaust the JNDI tree
*/
private static final void listContext(javax.naming.Context ctx, String indent) {
try {
NamingEnumeration<Binding> list = ctx.listBindings("");
while (list.hasMore()) {
Binding item = (Binding) list.next();
String className = item.getClassName();
String name = item.getName();
log.info(indent + className + " | " + name);
Object o = item.getObject();
if (o instanceof javax.naming.Context) {
listContext((javax.naming.Context) o, indent + " ");
}
}
} catch (NamingException ex) {
log.warn("JNDI failure: ", ex);
}
}
示例6: getNameInNamespace
import javax.naming.Binding; //导入方法依赖的package包/类
public String getNameInNamespace(long companyId, Binding binding)
throws Exception {
String baseDN = PrefsPropsUtil.getString(companyId,
PropsKeys.LDAP_BASE_DN);
if (Validator.isNull(baseDN)) {
return binding.getName();
} else {
StringBuilder sb = new StringBuilder();
sb.append(binding.getName());
sb.append(StringPool.COMMA);
sb.append(baseDN);
return sb.toString();
}
}
示例7: createMBeans
import javax.naming.Binding; //导入方法依赖的package包/类
/**
* Create the MBeans for the interesting global JNDI resources in
* the specified naming context.
*
* @param prefix Prefix for complete object name paths
* @param context Context to be scanned
*
* @exception NamingException if a JNDI exception occurs
*/
protected void createMBeans(String prefix, Context context)
throws NamingException {
if (debug >= 1) {
log("Creating MBeans for Global JNDI Resources in Context '" +
prefix + "'");
}
NamingEnumeration bindings = context.listBindings("");
while (bindings.hasMore()) {
Binding binding = (Binding) bindings.next();
String name = prefix + binding.getName();
Object value = context.lookup(binding.getName());
if (debug >= 2) {
log("Checking resource " + name);
}
if (value instanceof Context) {
createMBeans(name + "/", (Context) value);
} else if (value instanceof UserDatabase) {
try {
createMBeans(name, (UserDatabase) value);
} catch (Exception e) {
log("Exception creating UserDatabase MBeans for " + name,
e);
}
}
}
}
示例8: getBindingName
import javax.naming.Binding; //导入方法依赖的package包/类
private static String getBindingName(String path, Binding binding) {
// nécessaire pour glassfish 3.0.1
String result = binding.getName();
if (result.startsWith(JNDI_PREFIX)) {
result = result.substring(JNDI_PREFIX.length());
}
if (result.startsWith(path)) {
result = result.substring(path.length());
}
if (!result.isEmpty() && result.charAt(0) == '/') {
result = result.substring(1);
}
return result;
}
示例9: tearDownRecursively
import javax.naming.Binding; //导入方法依赖的package包/类
public static void tearDownRecursively(final Context c) throws Exception {
for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
Binding b = ne.next();
String name = b.getName();
Object object = b.getObject();
if (object instanceof Context) {
JNDIUtil.tearDownRecursively((Context) object);
}
c.unbind(name);
}
}
示例10: toString
import javax.naming.Binding; //导入方法依赖的package包/类
private static String toString(StringBuffer buf, int i, Context ctx)
throws NamingException {
int j = i + 4;
space(buf, i);
buf.append(ctx + " {").append("\n");
NamingEnumeration<Binding> enumeration = ctx.listBindings("");
while (enumeration.hasMoreElements()) {
Binding r = enumeration.nextElement();
space(buf, j);
if (r.getName() != null) {
buf.append(r.getName());
if (ctx instanceof DirContext) {
buf.append(" ");
buf.append(toString(((DirContext) ctx).getAttributes(r
.getName())));
}
}
buf.append(" = ");
if (r.getObject() instanceof Context) {
toString(buf, j, (Context) r.getObject());
} else {
buf.append(r.getObject() == null ? "" : r.getObject());
}
buf.append("\n");
}
space(buf, i);
buf.append("}");
return buf.toString();
}
示例11: dumpContext
import javax.naming.Binding; //导入方法依赖的package包/类
private static void dumpContext(String contextName) throws IOException {
try {
InitialContext ic = new InitialContext();
Context c = (Context)ic.lookup(contextName);
NamingEnumeration<Binding> be = c.listBindings("/");
String s = "\n\n" + contextName + ":\n";
while(be.hasMore()) {
Binding b = be.next();
s += " " + b.getName() + " -> " + b.getObject() + " (" + b.getClassName() + ")\n";
}
log.info(s);
ic.close();
}
catch (Exception e) {
throw new IOException(e);
}
}