JDK 11 java.naming.jmod - Naming Module

JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module.

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

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

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

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

✍: FYIcenter

com/sun/jndi/ldap/NotifierArgs.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.ldap;

import javax.naming.directory.SearchControls;
import javax.naming.event.*;

/**
 * This class holds the information in an event registration/deregistration
 * request. This includes the name, filter, search controls and
 * the different interfaces that the listener implements. This last piece
 * of information determines which event(s) the listener is interested in.
 *<p>
 * It overrides equals() and hashCode() to use all these pieces of
 * information so that it can be used correctly in a hashtable.
 *
 * @author Rosanna Lee
 */
final class NotifierArgs {
    static final int ADDED_MASK = 0x1;
    static final int REMOVED_MASK = 0x2;
    static final int CHANGED_MASK = 0x4;
    static final int RENAMED_MASK = 0x8;

    // these fields are package private; used by NamingEventNotifier
    String name;
    String filter;
    SearchControls controls;
    int mask;

    // package private
    NotifierArgs(String name, int scope, NamingListener l) {
        this(name, "(objectclass=*)", null, l);

        // if scope is not default, create search ctl and set it
        if (scope != EventContext.ONELEVEL_SCOPE) {
            controls = new SearchControls();
            controls.setSearchScope(scope);
        }
    }

    // package private
    NotifierArgs(String name, String filter, SearchControls ctls,
        NamingListener l) {
        this.name = name;
        this.filter = filter;
        this.controls = ctls;

        if (l instanceof NamespaceChangeListener) {
            mask |= ADDED_MASK|REMOVED_MASK|RENAMED_MASK;
        }
        if (l instanceof ObjectChangeListener) {
            mask |= CHANGED_MASK;
        }
    }

    // checks name, filter, controls
    public boolean equals(Object obj) {
        if (obj instanceof NotifierArgs) {
            NotifierArgs target = (NotifierArgs)obj;
            return mask == target.mask &&
                name.equals(target.name) && filter.equals(target.filter) &&
                checkControls(target.controls);
        }
        return false;
    }

    private boolean checkControls(SearchControls ctls) {
        if ((controls == null || ctls == null)) {
            return ctls == controls;
        }
        // ctls are nonempty

        return (controls.getSearchScope() == ctls.getSearchScope()) &&
            (controls.getTimeLimit() == ctls.getTimeLimit()) &&
            (controls.getDerefLinkFlag() == ctls.getDerefLinkFlag()) &&
            (controls.getReturningObjFlag() == ctls.getReturningObjFlag()) &&
            (controls.getCountLimit() == ctls.getCountLimit()) &&
            checkStringArrays(controls.getReturningAttributes(),
                ctls.getReturningAttributes());
    }

    private static boolean checkStringArrays(String[] s1, String[] s2) {
        if ((s1 == null) || (s2 == null)) {
            return s1 == s2;
        }

        // both are nonnull
        if (s1.length != s2.length) {
            return false;
        }

        for (int i = 0; i < s1.length; i++) {
            if (!s1[i].equals(s2[i])) {
                return false;
            }
        }
        return true;
    }

    // save from having to recalculate each time
    private int sum = -1;
    public int hashCode() {
        if (sum == -1)
            sum = mask + name.hashCode() + filter.hashCode() + controlsCode();
        return sum;
    }

    // used in calculating hash code
    private int controlsCode() {
        if (controls == null) return 0;

        int total = controls.getTimeLimit() + (int)controls.getCountLimit() +
            (controls.getDerefLinkFlag() ? 1 : 0) +
            (controls.getReturningObjFlag() ? 1 : 0);

        String[] attrs = controls.getReturningAttributes();
        if (attrs != null) {
            for (int i = 0; i < attrs.length; i++) {
                total += attrs[i].hashCode();
            }
        }

        return total;
    }
}

com/sun/jndi/ldap/NotifierArgs.java

 

Or download all of them as a single archive file:

File name: java.naming-11.0.1-src.zip
File size: 461792 bytes
Release date: 2018-11-04
Download 

 

JDK 11 java.net.http.jmod - Net HTTP Module

JDK 11 java.management.rmi.jmod - Management RMI Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-09-30, 52028👍, 0💬