当前位置: 首页>>代码示例>>Java>>正文


Java ServerException类代码示例

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


ServerException类属于us.kbase.common.service包,在下文中一共展示了ServerException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadModuleVersion

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected ModuleVersion loadModuleVersion(ModuleMethod modmeth, 
        String serviceVer) throws IOException, JsonClientException {
    final CatalogClient catClient = new CatalogClient(
            config.getCatalogURL());
    //TODO is this needed?
    catClient.setIsInsecureHttpConnectionAllowed(true);
    if (serviceVer == null || serviceVer.isEmpty()) {
        serviceVer = RELEASE;
    }
    try {
        return catClient.getModuleVersion(new SelectModuleVersion()
            .withModuleName(moduleName).withVersion(serviceVer));
    } catch (ServerException se) {
        throw new IllegalArgumentException(String.format(
                "Error looking up module %s with version %s: %s",
                moduleName, serviceVer, se.getLocalizedMessage()));
    }
}
 
开发者ID:kbase,项目名称:kb_sdk,代码行数:19,代码来源:SubsequentCallRunner.java

示例2: failGetObjectInfo

import us.kbase.common.service.ServerException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void failGetObjectInfo(final GetObjectInfo3Params params, final String exception)
		throws Exception {
	try {
		CLIENT1.getObjectInfo3(params);
		fail("got object with bad id");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(exception));
	}
	final us.kbase.workspace.GetObjectInfoNewParams newp =
			new us.kbase.workspace.GetObjectInfoNewParams()
					.withObjects(params.getObjects())
					.withIgnoreErrors(params.getIgnoreErrors())
					.withIncludeMetadata(params.getIncludeMetadata());
	for (final String key: params.getAdditionalProperties().keySet()) {
		newp.setAdditionalProperties(key, params.getAdditionalProperties().get(key));
	}
	failGetObjectInfoNew(newp, exception.replace("GetObjectInfo3", "GetObjectInfoNew"));
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:21,代码来源:JSONRPCLayerTester.java

示例3: failListObjects

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failListObjects(List<String> wsnames, List<Long> wsids,
		String type, String perm, Map<String, String> meta, Long showHidden,
		Long showDeleted, Long allVers, Long includeMeta, long limit, String exp)
		throws Exception {
	try {
		CLIENT1.listObjects(new ListObjectsParams().withWorkspaces(wsnames)
				.withIds(wsids).withType(type).withShowHidden(showHidden)
				.withShowDeleted(showDeleted).withShowAllVersions(allVers)
				.withIncludeMetadata(includeMeta).withPerm(perm).withMeta(meta)
				.withLimit(limit));
		fail("listed objects with bad params");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(exp));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:17,代码来源:JSONRPCLayerTester.java

示例4: checkHandleServiceConnection

import us.kbase.common.service.ServerException; //导入依赖的package包/类
private static void checkHandleServiceConnection(
		final URL handleServiceUrl,
		final AuthToken handleMgrToken,
		final InitReporter rep) {
	try {
		final AbstractHandleClient cli = new AbstractHandleClient(
				handleServiceUrl, handleMgrToken);
		if (handleServiceUrl.getProtocol().equals("http")) {
			rep.reportInfo("Warning - the Handle Service url uses insecure http. " +
					"https is recommended.");
			cli.setIsInsecureHttpConnectionAllowed(true);
		}
		cli.isOwner(new LinkedList<String>());
	} catch (Exception e) {
		if (!(e instanceof ServerException) || !e.getMessage().contains(
						"can not execute select * from Handle")) {
			rep.reportFail("Could not establish a connection to the Handle Service at "
					+ handleServiceUrl + ": " + e.getMessage());
		}
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:22,代码来源:InitWorkspaceServer.java

示例5: checkHandleManagerConnection

import us.kbase.common.service.ServerException; //导入依赖的package包/类
private static void checkHandleManagerConnection(
		final URL handleManagerUrl,
		final AuthToken handleMgrToken,
		final InitReporter rep) {
	try {
		final HandleMngrClient cli = new HandleMngrClient(
				handleManagerUrl, handleMgrToken);
		if (handleManagerUrl.getProtocol().equals("http")) {
			rep.reportInfo("Warning - the Handle Manager url uses insecure http. " +
					"https is recommended.");
			cli.setIsInsecureHttpConnectionAllowed(true);
		}
		cli.setPublicRead(Arrays.asList("FAKEHANDLE_-100"));
	} catch (Exception e) {
		if (!(e instanceof ServerException) || !e.getMessage().contains(
						"Unable to set acl(s) on handles FAKEHANDLE_-100")) {
			rep.reportFail("Could not establish a connection to the Handle Manager Service at "
					+ handleManagerUrl + ": " + e.getMessage());
		}
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:22,代码来源:InitWorkspaceServer.java

示例6: doReads

import us.kbase.common.service.ServerException; //导入依赖的package包/类
public void doReads() {
	thread = new Thread() {
		
		@Override
		public void run() {
			try {
				errors += performReads();
			} catch (Exception e) {
				e.printStackTrace();
				if (e instanceof ServerException) {
					System.out.println(((ServerException) e).getData());
				}
			}
		}
	};
	thread.start();
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:18,代码来源:ConfigurationsAndThreads.java

示例7: doWrites

import us.kbase.common.service.ServerException; //导入依赖的package包/类
public void doWrites() {
	thread = new Thread() {
		
		@Override
		public void run() {
			try {
				errors += performWrites();
			} catch (Exception e) {
				e.printStackTrace();
				if (e instanceof ServerException) {
					System.out.println(((ServerException) e).getData());
				}
			}
		}
	};
	thread.start();
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:18,代码来源:ConfigurationsAndThreads.java

示例8: reportAweStatus

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected static void reportAweStatus(AuthToken authPart, String returnVal,
		String result) throws IOException, JsonProcessingException,
		MalformedURLException, JsonClientException,
		JsonParseException, JsonMappingException, ServerException, AuthException {
	System.out.println(result);
	JsonNode rootNode = new ObjectMapper().registerModule(new JacksonTupleModule()).readTree(result);
	String aweId = "";
	if (rootNode.has("data")){
		JsonNode dataNode = rootNode.get("data");
		if (dataNode.has("id")){
			aweId = CmonkeyServerConfig.AWE_SERVICE_URL + "/" + dataNode.get("id").textValue();
			System.out.println(aweId);
			updateJobProgress(returnVal, "AWE job submitted: " + aweId, 1L, authPart.toString());
		}
	}
	if (rootNode.has("error")){
		if (rootNode.get("error").textValue()!=null){
			System.out.println(rootNode.get("error").textValue());
			updateJobProgress(returnVal, "AWE reported error on job " + aweId, 1L, authPart.toString());
			throw new ServerException(rootNode.get("error").textValue(), 0, "Unknown", null);
		}
	}
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:24,代码来源:CmonkeyServerCaller.java

示例9: failJob

import us.kbase.common.service.ServerException; //导入依赖的package包/类
private void failJob(CallbackStuff cbs, String moduleMeth, String release,
        String exp)
        throws Exception{
    try {
        cbs.callMethod(moduleMeth, new HashMap<String, Object>(), release);
        fail("Ran bad job");
    } catch (ServerException se) {
        assertThat("correct exception", se.getLocalizedMessage(), is(exp));
    }
}
 
开发者ID:kbase,项目名称:kb_sdk,代码行数:11,代码来源:CallbackServerTest.java

示例10: failSetWSDesc

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failSetWSDesc(SetWorkspaceDescriptionParams swdp, String excep)
		throws Exception {
	try {
		CLIENT1.setWorkspaceDescription(swdp);
		fail("set ws desc with bad params");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(excep));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:JSONRPCLayerTester.java

示例11: failGetObjectInfoNew

import us.kbase.common.service.ServerException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void failGetObjectInfoNew(
		final us.kbase.workspace.GetObjectInfoNewParams params,
		final String exception)
		throws Exception {
	try {
		CLIENT1.getObjectInfoNew(params);
		fail("got object with bad id");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(exception));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:14,代码来源:JSONRPCLayerTester.java

示例12: failObjRename

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failObjRename(RenameObjectParams rop,
		String excep) throws Exception {
	try {
		CLIENT1.renameObject(rop);
		fail("renamed with bad params");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(excep));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:JSONRPCLayerTester.java

示例13: failWSRename

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failWSRename(RenameWorkspaceParams rwp,
		String excep) throws Exception {
	try {
		CLIENT1.renameWorkspace(rwp);
		fail("renamed with bad params");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(excep));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:JSONRPCLayerTester.java

示例14: failGetWSDesc

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failGetWSDesc(final WorkspaceIdentity wsi, final String exp) throws Exception {
	try {
		CLIENT1.getWorkspaceDescription(wsi);
		fail("got desc from WS when expected failure");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(), is(exp));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:9,代码来源:JSONRPCLayerTester.java

示例15: failSetGlobalPerm

import us.kbase.common.service.ServerException; //导入依赖的package包/类
protected void failSetGlobalPerm(SetGlobalPermissionsParams sgpp,
		String exp) throws Exception {
	try {
		CLIENT1.setGlobalPermission(sgpp);
		fail("set global perms with bad params");
	} catch (ServerException se) {
		assertThat("correct excep message", se.getLocalizedMessage(),
				is(exp));
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:JSONRPCLayerTester.java


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