下面列出了javax.naming.spi.DirectoryManager#getContinuationDirContext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public DirContext createSubcontext(Name name, Attributes attrs)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_createSubcontext(nm, attrs, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_createSubcontext(nm, attrs, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.createSubcontext(e.getRemainingName(), attrs);
}
return answer;
}
public void modifyAttributes(Name name, int mod_op, Attributes attrs)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_modifyAttributes(nm, mod_op, attrs, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_modifyAttributes(nm, mod_op, attrs, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.modifyAttributes(e.getRemainingName(), mod_op, attrs);
}
}
public DirContext getSchema(Name name) throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_getSchema(nm, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_getSchema(nm, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.getSchema(e.getRemainingName());
}
return answer;
}
public DirContext getSchema(Name name) throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_getSchema(nm, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_getSchema(nm, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.getSchema(e.getRemainingName());
}
return answer;
}
public NamingEnumeration<SearchResult>
search(Name name,
String filter,
SearchControls cons)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, filter, cons, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, filter, cons, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), filter, cons);
}
return answer;
}
public void rebind(Name name, Object obj, Attributes attrs)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_rebind(nm, obj, attrs, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_rebind(nm, obj, attrs, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.rebind(e.getRemainingName(), obj, attrs);
}
}
public DirContext getSchema(Name name) throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_getSchema(nm, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_getSchema(nm, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.getSchema(e.getRemainingName());
}
return answer;
}
public void modifyAttributes(Name name, ModificationItem[] mods)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_modifyAttributes(nm, mods, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_modifyAttributes(nm, mods, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.modifyAttributes(e.getRemainingName(), mods);
}
}
public DirContext getSchema(Name name) throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_getSchema(nm, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_getSchema(nm, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.getSchema(e.getRemainingName());
}
return answer;
}
public Attributes getAttributes(Name name, String[] attrIds)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Attributes answer;
Name nm = name;
try {
answer = ctx.p_getAttributes(nm, attrIds, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_getAttributes(nm, attrIds, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.getAttributes(e.getRemainingName(), attrIds);
}
return answer;
}
public void modifyAttributes(Name name, ModificationItem[] mods)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_modifyAttributes(nm, mods, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_modifyAttributes(nm, mods, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.modifyAttributes(e.getRemainingName(), mods);
}
}
public void modifyAttributes(Name name, ModificationItem[] mods)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_modifyAttributes(nm, mods, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_modifyAttributes(nm, mods, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.modifyAttributes(e.getRemainingName(), mods);
}
}
public DirContext createSubcontext(Name name, Attributes attrs)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
DirContext answer;
Name nm = name;
try {
answer = ctx.p_createSubcontext(nm, attrs, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_createSubcontext(nm, attrs, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.createSubcontext(e.getRemainingName(), attrs);
}
return answer;
}
public void rebind(Name name, Object obj, Attributes attrs)
throws NamingException {
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
Name nm = name;
try {
ctx.p_rebind(nm, obj, attrs, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
ctx.p_rebind(nm, obj, attrs, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
cctx.rebind(e.getRemainingName(), obj, attrs);
}
}
public NamingEnumeration<SearchResult>
search(Name name,
String filterExpr,
Object[] filterArgs,
SearchControls cons)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), filterExpr, filterArgs,
cons);
}
return answer;
}
public NamingEnumeration<SearchResult>
search(Name name,
String filterExpr,
Object[] filterArgs,
SearchControls cons)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), filterExpr, filterArgs,
cons);
}
return answer;
}
public NamingEnumeration<SearchResult>
search(Name name,
String filterExpr,
Object[] filterArgs,
SearchControls cons)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, filterExpr, filterArgs, cons, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), filterExpr, filterArgs,
cons);
}
return answer;
}
public NamingEnumeration<SearchResult>
search(Name name,
Attributes matchingAttributes,
String[] attributesToReturn)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, matchingAttributes,
attributesToReturn, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, matchingAttributes,
attributesToReturn, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), matchingAttributes,
attributesToReturn);
}
return answer;
}
public NamingEnumeration<SearchResult>
search(Name name,
Attributes matchingAttributes,
String[] attributesToReturn)
throws NamingException
{
PartialCompositeDirContext ctx = this;
Hashtable<?,?> env = p_getEnvironment();
Continuation cont = new Continuation(name, env);
NamingEnumeration<SearchResult> answer;
Name nm = name;
try {
answer = ctx.p_search(nm, matchingAttributes,
attributesToReturn, cont);
while (cont.isContinue()) {
nm = cont.getRemainingName();
ctx = getPCDirContext(cont);
answer = ctx.p_search(nm, matchingAttributes,
attributesToReturn, cont);
}
} catch (CannotProceedException e) {
DirContext cctx = DirectoryManager.getContinuationDirContext(e);
answer = cctx.search(e.getRemainingName(), matchingAttributes,
attributesToReturn);
}
return answer;
}
/**
* Gets the context in which to continue the operation. This method
* is called when this context is asked to process a multicomponent
* Name in which the first component is a URL.
* Treat the first component like a junction: resolve it and then use
* DirectoryManager.getContinuationDirContext() to get the target context in
* which to operate on the remainder of the name (n.getSuffix(1)).
* Do this in case intermediate contexts are not DirContext.
*/
protected DirContext getContinuationDirContext(Name n) throws NamingException {
Object obj = lookup(n.get(0));
CannotProceedException cpe = new CannotProceedException();
cpe.setResolvedObj(obj);
cpe.setEnvironment(myEnv);
return DirectoryManager.getContinuationDirContext(cpe);
}