• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CannotProceedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.naming.CannotProceedException的典型用法代码示例。如果您正苦于以下问题:Java CannotProceedException类的具体用法?Java CannotProceedException怎么用?Java CannotProceedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CannotProceedException类属于javax.naming包,在下文中一共展示了CannotProceedException类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DirectoryManager.java


示例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));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:DirectoryManager.java


示例3: testGetContinuationDirContext

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testGetContinuationDirContext() throws NamingException {
	// Step 1: Write a simple class which implements
	// LdapContext and InitialContextFactory.
	// Please refer to the following class MyLdapContext

	// Step 2: Create an instance of MyLdapContext
	DirContext context = new MyLdapContext();

	// Step 3: Create an instance of CannotProceedException,
	// and set the resolve object as "context"
	CannotProceedException exception = new CannotProceedException(
			"TestGetContinuationDirContext");
	exception.setResolvedObj(context);
	// Step 4: Call DirectoryManager.getContinuationDirContext and pass
	// the "exception";

	DirContext newContext = DirectoryManager
			.getContinuationDirContext(exception);
	// Step 5: check result
	assertNotNull(newContext);
	// System.out.println(context);
	// System.out.println(newContext);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:DirectoryManagerJCKTest.java


示例4: testGetContinuationContext_OBJ_name_context_badnameh

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_badnameh()
		throws NamingException {
	log.setMethod("testGetContinuationContext_OBJ_name_context_badnameh()");
	CannotProceedException cpe = new CannotProceedException();
	Object obj = "resolved object";
	cpe.setResolvedObj(obj);
	CompositeName altName = new CompositeName("abc/abc");
	cpe.setAltName(altName);
	MockContext context = new MockContext(new Hashtable<String, Object>());
	cpe.setAltNameCtx(context);
	Hashtable<String, String> h = new Hashtable<String, String>();
	h.put(Context.OBJECT_FACTORIES, "bad name:asdfa");
	cpe.setEnvironment(h);
	try {
		NamingManager.getContinuationContext(cpe);
		fail();
	} catch (CannotProceedException e) {
		assertCPE(cpe, altName, context, h, e, obj);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:NamingManagerTest.java


示例5: assertCPE

import javax.naming.CannotProceedException; //导入依赖的package包/类
private void assertCPE(CannotProceedException cpe, CompositeName altName,
		MockContext context, Hashtable<String, String> h, CannotProceedException e,
		Object obj) {
	assertNull(e.getExplanation());
	assertNull(e.getMessage());
	assertNull(e.getRootCause());
	assertNull(e.getRemainingName());
	assertNull(e.getRemainingNewName());
	assertNull(e.getResolvedName());
	assertSame(e.getAltName(), altName);
	assertSame(e.getAltNameCtx(), context);
	assertEquals(e.getResolvedObj(), obj);
	assertSame(e, cpe);
	if (h != null) {
		assertSame(e.getEnvironment(), h);
	} else {
		assertSame(e.getEnvironment().get(NamingManager.CPE), e);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:NamingManagerTest.java


示例6: testGetContinuationContext_OBJ_name_context_wrongh

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_wrongh()
		throws NamingException {
	log.setMethod("testGetContinuationContext_OBJ_name_context_wrongh()");
	CannotProceedException cpe = new CannotProceedException();
	Object obj = "resolved object";
	cpe.setResolvedObj(obj);

	CompositeName altName = new CompositeName("abc/abc");
	cpe.setAltName(altName);
	MockContext context = new MockContext(new Hashtable<String, Object>());
	cpe.setAltNameCtx(context);
	Hashtable<String, String> h = new Hashtable<String, String>();
	h
			.put(Context.OBJECT_FACTORIES,
					"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockObjectFactory");
	cpe.setEnvironment(h);
	try {
		NamingManager.getContinuationContext(cpe);
		fail();
	} catch (CannotProceedException e) {
		assertCPE(cpe, altName, context, h, e, obj);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:NamingManagerTest.java


示例7: testGetContinuationContext_null_name_context_h

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testGetContinuationContext_null_name_context_h()
		throws NamingException {
	log.setMethod("testGetContinuationContext_null_name_context_h()");
	CannotProceedException cpe = new CannotProceedException();
	CompositeName altName = new CompositeName("abc/abc");
	cpe.setAltName(altName);
	MockContext context = new MockContext(new Hashtable<String, Object>());
	cpe.setAltNameCtx(context);
	Hashtable<String, String> h = new Hashtable<String, String>();
	h.put(Context.OBJECT_FACTORIES,"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
       cpe.setEnvironment(h);
	try {
	    NamingManager.getContinuationContext(cpe);
		fail();
	} catch (CannotProceedException e) {
		assertCPE(cpe, altName, context, h, e, null);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:NamingManagerTest.java


示例8: testGetContinuationContext_OBJ_name_context_null

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testGetContinuationContext_OBJ_name_context_null()
		throws NamingException {
	log.setMethod("testGetContinuationContext_OBJ_name_context_null()");
	CannotProceedException cpe = new CannotProceedException();
	Object obj = "resolved object";
	cpe.setResolvedObj(obj);
	CompositeName altName = new CompositeName("abc/abc");
	cpe.setAltName(altName);
	MockContext context = new MockContext(new Hashtable<String, Object>());
	cpe.setAltNameCtx(context);
	try {
		NamingManager.getContinuationContext(cpe);
		fail();
	} catch (CannotProceedException e) {
		assertCPE(cpe, altName, context, null, e, obj);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:NamingManagerTest.java


示例9: testConstructorAndGetterSetter

import javax.naming.CannotProceedException; //导入依赖的package包/类
public void testConstructorAndGetterSetter() throws InvalidNameException {
	log.setMethod("testConstructorAndGetterSetter()");

	CannotProceedException cpe = new CannotProceedException();
	Name altName = new CompositeName("1");
	Context altContext = null;
	Hashtable<?, ?> h = new Hashtable<Object, Object>();
	Name newName = new CompositeName("2");

	cpe.setAltName(altName);
	assertEquals(altName, cpe.getAltName());

	cpe.setAltNameCtx(altContext);
	assertEquals(altContext, cpe.getAltNameCtx());

	cpe.setEnvironment(h);
	assertEquals(h, cpe.getEnvironment());

	cpe.setRemainingNewName(newName);
	assertEquals(newName, cpe.getRemainingNewName());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:CannotProceedExceptionTest.java


示例10: getMeanGOPLength

import javax.naming.CannotProceedException; //导入依赖的package包/类
public static int getMeanGOPLength(IContainer container) throws CannotProceedException, IOException {
 int numStreams = container.getNumStreams();
 
 if( numStreams <= 0 )
     throw new IOException( "No streams found in container." );
 
 List<IIndexEntry> index_list = null;
 
 for( int j = 0; j < container.getNumStreams(); j++ ) {
     IStream stream = container.getStream(j);
     IStreamCoder coder = stream.getStreamCoder();
     if( coder.getCodecType() != ICodec.Type.CODEC_TYPE_VIDEO)
         continue;
     index_list = stream.getIndexEntries();
 }
 
 if( index_list == null || index_list.size() == 0)
     throw new CannotProceedException( "No index entries found!" );
 
 int k = 0;
 for( int i = 0; i < index_list.size(); i++ )
    if ( index_list.get(i).isKeyFrame() ) k++; 
 
    return index_list.size() / k;
}
 
开发者ID:openpreserve,项目名称:video-batch,代码行数:26,代码来源:XugglerAnalyzer.java


示例11: getContinuationDirContext

import javax.naming.CannotProceedException; //导入依赖的package包/类
/**
 * Create the next <code>DirContext</code> when using federation so that 
 * the <code>DirContext</code> operation can be reinvoked.
 * This should work similarly to 
 * <code>NamingManager.getContinuationContext</code> except that a 
 * reference to a <code>DirContext</code> is returned.
 * <p>
 * This method is also responsible for setting the property denoted by the
 * <code>CPE</code> string to be the supplied
 * <code>CannotProceedException</code> for that environment.</p>
 *
 * @param cpe   the <code>CannotProceedException</code> generated by the
 *              <code>DirContext</code> of the previous naming system when
 *              it can proceed no further.
 * @return      the next <code>DirContext</code> when using federation
 * @throws  NamingException if the resolved object is not set or if a
 *          <code>DirContext</code>  cannot be obtained from it either
 *          directly or indirectly.
 */
public static DirContext getContinuationDirContext(CannotProceedException cpe)
    throws NamingException {
    // obtain next context using NamingManager
    Context nextContext = null;
    try {
        nextContext = NamingManager.getContinuationContext(cpe);
    } catch (CannotProceedException e) {
        // tolerate CannotProceedException here
    }
    
    // if it is a DirContext
    if (nextContext instanceof DirContext) {
        // return as DirContext
        return (DirContext) nextContext;
    } else {
        // in case it's Context but not DirContext, wrap it as DirContext and return
        return new Context2DirContextWrapper(nextContext, cpe);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:39,代码来源:DirectoryManager.java


示例12: getObjectInstance

import javax.naming.CannotProceedException; //导入依赖的package包/类
/**
 * Returns new instance of the
 * org.apache.harmony.test.func.api.javax.naming.directory.provider.dns.TestCtxFactory
 * 
 * @param obj
 * @param name
 * @param nameCtx
 * @param environment
 * @param attrs
 * @return
 * @throws Exception
 */
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
    Hashtable environment, Attributes attrs) throws Exception {
    Object o = environment.get("java.naming.spi.CannotProceedException");
    if ((o instanceof CannotProceedException)
        && (nameCtx instanceof DirContext)) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.apache.harmony.test.func.api.javax."
                + "naming.provider.dns.TestCtxFactory");

        return new InitialDirContext(env);
    }
    return null;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:28,代码来源:MyObjectFactory2.java


示例13: makeContinuationContext

import javax.naming.CannotProceedException; //导入依赖的package包/类
public static DirContext makeContinuationContext ( String codebase, String clazz ) throws Exception {
    Class<?> ccCl = Class.forName("javax.naming.spi.ContinuationDirContext"); //$NON-NLS-1$
    Constructor<?> ccCons = ccCl.getDeclaredConstructor(CannotProceedException.class, Hashtable.class);
    ccCons.setAccessible(true);
    CannotProceedException cpe = new CannotProceedException();
    Reflections.setFieldValue(cpe, "stackTrace", new StackTraceElement[0]);
    cpe.setResolvedObj(new Reference("Foo", clazz, codebase));
    return (DirContext) ccCons.newInstance(cpe, null);
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:10,代码来源:JDKUtil.java


示例14: applyConfiguration

import javax.naming.CannotProceedException; //导入依赖的package包/类
/**
 * Applies the specified configuration and stores the Configuration Report for
 * later viewing.
 *
 * @param configurationId id of the configuration of the request
 * @throws CannotProceedException In case a serious error occurs (for example
 *           in case a null Configuration Report is received).
 */
public void applyConfiguration(final long configurationId) throws CannotProceedException {

  ReportHandler reportHandler = new ReportHandler(configurationId);
  progressReports.put(String.valueOf(configurationId), reportHandler);

  ConfigurationReport report = configurationService.applyConfiguration(configurationId, reportHandler);

  logger.debug("getConfigurationReport: Received configuration report? -> " + configurationId + ": " + (report == null ? "NULL" : "SUCCESS"));

  if (report == null) {
    logger.error("Received NULL Configuration report for configuration id:" + configurationId);
    throw new CannotProceedException("Did not receive Configuration Report.");
  }
  logger.debug("getConfigurationReport: Report=" + report.toXML());

  if (report.getName().equals("UNKNOWN")) {
    if (configurationReports.containsKey(String.valueOf(configurationId))) {
      configurationReports.get(String.valueOf(configurationId)).add(report);
    } else {
      List<ConfigurationReport> reports = getConfigurationReports(String.valueOf(configurationId));
      if (reports.isEmpty()) {
        reports.add(report);
      }
      configurationReports.put(String.valueOf(configurationId), reports);
    }
  }

  // store the report for viewing later
  ConfigurationReportHeader header = new ConfigurationReportHeader(report.getId(), report.getName(), report.getUser(), report.getStatus(),
      report.getStatusDescription(), report.getTimestamp());
  configurationReportHeaders.add(header);
}
 
开发者ID:c2mon,项目名称:c2mon-web-ui,代码行数:41,代码来源:ConfigLoaderService.java


示例15: 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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:39,代码来源:NamingManager.java


示例16: 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;
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:39,代码来源:NamingManager.java


示例17: 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));
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:27,代码来源:DirectoryManager.java



注:本文中的javax.naming.CannotProceedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractConnector类代码示例发布时间:2022-05-21
下一篇:
Java StreamRemoteCall类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap