Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 java.naming.jmod - Naming Module
JDK 17 java.naming.jmod is the JMOD file for JDK 17 Naming module.
JDK 17 Naming module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.naming.jmod.
JDK 17 Naming module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Naming module source code files are stored in \fyicenter\jdk-17.0.5\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/toolkit/dir/ContextEnumerator.java
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.jndi.toolkit.dir;
import javax.naming.*;
import javax.naming.directory.SearchControls;
import java.util.*;
/**
* A class for recursively enumerating the contents of a Context;
*
* @author Jon Ruiz
*/
public class ContextEnumerator implements NamingEnumeration<Binding> {
private static boolean debug = false;
private NamingEnumeration<Binding> children = null;
private Binding currentChild = null;
private boolean currentReturned = false;
private Context root;
private ContextEnumerator currentChildEnum = null;
private boolean currentChildExpanded = false;
private boolean rootProcessed = false;
private int scope = SearchControls.SUBTREE_SCOPE;
private String contextName = "";
public ContextEnumerator(Context context) throws NamingException {
this(context, SearchControls.SUBTREE_SCOPE);
}
public ContextEnumerator(Context context, int scope)
throws NamingException {
// return this object except when searching single-level
this(context, scope, "", scope != SearchControls.ONELEVEL_SCOPE);
}
protected ContextEnumerator(Context context, int scope, String contextName,
boolean returnSelf)
throws NamingException {
if(context == null) {
throw new IllegalArgumentException("null context passed");
}
root = context;
// No need to list children if we're only searching object
if (scope != SearchControls.OBJECT_SCOPE) {
children = getImmediateChildren(context);
}
this.scope = scope;
this.contextName = contextName;
// pretend root is processed, if we're not supposed to return ourself
rootProcessed = !returnSelf;
prepNextChild();
}
// Subclass should override if it wants to avoid calling obj factory
protected NamingEnumeration<Binding> getImmediateChildren(Context ctx)
throws NamingException {
return ctx.listBindings("");
}
// Subclass should override so that instance is of same type as subclass
protected ContextEnumerator newEnumerator(Context ctx, int scope,
String contextName, boolean returnSelf) throws NamingException {
return new ContextEnumerator(ctx, scope, contextName, returnSelf);
}
public boolean hasMore() throws NamingException {
return !rootProcessed ||
(scope != SearchControls.OBJECT_SCOPE && hasMoreDescendants());
}
public boolean hasMoreElements() {
try {
return hasMore();
} catch (NamingException e) {
return false;
}
}
public Binding nextElement() {
try {
return next();
} catch (NamingException e) {
throw new NoSuchElementException(e.toString());
}
}
public Binding next() throws NamingException {
if (!rootProcessed) {
rootProcessed = true;
return new Binding("", root.getClass().getName(),
root, true);
}
if (scope != SearchControls.OBJECT_SCOPE && hasMoreDescendants()) {
return getNextDescendant();
}
throw new NoSuchElementException();
}
public void close() throws NamingException {
root = null;
}
private boolean hasMoreChildren() throws NamingException {
return children != null && children.hasMore();
}
private Binding getNextChild() throws NamingException {
Binding oldBinding = children.next();
Binding newBinding = null;
// if the name is relative, we need to add it to the name of this
// context to keep it relative w.r.t. the root context we are
// enumerating
if(oldBinding.isRelative() && !contextName.isEmpty()) {
NameParser parser = root.getNameParser("");
Name newName = parser.parse(contextName);
newName.add(oldBinding.getName());
if(debug) {
System.out.println("ContextEnumerator: adding " + newName);
}
newBinding = new Binding(newName.toString(),
oldBinding.getClassName(),
oldBinding.getObject(),
oldBinding.isRelative());
} else {
if(debug) {
System.out.println("ContextEnumerator: using old binding");
}
newBinding = oldBinding;
}
return newBinding;
}
private boolean hasMoreDescendants() throws NamingException {
// if the current child is expanded, see if it has more elements
if (!currentReturned) {
if(debug) {System.out.println("hasMoreDescendants returning " +
(currentChild != null) ); }
return currentChild != null;
} else if (currentChildExpanded && currentChildEnum.hasMore()) {
if(debug) {System.out.println("hasMoreDescendants returning " +
"true");}
return true;
} else {
if(debug) {System.out.println("hasMoreDescendants returning " +
"hasMoreChildren");}
return hasMoreChildren();
}
}
private Binding getNextDescendant() throws NamingException {
if (!currentReturned) {
// returning parent
if(debug) {System.out.println("getNextDescendant: simple case");}
currentReturned = true;
return currentChild;
} else if (currentChildExpanded && currentChildEnum.hasMore()) {
if(debug) {System.out.println("getNextDescendant: expanded case");}
// if the current child is expanded, use it's enumerator
return currentChildEnum.next();
} else {
// Ready to go onto next child
if(debug) {System.out.println("getNextDescendant: next case");}
prepNextChild();
return getNextDescendant();
}
}
private void prepNextChild() throws NamingException {
if(hasMoreChildren()) {
try {
currentChild = getNextChild();
currentReturned = false;
} catch (NamingException e){
if (debug) System.out.println(e);
if (debug) e.printStackTrace();
}
} else {
currentChild = null;
return;
}
if(scope == SearchControls.SUBTREE_SCOPE &&
currentChild.getObject() instanceof Context) {
currentChildEnum = newEnumerator(
(Context)(currentChild.getObject()),
scope, currentChild.getName(),
false);
currentChildExpanded = true;
if(debug) {System.out.println("prepNextChild: expanded");}
} else {
currentChildExpanded = false;
currentChildEnum = null;
if(debug) {System.out.println("prepNextChild: normal");}
}
}
}
⏎ com/sun/jndi/toolkit/dir/ContextEnumerator.java
Or download all of them as a single archive file:
File name: java.naming-17.0.5-src.zip File size: 490626 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.net.http.jmod - Net HTTP Module
2023-09-23, ≈43🔥, 0💬
Popular Posts:
xml-commons External Source Code Files are provided in the source package file, xml-commons-external...
What Is commons-logging-1.2.jar? commons-logging-1.2.jar is the JAR file for Apache Commons Logging ...
What Is HttpComponents httpclient-4.2.2.jar? HttpComponents httpclient-4.2.2.jar is the JAR file for...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...