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


Java Messages.getString方法代码示例

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


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

示例1: bind

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void bind(Name name, Object obj) throws NamingException {
    if (!(name instanceof CompositeName)) {
        // jndi.26=URL context can't accept non-composite name: {0}
        throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
    }

    if (name.size() == 1) {
        bind(name.get(0), obj);
    } else {
        Context context = getContinuationContext(name);

        try {
            context.bind(name.getSuffix(1), obj);
        } finally {
            context.close();
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:GenericURLContext.java

示例2: getSchema

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public DirContext getSchema(Name name) throws NamingException {
    if (!(name instanceof CompositeName)) {
        // jndi.26=URL context can't accept non-composite name: {0}
        throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
    }

    if (name.size() == 1) {
        return getSchema(name.get(0));
    }
    DirContext context = getContinuationContext(name);

    try {
        return context.getSchema(name.getSuffix(1));
    } finally {
        context.close();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:ldapURLContext.java

示例3: search

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public NamingEnumeration<SearchResult> search(Name name,
        Attributes attributes) throws NamingException {
    if (!(name instanceof CompositeName)) {
        // jndi.26=URL context can't accept non-composite name: {0}
        throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
    }

    if (name.size() == 1) {
        return search(name.get(0), attributes);
    }

    DirContext context = getContinuationContext(name);

    try {
        return context.search(name.getSuffix(1), attributes);

    } finally {
        context.close();
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:21,代码来源:ldapURLContext.java

示例4: compareTo

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public int compareTo(Object obj) {
    if (obj == null || !(obj instanceof LdapName)) {
        throw new ClassCastException("obj " + Messages.getString("ldap.01"));
    }

    LdapName ln = (LdapName) obj;

    Iterator<?> iter = rdns.iterator();
    Iterator<?> iter2 = ln.rdns.iterator();

    while (iter.hasNext() && iter2.hasNext()) {
        int c = iter.next().toString().toLowerCase().compareTo(
                iter2.next().toString().toLowerCase());

        if (c != 0) {
            return c;
        }
    }

    if (iter.hasNext())
        return 1;
    if (iter2.hasNext())
        return -1;

    return 0;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:LdapName.java

示例5: convertFromStringToName

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * convert <code>String</code> name to <code>Name</code> instance, we
 * assume the <code>String</code> name parameter is using composite name
 * syntax (see LDAP service providers guidlines, part 4).
 * 
 * @param s
 *            <code>String</code> name to be converted
 * @return <code>Name</code> instance equivalent to <code>s</code>
 * @throws InvalidNameException
 *             occurs error while converting
 */
protected Name convertFromStringToName(String s)
        throws InvalidNameException {
    if (s == null) {
        // jndi.2E=The name is null
        throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$
    }

    CompositeName name = new CompositeName(s);
    if (name.size() == 0) {
        // return empty name
        return new LdapName(""); //$NON-NLS-1$
    }

    return name;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:LdapContextImpl.java

示例6: rebind

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public void rebind(Name name, Object obj, Attributes attributes)
        throws NamingException {
    if (!(name instanceof CompositeName)) {
        // jndi.26=URL context can't accept non-composite name: {0}
        throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
    }

    if (name.size() == 1) {
        rebind(name.get(0), obj, attributes);
        return;
    }

    DirContext context = getContinuationContext(name);

    try {
        context.rebind(name.getSuffix(1), obj, attributes);

    } finally {
        context.close();
    }

}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:23,代码来源:ldapURLContext.java

示例7: rebind

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void rebind(Name name, Object obj) throws NamingException {
    if (!(name instanceof CompositeName)) {
        // jndi.26=URL context can't accept non-composite name: {0}
        throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
    }

    if (name.size() == 1) {
        rebind(name.get(0), obj);
    } else {
        Context context = getContinuationContext(name);

        try {
            context.rebind(name.getSuffix(1), obj);
        } finally {
            context.close();
        }
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:22,代码来源:GenericURLContext.java

示例8: addAll

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Add given components to the end of current name. The order is preserved.
 * 
 * @param name
 *            components this name should be added
 * @return <code>this</code> object
 * @throws InvalidNameException
 *             if the name given is not an instance of <code>DNSName</code>
 *             class
 * @see Name#addAll(Name)
 */
public Name addAll(Name name) throws InvalidNameException {
    Vector<String> newComps;

    if (!(name instanceof DNSName)) {
        // jndi.31=Given name is not an instance of DNSName class
        throw new InvalidNameException(Messages.getString("jndi.31")); //$NON-NLS-1$
    }
    newComps = ((DNSName) name).components;
    components.addAll(newComps);
    return this;
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:23,代码来源:DNSName.java

示例9: search

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * This method is not supported.
 * 
 * @see DirContext#search(Name,
 *      String, SearchControls)
 */
public NamingEnumeration<SearchResult> search(Name arg0, String arg1,
        SearchControls arg2) throws NamingException {
    Object obj = lookup(arg0);

    if (obj instanceof DNSContext) {
        throw new OperationNotSupportedException();
    } else if (obj instanceof DirContext) {
        return ((DirContext) obj).search("", arg1, arg2); //$NON-NLS-1$
    } else {
        // jndi.4A=found object is not a DirContext
        throw new NotContextException(Messages.getString("jndi.4A")); //$NON-NLS-1$
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:20,代码来源:DNSContext.java

示例10: unescapeValue

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public static Object unescapeValue(String val) {
    if (val == null) {
        throw new NullPointerException("val "
                + Messages.getString("ldap.00"));
    }
    return LdapRdnParser.unescapeValue(val);
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:8,代码来源:Rdn.java

示例11: addInitialServer

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Adds initial DNS server the resolver should start with. Trying underlying
 * OS services to determine IP from name.
 * 
 * @param name
 *            server's name
 * @param ip
 *            server's IP address
 * @param port
 *            port on server
 */
public void addInitialServer(String name, String ip, int port,
        String zoneName) {
    Server server = new Server(name, ip, port);
    SList slist = SList.getInstance();

    if (name == null && ip == null) {
        // jndi.6F=Both name and IP are null
        throw new NullPointerException(Messages.getString("jndi.6F")); //$NON-NLS-1$
    }
    if (zoneName == null) {
        // jndi.70=zoneName is null
        throw new NullPointerException(Messages.getString("jndi.70")); //$NON-NLS-1$
    }
    // if IP is not given and we don't know this server yet
    // try to determine IP from underlying OS services
    if (ip == null && !slist.hasServer(name)) {
        InetAddress addrObj = TransportMgr.getIPByName_OS(name);

        if (addrObj != null) {
            server.setIP(ProviderMgr.getIpStr(addrObj.getAddress()));
        }
    }
    // add given zone <-> server pair
    if (!slist.hasServer(zoneName, server)) {
        slist.updateEntry(zoneName, server, SList.UNKNOWN);
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:39,代码来源:Resolver.java

示例12: parseIpStr

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Parses the text representation of IPv4 address.
 * 
 * @param ipStr
 *            string in <code>n.n.n.n</code> format.
 * @return four bytes with parsed IP address
 * @throws java.lang.NullPointerException
 *             if <code>ipStr</code> is null
 * @throws java.lang.IllegalArgumentException
 *             if given string is not in appropriate format
 */
public static byte[] parseIpStr(String ipStr) {
    StringTokenizer st;
    byte[] b = new byte[4];
    // jndi.62=Given string is not in appropriate format
    final String errMsg1 = Messages.getString("jndi.62"); //$NON-NLS-1$

    if (ipStr != null) {
        int k = 0;

        st = new StringTokenizer(ipStr, "."); //$NON-NLS-1$
        while (st.hasMoreTokens()) {
            String token = st.nextToken();
            int n;

            try {
                n = Integer.parseInt(token);
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException(errMsg1);
            }
            b[k++] = (byte) n;
        }
        if (k != 4) {
            throw new IllegalArgumentException(errMsg1);
        }
    } else {
        // jndi.63=Given string representation is null
        throw new NullPointerException(Messages.getString("jndi.63")); //$NON-NLS-1$
    }
    return b;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:42,代码来源:ProviderMgr.java

示例13: add

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
public void add(int index, Object val) {
    if (ordered) {
        values.add(index, val);
    } else {
        if (contains(val)) {
            // jndi.16=Value already exists.
            throw new IllegalStateException(Messages.getString("jndi.16")); //$NON-NLS-1$
        }
        values.add(index, val);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:BasicAttribute.java

示例14: getURLOrDefaultInitCtx

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Returns a non-null context for the specified name of string
 * representation.
 * <p>
 * If an initial context factory builder has been defined, then the
 * specified name parameter is ignored and the result of <code>
 * getDefaultInitCtx</code>
 * is returned. Otherwise, if the name is not a URL string, then it returns
 * the result of invoking <code>getDefaultInitCtx
 * </code>. Otherwise, it
 * attempts to return a URL context
 * {@link javax.naming.spi.NamingManager#getURLContext(String, Hashtable)},
 * but if unsuccessful, returns the result of invoking <code>
 * getDefaultInitCtx</code>.
 * </p>
 * 
 * @param name
 *            a name used in a naming operation which may not be null
 * @return a context which may be a URL context
 * @throws NamingException
 *             If failed to get the desired context.
 */
protected Context getURLOrDefaultInitCtx(String name)
        throws NamingException {

    /*
     * If an initial context factory builder has been defined, then the
     * specified name parameter is ignored and the result of
     * getDefaultInitCtx() is returned.
     */
    if (NamingManager.hasInitialContextFactoryBuilder()) {
        return getDefaultInitCtx();
    }

    if (null == name) {
        // jndi.00=name must not be null
        throw new NullPointerException(Messages.getString("jndi.00")); //$NON-NLS-1$
    }

    // If the name has components
    String scheme = UrlParser.getScheme(name);
    Context ctx = null;
    if (null != scheme) {
        synchronized (contextCache) {
            if (contextCache.containsKey(scheme)) {
                return contextCache.get(scheme);
            }

            // So the first component is a valid URL
            ctx = NamingManager.getURLContext(scheme, myProps);
            if (null == ctx) {
                ctx = getDefaultInitCtx();
            }
            contextCache.put(scheme, ctx);
        }
        return ctx;
    }
    return getDefaultInitCtx();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:60,代码来源:InitialContext.java

示例15: parseLookupProp

import org.apache.harmony.jndi.internal.nls.Messages; //导入方法依赖的package包/类
/**
 * Parses "lookup attribute" environment property and fills appropriate
 * internal variable.
 * 
 * @throws ConfigurationException
 *             if some DNS type or DNS class is unknown
 */
private void parseLookupProp() throws ConfigurationException {
    Object tmp;

    if (environment.containsKey(LOOKUP_ATTR)) {
        int k;
        String recClassName;
        String recTypeName;
        String lookupAttr;

        tmp = environment.get(LOOKUP_ATTR);
        if (tmp instanceof String) {
            lookupAttr = (String) tmp;
            k = lookupAttr.indexOf(" "); //$NON-NLS-1$
            if (k > -1) {
                recClassName = lookupAttr.substring(0, k);

                lookupAttrClass = ProviderMgr
                        .getRecordClassNumber(recClassName);
                if (lookupAttrClass == -1) {
                    // jndi.46=DNS class {0} is not supported
                    throw new ConfigurationException(Messages.getString(
                            "jndi.46", recClassName));//$NON-NLS-1$
                }
                recTypeName = lookupAttr.substring(k).trim();
            } else {
                lookupAttrClass = ProviderConstants.DEFAULT_LOOKUP_ATTR_CLASS;
                recTypeName = lookupAttr.trim();
            }
            lookupAttrType = ProviderMgr.getRecordTypeNumber(recTypeName);
            if (lookupAttrType == -1) {
                // jndi.47=DNS type {0} is not supported
                throw new ConfigurationException(Messages.getString(
                        "jndi.47", recTypeName)); //$NON-NLS-1$
            }
        }
    }
}
 
开发者ID:nextopio,项目名称:nextop-client,代码行数:45,代码来源:DNSContext.java


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