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


Java Name.toString方法代码示例

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


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

示例1: getGroupBeanFromResult

import javax.naming.Name; //导入方法依赖的package包/类
public GroupBean getGroupBeanFromResult(Name name, Attributes attributes)
{
	String id;
	if( !Check.isEmpty(groupIdField) )
	{
		id = getValue(attributes, groupIdField);
	}
	else
	{
		id = name.toString();
	}
	if( config.isForceLowercaseIds() )
	{
		id = id.toLowerCase();
	}

	String groupname = getValue(attributes, groupNameField);
	if( id.length() == 0 || groupname.length() == 0 )
	{
		return null;
	}
	return new DefaultGroupBean(id, groupname);
}
 
开发者ID:equella,项目名称:Equella,代码行数:24,代码来源:LDAP.java

示例2: getNameInNamespace

import javax.naming.Name; //导入方法依赖的package包/类
@Override
public String getNameInNamespace() throws NamingException {
	LocalContext ancestor = iParent;

	if (ancestor == null) return "";

	Name name = parse("");
	name.add(iName);

	while (ancestor != null && ancestor.iName != null) {
		name.add(0, ancestor.iName);
		ancestor = ancestor.iParent;
	}

	return name.toString();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:17,代码来源:LocalContext.java

示例3: fromName

import javax.naming.Name; //导入方法依赖的package包/类
/**
 * Convert a {@link javax.naming.Name} to a Dn
 *
 * @param name The Name to convert
 * @return A Dn
 */
public static Dn fromName( Name name )
{
    try
    {
        return new Dn( name.toString() );
    }
    catch ( LdapInvalidDnException lide )
    {
        // TODO : check if we must throw an exception.
        // Logically, the Name must be valid.
        return null;
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:20,代码来源:JndiUtils.java

示例4: getObjectInstance

import javax.naming.Name; //导入方法依赖的package包/类
/**
 * <p>Create and return a new <code>MemoryUserDatabase</code> instance
 * that has been configured according to the properties of the
 * specified <code>Reference</code>.  If you instance can be created,
 * return <code>null</code> instead.</p>
 *
 * @param obj The possibly null object containing location or
 *  reference information that can be used in creating an object
 * @param name The name of this object relative to <code>nameCtx</code>
 * @param nameCtx The context relative to which the <code>name</code>
 *  parameter is specified, or <code>null</code> if <code>name</code>
 *  is relative to the default initial context
 * @param environment The possibly null environment that is used in
 *  creating this object
 */
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                Hashtable<?,?> environment)
    throws Exception {

    // We only know how to deal with <code>javax.naming.Reference</code>s
    // that specify a class name of "org.apache.catalina.UserDatabase"
    if ((obj == null) || !(obj instanceof Reference)) {
        return (null);
    }
    Reference ref = (Reference) obj;
    if (!"org.apache.catalina.UserDatabase".equals(ref.getClassName())) {
        return (null);
    }

    // Create and configure a MemoryUserDatabase instance based on the
    // RefAddr values associated with this Reference
    MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
    RefAddr ra = null;

    ra = ref.get("pathname");
    if (ra != null) {
        database.setPathname(ra.getContent().toString());
    }

    ra = ref.get("readonly");
    if (ra != null) {
        database.setReadonly(Boolean.parseBoolean(ra.getContent().toString()));
    }

    // Return the configured database instance
    database.open();
    // Don't try something we know won't work
    if (!database.getReadonly())
        database.save();
    return (database);

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

示例5: collectAllSubGroupFullNames

import javax.naming.Name; //导入方法依赖的package包/类
private void collectAllSubGroupFullNames(Set<String> results, DirContext ctx, Name parent)
{
	final String fullname = parent.toString();
	if( results.add(fullname) )
	{
		for( Name child : ldap.searchAllBases(ctx, getSubgroupsByMemberOfFilter(fullname),
			new FullNameHitsCollector(), true) )
		{
			collectAllSubGroupFullNames(results, ctx, child);
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:MemberOfGroupSearch.java

示例6: getDistinguishedName

import javax.naming.Name; //导入方法依赖的package包/类
/**
 * Returns the distinguished name of a search result.
 *
 * @param context Our DirContext
 * @param base The base DN
 * @param result The search result
 * @return String containing the distinguished name
 */
protected String getDistinguishedName(DirContext context, String base, SearchResult result)
    throws NamingException {
    // Get the entry's distinguished name
    NameParser parser = context.getNameParser("");
    Name contextName = parser.parse(context.getNameInNamespace());
    Name baseName = parser.parse(base);

    // Bugzilla 32269
    Name entryName = parser.parse(new CompositeName(result.getName()).get(0));

    Name name = contextName.addAll(baseName);
    name = name.addAll(entryName);
    return name.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:JNDIRealm.java

示例7: getMyComponents

import javax.naming.Name; //导入方法依赖的package包/类
protected Name getMyComponents(Name name) throws NamingException {
	if (name instanceof CompositeName) {
		if (name.size() > 1)
			throw new InvalidNameException(name.toString() + " has more components than namespace can handle");
		return parse(name.get(0));
	} else {
		return name;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:LocalContext.java

示例8: rename

import javax.naming.Name; //导入方法依赖的package包/类
@Override
public void rename(Name oldname, Name newname) throws NamingException {
	if (oldname.isEmpty() || newname.isEmpty())
		throw new InvalidNameException("Cannot rename empty name");

	Name oldnm = getMyComponents(oldname);
	Name newnm = getMyComponents(newname);

	if (oldnm.size() != newnm.size())
		throw new OperationNotSupportedException("Do not support rename across different contexts");

	String oldatom = oldnm.get(0);
	String newatom = newnm.get(0);

	if (oldnm.size() == 1) {
		if (iBindings.get(newatom) != null)
			throw new NameAlreadyBoundException(newname.toString() + " is already bound");

		Object oldBinding = iBindings.remove(oldatom);
		if (oldBinding == null)
			throw new NameNotFoundException(oldname.toString() + " not bound");

		iBindings.put(newatom, oldBinding);
	} else {
		if (!oldatom.equals(newatom))
			throw new OperationNotSupportedException("Do not support rename across different contexts");

		Object inter = iBindings.get(oldatom);
		
		if (!(inter instanceof Context))
			throw new NotContextException(oldatom + " does not name a context");

		((Context) inter).rename(oldnm.getSuffix(1), newnm.getSuffix(1));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:36,代码来源:LocalContext.java

示例9: getTargetContext

import javax.naming.Name; //导入方法依赖的package包/类
protected DirContextStringPair getTargetContext(String name)
        throws NamingException {

    if (cpe.getResolvedObj() == null)
        throw (NamingException)cpe.fillInStackTrace();

    Context ctx = NamingManager.getContext(cpe.getResolvedObj(),
                                           cpe.getAltName(),
                                           cpe.getAltNameCtx(),
                                           env);

    if (ctx instanceof DirContext)
        return new DirContextStringPair((DirContext)ctx, name);

    if (ctx instanceof Resolver) {
        Resolver res = (Resolver)ctx;
        ResolveResult rr = res.resolveToClass(name, DirContext.class);

        // Reached a DirContext; return result.
        DirContext dctx = (DirContext)rr.getResolvedObj();
        Name tmp = rr.getRemainingName();
        String remains = (tmp != null) ? tmp.toString() : "";
        return (new DirContextStringPair(dctx, remains));
    }

    // Resolve all the way using lookup().  This may allow the operation
    // to succeed if it doesn't require the penultimate context.
    Object ultimate = ctx.lookup(name);
    if (ultimate instanceof DirContext) {
        return (new DirContextStringPair((DirContext)ultimate, ""));
    }

    throw (NamingException)cpe.fillInStackTrace();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:ContinuationDirContext.java

示例10: getObjectInstance

import javax.naming.Name; //导入方法依赖的package包/类
/**
 * <p>Create and return a new <code>MemoryUserDatabase</code> instance
 * that has been configured according to the properties of the
 * specified <code>Reference</code>.  If you instance can be created,
 * return <code>null</code> instead.</p>
 *
 * @param obj The possibly null object containing location or
 *  reference information that can be used in creating an object
 * @param name The name of this object relative to <code>nameCtx</code>
 * @param nameCtx The context relative to which the <code>name</code>
 *  parameter is specified, or <code>null</code> if <code>name</code>
 *  is relative to the default initial context
 * @param environment The possibly null environment that is used in
 *  creating this object
 */
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                Hashtable environment)
    throws Exception {

    // We only know how to deal with <code>javax.naming.Reference</code>s
    // that specify a class name of "org.apache.catalina.UserDatabase"
    if ((obj == null) || !(obj instanceof Reference)) {
        return (null);
    }
    Reference ref = (Reference) obj;
    if (!"org.apache.catalina.UserDatabase".equals(ref.getClassName())) {
        return (null);
    }

    // Create and configure a MemoryUserDatabase instance based on the
    // RefAddr values associated with this Reference
    MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
    RefAddr ra = null;

    ra = ref.get("pathname");
    if (ra != null) {
        database.setPathname(ra.getContent().toString());
    }

    // Return the configured database instance
    database.open();
    database.save();
    return (database);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:46,代码来源:MemoryUserDatabaseFactory.java

示例11: getObjectInstance

import javax.naming.Name; //导入方法依赖的package包/类
/**
 * <p>
 * Create and return a new <code>MemoryUserDatabase</code> instance that has
 * been configured according to the properties of the specified
 * <code>Reference</code>. If you instance can be created, return
 * <code>null</code> instead.
 * </p>
 *
 * @param obj
 *            The possibly null object containing location or reference
 *            information that can be used in creating an object
 * @param name
 *            The name of this object relative to <code>nameCtx</code>
 * @param nameCtx
 *            The context relative to which the <code>name</code> parameter
 *            is specified, or <code>null</code> if <code>name</code> is
 *            relative to the default initial context
 * @param environment
 *            The possibly null environment that is used in creating this
 *            object
 */
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
		throws Exception {

	// We only know how to deal with <code>javax.naming.Reference</code>s
	// that specify a class name of "org.apache.catalina.UserDatabase"
	if ((obj == null) || !(obj instanceof Reference)) {
		return (null);
	}
	Reference ref = (Reference) obj;
	if (!"org.apache.catalina.UserDatabase".equals(ref.getClassName())) {
		return (null);
	}

	// Create and configure a MemoryUserDatabase instance based on the
	// RefAddr values associated with this Reference
	MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
	RefAddr ra = null;

	ra = ref.get("pathname");
	if (ra != null) {
		database.setPathname(ra.getContent().toString());
	}

	ra = ref.get("readonly");
	if (ra != null) {
		database.setReadonly(Boolean.parseBoolean(ra.getContent().toString()));
	}

	// Return the configured database instance
	database.open();
	// Don't try something we know won't work
	if (!database.getReadonly())
		database.save();
	return (database);

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

示例12: composeName

import javax.naming.Name; //导入方法依赖的package包/类
@Override
public String composeName(String name, String prefix) throws NamingException {
	Name result = composeName(new CompositeName(name), new CompositeName(prefix));
	return result.toString();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:6,代码来源:LocalContext.java


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