JDK 11 jdk.naming.rmi.jmod - Naming RMI Module

JDK 11 jdk.naming.rmi.jmod is the JMOD file for JDK 11 Naming RMI module.

JDK 11 Naming RMI module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.naming.rmi.jmod.

JDK 11 Naming RMI module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Naming RMI module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.naming.rmi.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

com/sun/jndi/url/rmi/rmiURLContext.java

/*
 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package com.sun.jndi.url.rmi;

import java.util.Hashtable;

import javax.naming.*;
import javax.naming.spi.ResolveResult;
import com.sun.jndi.toolkit.url.GenericURLContext;
import com.sun.jndi.rmi.registry.RegistryContext;


/**
 * An RMI URL context resolves names that are URLs of the form
 * <pre>
 *   rmi://[host][:port][/[object]]
 * or
 *   rmi:[/][object]
 * </pre>
 * If an object is specified, the URL resolves to the named object.
 * Otherwise, the URL resolves to the specified RMI registry.
 *
 * @author Scott Seligman
 */
public class rmiURLContext extends GenericURLContext {

    public rmiURLContext(Hashtable<?,?> env) {
        super(env);
    }

    /**
     * Resolves the registry portion of "url" to the corresponding
     * RMI registry, and returns the atomic object name as the
     * remaining name.
     */
    protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
            throws NamingException
    {
        if (!url.startsWith("rmi:")) {
            throw (new IllegalArgumentException(
                    "rmiURLContext: name is not an RMI URL: " + url));
        }

        // Parse the URL.

        String host = null;
        int port = -1;
        String objName = null;

        int i = 4;              // index into url, following the "rmi:"

        if (url.startsWith("//", i)) {          // parse "//host:port"
            i += 2;                             // skip past "//"
            int slash = url.indexOf('/', i);
            if (slash < 0) {
                slash = url.length();
            }
            if (url.startsWith("[", i)) {               // at IPv6 literal
                int brac = url.indexOf(']', i + 1);
                if (brac < 0 || brac > slash) {
                    throw new IllegalArgumentException(
                        "rmiURLContext: name is an Invalid URL: " + url);
                }
                host = url.substring(i, brac + 1);      // include brackets
                i = brac + 1;                           // skip past "[...]"
            } else {                                    // at host name or IPv4
                int colon = url.indexOf(':', i);
                int hostEnd = (colon < 0 || colon > slash)
                    ? slash
                    : colon;
                if (i < hostEnd) {
                    host = url.substring(i, hostEnd);
                }
                i = hostEnd;                            // skip past host
            }
            if ((i + 1 < slash)) {
                if ( url.startsWith(":", i)) {       // parse port
                    i++;                             // skip past ":"
                    port = Integer.parseInt(url.substring(i, slash));
                } else {
                    throw new IllegalArgumentException(
                        "rmiURLContext: name is an Invalid URL: " + url);
                }
            }
            i = slash;
        }
        if ("".equals(host)) {
            host = null;
        }
        if (url.startsWith("/", i)) {           // skip "/" before object name
            i++;
        }
        if (i < url.length()) {
            objName = url.substring(i);
        }

        // Represent object name as empty or single-component composite name.
        CompositeName remaining = new CompositeName();
        if (objName != null) {
            remaining.add(objName);
        }

        // Debug
        //System.out.println("host=" + host + " port=" + port +
        //                 " objName=" + remaining.toString() + "\n");

        // Create a registry context.
        Context regCtx = new RegistryContext(host, port, env);

        return (new ResolveResult(regCtx, remaining));
    }
}

com/sun/jndi/url/rmi/rmiURLContext.java

 

JDK 11 jdk.net.jmod - Net Module

JDK 11 jdk.naming.dns.jmod - Naming DNS Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-04-25, 2478👍, 0💬