src/share/classes/javax/naming/spi/DirectoryManager.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  76       * Creates a context in which to continue a <tt>DirContext</tt> operation.
  77       * Operates just like <tt>NamingManager.getContinuationContext()</tt>,
  78       * only the continuation context returned is a <tt>DirContext</tt>.
  79       *
  80       * @param cpe
  81       *         The non-null exception that triggered this continuation.
  82       * @return A non-null <tt>DirContext</tt> object for continuing the operation.
  83       * @exception NamingException If a naming exception occurred.
  84       *
  85       * @see NamingManager#getContinuationContext(CannotProceedException)
  86       */
  87     @SuppressWarnings("unchecked")
  88     public static DirContext getContinuationDirContext(
  89             CannotProceedException cpe) throws NamingException {
  90 
  91         Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
  92         if (env == null) {
  93             env = new Hashtable<>(7);
  94         } else {
  95             // Make a (shallow) copy of the environment.
  96             env = (Hashtable<Object,Object>) env.clone();
  97         }
  98         env.put(CPE, cpe);
  99 
 100         return (new ContinuationDirContext(cpe, env));
 101     }
 102 
 103     /**
 104       * Creates an instance of an object for the specified object,
 105       * attributes, and environment.
 106       * <p>
 107       * This method is the same as <tt>NamingManager.getObjectInstance</tt>
 108       * except for the following differences:
 109       *<ul>
 110       *<li>
 111       * It accepts an <tt>Attributes</tt> parameter that contains attributes
 112       * associated with the object. The <tt>DirObjectFactory</tt> might use these
 113       * attributes to save having to look them up from the directory.
 114       *<li>
 115       * The object factories tried must implement either
 116       * <tt>ObjectFactory</tt> or <tt>DirObjectFactory</tt>.


   1 /*
   2  * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  76       * Creates a context in which to continue a <tt>DirContext</tt> operation.
  77       * Operates just like <tt>NamingManager.getContinuationContext()</tt>,
  78       * only the continuation context returned is a <tt>DirContext</tt>.
  79       *
  80       * @param cpe
  81       *         The non-null exception that triggered this continuation.
  82       * @return A non-null <tt>DirContext</tt> object for continuing the operation.
  83       * @exception NamingException If a naming exception occurred.
  84       *
  85       * @see NamingManager#getContinuationContext(CannotProceedException)
  86       */
  87     @SuppressWarnings("unchecked")
  88     public static DirContext getContinuationDirContext(
  89             CannotProceedException cpe) throws NamingException {
  90 
  91         Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
  92         if (env == null) {
  93             env = new Hashtable<>(7);
  94         } else {
  95             // Make a (shallow) copy of the environment.
  96             env = env.clone();
  97         }
  98         env.put(CPE, cpe);
  99 
 100         return (new ContinuationDirContext(cpe, env));
 101     }
 102 
 103     /**
 104       * Creates an instance of an object for the specified object,
 105       * attributes, and environment.
 106       * <p>
 107       * This method is the same as <tt>NamingManager.getObjectInstance</tt>
 108       * except for the following differences:
 109       *<ul>
 110       *<li>
 111       * It accepts an <tt>Attributes</tt> parameter that contains attributes
 112       * associated with the object. The <tt>DirObjectFactory</tt> might use these
 113       * attributes to save having to look them up from the directory.
 114       *<li>
 115       * The object factories tried must implement either
 116       * <tt>ObjectFactory</tt> or <tt>DirObjectFactory</tt>.