本文整理汇总了Java中com.blackducksoftware.sdk.fault.SdkFault类的典型用法代码示例。如果您正苦于以下问题:Java SdkFault类的具体用法?Java SdkFault怎么用?Java SdkFault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SdkFault类属于com.blackducksoftware.sdk.fault包,在下文中一共展示了SdkFault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@Override
public void run() {
final Iterable<CodeMatchDiscovery> discoveries;
try {
discoveries = discoveryApi.getCodeMatchDiscoveries(projectId, partialCodeTree, filterByCodeMatchType);
} catch (SdkFault e) {
throw new RuntimeException(e);
}
synchronized (accumulator) {
for (CodeMatchDiscovery discovery : discoveries) {
accumulator.add(new SlimCodeMatchDiscovery(discovery));
countCurrent.incrementAndGet();
}
}
}
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:19,代码来源:SampleIdentifyAllCodeMatchDiscoveriesMemoryManagedAdvanced.java
示例2: call
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@Override
public SdkFault call() throws Exception {
try {
ProtexServerProxy proxy = protexServerProxy.get();
if (protexServerProxy.get() == null) {
proxy = new ProtexServerProxy(serverUri, username,
password);
protexServerProxy.set(proxy);
}
ProjectApi projectApi = proxy.getProjectApi();
projectApi.removeProjectUser(projectId, userId);
} catch (SdkFault e) {
return e;
}
return null;
}
示例3: call
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@Override
public SdkFault call() throws Exception {
try {
ProtexServerProxy proxy = protexServerProxy.get();
if (protexServerProxy.get() == null) {
proxy = new ProtexServerProxy(serverUri, username,
password);
protexServerProxy.set(proxy);
}
ProjectApi projectApi = proxy.getProjectApi();
projectApi.addProjectUser(projectId, userId);
} catch (SdkFault e) {
return e;
}
return null;
}
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:17,代码来源:SampleAssignProjectUsersNToMX.java
示例4: cleanupComponent
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@AfterClass(alwaysRun = true)
protected void cleanupComponent() {
try {
List<Component> components = getProxy().getComponentApi().getComponentsByName(componentName, null);
if (components != null) {
for (Component component : components) {
if (ComponentType.CUSTOM.equals(component.getComponentType())) {
getProxy().getComponentApi().deleteComponent(component.getComponentKey());
}
}
}
} catch (SdkFault fault) {
fault.printStackTrace(System.err);
}
}
开发者ID:blackducksoftware,项目名称:sdk-client-tools-protex,代码行数:17,代码来源:SampleCreateCustomComponentAndCodePrintTest.java
示例5: synchronousSourceScan
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
/**
* Performs a scan of project source files, blocking until the scan is complete
*
* @param server
* The server to operate on
* @param projectId
* The ID of the project to scan
* @param pollDelayMs
* The delay in milliseconds between polls of the server to check on scan status
* @throws SdkFault
* If there is an issue while performing the scan
*/
public static void synchronousSourceScan(ProtexServerProxy server, String projectId, long pollDelayMs) throws SdkFault {
server.getProjectApi().startAnalysis(projectId, true);
boolean done = false;
while (!done) {
try {
Thread.sleep(pollDelayMs);
AnalysisStatus status = server.getProjectApi().getAnalysisStatus(projectId);
done = status.isFinished();
} catch (Exception e) {
done = true;
}
}
}
示例6: getAnalysisSourceLocation
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
/**
* Generates a source location from test settings for use by SDK example tests
*
* @param server
* The server to operate on
* @return The analysis source location of the configured settings
* @throws SdkFault
* If there is an issue communicating with the server
* @throws UnsupportedOperationException
* If test configuration does not allow for scanned-source tests
*/
public static AnalysisSourceLocation getAnalysisSourceLocation(ProtexServerProxy server) throws SdkFault {
if (sourceLocationCached == null && !sourceLookupAttempted) {
sourceLocationCached = getConfiguredSourceLocation(server);
if (sourceLocationCached == null && getUploadSourcesAllowed()) {
sourceLocationCached = getHibernateCoreSource(server);
}
sourceLookupAttempted = true;
}
if (sourceLocationCached == null) {
throw new UnsupportedOperationException("No sources configured - a source location must be set, or default sources must be allowed");
}
return sourceLocationCached;
}
示例7: getHibernateCoreSource
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
/**
* Attempts to find or upload the default SDK examples test source
*
* @param server
* Server to operate on
* @return The analysis source location of the test source on the server
* @throws SdkFault
* If there is an issue uploading/finding the source
*/
private static AnalysisSourceLocation getHibernateCoreSource(ProtexServerProxy server) throws SdkFault {
// First, check that the source aren't already there - lets not duplicate the upload
AnalysisSourceLocation testLocation = new AnalysisSourceLocation();
testLocation.setHostname("localhost");
testLocation.setRepository(AnalysisSourceRepository.REMOTE_SERVER);
testLocation.setSourcePath(HIBERNATE_SOURCE_NAME);
if (!isSourceUploaded(server, testLocation)) {
logger.info("Test sources not yet present - uploading to server");
File temporaryUnpackLocation = unpackClasspathSource(HIBERNATE_SOURCE_LOCATION, ".zip");
DataSource unexpandedfileDS = new FileDataSource(temporaryUnpackLocation);
SourceCodeUploadRequest sourceCodeUploadRequest = new SourceCodeUploadRequest();
sourceCodeUploadRequest.setSourceName(HIBERNATE_SOURCE_NAME + ".zip");
sourceCodeUploadRequest.setSourceContent(new DataHandler(unexpandedfileDS));
testLocation = server.getPolicyApi().uploadSourceArchive(sourceCodeUploadRequest);
}
return testLocation;
}
示例8: reload
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
public boolean reload(UIResponseObserver observer) {
observer.pushMessage("Try to loading project lists....");
log.debug("Reload project list from Protex Server.");
observer.setMessageHeader("Loading project lists from Protex Server.\n >");
try {
List<ProjectInfo> piList = ProtexSDKAPIManager.getProjectAPI().getProjectsByUser(LoginSessionEnt.getInstance().getUserID());
for(ProjectInfo pi:piList) {
String projectID = pi.getProjectId();
String projectName = pi.getName();
OSIProjectInfo tmpProjectInfo = this.getProjectInfo(projectName);
if(tmpProjectInfo == null) {
tmpProjectInfo = new OSIProjectInfo(projectID, projectName);
this.putProjectInfo(projectName, tmpProjectInfo);
observer.pushMessageWithHeader(projectName);
}
}
} catch (SdkFault e) {
log.warn("getProjectsByUser() failed: " + e.getMessage());
return false;
}
ProjectInfoLoaderMgrThread pir = new ProjectInfoLoaderMgrThread(this.getProjects());
pir.start();
return true;
}
示例9: getLicenseID
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
public static String getLicenseID(String pLicenseName) {
if(pLicenseName == null) return null;
// 1. Memory
if(licenseNameIDMap.containsKey(pLicenseName)) {
return licenseNameIDMap.get(pLicenseName);
}
// 2. API
String ret = null;
try {
if(ProtexSDKAPIManager.getLicenseAPI() != null) {
GlobalLicense license = ProtexSDKAPIManager.getLicenseAPI().getLicenseByName(pLicenseName);
ret = license.getLicenseId();
}
} catch (SdkFault e) {
log.error(e);
}
licenseNameIDMap.put(pLicenseName, ret);
return ret;
}
示例10: getLicenseName
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
public static String getLicenseName(String pLicenseID) {
if(pLicenseID == null) return null;
// 1. Memory
if(licenseIDNameMap.containsKey(pLicenseID)) {
return licenseIDNameMap.get(pLicenseID);
}
// 2. API
String ret = null;
try {
if(ProtexSDKAPIManager.getLicenseAPI() != null) {
GlobalLicense license = ProtexSDKAPIManager.getLicenseAPI().getLicenseById(pLicenseID);
ret = license.getLicenseId();
}
} catch (SdkFault e) {
log.warn(e);
}
return ret;
}
示例11: createIdentifiedFileEntListFromCodeTreeResult
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
private static ArrayList<IdentifiedFilesRow> createIdentifiedFileEntListFromCodeTreeResult(
String pProjectName,
UIResponseObserver observer) {
ArrayList<IdentifiedFilesRow> identifiedFileList = new ArrayList<IdentifiedFilesRow>();
log.debug("createIdentifiedFileEntListFromCodeTreeResult");
try {
CodeTreeWorker worker = new CodeTreeWorker(pProjectName, identifiedFileList, observer);
worker.treeWalk(ROOT);
} catch (SdkFault e) {
System.err.println("getCodeTree() failed: " + e.getMessage());
log.warn("getCodeTree() failed: " + e.getMessage());
return null;
}
if(identifiedFileList.size() == 0)
return null;
return identifiedFileList;
}
示例12: setCodeTree
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
public static PartialCodeTree setCodeTree(String projectName, UIResponseObserver observer) {
String ROOT = "/";
String projectID = UISDKInterfaceManager.getSDKInterface().getProjectID(projectName);
String pMessage = " > Generating Code Tree from server.\n";
observer.pushMessageWithHeader(pMessage);
try {
PartialCodeTree codeTree = getCodeTree(projectName);
if(codeTree == null) {
codeTree = ProtexSDKAPIManager.getCodeTreeAPI().getCodeTreeByNodeTypes(projectID, ROOT, CodeTreeUtilities.INFINITE_DEPTH, Boolean.TRUE, CodeTreeUtilities.ALL_CODE_TREE_NODE_TYPES);
codeTreeMap.put(projectName, codeTree);
}
return codeTree;
} catch (SdkFault e) {
log.warn(e);
}
return null;
}
示例13: loadLocalComponent
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
public static void loadLocalComponent(String projectId, boolean force) {
// 1. check "loadedLocalComponentProject"
if(!force) {
if(localComponentManagerMap.containsKey(projectId)) return;
} else {
localComponentManagerMap.remove(projectId);
}
// 2. Load Local Component
try {
ComponentManager localComponentManager = new ComponentManager();
LocalComponentPageFilter pageFilter = PageFilterFactory.getAllRows(LocalComponentColumn.COMPONENT_NAME);
List<LocalComponent> components = ProtexSDKAPIManager.getLocalComponentAPI().getLocalComponents(projectId, pageFilter);
for (LocalComponent component : components) {
ComponentInfo info = new ComponentInfo(component.getComponentId(), component.getName());
info.setLicenseId(component.getLicenseId());
localComponentManager.addComponent(info);
}
localComponentManagerMap.put(projectId, localComponentManager);
} catch (SdkFault e) {
log.warn(e);
}
// TODO: if there is local component info in ComponentInfoCache, when updating this info? "SyncFromServer"?
}
示例14: identify
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@Override
public void identify() throws SdkFault {
DeclaredIdentificationRequest oDeclaredIdentificationRequest =
getDeclaredIdentificationRequest(
curFilePath,
newComponentID,
newVersionID,
identifiedUsageLevel,
identifiedLicenseInfo);
ProtexSDKAPIManager.getIdentificationAPI().addDeclaredIdentification(
projectID,
curFilePath,
oDeclaredIdentificationRequest,
BomRefreshMode.SKIP);
log.debug("Identified(PatternMatch) ����2 : " + curFilePath + " ==> " + oDeclaredIdentificationRequest.getIdentifiedComponentId() + "#" + oDeclaredIdentificationRequest.getIdentifiedVersionId());
this.updateComment();
this.updateDBnUI("identify");
}
示例15: reset
import com.blackducksoftware.sdk.fault.SdkFault; //导入依赖的package包/类
@Override
public void reset(Identification id) throws SdkFault {
BomRefreshMode refreshMode = BomRefreshMode.ASYNCHRONOUS;
String optionRefreshMode = Property.getInstance().getProperty(Property.IDENTIFICATION_WITH_SYNCHRONOUS_BOM_REFRESH);
if("true".equals(optionRefreshMode.toLowerCase())) {
refreshMode = BomRefreshMode.SYNCHRONOUS;
}
if(id.getType() != IdentificationType.STRING_SEARCH) return;
String identifiedVersionId = id.getIdentifiedVersionId();
if(identifiedVersionId == null) {
identifiedVersionId = "";
}
if( (currentVersionID.equals(identifiedVersionId)) || (identifiedVersionId.length() <= 0) ) {
ProtexSDKAPIManager.getIdentificationAPI().removeStringSearchIdentification(
projectID,
(StringSearchIdentification) id,
refreshMode);
log.debug("reset("+getInfo()+") "+curFilePath+" complete");
}
this.updateDBnUI("reset");
}