當前位置: 首頁>>代碼示例>>Java>>正文


Java Binding.getName方法代碼示例

本文整理匯總了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());
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:24,代碼來源:ApplicationContext.java

示例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());
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:ApplicationContext.java

示例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);
        }
    }

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:21,代碼來源:ApplicationContext.java

示例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());
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:23,代碼來源:ApplicationContext.java

示例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);
   }
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:21,代碼來源:EESchedulerTask.java

示例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();
	}
}
 
開發者ID:openegovplatform,項目名稱:OEPv2,代碼行數:19,代碼來源:ManagerLdap.java

示例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);
            }
        }
    }

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:39,代碼來源:GlobalResourcesLifecycleListener.java

示例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;
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:15,代碼來源:JndiBinding.java

示例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);
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:12,代碼來源:JNDIUtil.java

示例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();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:33,代碼來源:Util.java

示例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);
        }
    }
 
開發者ID:NovaOrdis,項目名稱:playground,代碼行數:28,代碼來源:ServletA.java


注:本文中的javax.naming.Binding.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。