当前位置: 首页>>代码示例>>Java>>正文


Java NameClassPair.getName方法代码示例

本文整理汇总了Java中javax.naming.NameClassPair.getName方法的典型用法代码示例。如果您正苦于以下问题:Java NameClassPair.getName方法的具体用法?Java NameClassPair.getName怎么用?Java NameClassPair.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.naming.NameClassPair的用法示例。


在下文中一共展示了NameClassPair.getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contextDump

import javax.naming.NameClassPair; //导入方法依赖的package包/类
private static String contextDump(Context ctx, String root, boolean recurse, int level) 
{
	StringBuilder sb = new StringBuilder();
	try
	{
		for( NamingEnumeration<NameClassPair> list = ctx.list(root); list.hasMore(); ) 
		{
		    NameClassPair nc = list.next();
		    for(int t=0; t<level; ++t)
		    	sb.append('\t');
		    sb.append(nc);
	    	sb.append("line.separator");
	    	if(recurse)
	    	{
	    		String childPath = root.length() > 0 ? root + "/" + nc.getName() : nc.getName();
	    		contextDump(ctx, childPath, recurse, level+1);
	    	}
		}
	}
	catch(NamingException nX)
	{
		sb.append(nX.getMessage());
	}
	
	return sb.toString();
}
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:27,代码来源:JndiUtility.java

示例2: list

import javax.naming.NameClassPair; //导入方法依赖的package包/类
/**
 * List children of this collection. The names given are relative to this
 * URI's path. The full uri of the children is then : path + "/" + name.
 */
public Enumeration<String> list()
    throws IOException {

    if (!connected) {
        connect();
    }

    if ((resource == null) && (collection == null)) {
        throw new FileNotFoundException(
                getURL() == null ? "null" : getURL().toString());
    }

    Vector<String> result = new Vector<String>();

    if (collection != null) {
        try {
            NamingEnumeration<NameClassPair> enumeration =
                collection.list("/");
            UEncoder urlEncoder = new UEncoder(UEncoder.SafeCharsSet.WITH_SLASH);
            while (enumeration.hasMoreElements()) {
                NameClassPair ncp = enumeration.nextElement();
                String s = ncp.getName();
                result.addElement(
                        urlEncoder.encodeURL(s, 0, s.length()).toString());
            }
        } catch (NamingException e) {
            // Unexpected exception
            throw new FileNotFoundException(
                    getURL() == null ? "null" : getURL().toString());
        }
    }

    return result.elements();

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:40,代码来源:DirContextURLConnection.java

示例3: tldScanResourcePathsWebInf

import javax.naming.NameClassPair; //导入方法依赖的package包/类
private void tldScanResourcePathsWebInf(DirContext resources,
                                        String rootPath,
                                        Set tldPaths) 
        throws IOException {

    if (log.isTraceEnabled()) {
        log.trace("  Scanning TLDs in " + rootPath + " subdirectory");
    }

    try {
        NamingEnumeration items = resources.list(rootPath);
        while (items.hasMoreElements()) {
            NameClassPair item = (NameClassPair) items.nextElement();
            String resourcePath = rootPath + "/" + item.getName();
            if (!resourcePath.endsWith(".tld")
                    && (resourcePath.startsWith("/WEB-INF/classes")
                        || resourcePath.startsWith("/WEB-INF/lib"))) {
                continue;
            }
            if (resourcePath.endsWith(".tld")) {
                if (log.isTraceEnabled()) {
                    log.trace("   Adding path '" + resourcePath + "'");
                }
                tldPaths.add(resourcePath);
            } else {
                tldScanResourcePathsWebInf(resources, resourcePath,
                                           tldPaths);
            }
        }
    } catch (NamingException e) {
        ; // Silent catch: it's valid that no /WEB-INF directory exists
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:TldConfig.java

示例4: list

import javax.naming.NameClassPair; //导入方法依赖的package包/类
/**
 * List children of this collection. The names given are relative to this
 * URI's path. The full uri of the children is then : path + "/" + name.
 */
public Enumeration<String> list() throws IOException {

	if (!connected) {
		connect();
	}

	if ((resource == null) && (collection == null)) {
		throw new FileNotFoundException(getURL() == null ? "null" : getURL().toString());
	}

	Vector<String> result = new Vector<String>();

	if (collection != null) {
		try {
			NamingEnumeration<NameClassPair> enumeration = collection.list("/");
			UEncoder urlEncoder = new UEncoder(UEncoder.SafeCharsSet.WITH_SLASH);
			while (enumeration.hasMoreElements()) {
				NameClassPair ncp = enumeration.nextElement();
				String s = ncp.getName();
				result.addElement(urlEncoder.encodeURL(s, 0, s.length()).toString());
			}
		} catch (NamingException e) {
			// Unexpected exception
			throw new FileNotFoundException(getURL() == null ? "null" : getURL().toString());
		}
	}

	return result.elements();

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:35,代码来源:DirContextURLConnection.java

示例5: doList

import javax.naming.NameClassPair; //导入方法依赖的package包/类
private static void doList(int level, InitialContext context, String name) throws NamingException {

      for (NamingEnumeration ne = context.list(name); ne.hasMore();) {
         NameClassPair ncp = (NameClassPair) ne.next();
         String objectName = ncp.getName();
         String className = ncp.getClassName();
         String classText = " :" + className;
         if (isContext(className)) {
            log.debug(getPad(level) + "+" + objectName + classText);
            doList(level + 1, context, name + "/" + objectName);
         } else {
            log.debug(getPad(level) + "-" + objectName + classText);
         }
      }
   }
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:16,代码来源:EjbLookup.java

示例6: walk

import javax.naming.NameClassPair; //导入方法依赖的package包/类
private void walk(Context ctx, String name) {
    NamingEnumeration<NameClassPair> list = null;
    try {
        list = ctx.list("java:comp/" + name);
        while (list.hasMore()) {
            NameClassPair pair = list.next();
            if(!pair.getName().equals("__")){
                String cname = name + "/" + pair.getName();
                walk(ctx, cname);
            }
        }
    } catch (NamingException e) {
        logger.info("java:comp/" + name);
    }
}
 
开发者ID:phuihock,项目名称:birtconn,代码行数:16,代码来源:Application.java

示例7: getJndiDataSourcesAt

import javax.naming.NameClassPair; //导入方法依赖的package包/类
private static Map<String, DataSource> getJndiDataSourcesAt(String jndiPrefix)
		throws NamingException {
	final InitialContext initialContext = new InitialContext();
	final Map<String, DataSource> dataSources = new LinkedHashMap<String, DataSource>(2);
	try {
		for (final NameClassPair nameClassPair : Collections
				.list(initialContext.list(jndiPrefix))) {
			// note: il ne suffit pas de tester
			// (DataSource.class.isAssignableFrom(Class.forName(nameClassPair.getClassName())))
			// car nameClassPair.getClassName() vaut "javax.naming.LinkRef" sous jboss 5.1.0.GA
			// par exemple, donc on fait le lookup pour voir
			final String jndiName;
			if (nameClassPair.getName().startsWith("java:")) {
				// pour glassfish v3
				jndiName = nameClassPair.getName();
			} else {
				jndiName = jndiPrefix + '/' + nameClassPair.getName();
			}
			final Object value = initialContext.lookup(jndiName);
			if (value instanceof DataSource) {
				dataSources.put(jndiName, (DataSource) value);
			}
		}
	} catch (final NamingException e) {
		// le préfixe ("comp/env/jdbc", "/jdbc" ou "java:global/jdbc", etc) n'existe pas dans jndi,
		// (dans glassfish 3.0.1, c'est une NamingException et non une NameNotFoundException)
		return dataSources;
	}
	initialContext.close();
	return dataSources;
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:32,代码来源:JdbcWrapperHelper.java

示例8: list

import javax.naming.NameClassPair; //导入方法依赖的package包/类
/**
 * List children of this collection. The names given are relative to this
 * URI's path. The full uri of the children is then : path + "/" + name.
 */
public Enumeration<String> list()
    throws IOException {

    if (!connected) {
        connect();
    }

    if ((resource == null) && (collection == null)) {
        throw new FileNotFoundException(
                getURL() == null ? "null" : getURL().toString());
    }

    Vector<String> result = new Vector<String>();

    if (collection != null) {
        try {
            NamingEnumeration<NameClassPair> enumeration =
                collection.list("/");
            while (enumeration.hasMoreElements()) {
                NameClassPair ncp = enumeration.nextElement();
                String s = ncp.getName();
                result.addElement(
                        URL_ENCODER.encodeURL(s, 0, s.length()).toString());
            }
        } catch (NamingException e) {
            // Unexpected exception
            throw new FileNotFoundException(
                    getURL() == null ? "null" : getURL().toString());
        }
    }

    return result.elements();

}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:39,代码来源:DirContextURLConnection.java

示例9: logNameClassPair

import javax.naming.NameClassPair; //导入方法依赖的package包/类
public static void logNameClassPair(NameClassPair ncp) {

        String s = "name: ";
        s += ncp.getName();

        s += ", class name: ";
        s += ncp.getClassName();

        s += ", name in namespace: ";

        try {

            s += ncp.getNameInNamespace();
        }
        catch(UnsupportedOperationException e) {

            s += "UNSUPPORTED";

        }

        s += ", ";
        s += (ncp.isRelative() ? "relative" : "NOT relative");

        log.info(s);
    }
 
开发者ID:NovaOrdis,项目名称:playground,代码行数:26,代码来源:Util.java

示例10: next

import javax.naming.NameClassPair; //导入方法依赖的package包/类
@Override
public Binding next() throws NamingException {
    NameClassPair pair = entries.next();
    return new Binding(pair.getName(), pair.getClassName(), null);
}
 
开发者ID:huihoo,项目名称:olat,代码行数:6,代码来源:VFSDirContext.java


注:本文中的javax.naming.NameClassPair.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。