本文整理汇总了Java中javax.naming.CannotProceedException.getEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Java CannotProceedException.getEnvironment方法的具体用法?Java CannotProceedException.getEnvironment怎么用?Java CannotProceedException.getEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.CannotProceedException
的用法示例。
在下文中一共展示了CannotProceedException.getEnvironment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContinuationDirContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Creates a context in which to continue a <tt>DirContext</tt> operation.
* Operates just like <tt>NamingManager.getContinuationContext()</tt>,
* only the continuation context returned is a <tt>DirContext</tt>.
*
* @param cpe
* The non-null exception that triggered this continuation.
* @return A non-null <tt>DirContext</tt> object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*
* @see NamingManager#getContinuationContext(CannotProceedException)
*/
@SuppressWarnings("unchecked")
public static DirContext getContinuationDirContext(
CannotProceedException cpe) throws NamingException {
Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
if (env == null) {
env = new Hashtable<>(7);
} else {
// Make a (shallow) copy of the environment.
env = (Hashtable<Object,Object>) env.clone();
}
env.put(CPE, cpe);
return (new ContinuationDirContext(cpe, env));
}
示例2: getContinuationDirContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Creates a context in which to continue a {@code DirContext} operation.
* Operates just like {@code NamingManager.getContinuationContext()},
* only the continuation context returned is a {@code DirContext}.
*
* @param cpe
* The non-null exception that triggered this continuation.
* @return A non-null {@code DirContext} object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*
* @see NamingManager#getContinuationContext(CannotProceedException)
*/
@SuppressWarnings("unchecked")
public static DirContext getContinuationDirContext(
CannotProceedException cpe) throws NamingException {
Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
if (env == null) {
env = new Hashtable<>(7);
} else {
// Make a (shallow) copy of the environment.
env = (Hashtable<Object,Object>) env.clone();
}
env.put(CPE, cpe);
return (new ContinuationDirContext(cpe, env));
}
示例3: getContinuationContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Creates a context in which the context operation must be continued.
* This method is used by operations on names that span multiple namespaces.
*
* @param cpe the exception that triggered this continuation. This method
* obtains the environment ({@link CannotProceedException#getEnvironment()}
* and sets the environment property {@link #CPE} = cpe.
*
* @return a non null context for continuing the operation
*
* @throws NamingException if the naming problems have occured
*/
public static Context getContinuationContext (CannotProceedException cpe)
throws NamingException
{
Hashtable env = cpe.getEnvironment ();
if (env != null)
env.put (CPE, cpe);
// TODO: Check if this implementation matches the API specification
try
{
Object obj = getObjectInstance (cpe.getResolvedObj(),
cpe.getAltName (),
cpe.getAltNameCtx (),
env);
if (obj != null)
return (Context) obj;
}
catch (Exception _)
{
}
// fix stack trace for re-thrown exception (message confusing otherwise)
cpe.fillInStackTrace();
throw cpe;
}
示例4: getContinuationContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Creates a context in which the context operation must be continued.
* This method is used by operations on names that span multiple namespaces.
*
* @param cpe the exception that triggered this continuation. This method
* obtains the environment ({@link CannotProceedException#getEnvironment()}
* and sets the environment property {@link #CPE} = cpe.
*
* @return a non null context for continuing the operation
*
* @throws NamingException if the naming problems have occured
*/
public static Context getContinuationContext (CannotProceedException cpe)
throws NamingException
{
Hashtable env = cpe.getEnvironment ();
if (env != null)
env.put (CPE, cpe);
// TODO: Check if this implementation matches the API specification
try
{
Object obj = getObjectInstance (cpe.getResolvedObj(),
cpe.getAltName (),
cpe.getAltNameCtx (),
env);
if (obj != null)
return (Context) obj;
}
catch (Exception _)
{
}
// fix stack trace for re-thrown exception (message confusing otherwise)
cpe.fillInStackTrace();
throw cpe;
}
示例5: getContinuationDirContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Creates a context in which to continue a <tt>DirContext</tt> operation.
* Operates just like <tt>NamingManager.getContinuationContext()</tt>,
* only the continuation context returned is a <tt>DirContext</tt>.
*
* @param cpe
* The non-null exception that triggered this continuation.
* @return A non-null <tt>DirContext</tt> object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*
* @see NamingManager#getContinuationContext(CannotProceedException)
*/
public static DirContext getContinuationDirContext(
CannotProceedException cpe) throws NamingException {
Hashtable env = cpe.getEnvironment();
if (env == null) {
env = new Hashtable(7);
} else {
// Make a (shallow) copy of the environment.
env = (Hashtable) env.clone();
}
env.put(CPE, cpe);
return (new ContinuationDirContext(cpe, env));
}
示例6: getContinuationContext
import javax.naming.CannotProceedException; //导入方法依赖的package包/类
/**
* Create the next context when using federation. All the information
* required to do this is contained in the
* <code>CannotProceedException</code> <code>e</code>. If the resolved
* object is null then throw the supplied
* <code>CannotProceedException</code> <code>e</code> using the stack
* details from this thread. The resolved object in <code>e</code> may
* already be a <code>Context</code>. This is the case where the service
* provider gives an explicit pointer to the next naming system. A Context
* object is returned as the continuation context, but need not be the same
* object instance as the resolved object.
* <p>
* If the resolved object is not already a <code>Context</code> then it is
* necessary to use the resolved object together with the
* <code>altName</code> name, the <code>altNameCtx</code> context and
* the environment hashtable to get an instance of the object. This should
* then be a context which is returned as the continuation context. If an
* instance cannot be obtained then throw the supplied
* <code>CannotProceedException</code> using the stack details from this
* thread.
* </p>
* <p>
* This method is responsible for setting the property denoted by the
* <code>CPE</code> string to be the supplied
* <code>CannotProceedException</code> for the exception <code>e</code>
* environment. The continuation context should then inherit this property.
* </p>
*
* @param cpe
* the <code>CannotProceedException</code> generated by the
* context of the previous naming system when it can proceed no
* further.
* @return the next Context when using federation
* @throws NamingException
* if the resolved object is null or if a context cannot be
* obtained from it either directly or indirectly.
*/
@SuppressWarnings("unchecked") //$NON-NLS-1$
public static Context getContinuationContext(CannotProceedException cpe)
throws NamingException {
Context ctx = null;
// set CPE property of the env
if (cpe.getEnvironment() == null) {
cpe.setEnvironment(new Hashtable<String, CannotProceedException>());
}
((Hashtable<String, CannotProceedException>) cpe.getEnvironment()).put(CPE, cpe);
// if resolved object is null
if (null == cpe.getResolvedObj()) {
// re-throw cpe
cpe.fillInStackTrace();
throw cpe;
}
// if cpe's resolved obj is Context
if (cpe.getResolvedObj() instanceof Context) {
// accept it as the continuation context
ctx = (Context) cpe.getResolvedObj();
} else {
// otherwise, call getObjectInstance() to get a context instance
try {
ctx = (Context) getObjectInstance(cpe.getResolvedObj(), cpe
.getAltName(), cpe.getAltNameCtx(), cpe
.getEnvironment());
} catch (Exception ex) {
// throw back CPE in case of any exception
throw cpe;
}
// if ctx cannot be obtained
if (null == ctx) {
// re-throw CPE
cpe.fillInStackTrace();
throw cpe;
}
}
// return the continuation context
return ctx;
}